- aggiunto bottone per Confermare tutti gli ordini
- 1 bottone per Consegnare e Pagare
This commit is contained in:
@@ -1730,6 +1730,8 @@ const msg_it = {
|
|||||||
totalPrice: 'Totale',
|
totalPrice: 'Totale',
|
||||||
carrello_utente: 'Carrello dell\'Utente',
|
carrello_utente: 'Carrello dell\'Utente',
|
||||||
tutti: 'Tutti',
|
tutti: 'Tutti',
|
||||||
|
paga: 'Paga',
|
||||||
|
consegna: 'Consegna',
|
||||||
},
|
},
|
||||||
gas: {
|
gas: {
|
||||||
name: 'Ordine Gas',
|
name: 'Ordine Gas',
|
||||||
@@ -1748,13 +1750,15 @@ const msg_it = {
|
|||||||
totalQtyPreordered: 'totalQty PreOrd',
|
totalQtyPreordered: 'totalQty PreOrd',
|
||||||
numero_ordine: 'Numero d\'Ordine',
|
numero_ordine: 'Numero d\'Ordine',
|
||||||
nome: 'Nominativo',
|
nome: 'Nominativo',
|
||||||
sendmail: 'Invia Email a Tutti',
|
sendmail: 'Invia Email a Tutti {count}',
|
||||||
sendmail_test: 'Invia Email TEST',
|
sendmail_test: 'Invia Email TEST',
|
||||||
email_sent: '{inviate} email inviate !',
|
email_sent: '{inviate} email inviate !',
|
||||||
email_not_send: 'Email non inviata',
|
email_not_send: 'Email non inviata',
|
||||||
update_order: 'Aggiorna Ordine',
|
update_order: 'Aggiorna Ordine',
|
||||||
update_TotalPrice: 'Aggiorna Totale',
|
update_TotalPrice: 'Aggiorna Totale',
|
||||||
TotalPriceProduct: 'Prezzo Totale',
|
TotalPriceProduct: 'Prezzo Totale',
|
||||||
|
order_confirm: 'Conferma Ordini (aggiorna Qta magazzino)',
|
||||||
|
check_invia_email: 'Invia le email',
|
||||||
},
|
},
|
||||||
cash: {
|
cash: {
|
||||||
creatorUserId: 'Creatore',
|
creatorUserId: 'Creatore',
|
||||||
|
|||||||
@@ -785,8 +785,10 @@ export const useProducts = defineStore('Products', {
|
|||||||
return ris
|
return ris
|
||||||
},
|
},
|
||||||
|
|
||||||
getOptions() {
|
getOptions(sendmail: boolean) {
|
||||||
return {}
|
return {
|
||||||
|
sendmail
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async CreateOrdersCart({ cart_id, status, note }: { cart_id: string, status: number, note: string }) {
|
async CreateOrdersCart({ cart_id, status, note }: { cart_id: string, status: number, note: string }) {
|
||||||
@@ -802,7 +804,7 @@ export const useProducts = defineStore('Products', {
|
|||||||
|
|
||||||
let ris = null
|
let ris = null
|
||||||
|
|
||||||
ris = await Api.SendReq('/cart/' + this.userActive._id + '/createorderscart', 'POST', { cart_id, status, note, options: this.getOptions() })
|
ris = await Api.SendReq('/cart/' + this.userActive._id + '/createorderscart', 'POST', { cart_id, status, note, options: this.getOptions(true) })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
||||||
if (res.data.status === shared_consts.OrderStatus.CHECKOUT_SENT) {
|
if (res.data.status === shared_consts.OrderStatus.CHECKOUT_SENT) {
|
||||||
@@ -823,7 +825,7 @@ export const useProducts = defineStore('Products', {
|
|||||||
return ris
|
return ris
|
||||||
},
|
},
|
||||||
|
|
||||||
async UpdateStatusCart({ ordercart_id, status }: { ordercart_id: string, status: number }) {
|
/*async UpdateStatusCart({ ordercart_id, status }: { ordercart_id: string, status: number }) {
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore()
|
||||||
@@ -850,11 +852,9 @@ export const useProducts = defineStore('Products', {
|
|||||||
})
|
})
|
||||||
|
|
||||||
return ris
|
return ris
|
||||||
},
|
},*/
|
||||||
|
|
||||||
|
async UpdateOrderCartStatus({ order_id, status, sendmail }: { order_id: string, status: number, sendmail: boolean }) {
|
||||||
|
|
||||||
async UpdateOrderCartStatus({ order_id, status }: { order_id: string, status: number }) {
|
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const globalStore = useGlobalStore()
|
const globalStore = useGlobalStore()
|
||||||
@@ -864,7 +864,7 @@ export const useProducts = defineStore('Products', {
|
|||||||
|
|
||||||
let ris = null
|
let ris = null
|
||||||
|
|
||||||
ris = await Api.SendReq('/cart/' + this.userActive._id + '/ordercartstatus', 'POST', { order_id, status, options: this.getOptions() })
|
ris = await Api.SendReq('/cart/' + this.userActive._id + '/ordercartstatus', 'POST', { order_id, status, options: this.getOptions(sendmail) })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
||||||
this.updateDataProduct(res)
|
this.updateDataProduct(res)
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ export default defineComponent({
|
|||||||
|
|
||||||
const arrout = ref(<any[]>[])
|
const arrout = ref(<any[]>[])
|
||||||
|
|
||||||
|
const check_send_email = ref(false)
|
||||||
|
|
||||||
const initialPagination = ref({
|
const initialPagination = ref({
|
||||||
sortBy: 'desc',
|
sortBy: 'desc',
|
||||||
descending: false,
|
descending: false,
|
||||||
@@ -365,24 +367,45 @@ export default defineComponent({
|
|||||||
title: 'Ordine'
|
title: 'Ordine'
|
||||||
}).onOk(async () => {
|
}).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) {
|
if (statusnow.value === status) {
|
||||||
order.status = statusnow.value
|
order.status = statusnow.value
|
||||||
updateorders(true)
|
updateorders(true)
|
||||||
tools.showPositiveNotif($q, 'Ordine ' + statusStr)
|
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')
|
||||||
// change_field('status')
|
// change_field('status')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendMailToAll() {
|
function sendMailToAll() {
|
||||||
const orders = getOrdersCartWithTotals()
|
const orders = arrout.value
|
||||||
|
|
||||||
let res = null
|
let res = null
|
||||||
let inviate = 0
|
let inviate = 0
|
||||||
|
|
||||||
|
$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 () => {
|
||||||
|
|
||||||
|
|
||||||
for (const ord of orders) {
|
for (const ord of orders) {
|
||||||
res = await productStore.sendMailToTheBuyer(ord._id, templemail.value, false)
|
res = await productStore.sendMailToTheBuyer(ord._id, templemail.value, false)
|
||||||
if (res && res.emailsend)
|
if (res && res.emailsend)
|
||||||
@@ -394,11 +417,12 @@ export default defineComponent({
|
|||||||
} else {
|
} else {
|
||||||
tools.showNegativeNotif($q, t('orderscart.email_not_send'))
|
tools.showNegativeNotif($q, t('orderscart.email_not_send'))
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sendMailTest() {
|
async function sendMailTest() {
|
||||||
const orders = getOrdersCartWithTotals()
|
const orders = arrout.value
|
||||||
|
|
||||||
if (orders && orders.length > 0) {
|
if (orders && orders.length > 0) {
|
||||||
const res = await productStore.sendMailToTheBuyer(orders[0]._id, templemail.value, true)
|
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)
|
onMounted(mounted)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -441,6 +495,8 @@ export default defineComponent({
|
|||||||
fieldsTable,
|
fieldsTable,
|
||||||
storeGasordine,
|
storeGasordine,
|
||||||
arrout,
|
arrout,
|
||||||
|
check_send_email,
|
||||||
|
ConfermaOrdini,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -146,6 +146,19 @@
|
|||||||
"
|
"
|
||||||
class="q-pa-sm"
|
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-btn-dropdown rounded dense label="Azioni">
|
||||||
<q-list class="text-primary">
|
<q-list class="text-primary">
|
||||||
<q-item
|
<q-item
|
||||||
@@ -200,7 +213,7 @@
|
|||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
<q-td key="ind" :props="props">
|
<q-td key="ind" :props="props">
|
||||||
<div class="q-pa-sm">
|
<div class="q-pa-sm">
|
||||||
{{index}}
|
{{ index }}
|
||||||
</div>
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
<q-td key="apri" :props="props">
|
<q-td key="apri" :props="props">
|
||||||
@@ -221,6 +234,19 @@
|
|||||||
v-if="tools.isManager() && props.row.user.name !== 'TOTALI'"
|
v-if="tools.isManager() && props.row.user.name !== 'TOTALI'"
|
||||||
class="q-pa-sm"
|
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-btn-dropdown rounded dense label="Azioni">
|
||||||
<q-list class="text-primary">
|
<q-list class="text-primary">
|
||||||
<q-item
|
<q-item
|
||||||
@@ -332,6 +358,34 @@
|
|||||||
</q-table>
|
</q-table>
|
||||||
</div>
|
</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 -->
|
<!-- Emails -->
|
||||||
|
|
||||||
<div v-if="tools.isManager()" class="q-ma-sm q-pa-sm row">
|
<div v-if="tools.isManager()" class="q-ma-sm q-pa-sm row">
|
||||||
@@ -366,7 +420,7 @@
|
|||||||
<q-btn
|
<q-btn
|
||||||
color="positive"
|
color="positive"
|
||||||
icon="mail"
|
icon="mail"
|
||||||
:label="t('orderscart.sendmail')"
|
:label="t('orderscart.sendmail', { count: arrout.length })"
|
||||||
@click="sendMailToAll"
|
@click="sendMailToAll"
|
||||||
></q-btn>
|
></q-btn>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user