- Seleziona l'ordine GAS e compare sulla email
- img logo
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user