diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 1dc81dd..a0b6473 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -2,6 +2,7 @@ import { ref, onMounted} from 'vue'; import Chart from 'primevue/chart'; import Fieldset from 'primevue/fieldset'; +import MeterGroup from 'primevue/metergroup'; import { getProducts,getWarehouses } from '../api.js'; const products = ref(); @@ -16,6 +17,16 @@ const colorsSchemes = [ "#cd6133", "#84817a", "#cc8e35", "#ccae62" ]; +const getProductValues = (warehouse) => { + return products.value + .filter(product => product.warehouses.includes(warehouse.id)) + .map(product => ({ + label: product.name, + color: getColorForProduct(product.name), + value: (product.quantity * 100) / warehouse.max_capacity + })); +}; + const getColorForProduct = (productName) => { if (!productColors[productName]) { productColors[productName] = colorsSchemes[Object.keys(productColors).length % colorsSchemes.length]; @@ -45,7 +56,14 @@ onMounted(async () => { \ No newline at end of file