- Seleziona l'ordine GAS e compare sulla email

- img logo
This commit is contained in:
Surya Paolo
2023-12-24 00:56:05 +01:00
parent 3f4eb0877c
commit c27c293fbf
30 changed files with 285 additions and 109 deletions

View File

@@ -10,7 +10,7 @@ import { CCopyBtn } from '../CCopyBtn'
import { func_tools, toolsext } from '@store/Modules/toolsext'
import { IBaseOrder, IOrder, IOrderCart, IProduct } from '@src/model'
import { IBaseOrder, IGasordine, IOrder, IOrderCart, IProduct } from '@src/model'
import { tools } from '@store/Modules/tools'
import { useProducts } from '@store/Products'
@@ -29,6 +29,11 @@ export default defineComponent({
required: false,
default: '',
},
cosa: {
type: Number,
required: false,
default: 0,
},
complete: {
type: Boolean,
required: false,
@@ -57,6 +62,7 @@ export default defineComponent({
})
const storeSelected = ref('')
const gasordineSelected = ref('')
const arrordersCart = ref(<IOrderCart[]>[])
const openlistorders = ref(false)
@@ -90,11 +96,11 @@ export default defineComponent({
globalStore.rightDrawerOpen = true
return false
}
const ris = await products.addtoCartBase({ $q, t, code: myproduct.value.code!, order: myorder, addqty: add })
updateproduct()
if (ris && ris.myord) {
}
}
@@ -120,6 +126,19 @@ export default defineComponent({
}
}
function getSingleGasordine(gasordine: IGasordine) {
try {
const mygas = gasordine
if (mygas)
return mygas.name + ' (' + mygas.city + ') ' + t('gas.dataora_chiusura_ordini') + ': ' + tools.getstrDateShort(mygas.dataora_chiusura_ordini)
+ ' ' + t('gas.dataora_ritiro') + ': ' + tools.getstrDateShort(mygas.dataora_ritiro)
else
return ''
} catch (e) {
return ''
}
}
function updateproduct() {
myproduct.value = products.getProductByCode(props.code)
// products.updateQuantityAvailable(myproduct.value._id)
@@ -146,6 +165,26 @@ export default defineComponent({
return myarr
}
function getGasordines() {
if (!myproduct.value)
return []
const myarr: any = []
let ind = 1
myproduct.value.gasordines.forEach((gasordine: IGasordine) => {
myarr.push(
{
id: ind,
label: getSingleGasordine(gasordine),
value: gasordine._id
})
ind++
})
return myarr
}
function checkifCartDisable() {
// return !myorder.idStorehouse
return false
@@ -184,6 +223,10 @@ export default defineComponent({
myorder.idStorehouse = newval
})
watch(() => gasordineSelected.value, (newval, oldval) => {
myorder.idGasordine = newval
})
function load() {
updateproduct()
// console.log('Load', myproduct.value.name)
@@ -196,10 +239,19 @@ export default defineComponent({
myorder.idStorehouse = myproduct.value.storehouses[0]._id
}
if (myproduct.value.gasordines && myproduct.value.gasordines.length === 1) {
myorder.idGasordine = myproduct.value.gasordines[0]._id
}
const ord = products.getOrderProductInCart(myproduct.value._id)
if (ord) {
myorder.quantity = ord.quantity
myorder.quantitypreordered = ord.quantitypreordered
if (ord.idGasordine)
gasordineSelected.value = ord.idGasordine!
}
}
@@ -258,6 +310,7 @@ export default defineComponent({
getclimgproduct,
getnumstore,
getSingleStorehouse,
getSingleGasordine,
getStorehouses,
checkifCartDisable,
myproduct,
@@ -265,6 +318,7 @@ export default defineComponent({
tools,
t,
storeSelected,
gasordineSelected,
enableSubQty,
enableAddQty,
getQtyAvailable,
@@ -281,6 +335,7 @@ export default defineComponent({
getQtyBookableAvailable,
listord,
sumval,
getGasordines,
}
}
})

View File

@@ -26,12 +26,12 @@
{{ myproduct.name }}
</div>
<div class="product_code">
&nbsp; {{$t('ecomm.codice')}}: {{ myproduct.code }}
&nbsp; {{ $t('ecomm.codice') }}: {{ myproduct.code }}
</div>
</div>
</q-item>
<q-item>
<div v-if="complete" class="row items-center">
<q-item v-if="complete">
<div class="row items-center">
<div class="text-title text-grey-9">
<span class="text-grey-7" v-html="myproduct.description"></span>
</div>
@@ -66,6 +66,52 @@
</div>
</q-item-label>
</q-item-section>
<q-item-section avatar v-if="myproduct.weight">
<q-icon
name="fas fa-balance-scale"
style="padding-right: 16px !important"
/>
</q-item-section>
<q-item-section v-if="myproduct.weight">
<q-item-label>
{{ t('products.weight') }}
</q-item-label>
<q-item-label>
<span class="text-black q-ml-xs text-h8" v-if="myproduct.unit">
{{ myproduct.weight }}
{{ tools.getUnitsMeasure(myproduct.unit, true) }}</span
>
</q-item-label>
</q-item-section>
</q-item>
<q-item v-if="myproduct.gasordines && myproduct.gasordines.length >= 1">
<q-item-section avatar>
<q-icon color="blue" name="fas fa-shipping-fast" />
</q-item-section>
<q-item-section>
<q-item-label>
{{ t('products.gasordine') }}
</q-item-label>
<q-item-label
v-if="(tools.isArray(myproduct.gasordines) && myproduct.gasordines.length > 1) && (!myorder.idGasordine || ((myorder.quantity + myorder.quantitypreordered) === 0 ))">
<q-select
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
outlined
v-model="gasordineSelected"
:options="getGasordines()"
:label="t('products.select_gasordine') + `:`"
emit-value
map-options
>
</q-select>
</q-item-label>
<q-item-label v-else>
<span class="text-title text-center">{{
getSingleGasordine(myproduct.gasordines[0])
}}</span>
</q-item-label>
</q-item-section>
</q-item>
</q-list>
<div v-if="true">
@@ -90,17 +136,6 @@
{{ myproduct.producer.name }}</span
>
</div>
<div
v-if="myproduct.weight"
class="text-grey text-title row items-center"
>
<q-icon name="fas fa-balance-scale" class="q-mr-xs" />
{{ t('products.weight') }}:
<span class="text-black q-ml-xs text-h8" v-if="myproduct.unit">
{{ myproduct.weight }}
{{ tools.getUnitsMeasure(myproduct.unit, true) }}</span
>
</div>
</div>
<!--<q-rating v-model="myproduct.stars" :max="5" size="32px" readonly/>-->
@@ -108,14 +143,15 @@
<div>
<q-list>
<q-item
v-if="
cosa === shared_consts.PROD.BOTTEGA ||
(cosa === shared_consts.PROD.GAS && getQtyAvailable() > 0)
"
:clickable="tools.isManager()"
@click="tools.isManager() ? (visuListDisponibili()) : null"
@click="tools.isManager() ? visuListDisponibili() : null"
>
<q-item-section avatar>
<q-icon
color="green"
name="fas fa-store"
/>
<q-icon color="green" name="fas fa-store" />
</q-item-section>
<q-item-section>
@@ -146,9 +182,9 @@
</q-item-section>
</q-item>
<q-item
v-if="getQtyBookableAvailable() > 0 || (myproduct.bookableQty > 0)"
v-if="getQtyBookableAvailable() > 0 || myproduct.bookableQty > 0"
:clickable="tools.isManager()"
@click="tools.isManager() ? (visuListBookable()) : null"
@click="tools.isManager() ? visuListBookable() : null"
>
<q-item-section avatar>
<q-icon color="blue" name="fas fa-edit" />
@@ -183,48 +219,6 @@
</q-item-section>
</q-item>
</q-list>
<div class="row q-mb-sm no-wrap items-center centeritems">
<q-btn
icon="fas fa-cart-arrow-down"
:color="enableSubQty() ? 'negative' : 'grey'"
:disable="checkifCartDisable() || !enableSubQty()"
rounded
size="md"
:label="t('products.subcart', { qta: 1 })"
@click="addtoCart(false)"
>
</q-btn>
<q-field
outlined
dense
style="width: 40px; height: 30px"
class="q-mx-xs"
>
<template v-slot:control>
<div class="self-center no-outline" tabindex="0">
{{ myorder.quantity }}
</div>
<div
v-if="myorder.quantitypreordered"
class="self-center no-outline"
tabindex="0"
>
</div>
</template>
</q-field>
<q-btn
icon-right="fas fa-cart-plus"
color="positive"
:disable="checkifCartDisable() || !enableAddQty()"
rounded
size="md"
:label="t('products.addcart', { qta: 1 })"
@click="addtoCart(true)"
>
</q-btn>
</div>
<div v-if="complete || getnumstore() > 1">
<div
class="text-blue text-title row items-center q-mr-md centeritems"
@@ -254,6 +248,42 @@
</div>
</div>
</div>
<div class="row q-mb-sm no-wrap items-center centeritems">
<q-btn
icon="fas fa-cart-arrow-down"
:color="enableSubQty() ? 'negative' : 'grey'"
:disable="checkifCartDisable() || !enableSubQty()"
rounded
size="md"
:label="t('products.subcart', { qta: 1 })"
@click="addtoCart(false)"
>
</q-btn>
<q-field
outlined
dense
style="width: 40px; height: 30px"
class="q-mx-xs"
>
<template v-slot:control>
<div class="self-center no-outline" tabindex="0">
{{ myorder.quantity + myorder.quantitypreordered }}
</div>
</template>
</q-field>
<q-btn
icon-right="fas fa-cart-plus"
color="positive"
:disable="checkifCartDisable() || !enableAddQty()"
rounded
size="md"
:label="t('products.addcart', { qta: 1 })"
@click="addtoCart(true)"
>
</q-btn>
</div>
<q-card-actions vertical align="center">
<q-btn
@@ -345,9 +375,7 @@
<td>&nbsp;</td>
<td class="text-center">
Totali:
<span class="totali">{{
sumval
}}</span>
<span class="totali">{{ sumval }}</span>
</td>
<td>&nbsp;</td>
</tr>

View File

@@ -30,4 +30,8 @@
font-style: italic;
color: green;
font-weight: bold;
}
.gasordine {
font-style: italic;
color: blue;
}

View File

@@ -42,7 +42,7 @@ export default defineComponent({
function addsubqty(addqty: boolean, subqty: boolean) {
if (products.isQtyAvailableByOrder(props.order)) {
if (addqty) {
if (props.order.quantity >= 20)
if (props.order.quantity >= 100)
return false
}
@@ -54,7 +54,7 @@ export default defineComponent({
if (products.isInPreorderByOrder(props.order)) {
if (addqty) {
if (props.order.quantitypreordered >= 20)
if (props.order.quantitypreordered >= 100)
return false
}
@@ -99,6 +99,8 @@ export default defineComponent({
removeFromCard,
isApplicatoSconto,
getRisparmio,
tools,
products,
}
},
})

View File

@@ -11,10 +11,15 @@
</q-img>
</div>
<div class="col-4 q-ml-xs">
<div v-if="order.idGasordine" class="gasordine">
{{ products.getSingleGasordine(order, true) }}<br>
</div>
{{ order.product.name }}
<div v-if="showall">
<!--<div v-if="showalle">
<br /><span class="text-grey">{{ order.product.description }}</span>
</div>
-->
</div>
<div class="col-3">
<div class="row q-mb-xs no-wrap items-center centeritems">
@@ -48,6 +53,13 @@
@click="addsubqty(true, false)"
></q-btn>
</div>
<div
class="text-black q-ml-xs text-h8 text-center"
v-if="order.product.unit"
>
{{ tools.getWeightTotalByOrder(order) }}
{{ tools.getUnitsMeasure(order.product.unit, true) }}
</div>
</div>
<div class="col-2 no-wrap text-subtitle3_short q-mr-sm">
<span :class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''"