aggio gasordine

This commit is contained in:
Surya Paolo
2024-01-16 16:56:57 +01:00
parent 2005b8cb56
commit 62267ef618
21 changed files with 57 additions and 115 deletions

View File

@@ -215,8 +215,8 @@ export default defineComponent({
function getActualGasordine(myprod: IProduct) { function getActualGasordine(myprod: IProduct) {
// Ottieni il negozio attualmente selezionato: // Ottieni il negozio attualmente selezionato:
// Se ce n'è solo 1 allora prendi quello ! // Se ce n'è solo 1 allora prendi quello !
if (myprod.gasordines.length === 1) { if (myprod.gasordine) {
return myprod.gasordines[0]._id return myprod.gasordine._id
} else { } else {
// Ottieni il gasordine attualmente scelto ! // Ottieni il gasordine attualmente scelto !
return '' return ''

View File

@@ -226,10 +226,10 @@
:label="col.visulabel ? $t(col.label_trans) : col.label" :label="col.visulabel ? $t(col.label_trans) : col.label"
> >
</q-input> </q-input>
<q-label v-if="col.showLinkResult"> <q-field v-if="col.showLinkResult">
Diventerà: <a :href="tools.generateURL(col.showLinkResult, myvalue)" target="_blank">{{tools.generateURL(col.showLinkResult, myvalue)}}</a> Diventerà: <a :href="tools.generateURL(col.showLinkResult, myvalue)" target="_blank">{{tools.generateURL(col.showLinkResult, myvalue)}}</a>
</q-label> </q-field>
</div> </div>
<div <div

View File

@@ -184,8 +184,8 @@ export default defineComponent({
function getActualGasordine(myprod: IProduct) { function getActualGasordine(myprod: IProduct) {
// Ottieni il negozio attualmente selezionato: // Ottieni il negozio attualmente selezionato:
// Se ce n'è solo 1 allora prendi quello ! // Se ce n'è solo 1 allora prendi quello !
if (myprod.gasordines.length === 1) { if (myprod.gasordine) {
return myprod.gasordines[0]._id return myprod.gasordine._id
} else { } else {
// Ottieni il gasordine attualmente scelto ! // Ottieni il gasordine attualmente scelto !
return '' return ''

View File

@@ -94,7 +94,7 @@
@input="change_field('note')" @input="change_field('note')"
> >
</q-input> </q-input>
<q-label v-else> Note: {{ note }} </q-label> <q-field v-else> Note: {{ note }} </q-field>
<q-input <q-input
v-if="editOn && tools.isManager() && getNumItems() > 0" v-if="editOn && tools.isManager() && getNumItems() > 0"

View File

@@ -72,8 +72,6 @@ export default defineComponent({
}) })
const storeSelected = ref('') const storeSelected = ref('')
const gasordineSelected = ref('')
const recgasordineSelected = ref(<any>null)
const arrordersCart = ref(<IOrderCart[]>[]) const arrordersCart = ref(<IOrderCart[]>[])
const timerInterval = ref(<any>null) const timerInterval = ref(<any>null)
@@ -96,7 +94,7 @@ export default defineComponent({
return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter) return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter)
}) })
watch(() => editOn.value, (to: any, from: any) => { watch(() => editOn.value, (to: any, from: any) => {
if (!editOn.value) if (!editOn.value)
ricarica() ricarica()
@@ -178,9 +176,6 @@ export default defineComponent({
myorder.idStorehouse = '' myorder.idStorehouse = ''
myorder.idGasordine = '' myorder.idGasordine = ''
gasordineSelected.value = ''
recgasordineSelected.value = null
} }
function updateproduct() { function updateproduct() {
@@ -206,8 +201,6 @@ export default defineComponent({
try { try {
myproduct.value = products.getProductById(props.id) myproduct.value = products.getProductById(props.id)
recgasordineSelected.value = myproduct.value.gasordines.find((rec: any) => rec._id === gasordineSelected.value)
updateLabel() updateLabel()
} catch (e) { } catch (e) {
console.error('err', e) console.error('err', e)
@@ -235,26 +228,6 @@ export default defineComponent({
return myarr 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() { function checkifCartDisable() {
// return !myorder.idStorehouse // return !myorder.idStorehouse
return isOrdineChiuso() return isOrdineChiuso()
@@ -283,21 +256,13 @@ export default defineComponent({
myorder.idStorehouse = newval myorder.idStorehouse = newval
}) })
watch(() => gasordineSelected.value, (newval, oldval) => {
if (newval) {
myorder.idGasordine = newval
recgasordineSelected.value = myproduct.value.gasordines.find((rec: any) => rec._id === gasordineSelected.value)
updateLabel()
}
})
function updateLabel() { function updateLabel() {
if (recgasordineSelected.value) { if (myproduct.value.gasordine) {
//labelDataRitiro.value = tools.getstrDateTime(recgasordineSelected.value.dataora_ritiro) //labelDataRitiro.value = tools.getstrDateTime(recgasordineSelected.value.dataora_ritiro)
if (recgasordineSelected.value.data_arrivo_merce) if (myproduct.value.gasordine.data_arrivo_merce)
labelDataArrivoMerce.value = tools.getstrDateShort(recgasordineSelected.value.data_arrivo_merce) labelDataArrivoMerce.value = tools.getstrDateShort(myproduct.value.gasordine.data_arrivo_merce)
if (recgasordineSelected.value.dataora_ritiro) if (myproduct.value.gasordine.dataora_ritiro)
labelDataRitiro.value = tools.getstrDateTime(recgasordineSelected.value.dataora_ritiro) labelDataRitiro.value = tools.getstrDateTime(myproduct.value.gasordine.dataora_ritiro)
} else { } else {
labelDataArrivoMerce.value = '' labelDataArrivoMerce.value = ''
labelDataRitiro.value = '' labelDataRitiro.value = ''
@@ -316,15 +281,15 @@ export default defineComponent({
} }
function updateTimerLabel() { function updateTimerLabel() {
if (recgasordineSelected.value) if (myproduct.value.gasordine && myproduct.value.gasordine._id && myproduct.value.gasordine.dataora_chiusura_ordini)
timerLabelScadenza.value = tools.getCountDown(recgasordineSelected.value.dataora_chiusura_ordini) timerLabelScadenza.value = tools.getCountDown(myproduct.value.gasordine.dataora_chiusura_ordini)
else else
timerLabelScadenza.value = '' timerLabelScadenza.value = ''
} }
function isOrdineChiuso() { function isOrdineChiuso() {
return recgasordineSelected.value && recgasordineSelected.value.dataora_chiusura_ordini && return myproduct.value.gasordine && myproduct.value.gasordine.dataora_chiusura_ordini &&
tools.getCountDown(recgasordineSelected.value.dataora_chiusura_ordini) === '' tools.getCountDown(myproduct.value.gasordine.dataora_chiusura_ordini) === ''
} }
function startTimer() { function startTimer() {
@@ -347,9 +312,8 @@ export default defineComponent({
myorder.idStorehouse = myproduct.value.storehouses[0]._id myorder.idStorehouse = myproduct.value.storehouses[0]._id
} }
if (myproduct.value.gasordines && myproduct.value.gasordines.length === 1) { if (myproduct.value.gasordine) {
myorder.idGasordine = myproduct.value.gasordines[0]._id myorder.idGasordine = myproduct.value.gasordine._id
gasordineSelected.value = myorder.idGasordine!
} }
const ord = products.getOrderProductInCart(myproduct.value._id) const ord = products.getOrderProductInCart(myproduct.value._id)
@@ -357,21 +321,11 @@ export default defineComponent({
myorder.quantity = ord.quantity myorder.quantity = ord.quantity
myorder.quantitypreordered = ord.quantitypreordered myorder.quantitypreordered = ord.quantitypreordered
if (ord.idGasordine) {
gasordineSelected.value = ord.idGasordine!
recgasordineSelected.value = myproduct.value.gasordines.find((rec: IGasordine) => rec._id === ord.idGasordine!)
}
// Seleziona il Negozio che avevo già scelto nell'ordine ! // Seleziona il Negozio che avevo già scelto nell'ordine !
if (ord.idStorehouse) if (ord.idStorehouse)
storeSelected.value = ord.idStorehouse storeSelected.value = ord.idStorehouse
} }
if (gasordineSelected.value) {
recgasordineSelected.value = myproduct.value.gasordines.find((rec: IGasordine) => rec._id === gasordineSelected.value)
}
} }
updateLabel() updateLabel()
@@ -404,7 +358,7 @@ export default defineComponent({
} }
function isOrdGas(): boolean { function isOrdGas(): boolean {
return myproduct.value && myproduct.value.idGasordines ? myproduct.value.idGasordines.length > 0 : false return (myproduct.value && !!myproduct.value.idGasordine && myproduct.value.gasordine! && myproduct.value.gasordine.active)
} }
function getpercqtaraggiunta(): number { function getpercqtaraggiunta(): number {
@@ -472,7 +426,6 @@ export default defineComponent({
tools, tools,
t, t,
storeSelected, storeSelected,
gasordineSelected,
getQtyWarn, getQtyWarn,
openlistorders, openlistorders,
func_tools, func_tools,
@@ -485,8 +438,6 @@ export default defineComponent({
getQtyWarnPreOrdered, getQtyWarnPreOrdered,
listord, listord,
sumval, sumval,
getGasordines,
recgasordineSelected,
timerLabelScadenza, timerLabelScadenza,
labelDataRitiro, labelDataRitiro,
labelDataArrivoMerce, labelDataArrivoMerce,
@@ -497,7 +448,6 @@ export default defineComponent({
onTouchStart, onTouchStart,
onTouchMove, onTouchMove,
onTouchEnd, onTouchEnd,
$router,
naviga, naviga,
globalStore, globalStore,
editOn, editOn,

View File

@@ -1,7 +1,6 @@
<template> <template>
<div class="row items-start q-gutter-sm"> <div class="row items-start q-gutter-sm">
<q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" /> <q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" />
<q-card <q-card
:class="{ :class="{
'my-card-big': complete, 'my-card-big': complete,
@@ -330,6 +329,7 @@
<q-item-section> <q-item-section>
<q-item-label class=""> <q-item-label class="">
<CMyValueDb <CMyValueDb
title=""
:editOn="editOn" :editOn="editOn"
table="products" table="products"
:id="myproduct._id" :id="myproduct._id"
@@ -448,37 +448,17 @@
</q-item-section> </q-item-section>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item v-if="myproduct.gasordines && myproduct.gasordines.length >= 1"> <q-item v-if="myproduct.gasordine && myproduct.gasordine.active && myproduct.idGasordine">
<q-item-section avatar> <q-item-section avatar>
<q-icon color="blue" name="fas fa-shipping-fast" /> <q-icon color="blue" name="fas fa-shipping-fast" />
</q-item-section> </q-item-section>
<q-item-section> <q-item-section>
<q-item-label class="subtit_prod"> <q-item-label class="subtit_prod">
{{ t('products.gasordine') }} {{ t('products.gasordine') }}
</q-item-label> </q-item-label>
<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">{{ <span class="text-title text-center">{{
getSingleGasordine(myproduct.gasordines[0]) myproduct.gasordine.name
}}</span> }}</span>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
@@ -624,12 +604,12 @@
</q-item-section> </q-item-section>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item v-if="myproduct.gasordines && myproduct.gasordines.length >= 1"> <q-item v-if="myproduct.gasordine && myproduct.gasordine.active">
<q-item-section avatar> <q-item-section avatar>
<q-icon color="blue" name="fas fa-hourglass-half" /> <q-icon color="blue" name="fas fa-hourglass-half" />
</q-item-section> </q-item-section>
<q-item-section v-if="!!recgasordineSelected.dataora_chiusura_ordini"> <q-item-section v-if="!!myproduct.gasordine.dataora_chiusura_ordini">
<q-item-label class="countdown_scadenza"> <q-item-label class="countdown_scadenza">
<span v-if="timerLabelScadenza">{{ timerLabelScadenza }}</span> <span v-if="timerLabelScadenza">{{ timerLabelScadenza }}</span>
<span v-else-if="isOrdineChiuso()">{{ <span v-else-if="isOrdineChiuso()">{{
@@ -639,8 +619,8 @@
:editOn="editOn" :editOn="editOn"
:title="t('gas.dataora_chiusura_ordini')" :title="t('gas.dataora_chiusura_ordini')"
table="gasordines" table="gasordines"
:id="recgasordineSelected._id" :id="myproduct.gasordine._id"
:rec="recgasordineSelected" :rec="myproduct.gasordine"
mykey="dataora_chiusura_ordini" mykey="dataora_chiusura_ordini"
debounce="1000" debounce="1000"
:save="updateproductmodif()" :save="updateproductmodif()"
@@ -651,7 +631,7 @@
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item v-if="labelDataArrivoMerce || editOn"> <q-item v-if="myproduct.gasordine && myproduct.gasordine.active && (labelDataArrivoMerce || editOn)">
<q-item-section avatar> <q-item-section avatar>
<q-icon color="red" name="fas fa-shipping-fast" /> <q-icon color="red" name="fas fa-shipping-fast" />
</q-item-section> </q-item-section>
@@ -662,8 +642,8 @@
:editOn="editOn" :editOn="editOn"
:title="t('gas.data_arrivo_merce')" :title="t('gas.data_arrivo_merce')"
table="gasordines" table="gasordines"
:id="recgasordineSelected._id" :id="myproduct.gasordine._id"
:rec="recgasordineSelected" :rec="myproduct.gasordine"
mykey="data_arrivo_merce" mykey="data_arrivo_merce"
debounce="1000" debounce="1000"
:save="updateproductmodif()" :save="updateproductmodif()"
@@ -674,7 +654,7 @@
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
</q-item> </q-item>
<q-item v-if="labelDataRitiro || editOn"> <q-item v-if="myproduct.gasordine && myproduct.gasordine.active && (labelDataRitiro || editOn)">
<q-item-section avatar> <q-item-section avatar>
<q-icon color="green" name="fas fa-people-carry" /> <q-icon color="green" name="fas fa-people-carry" />
</q-item-section> </q-item-section>
@@ -685,8 +665,8 @@
:editOn="editOn" :editOn="editOn"
:title="t('gas.dataora_ritiro')" :title="t('gas.dataora_ritiro')"
table="gasordines" table="gasordines"
:id="recgasordineSelected._id" :id="myproduct.gasordine._id"
:rec="recgasordineSelected" :rec="myproduct.gasordine"
mykey="dataora_ritiro" mykey="dataora_ritiro"
:justifycenter="false" :justifycenter="false"
debounce="1000" debounce="1000"
@@ -801,6 +781,7 @@
</div> </div>
<div v-if="editOn">{{ t('ecomm.active') }}:</div> <div v-if="editOn">{{ t('ecomm.active') }}:</div>
<CMyValueDb <CMyValueDb
title=""
v-if="editOn" v-if="editOn"
:editOn="editOn" :editOn="editOn"
table="products" table="products"

View File

@@ -31,12 +31,12 @@ export interface IProduct {
idProducer?: string, idProducer?: string,
idProvider?: string, idProvider?: string,
idStorehouses?: string[], idStorehouses?: string[],
idGasordines?: string[], idGasordine?: string,
idScontisticas?: string[], idScontisticas?: string[],
scontisticas: IScontistica[], scontisticas: IScontistica[],
producer?: IProducer, producer?: IProducer,
storehouses: IStorehouse[], storehouses: IStorehouse[],
gasordines: IGasordine[], gasordine: IGasordine | null,
provider?: IProvider, provider?: IProvider,
price: number, price: number,
after_price?: string, after_price?: string,

View File

@@ -2060,9 +2060,15 @@ export const colTableProducts = [
jointable: 'storehouses', jointable: 'storehouses',
}), }),
AddCol({ AddCol({
name: 'idGasordines', name: 'idGasordine',
label_trans: 'gas.name', label_trans: 'gas.name',
fieldtype: costanti.FieldType.multiselect, fieldtype: costanti.FieldType.select,
jointable: 'gasordines',
}),
AddCol({
name: 'idGasordine',
label_trans: 'gas.name',
fieldtype: costanti.FieldType.select,
jointable: 'gasordines', jointable: 'gasordines',
}), }),
AddCol({ AddCol({

View File

@@ -65,12 +65,12 @@ function getRecordProductEmpty(): IProduct {
active: false, active: false,
idProducer: '', idProducer: '',
idStorehouses: [], idStorehouses: [],
idGasordines: [], idGasordine: '',
idScontisticas: [], idScontisticas: [],
scontisticas: [], scontisticas: [],
gasordines: [],
idProvider: '', idProvider: '',
producer: {}, producer: {},
gasordine: null,
storehouses: [], storehouses: [],
provider: {}, provider: {},
price: 0.0, price: 0.0,
@@ -121,10 +121,10 @@ export const useProducts = defineStore('Products', {
getProducts: (state: IProductsState) => (cosa?: number): IProduct[] => { getProducts: (state: IProductsState) => (cosa?: number): IProduct[] => {
if (!!cosa) { if (!!cosa) {
return state.products.filter((rec: IProduct) => { return state.products.filter((rec: IProduct) => {
const hasGasOrdines = rec.idGasordines && rec.idGasordines.length > 0; const hasGasOrdines = rec.idGasordine
if ((cosa === shared_consts.PROD.GAS && hasGasOrdines) || if ((cosa === shared_consts.PROD.GAS && hasGasOrdines) ||
(cosa === shared_consts.PROD.BOTTEGA && ((!hasGasOrdines || (hasGasOrdines && rec.idGasordines?.length === 0))))) { (cosa === shared_consts.PROD.BOTTEGA && ((!hasGasOrdines || (hasGasOrdines && rec.idGasordine))))) {
return true; return true;
} }
@@ -571,7 +571,7 @@ export const useProducts = defineStore('Products', {
ris = await Api.SendReq('/cart/' + userStore.my._id, 'GET', null) ris = await Api.SendReq('/cart/' + userStore.my._id, 'GET', null)
.then((res) => { .then((res) => {
if (res.data.cart) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories) if (res.data && res.data.cart) { // console.log('RISULTANTE CATEGORIES DAL SERVER = ', res.data.categories)
this.cart = res.data.cart this.cart = res.data.cart
} else { } else {
this.cart = { items: [], totalPrice: 0, totalQty: 0, userId: '' } this.cart = { items: [], totalPrice: 0, totalQty: 0, userId: '' }
@@ -665,8 +665,8 @@ export const useProducts = defineStore('Products', {
} }
} }
if (!order.idGasordine && order.quantitypreordered > 0) { if (!order.idGasordine && order.quantitypreordered > 0) {
if (product.gasordines.length === 1) { if (product.gasordine && product.gasordine._id) {
order.idGasordine = product.gasordines[0]._id order.idGasordine = product.gasordine._id
} else { } else {
order.idGasordine = globalStore.gasordines ? globalStore.gasordines[0]._id : '' order.idGasordine = globalStore.gasordines ? globalStore.gasordines[0]._id : ''
} }

View File

@@ -294,6 +294,11 @@
color="positive" color="positive"
@click="EseguiFunz('CopyPriceToCalc')" @click="EseguiFunz('CopyPriceToCalc')"
></q-btn> ></q-btn>
<q-btn
label="SistemaGasOrdine"
color="positive"
@click="EseguiFunz('SistemaGasOrdine')"
></q-btn>
<br /> <br />
</div> </div>

BIN
upload/GAS00001.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

BIN
upload/GAS00002.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

BIN
upload/GAS00003.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB