diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index a93a6710..082a5d71 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -28,7 +28,8 @@ export const shared_consts = { GRAMMI: 1, CHILI: 2, LITRI: 3, - PEZZI: 4, + MILLILITRI: 4, + PEZZI: 10, }, TYPECASH: { @@ -73,10 +74,15 @@ export const shared_consts = { short: 'Lt', value: 3, }, + { + label: 'MilliLitri (ml)', + short: 'ml', + value: 4, + }, { label: 'Pezzi (p)', short: 'p', - value: 4, + value: 10, }, ], diff --git a/src/components/CProductCard/CProductCard.vue b/src/components/CProductCard/CProductCard.vue index c36a094f..bb86718f 100755 --- a/src/components/CProductCard/CProductCard.vue +++ b/src/components/CProductCard/CProductCard.vue @@ -87,9 +87,9 @@ class="text-black q-ml-xs text-h8" v-if="myproduct.productInfo.unit" > - {{ myproduct.productInfo.weight }} + {{ tools.getWeightByUnit(myproduct.productInfo.unit, true, myproduct.productInfo.weight) }} {{ - tools.getUnitsMeasure(myproduct.productInfo.unit, true) + tools.getUnitsMeasure(myproduct.productInfo.unit, true, myproduct.productInfo.weight) }} @@ -429,13 +429,13 @@ {{ t('ecomm.offerta_gas_raggiunta', { qta: myproduct.qtyToReachForGas, - unit: tools.getUnitsMeasure(myproduct.productInfo.unit, true), + unit: tools.getUnitsMeasure(myproduct.productInfo.unit, true, myproduct.productInfo.weight), }) }} {{ t('ecomm.offerta_gas', { qta: myproduct.qtyToReachForGas, - unit: tools.getUnitsMeasure(myproduct.productInfo.unit, true), + unit: tools.getUnitsMeasure(myproduct.productInfo.unit, true, myproduct.productInfo.weight), }) }} diff --git a/src/components/CSingleCart/CSingleCart.vue b/src/components/CSingleCart/CSingleCart.vue index d6bdfd7c..d2fba223 100755 --- a/src/components/CSingleCart/CSingleCart.vue +++ b/src/components/CSingleCart/CSingleCart.vue @@ -58,6 +58,7 @@ borderless rounded dense + @update:model-value="updateOrder" :label="$t('ecomm.preord')" > @@ -85,7 +86,7 @@
- {{ order.quantity + order.quantitypreordered }} x € + {{ (order.quantity + order.quantitypreordered) }} x € {{ order.price ? order.price : 0 }} @@ -102,8 +103,8 @@ >€ {{ ( - order.price * order.quantity + - order.price * order.quantitypreordered + (order.price * order.quantity) + + (order.price * order.quantitypreordered) ).toFixed(2) }}) rec.value === unit) - return unitrec ? (short ? unitrec.short : unitrec.label) : '' + getUnitsMeasure(unit: number, short: boolean, weight: number | undefined) { + let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit) + let mystr = '' + if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) { + unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.GRAMMI) + } + if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) { + unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === shared_consts.UNITS_OF_MEASURE.MILLILITRI) + } + mystr = unitrec ? (short ? unitrec.short : unitrec.label) : '' + return mystr + }, + + getWeightByUnit(unit: number, short: boolean, weight: number|undefined) { + let unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec: any) => rec.value === unit) + if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.CHILI && weight && weight < 1) { + return weight * 1000 + } + if (unitrec && unitrec.value === shared_consts.UNITS_OF_MEASURE.LITRI && weight && weight < 1) { + return weight * 1000 + } + return weight }, getWeightTotalByOrder(order: IOrder) {