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) {
// Ottieni il negozio attualmente selezionato:
// Se ce n'è solo 1 allora prendi quello !
if (myprod.gasordines.length === 1) {
return myprod.gasordines[0]._id
if (myprod.gasordine) {
return myprod.gasordine._id
} else {
// Ottieni il gasordine attualmente scelto !
return ''

View File

@@ -226,10 +226,10 @@
:label="col.visulabel ? $t(col.label_trans) : col.label"
>
</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>
</q-label>
</q-field>
</div>
<div

View File

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

View File

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

View File

@@ -72,8 +72,6 @@ export default defineComponent({
})
const storeSelected = ref('')
const gasordineSelected = ref('')
const recgasordineSelected = ref(<any>null)
const arrordersCart = ref(<IOrderCart[]>[])
const timerInterval = ref(<any>null)
@@ -178,9 +176,6 @@ export default defineComponent({
myorder.idStorehouse = ''
myorder.idGasordine = ''
gasordineSelected.value = ''
recgasordineSelected.value = null
}
function updateproduct() {
@@ -206,8 +201,6 @@ export default defineComponent({
try {
myproduct.value = products.getProductById(props.id)
recgasordineSelected.value = myproduct.value.gasordines.find((rec: any) => rec._id === gasordineSelected.value)
updateLabel()
} catch (e) {
console.error('err', e)
@@ -235,26 +228,6 @@ 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 isOrdineChiuso()
@@ -283,21 +256,13 @@ export default defineComponent({
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() {
if (recgasordineSelected.value) {
if (myproduct.value.gasordine) {
//labelDataRitiro.value = tools.getstrDateTime(recgasordineSelected.value.dataora_ritiro)
if (recgasordineSelected.value.data_arrivo_merce)
labelDataArrivoMerce.value = tools.getstrDateShort(recgasordineSelected.value.data_arrivo_merce)
if (recgasordineSelected.value.dataora_ritiro)
labelDataRitiro.value = tools.getstrDateTime(recgasordineSelected.value.dataora_ritiro)
if (myproduct.value.gasordine.data_arrivo_merce)
labelDataArrivoMerce.value = tools.getstrDateShort(myproduct.value.gasordine.data_arrivo_merce)
if (myproduct.value.gasordine.dataora_ritiro)
labelDataRitiro.value = tools.getstrDateTime(myproduct.value.gasordine.dataora_ritiro)
} else {
labelDataArrivoMerce.value = ''
labelDataRitiro.value = ''
@@ -316,15 +281,15 @@ export default defineComponent({
}
function updateTimerLabel() {
if (recgasordineSelected.value)
timerLabelScadenza.value = tools.getCountDown(recgasordineSelected.value.dataora_chiusura_ordini)
if (myproduct.value.gasordine && myproduct.value.gasordine._id && myproduct.value.gasordine.dataora_chiusura_ordini)
timerLabelScadenza.value = tools.getCountDown(myproduct.value.gasordine.dataora_chiusura_ordini)
else
timerLabelScadenza.value = ''
}
function isOrdineChiuso() {
return recgasordineSelected.value && recgasordineSelected.value.dataora_chiusura_ordini &&
tools.getCountDown(recgasordineSelected.value.dataora_chiusura_ordini) === ''
return myproduct.value.gasordine && myproduct.value.gasordine.dataora_chiusura_ordini &&
tools.getCountDown(myproduct.value.gasordine.dataora_chiusura_ordini) === ''
}
function startTimer() {
@@ -347,9 +312,8 @@ 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
gasordineSelected.value = myorder.idGasordine!
if (myproduct.value.gasordine) {
myorder.idGasordine = myproduct.value.gasordine._id
}
const ord = products.getOrderProductInCart(myproduct.value._id)
@@ -357,21 +321,11 @@ export default defineComponent({
myorder.quantity = ord.quantity
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 !
if (ord.idStorehouse)
storeSelected.value = ord.idStorehouse
}
if (gasordineSelected.value) {
recgasordineSelected.value = myproduct.value.gasordines.find((rec: IGasordine) => rec._id === gasordineSelected.value)
}
}
updateLabel()
@@ -404,7 +358,7 @@ export default defineComponent({
}
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 {
@@ -472,7 +426,6 @@ export default defineComponent({
tools,
t,
storeSelected,
gasordineSelected,
getQtyWarn,
openlistorders,
func_tools,
@@ -485,8 +438,6 @@ export default defineComponent({
getQtyWarnPreOrdered,
listord,
sumval,
getGasordines,
recgasordineSelected,
timerLabelScadenza,
labelDataRitiro,
labelDataArrivoMerce,
@@ -497,7 +448,6 @@ export default defineComponent({
onTouchStart,
onTouchMove,
onTouchEnd,
$router,
naviga,
globalStore,
editOn,

View File

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

View File

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

View File

@@ -2060,9 +2060,15 @@ export const colTableProducts = [
jointable: 'storehouses',
}),
AddCol({
name: 'idGasordines',
name: 'idGasordine',
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',
}),
AddCol({

View File

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

View File

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