- filtro se GAS o Prodotti
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { defineComponent, onMounted, ref } from 'vue'
|
||||
import { defineComponent, onMounted, ref, watch } from 'vue'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
@@ -31,6 +31,15 @@ export default defineComponent({
|
||||
const myarrrec = ref(<any>{})
|
||||
const myoldrec = ref(<any>{})
|
||||
|
||||
const cosa = ref(0)
|
||||
|
||||
const initialPagination = ref({
|
||||
sortBy: 'desc',
|
||||
descending: false,
|
||||
rowsPerPage: 10,
|
||||
// rowsNumber: xx if getting data from a server
|
||||
})
|
||||
|
||||
const conferma_carrello = ref(false)
|
||||
const conferma_ordine = ref(false)
|
||||
const endload = ref(false)
|
||||
@@ -136,6 +145,10 @@ export default defineComponent({
|
||||
}
|
||||
])
|
||||
|
||||
watch(() => cosa.value, (newval, oldval) => {
|
||||
|
||||
})
|
||||
|
||||
// const { setValDb, getValDb } = MixinBase()
|
||||
|
||||
function getCols(props: any) {
|
||||
@@ -143,8 +156,10 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function getOrdersCart(): IOrderCart[] | undefined {
|
||||
const ris = productStore.getOrdersCart(taborders.value)
|
||||
// console.log(ris)
|
||||
const hasGasordine: any = (cosa.value === shared_consts.PROD.TUTTI) ? undefined : (cosa.value === shared_consts.PROD.GAS)
|
||||
console.log('hasgas', hasGasordine)
|
||||
const ris = productStore.getOrdersCart(taborders.value, hasGasordine)
|
||||
|
||||
return ris
|
||||
}
|
||||
|
||||
@@ -314,6 +329,8 @@ export default defineComponent({
|
||||
getOrdersCartWithTotals,
|
||||
productStore,
|
||||
t,
|
||||
initialPagination,
|
||||
cosa,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -2,6 +2,56 @@
|
||||
<q-page>
|
||||
<CTitleBanner title="Ordini"></CTitleBanner>
|
||||
<q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" />
|
||||
|
||||
<div class="q-gutter-md text-center">
|
||||
<q-btn-toggle
|
||||
v-model="cosa"
|
||||
push
|
||||
rounded
|
||||
glossy
|
||||
toggle-color="purple"
|
||||
:options="[
|
||||
{ value: shared_consts.PROD.TUTTI, slot: 'tutti' },
|
||||
{ value: shared_consts.PROD.BOTTEGA, slot: 'bottega' },
|
||||
{ value: shared_consts.PROD.GAS, slot: 'gas' },
|
||||
]"
|
||||
>
|
||||
<template v-slot:tutti>
|
||||
<div class="row items-center no-wrap">
|
||||
<div class="text-center">
|
||||
{{ t('gas.tutti') }}
|
||||
<br />
|
||||
{{ t('gas.x_prodotti_gas', { qta: productStore.getNumQtaGas()+productStore.getNumQtaBottega() }) }}
|
||||
</div>
|
||||
<q-icon right name="fas fa-user-friends" />
|
||||
</div>
|
||||
</template>
|
||||
<template v-slot:gas>
|
||||
<div class="row items-center no-wrap">
|
||||
<div class="text-center">
|
||||
{{ t('gas.ordina_sul_gas') }}
|
||||
<br />
|
||||
{{ t('gas.x_prodotti_gas', { qta: productStore.getNumQtaGas() }) }}
|
||||
</div>
|
||||
<q-icon right name="fas fa-user-friends" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-slot:bottega>
|
||||
<div class="row items-center no-wrap">
|
||||
<div class="text-center">
|
||||
{{ t('gas.bottega') }}
|
||||
<br />
|
||||
{{
|
||||
t('gas.x_prodotti_bottega', { qta: productStore.getNumQtaBottega() })
|
||||
}}
|
||||
</div>
|
||||
<q-icon right name="fas fa-store" />
|
||||
</div>
|
||||
</template>
|
||||
</q-btn-toggle>
|
||||
</div>
|
||||
˚
|
||||
<div v-if="endload" class="panel">
|
||||
<q-tabs v-model="taborders" inline-label class="text-blue">
|
||||
<span v-for="(stat, index) of shared_consts.OrderStat" :key="index">
|
||||
@@ -21,6 +71,7 @@
|
||||
:hide-header="$q.screen.lt.sm"
|
||||
:columns="columns"
|
||||
row-key="numorder"
|
||||
:pagination="initialPagination"
|
||||
:rows="getOrdersCartWithTotals()"
|
||||
>
|
||||
<template v-if="$q.screen.lt.sm" v-slot:item="props">
|
||||
|
||||
@@ -84,16 +84,6 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
|
||||
function getNumQtaGas() {
|
||||
const arrprod = productStore.getProducts(shared_consts.PROD.GAS)
|
||||
return arrprod.length
|
||||
}
|
||||
|
||||
function getNumQtaBottega() {
|
||||
const arrprod = productStore.getProducts(shared_consts.PROD.BOTTEGA)
|
||||
return arrprod.length
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
@@ -105,8 +95,6 @@ export default defineComponent({
|
||||
search,
|
||||
cosa,
|
||||
shared_consts,
|
||||
getNumQtaGas,
|
||||
getNumQtaBottega,
|
||||
getCatProds,
|
||||
cat,
|
||||
productStore,
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="text-center">
|
||||
{{ t('gas.ordina_sul_gas') }}
|
||||
<br />
|
||||
{{ t('gas.x_prodotti_gas', { qta: getNumQtaGas() }) }}
|
||||
{{ t('gas.x_prodotti_gas', { qta: productStore.getNumQtaGas() }) }}
|
||||
</div>
|
||||
<q-icon right name="fas fa-user-friends" />
|
||||
</div>
|
||||
@@ -32,7 +32,7 @@
|
||||
{{ t('gas.bottega') }}
|
||||
<br />
|
||||
{{
|
||||
t('gas.x_prodotti_bottega', { qta: getNumQtaBottega() })
|
||||
t('gas.x_prodotti_bottega', { qta: productStore.getNumQtaBottega() })
|
||||
}}
|
||||
</div>
|
||||
<q-icon right name="fas fa-store" />
|
||||
|
||||
Reference in New Issue
Block a user