- filtro se GAS o Prodotti
This commit is contained in:
@@ -52,4 +52,9 @@
|
||||
.label-qta{
|
||||
font-size: 1.15rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.countdown_scadenza{
|
||||
font-size: 1.15rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { defineComponent, ref, toRef, computed, PropType, watch, onMounted, reactive } from 'vue'
|
||||
import { defineComponent, ref, toRef, computed, PropType, watch, onMounted, reactive, onBeforeUnmount } from 'vue'
|
||||
import { useI18n } from '@src/boot/i18n'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
@@ -65,8 +65,12 @@ export default defineComponent({
|
||||
|
||||
const storeSelected = ref('')
|
||||
const gasordineSelected = ref('')
|
||||
const recgasordineSelected = ref(<any>null)
|
||||
const arrordersCart = ref(<IOrderCart[]>[])
|
||||
|
||||
const timerInterval = ref(<any>null)
|
||||
const timerLabelScadenza = ref('')
|
||||
|
||||
const openlistorders = ref(false)
|
||||
const endload = ref(false)
|
||||
const myproduct = ref(<IProduct>{})
|
||||
@@ -217,8 +221,33 @@ export default defineComponent({
|
||||
|
||||
watch(() => gasordineSelected.value, (newval, oldval) => {
|
||||
myorder.idGasordine = newval
|
||||
recgasordineSelected.value = myproduct.value.gasordines.find((rec: any) => rec._id === gasordineSelected.value)
|
||||
|
||||
})
|
||||
|
||||
function mounted() {
|
||||
load()
|
||||
// Start the timer when the component is mounted
|
||||
startTimer();
|
||||
}
|
||||
|
||||
function beforeDestroy() {
|
||||
// Clear the interval when the component is destroyed to prevent memory leaks
|
||||
clearInterval(timerInterval.value);
|
||||
}
|
||||
|
||||
function updateTimerLabel() {
|
||||
if (recgasordineSelected.value)
|
||||
timerLabelScadenza.value = tools.getCountDown(recgasordineSelected.value.dataora_chiusura_ordini)
|
||||
else
|
||||
timerLabelScadenza.value = ''
|
||||
}
|
||||
|
||||
function startTimer() {
|
||||
// Update the timer label every second
|
||||
timerInterval.value = setInterval(() => updateTimerLabel(), 1000);
|
||||
}
|
||||
|
||||
function load() {
|
||||
updateproduct()
|
||||
// console.log('Load', myproduct.value.name)
|
||||
@@ -234,22 +263,29 @@ export default defineComponent({
|
||||
|
||||
if (myproduct.value.gasordines && myproduct.value.gasordines.length === 1) {
|
||||
myorder.idGasordine = myproduct.value.gasordines[0]._id
|
||||
gasordineSelected.value = myorder.idGasordine!
|
||||
}
|
||||
|
||||
|
||||
const ord = products.getOrderProductInCart(myproduct.value._id)
|
||||
if (ord) {
|
||||
myorder.quantity = ord.quantity
|
||||
myorder.quantitypreordered = ord.quantitypreordered
|
||||
|
||||
if (ord.idGasordine)
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// console.log('°°° ENDLOAD °°°')
|
||||
@@ -283,7 +319,8 @@ export default defineComponent({
|
||||
}, 0))
|
||||
}
|
||||
|
||||
onMounted(load)
|
||||
onMounted(mounted)
|
||||
onBeforeUnmount(beforeDestroy)
|
||||
|
||||
return {
|
||||
visuListDisponibili,
|
||||
@@ -316,6 +353,8 @@ export default defineComponent({
|
||||
listord,
|
||||
sumval,
|
||||
getGasordines,
|
||||
recgasordineSelected,
|
||||
timerLabelScadenza,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -131,6 +131,20 @@
|
||||
</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-hourglass-half" />
|
||||
</q-item-section>
|
||||
|
||||
<q-item-section>
|
||||
<q-item-label>
|
||||
{{ t('gas.dataora_chiusura_ordini') }}
|
||||
</q-item-label>
|
||||
<q-item-label class="countdown_scadenza">
|
||||
{{ timerLabelScadenza }}
|
||||
</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
<div v-if="true">
|
||||
<div v-if="complete && myproduct.producer && myproduct.producer.city">
|
||||
@@ -166,7 +180,7 @@
|
||||
(cosa === shared_consts.PROD.GAS && products.getQtyAvailable(myproduct) > 0)
|
||||
"
|
||||
:clickable="tools.isManager()"
|
||||
@click="tools.isManager() ? visuListDisponibili() : null"
|
||||
@click="tools.isManager() && (myproduct.QuantitaOrdinateInAttesa && myproduct.QuantitaOrdinateInAttesa > 0) ? visuListDisponibili() : null"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-icon color="green" name="fas fa-store" />
|
||||
@@ -200,7 +214,7 @@
|
||||
<q-item
|
||||
v-if="products.getQtyBookableAvailable(myproduct) > 0 || myproduct.bookableQty > 0"
|
||||
:clickable="tools.isManager()"
|
||||
@click="tools.isManager() ? visuListBookable() : null"
|
||||
@click="tools.isManager() && (myproduct.QuantitaPrenotateInAttesa && myproduct.QuantitaPrenotateInAttesa > 0) ? visuListBookable() : null"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-icon color="blue" name="fas fa-edit" />
|
||||
|
||||
Reference in New Issue
Block a user