Gestione Ordini: evaso...
This commit is contained in:
@@ -12,3 +12,10 @@ $heightBtn: 100%;
|
||||
.q-item__label--caption{
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.ordstat{
|
||||
text-align: center;
|
||||
border: 1px solid #8778cb;
|
||||
border-radius: 10px;
|
||||
padding: 5px;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ export default defineComponent({
|
||||
const conferma_carrello = ref(false)
|
||||
const conferma_ordine = ref(false)
|
||||
|
||||
const taborders = ref(shared_consts.OrderStatStr.IN_CORSO)
|
||||
const taborders = ref(shared_consts.OrderStat.IN_CORSO.value)
|
||||
const statusnow = ref(0)
|
||||
const arrnumstatus = ref(<any[]>[])
|
||||
const columns = ref(<any>[
|
||||
@@ -143,7 +143,7 @@ export default defineComponent({
|
||||
|
||||
function getOrdersCart(): IOrderCart[] | undefined {
|
||||
const ris = productStore.getOrdersCart(taborders.value)
|
||||
console.log(ris)
|
||||
// console.log(ris)
|
||||
return ris
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const allorders = getAllOrdersCart()
|
||||
for (const status of [2, 3, 4, 6, 10]) {
|
||||
for (const status of [2, 3, 4, 5, 6, 7, 8, 10]) {
|
||||
arrnumstatus.value[status] = allorders.filter((rec) => (rec.status === status)).reduce((sum, item) => sum + 1, 0)
|
||||
}
|
||||
|
||||
@@ -170,8 +170,18 @@ export default defineComponent({
|
||||
|
||||
updateorders()
|
||||
|
||||
console.log('arrnumstatus;')
|
||||
console.log(arrnumstatus.value)
|
||||
taborders.value = -1
|
||||
|
||||
Object.keys(arrnumstatus.value).forEach((stat: any) => {
|
||||
if (arrnumstatus.value[stat] > 0) {
|
||||
if (taborders.value === -1)
|
||||
taborders.value = parseInt(stat)
|
||||
}
|
||||
})
|
||||
|
||||
if (taborders.value === -1)
|
||||
taborders.value = shared_consts.OrderStat.IN_CORSO.value
|
||||
|
||||
|
||||
if (tools.isManager()) {
|
||||
columns.value = [...columns_Admin.value]
|
||||
@@ -234,7 +244,7 @@ export default defineComponent({
|
||||
title: 'Ordine'
|
||||
}).onOk(async () => {
|
||||
|
||||
statusnow.value = await productStore.UpdateOrderStatus({ order_id: order._id, status })
|
||||
statusnow.value = await productStore.UpdateOrderCartStatus({ order_id: order._id, status })
|
||||
|
||||
if (statusnow.value === status) {
|
||||
order.status = statusnow.value
|
||||
|
||||
@@ -3,38 +3,15 @@
|
||||
<CTitleBanner title="Ordini"></CTitleBanner>
|
||||
<div class="panel">
|
||||
<q-tabs v-model="taborders" inline-label class="text-blue">
|
||||
<q-tab
|
||||
class="text-black"
|
||||
:name="shared_consts.OrderStatStr.IN_CORSO"
|
||||
icon="fas fa-tasks"
|
||||
:label="`(` + arrnumstatus[2] + `) in Corso`"
|
||||
/>
|
||||
<q-tab
|
||||
class="text-blue"
|
||||
:name="shared_consts.OrderStatStr.CONFERMATI"
|
||||
icon="fas fa-calendar"
|
||||
:label="`(` + arrnumstatus[3] + `) Confermati`"
|
||||
/>
|
||||
<q-tab
|
||||
class="text-green"
|
||||
:name="shared_consts.OrderStatStr.PAGATI"
|
||||
icon="fas fa-calendar"
|
||||
:label="`(` + arrnumstatus[4] + `) Pagati`"
|
||||
/>
|
||||
<q-tab
|
||||
class="text-blue-grey-8"
|
||||
v-if="arrnumstatus[6] > 0"
|
||||
:name="shared_consts.OrderStatStr.COMPLETATI"
|
||||
icon="fas fa-check"
|
||||
:label="`(` + arrnumstatus[6] + `) Completati`"
|
||||
/>
|
||||
<q-tab
|
||||
class="text-red"
|
||||
v-if="arrnumstatus[10] > 0"
|
||||
:name="shared_consts.OrderStatStr.CANCELLATI"
|
||||
icon="delete"
|
||||
:label="`(` + arrnumstatus[10] + `) Cancellati`"
|
||||
/>
|
||||
<span v-for="(stat, index) of shared_consts.OrderStat" :key="index">
|
||||
<q-tab
|
||||
v-if="arrnumstatus[stat.value] > 0"
|
||||
:class="stat.color"
|
||||
:name="stat.value"
|
||||
:icon="stat.icon"
|
||||
:label="`(` + arrnumstatus[stat.value] + `) ` + stat.label"
|
||||
/>
|
||||
</span>
|
||||
</q-tabs>
|
||||
|
||||
<div class="q-pa-sm">
|
||||
@@ -56,10 +33,6 @@
|
||||
<q-item-section side>
|
||||
<q-item-label v-if="col.name === 'created_at'" caption
|
||||
>{{ tools.getstrDateTime(col.value) }}
|
||||
<span v-if="taborders === shared_consts.OrderStatStr.COMPLETATI">
|
||||
<br />Completato il:
|
||||
{{ tools.getstrDateTime(props.row.completed_at) }}
|
||||
</span>
|
||||
</q-item-label>
|
||||
<q-item-label v-else-if="col.name === 'items'" caption>
|
||||
<div
|
||||
@@ -101,7 +74,7 @@
|
||||
</q-td>
|
||||
<q-td key="created_at" :props="props">
|
||||
{{ tools.getstrDateTime(props.row.created_at) }}
|
||||
<span v-if="taborders === shared_consts.OrderStatStr.COMPLETATI">
|
||||
<span v-if="taborders === shared_consts.OrderStat.COMPLETATI">
|
||||
<br />Completato il:<br />{{
|
||||
tools.getstrDateTime(props.row.completed_at)
|
||||
}}
|
||||
@@ -123,114 +96,47 @@
|
||||
<span :class="props.row.status">{{
|
||||
shared_consts.getStatusStr(props.row.status)
|
||||
}}</span>
|
||||
<div v-if="props.row.evaso" class="ordstat">
|
||||
{{ tools.getstrDateTime(props.row.date_evaso) }}:
|
||||
<span class="ordstat">{{ $t('ecomm.spedito') }}</span>
|
||||
</div>
|
||||
<div v-if="props.row.consegnato" class="ordstat">
|
||||
{{ tools.getstrDateTime(props.row.date_consegnato) }}:
|
||||
<span class="ordstat">{{ $t('ecomm.consegnato') }}</span>
|
||||
</div>
|
||||
<div v-if="props.row.pagato" class="ordstat">
|
||||
{{ tools.getstrDateTime(props.row.date_pagato) }}:
|
||||
<span class="ordstat">{{ $t('ecomm.pagato') }}</span>
|
||||
</div>
|
||||
<div v-if="props.row.spedito">
|
||||
{{ tools.getstrDateTime(props.row.date_spedito) }}:
|
||||
<span class="ordstat">{{ $t('ecomm.spedito') }}</span>
|
||||
</div>
|
||||
<div v-if="props.row.completed">
|
||||
{{ tools.getstrDateTime(props.row.date_completed) }}:
|
||||
<span class="ordstat">{{ $t('ecomm.completed') }}</span>
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td key="comandi" :props="props">
|
||||
<div v-if="tools.isManager()" class="q-pa-sm">
|
||||
<q-btn-dropdown rounded dense label="Azioni">
|
||||
<q-list class="text-primary">
|
||||
<q-item
|
||||
v-for="(cmd, index) of shared_consts.OrderCmdStr"
|
||||
:key="index"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
clickFunz(
|
||||
props.row,
|
||||
shared_consts.OrderStatus.ORDER_CONFIRMED
|
||||
)
|
||||
"
|
||||
@click="clickFunz(props.row, cmd.value)"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="fas fa-list-ol"
|
||||
color="grey"
|
||||
:icon="cmd.icon"
|
||||
:color="cmd.color"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Inviato</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
clickFunz(
|
||||
props.row,
|
||||
shared_consts.OrderStatus.ORDER_CONFIRMED
|
||||
)
|
||||
"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="fas fa-calendar-check"
|
||||
color="secondary"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Confermato</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
clickFunz(props.row, shared_consts.OrderStatus.PAYED)
|
||||
"
|
||||
color="blue"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="money"
|
||||
color="positive"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Pagato</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
clickFunz(
|
||||
props.row,
|
||||
shared_consts.OrderStatus.RECEIVED
|
||||
)
|
||||
"
|
||||
color="blue"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="fas fa-check"
|
||||
color="primary"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Completato</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="
|
||||
clickFunz(
|
||||
props.row,
|
||||
shared_consts.OrderStatus.CANCELED
|
||||
)
|
||||
"
|
||||
color="blue"
|
||||
>
|
||||
<q-item-section avatar>
|
||||
<q-avatar
|
||||
icon="delete"
|
||||
color="negative"
|
||||
text-color="white"
|
||||
/>
|
||||
</q-item-section>
|
||||
<q-item-section>
|
||||
<q-item-label>Cancellato</q-item-label>
|
||||
<q-item-label>{{ cmd.label }}</q-item-label>
|
||||
</q-item-section>
|
||||
</q-item>
|
||||
</q-list>
|
||||
|
||||
Reference in New Issue
Block a user