- aggiunto bottone per Confermare tutti gli ordini
- 1 bottone per Consegnare e Pagare
This commit is contained in:
@@ -38,6 +38,8 @@ export default defineComponent({
|
||||
|
||||
const arrout = ref(<any[]>[])
|
||||
|
||||
const check_send_email = ref(false)
|
||||
|
||||
const initialPagination = ref({
|
||||
sortBy: 'desc',
|
||||
descending: false,
|
||||
@@ -365,40 +367,62 @@ export default defineComponent({
|
||||
title: 'Ordine'
|
||||
}).onOk(async () => {
|
||||
|
||||
statusnow.value = await productStore.UpdateOrderCartStatus({ order_id: order._id, status })
|
||||
statusnow.value = await productStore.UpdateOrderCartStatus({ order_id: order._id, status, sendmail: check_send_email.value })
|
||||
|
||||
if (statusnow.value === status) {
|
||||
order.status = statusnow.value
|
||||
updateorders(true)
|
||||
tools.showPositiveNotif($q, 'Ordine ' + statusStr)
|
||||
}
|
||||
|
||||
// Se l'ordine è stato PAGATO, controllo se è stato consegnato
|
||||
if (status === shared_consts.OrderStatus.DELIVERED) {
|
||||
if (!order.pagato) {
|
||||
clickFunz(order, shared_consts.OrderStatus.PAYED)
|
||||
}
|
||||
}
|
||||
|
||||
// change_field('status')
|
||||
// change_field('status')
|
||||
})
|
||||
}
|
||||
|
||||
async function sendMailToAll() {
|
||||
const orders = getOrdersCartWithTotals()
|
||||
function sendMailToAll() {
|
||||
const orders = arrout.value
|
||||
|
||||
let res = null
|
||||
let inviate = 0
|
||||
|
||||
for (const ord of orders) {
|
||||
res = await productStore.sendMailToTheBuyer(ord._id, templemail.value, false)
|
||||
if (res && res.emailsend)
|
||||
inviate++
|
||||
}
|
||||
$q.dialog({
|
||||
message: 'Inviare la email ' + templemail.value + ' a tutti ?',
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
cancel: {
|
||||
label: t('dialog.cancel')
|
||||
},
|
||||
title: 'Ordine'
|
||||
}).onOk(async () => {
|
||||
|
||||
if (inviate > 0) {
|
||||
tools.showPositiveNotif($q, t('orderscart.email_sent', { inviate }))
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('orderscart.email_not_send'))
|
||||
}
|
||||
|
||||
for (const ord of orders) {
|
||||
res = await productStore.sendMailToTheBuyer(ord._id, templemail.value, false)
|
||||
if (res && res.emailsend)
|
||||
inviate++
|
||||
}
|
||||
|
||||
if (inviate > 0) {
|
||||
tools.showPositiveNotif($q, t('orderscart.email_sent', { inviate }))
|
||||
} else {
|
||||
tools.showNegativeNotif($q, t('orderscart.email_not_send'))
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
async function sendMailTest() {
|
||||
const orders = getOrdersCartWithTotals()
|
||||
const orders = arrout.value
|
||||
|
||||
if (orders && orders.length > 0) {
|
||||
const res = await productStore.sendMailToTheBuyer(orders[0]._id, templemail.value, true)
|
||||
@@ -412,6 +436,36 @@ export default defineComponent({
|
||||
|
||||
}
|
||||
|
||||
async function CambiaStatoaTutti(status: number) {
|
||||
|
||||
for (const order of arrout.value) {
|
||||
statusnow.value = await productStore.UpdateOrderCartStatus({ order_id: order._id, status, sendmail: check_send_email.value })
|
||||
}
|
||||
|
||||
updateorders(true)
|
||||
}
|
||||
|
||||
function ConfermaOrdini() {
|
||||
|
||||
let conemail = 'ed inviare le Email di Conferma'
|
||||
if (!check_send_email.value)
|
||||
conemail = 'senza inviare le Email di Conferma'
|
||||
|
||||
$q.dialog({
|
||||
message: 'Confermare tutti gli Ordini ' + conemail + '?',
|
||||
ok: {
|
||||
label: t('dialog.yes'),
|
||||
push: true
|
||||
},
|
||||
cancel: {
|
||||
label: t('dialog.cancel')
|
||||
},
|
||||
title: 'Ordine'
|
||||
}).onOk(async () => {
|
||||
await CambiaStatoaTutti(shared_consts.OrderStatus.ORDER_CONFIRMED)
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
@@ -441,6 +495,8 @@ export default defineComponent({
|
||||
fieldsTable,
|
||||
storeGasordine,
|
||||
arrout,
|
||||
check_send_email,
|
||||
ConfermaOrdini,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -146,6 +146,19 @@
|
||||
"
|
||||
class="q-pa-sm"
|
||||
>
|
||||
<q-btn
|
||||
v-if="
|
||||
taborders ===
|
||||
shared_consts.OrderStat.CONFERMATI.value
|
||||
"
|
||||
size="sm"
|
||||
dense
|
||||
color="green"
|
||||
icon="fas fa-people-carry"
|
||||
:label="t('ecomm.consegna')"
|
||||
@click="clickFunz(props.row, shared_consts.OrderStat.DELIVERED.value)"
|
||||
></q-btn>
|
||||
|
||||
<q-btn-dropdown rounded dense label="Azioni">
|
||||
<q-list class="text-primary">
|
||||
<q-item
|
||||
@@ -200,7 +213,7 @@
|
||||
<q-tr :props="props">
|
||||
<q-td key="ind" :props="props">
|
||||
<div class="q-pa-sm">
|
||||
{{index}}
|
||||
{{ index }}
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td key="apri" :props="props">
|
||||
@@ -221,6 +234,19 @@
|
||||
v-if="tools.isManager() && props.row.user.name !== 'TOTALI'"
|
||||
class="q-pa-sm"
|
||||
>
|
||||
<q-btn
|
||||
v-if="
|
||||
taborders === shared_consts.OrderStat.CONFERMATI.value
|
||||
"
|
||||
size="sm"
|
||||
dense
|
||||
color="green"
|
||||
icon="fas fa-people-carry"
|
||||
class="q-mx-sm"
|
||||
:label="t('ecomm.consegna')"
|
||||
@click="clickFunz(props.row, shared_consts.OrderStat.DELIVERED.value)"
|
||||
></q-btn>
|
||||
|
||||
<q-btn-dropdown rounded dense label="Azioni">
|
||||
<q-list class="text-primary">
|
||||
<q-item
|
||||
@@ -332,6 +358,34 @@
|
||||
</q-table>
|
||||
</div>
|
||||
|
||||
<!-- Ordini IN CORSO -->
|
||||
<div
|
||||
v-if="
|
||||
tools.isManager() &&
|
||||
taborders === shared_consts.OrderStat.IN_CORSO.value
|
||||
"
|
||||
class="q-ma-sm q-pa-sm row justify-center"
|
||||
>
|
||||
<div>
|
||||
<q-toggle
|
||||
v-if="tools.isManager()"
|
||||
v-model="check_send_email"
|
||||
color="blue"
|
||||
class="row q-mx-md"
|
||||
icon="fas fa-envelope"
|
||||
:label="$t('orderscart.check_invia_email')"
|
||||
>
|
||||
</q-toggle>
|
||||
</div>
|
||||
|
||||
<q-btn
|
||||
color="positive"
|
||||
icon="mail"
|
||||
:label="t('orderscart.order_confirm')"
|
||||
@click="ConfermaOrdini"
|
||||
></q-btn>
|
||||
</div>
|
||||
|
||||
<!-- Emails -->
|
||||
|
||||
<div v-if="tools.isManager()" class="q-ma-sm q-pa-sm row">
|
||||
@@ -366,7 +420,7 @@
|
||||
<q-btn
|
||||
color="positive"
|
||||
icon="mail"
|
||||
:label="t('orderscart.sendmail')"
|
||||
:label="t('orderscart.sendmail', { count: arrout.length })"
|
||||
@click="sendMailToAll"
|
||||
></q-btn>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user