aggio gasordine
This commit is contained in:
@@ -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)
|
||||
@@ -96,7 +94,7 @@ export default defineComponent({
|
||||
return globalStore.getTableJoinByName(item.table, addall, addnone, item.filter)
|
||||
})
|
||||
|
||||
|
||||
|
||||
watch(() => editOn.value, (to: any, from: any) => {
|
||||
if (!editOn.value)
|
||||
ricarica()
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user