possibilità di modificare un ordine, e anche i totali

This commit is contained in:
Surya Paolo
2024-01-15 22:19:33 +01:00
parent 8979cd807a
commit c8a4be65c1
25 changed files with 315 additions and 94 deletions

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.22" APP_VERSION="1.0.23"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.22" APP_VERSION="1.0.23"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="17" APP_ID="17"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.22" APP_VERSION="1.0.23"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="17" APP_ID="17"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.22" APP_VERSION="1.0.23"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="1.0.22" APP_VERSION="1.0.23"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1066,12 +1066,14 @@ export const shared_consts = {
RECEIVED: 7, RECEIVED: 7,
COMPLETED: 6, COMPLETED: 6,
CANCELED: 10, CANCELED: 10,
PREPARED: 15,
DELETE_REALLY: 20, DELETE_REALLY: 20,
}, },
OrderStat: { OrderStat: {
// IN_CART: { label: 'In Carrello', value: 1 }, //IN_CART // IN_CART: { label: 'In Carrello', value: 1 }, //IN_CART
IN_CORSO: { label: 'In Corso', value: 2, icon: 'fas fa-tasks', color: 'text-black' }, //CHECKOUT_SENT IN_CORSO: { label: 'In Corso', value: 2, icon: 'fas fa-tasks', color: 'text-black' }, //CHECKOUT_SENT
PREPARED: { label: 'Preparati', value: 15, icon: 'fas fa-archive', color: 'text-orange' },
CONFERMATI: { label: 'Confermati', value: 3, icon: 'fas fa-calendar', color: 'text-blue' }, //ORDER_CONFIRMED CONFERMATI: { label: 'Confermati', value: 3, icon: 'fas fa-calendar', color: 'text-blue' }, //ORDER_CONFIRMED
PAGATI: { label: 'Pagati', value: 4, icon: 'money', color: 'text-green' }, //PAYED PAGATI: { label: 'Pagati', value: 4, icon: 'money', color: 'text-green' }, //PAYED
DELIVERED: { label: 'Consegnato', value: 5, icon: 'fas fa-calendar', color: 'text-blue' }, //DELIVERED DELIVERED: { label: 'Consegnato', value: 5, icon: 'fas fa-calendar', color: 'text-blue' }, //DELIVERED
@@ -1081,14 +1083,6 @@ export const shared_consts = {
CANCELLATI: { label: 'Cancellati', value: 10, icon: 'delete', color: 'text-red' }, //CANCELED CANCELLATI: { label: 'Cancellati', value: 10, icon: 'delete', color: 'text-red' }, //CANCELED
}, },
OrderStatusView: [
2,
3,
4,
6,
10,
],
REACTIONS_FIELD: REACTIONS_FIELD:
{ {
numseen: 1, numseen: 1,
@@ -1110,6 +1104,10 @@ export const shared_consts = {
label: 'Ordine in Lavorazione', label: 'Ordine in Lavorazione',
value: 2, value: 2,
}, },
{
label: 'Preparato',
value: 15,
},
{ {
label: 'Ordine Confermato', label: 'Ordine Confermato',
value: 3, value: 3,
@@ -1149,23 +1147,29 @@ export const shared_consts = {
color: 'secondary', color: 'secondary',
}, },
{ {
label: 'Conferma Ordine Evaso (e aggiorna Qta in Stock)', //ORDER_CONFIRMED label: '📩 Conferma Ordine Evaso (e aggiorna Qta in Stock)', //ORDER_CONFIRMED
value: 3, value: 3,
icon: 'fas fa-calendar-check', icon: 'fas fa-calendar-check',
color: 'primary', color: 'primary',
}, },
{
label: '📩 Imposta come Consegnato', //DELIVERED
value: 5,
icon: 'fas fa-shipping-fast',
color: 'blue',
},
{
label: 'Imposta come Preparato', //PREPARED
value: 15,
icon: 'fas fa-archive',
color: 'blue',
},
{ {
label: 'Imposta come Pagato', //PAYED label: 'Imposta come Pagato', //PAYED
value: 4, value: 4,
icon: 'money', icon: 'money',
color: 'positive', color: 'positive',
}, },
{
label: 'Imposta come Consegnato', //DELIVERED
value: 5,
icon: 'fas fa-shipping-fast',
color: 'blue',
},
{ {
label: 'Imposta come Spedito', //DELIVERED label: 'Imposta come Spedito', //DELIVERED
value: 5, value: 5,

View File

@@ -230,7 +230,7 @@ export default defineComponent({
if (myprod && myprod.active) { if (myprod && myprod.active) {
let myorder: IOrder = { let myorder: IOrder = {
quantity: 1, quantitypreordered: 0, quantity: 1, quantitypreordered: 0,
TotalPriceProduct: 0, price: 0, TotalPriceProduct: 0, TotalPriceProductCalc: 0, price: 0,
idStorehouse: getActualIdStorehouse(myprod), idStorehouse: getActualIdStorehouse(myprod),
idGasordine: getActualGasordine(myprod), idGasordine: getActualGasordine(myprod),
} }

View File

@@ -130,10 +130,10 @@ export default defineComponent({
async function mounted() { async function mounted() {
console.log(' ## INIZIO MOUNT ') // console.log(' ## INIZIO MOUNT ')
username.value = userStore.my.username username.value = userStore.my.username
await loadCircuits() await loadCircuits()
console.log(' -- FINE MOUNT ') // console.log(' -- FINE MOUNT ')
} }
function updateValue(val: number) { function updateValue(val: number) {

View File

@@ -1,4 +1,4 @@
import { defineComponent, onMounted, ref, computed } from 'vue' import { defineComponent, onMounted, ref, computed, watch } from 'vue'
import { tools } from '@store/Modules/tools' import { tools } from '@store/Modules/tools'
import { useUserStore } from '@store/UserStore' import { useUserStore } from '@store/UserStore'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
@@ -15,6 +15,7 @@ import { shared_consts } from '@src/common/shared_vuejs'
import { CSingleCart } from '../CSingleCart' import { CSingleCart } from '../CSingleCart'
import { CTitleBanner } from '@components' import { CTitleBanner } from '@components'
export default defineComponent({ export default defineComponent({
name: 'COrdersCart', name: 'COrdersCart',
props: { props: {
@@ -46,6 +47,17 @@ export default defineComponent({
const recOrderCart = ref(<IOrderCart>{}) const recOrderCart = ref(<IOrderCart>{})
const search = ref('') const search = ref('')
const editOn = ref(false)
const allTotalPrice = ref(<number | undefined>undefined);
watch(allTotalPrice, (newValue: any) => {
if (!newValue)
recOrderCart.value.totalPrice = 0
else
recOrderCart.value.totalPrice = parseFloat(newValue);
});
const statusnow = computed(() => (): number => { const statusnow = computed(() => (): number => {
if (recOrderCart.value) { if (recOrderCart.value) {
@@ -57,6 +69,8 @@ export default defineComponent({
function mounted() { function mounted() {
// Inizializza // Inizializza
load() load()
allTotalPrice.value = recOrderCart.value.totalPrice
} }
function getItems(): IBaseOrder[] | [] { function getItems(): IBaseOrder[] | [] {
@@ -93,6 +107,14 @@ export default defineComponent({
} }
} }
function myTotalPriceCalc(): string {
if (recOrderCart.value) {
return recOrderCart.value.totalPriceCalc ? recOrderCart.value.totalPriceCalc.toFixed(2) : ''
} else {
return '0'
}
}
function myTotalQty(): number { function myTotalQty(): number {
if (recOrderCart.value) { if (recOrderCart.value) {
return recOrderCart.value.totalQty return recOrderCart.value.totalQty
@@ -108,6 +130,7 @@ export default defineComponent({
oldrec.value = myrec.value oldrec.value = myrec.value
note.value = recOrderCart.value.note! note.value = recOrderCart.value.note!
} }
allTotalPrice.value = recOrderCart.value.totalPrice
endload.value = true endload.value = true
} }
@@ -172,7 +195,7 @@ export default defineComponent({
if (myprod && myprod.active) { if (myprod && myprod.active) {
let myorder: IOrder = { let myorder: IOrder = {
quantity: 1, quantitypreordered: 0, quantity: 1, quantitypreordered: 0,
TotalPriceProduct: 0, price: 0, TotalPriceProduct: 0, TotalPriceProductCalc: 0, price: 0,
idStorehouse: getActualIdStorehouse(myprod), idStorehouse: getActualIdStorehouse(myprod),
idGasordine: getActualGasordine(myprod), idGasordine: getActualGasordine(myprod),
} }
@@ -182,8 +205,9 @@ export default defineComponent({
} }
} }
function updateOrdersCart(paramstoupdate: any) { async function updateOrdersCart(paramstoupdate: any) {
productStore.updateOrdersCartById(props.idOrdersCart, paramstoupdate) await productStore.updateOrdersCartById(props.idOrdersCart, paramstoupdate)
} }
function ordersUpdated() { function ordersUpdated() {
@@ -191,6 +215,17 @@ export default defineComponent({
load() load()
} }
function changeTotalPrice() {
change_field('totalPrice')
}
function updateTotalPrice() {
updateOrdersCart({totalPrice: allTotalPrice.value})
}
onMounted(mounted) onMounted(mounted)
@@ -214,6 +249,11 @@ export default defineComponent({
updateOrdersCart, updateOrdersCart,
ordersUpdated, ordersUpdated,
t, t,
editOn,
allTotalPrice,
changeTotalPrice,
updateTotalPrice,
myTotalPriceCalc,
} }
} }
}) })

View File

@@ -2,6 +2,15 @@
<q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" /> <q-spinner v-if="!endload" color="primary" size="3em" :thickness="2" />
<div v-if="endload && recOrderCart.numorder > 0"> <div v-if="endload && recOrderCart.numorder > 0">
<div v-if="recOrderCart" class="panel"> <div v-if="recOrderCart" class="panel">
<q-toggle
v-if="tools.isManager()"
v-model="editOn"
class="absolute-top-left"
color="green"
icon="fas fa-pencil-alt"
dense
>
</q-toggle>
<div class="numorder"> <div class="numorder">
{{ t('orderscart.numero_ordine') }}: {{ recOrderCart.numorder }} {{ t('orderscart.numero_ordine') }}: {{ recOrderCart.numorder }}
</div> </div>
@@ -26,17 +35,51 @@
:order="itemorder.order" :order="itemorder.order"
:showall="false" :showall="false"
:idOrdersCart="recOrderCart._id" :idOrdersCart="recOrderCart._id"
:editmode="tools.isManager()" :editmode="editOn"
:nomodif="true" :nomodif="true"
@update="ordersUpdated()" @update="ordersUpdated()"
/> />
</div> </div>
</div> </div>
<q-separator></q-separator> <q-separator></q-separator>
<div
v-if="myTotalPriceCalc() !== myTotalPrice() && myTotalPriceCalc() !== ''"
class="col-6 q-mr-sm"
style="text-align: right"
>
<span class="text-grey q-mr-xs">{{ t('ecomm.calcolato') }}:</span>
<span class="text-subtitle1 q-mr-sm"
> {{ myTotalPriceCalc() }}</span
>
</div>
<div class="col-6 q-mr-sm" style="text-align: right"> <div class="col-6 q-mr-sm" style="text-align: right">
<span class="text-grey q-mr-xs">{{ t('ecomm.totale') }}:</span> <span class="text-grey q-mr-xs">{{ t('ecomm.totale') }}:</span>
<span class="text-subtitle1 q-mr-sm"> {{ myTotalPrice() }}</span> <span class="text-subtitle1 q-mr-sm"> {{ myTotalPrice() }}</span>
</div> </div>
<div>
<q-input
v-if="editOn && getNumItems() > 0"
v-model="allTotalPrice"
:label="t('ecomm.totalPrice')"
filled
dense
debounce="1000"
@change="changeTotalPrice"
>
</q-input>
<q-btn
v-if="editOn"
outline
rounded
dense
color="green"
icon="fas fa-redo"
:label="t('orderscart.update_TotalPrice')"
@click="updateTotalPrice"
>
</q-btn>
</div>
<q-input <q-input
v-if="tools.isManager() && getNumItems() > 0" v-if="tools.isManager() && getNumItems() > 0"

View File

@@ -3,11 +3,12 @@ import { CCardState } from '../CCardState'
import { CCopyBtn } from '../CCopyBtn' import { CCopyBtn } from '../CCopyBtn'
import { IOperators, IOrder, IProduct } from '@src/model' import { IOperators, IOrder, IProduct } from '@src/model'
import { defineComponent, PropType, toRef } from 'vue' import { defineComponent, PropType, toRef, ref, watch, onMounted } from 'vue'
import { CTitleBanner } from '@src/components/CTitleBanner' import { CTitleBanner } from '@src/components/CTitleBanner'
import { useProducts } from '@store/Products' import { useProducts } from '@store/Products'
import { useI18n } from '@src/boot/i18n' import { useI18n } from '@src/boot/i18n'
import { useQuasar } from 'quasar' import { useQuasar } from 'quasar'
import { loadRouteLocation } from 'vue-router'
export default defineComponent({ export default defineComponent({
name: 'CSingleCart', name: 'CSingleCart',
@@ -45,6 +46,47 @@ export default defineComponent({
const $q = useQuasar() const $q = useQuasar()
const orderQuantity = ref(<number | undefined>undefined);
const orderQuantityPreordered = ref(<number | undefined>undefined);
const orderTotalPriceProduct = ref(<number | undefined>undefined);
const enableQty = ref(false)
const endload = ref(false)
const enableQtyPreordered = ref(false)
const enableChangeTotalPrice = ref(false)
watch(orderQuantity, (newValue: any) => {
if (!newValue)
order.value.quantity = 0
else
order.value.quantity = parseFloat(newValue);
enableChangeTotalPrice.value = false
});
watch(orderQuantityPreordered, (newValue: any) => {
if (!newValue)
order.value.quantitypreordered = 0
else
order.value.quantitypreordered = parseFloat(newValue);
enableChangeTotalPrice.value = false
});
watch(orderTotalPriceProduct, (newValue: any) => {
if (!newValue)
order.value.TotalPriceProduct = 0
else
order.value.TotalPriceProduct = parseFloat(newValue);
});
watch(() => props.order.TotalPriceProduct, (newValue: any) => {
if (!newValue)
orderTotalPriceProduct.value = 0
else
orderTotalPriceProduct.value = parseFloat(newValue);
});
function myimgclass() { function myimgclass() {
if (props.showall) { if (props.showall) {
return 'imgNormal' return 'imgNormal'
@@ -102,23 +144,46 @@ export default defineComponent({
} }
function removeFromCard() { function removeFromCard() {
if (props.idOrdersCart) {
//
} else {
products.removeFromCart({ order: order.value }) products.removeFromCart({ order: order.value })
}
} }
async function updateOrder(paramstoupdate: any) { async function updateOrder(paramstoupdate: any) {
await products.updateOrderByOrder(props.idOrdersCart, order.value._id, paramstoupdate) endload.value = false
if (enableChangeTotalPrice.value) {
paramstoupdate = { ...paramstoupdate, TotalPriceProduct: order.value.TotalPriceProduct }
}
const myOrdersCart = await products.updateOrderByOrder(props.idOrdersCart, order.value._id, paramstoupdate)
emit('update') emit('update')
mounted()
} }
function getRisparmio(): string { function getRisparmio(): string {
return ((order.value.product!.price * order.value.quantity) - order.value.TotalPriceProduct).toFixed(2) return ((order.value.product!.price * order.value.quantity) - order.value.TotalPriceProduct).toFixed(2)
} }
function mounted() {
endload.value = false
if (props.order.quantity !== 0) {
orderQuantity.value = props.order.quantity
enableQty.value = true
}
if (props.order.quantitypreordered !== 0) {
orderQuantityPreordered.value = props.order.quantitypreordered
enableQtyPreordered.value = true
}
orderTotalPriceProduct.value = props.order.TotalPriceProduct
endload.value = true
}
function changeTotalPrice() {
console.log('changeTotalPrice')
enableChangeTotalPrice.value = true
}
onMounted(mounted)
return { return {
myimgclass, myimgclass,
addsubqty, addsubqty,
@@ -129,6 +194,13 @@ export default defineComponent({
products, products,
t, t,
updateOrder, updateOrder,
orderQuantity,
orderQuantityPreordered,
enableQty,
enableQtyPreordered,
changeTotalPrice,
orderTotalPriceProduct,
endload,
} }
}, },
}) })

View File

@@ -24,7 +24,13 @@
v-if="order.product.productInfo.unit" v-if="order.product.productInfo.unit"
> >
{{ tools.getWeightTotalByOrder(order) }} {{ tools.getWeightTotalByOrder(order) }}
{{ tools.getUnitsMeasure(order.product.productInfo.unit, true, order.product.productInfo.weight) }} {{
tools.getUnitsMeasure(
order.product.productInfo.unit,
true,
order.product.productInfo.weight
)
}}
</div> </div>
<div class="row q-mb-xs no-wrap items-center centeritems"> <div class="row q-mb-xs no-wrap items-center centeritems">
<q-btn <q-btn
@@ -43,7 +49,8 @@
></q-btn> ></q-btn>
<div v-if="editmode"> <div v-if="editmode">
<q-input <q-input
v-model="order.quantity" v-if="enableQty"
v-model="orderQuantity"
autofocus autofocus
debounce="500" debounce="500"
borderless borderless
@@ -52,16 +59,28 @@
:label="t('products.quantity')" :label="t('products.quantity')"
></q-input> ></q-input>
<q-input <q-input
v-model="order.quantitypreordered" v-if="enableQtyPreordered"
v-model="orderQuantityPreordered"
autofocus
debounce="500"
borderless
rounded
densep
:label="t('ecomm.preord')"
></q-input>
</div>
<div v-if="editmode">
<q-input
v-model="orderTotalPriceProduct"
autofocus autofocus
debounce="500" debounce="500"
borderless borderless
rounded rounded
dense dense
:label="t('ecomm.preord')" @change="changeTotalPrice"
:label="t('orderscart.TotalPriceProduct')"
></q-input> ></q-input>
</div>
<div v-if="tools.isManager">
<q-btn <q-btn
outline outline
rounded rounded
@@ -69,7 +88,12 @@
color="green" color="green"
icon="fas fa-redo" icon="fas fa-redo"
:label="t('orderscart.update_order')" :label="t('orderscart.update_order')"
@click="updateOrder({quantitypreordered: order.quantitypreordered, quantity: order.quantity})" @click="
updateOrder({
quantitypreordered: order.quantitypreordered,
quantity: order.quantity,
})
"
> >
</q-btn> </q-btn>
</div> </div>
@@ -108,30 +132,40 @@
: 0 : 0
}} }}
</span> </span>
<span v-if="tools.isManager() && order.TotalPriceProduct !== order.TotalPriceProductCalc"
:class="isApplicatoSconto() ? 'ordine_scontato_nuovo' : ''">
(Calc:
{{
order.TotalPriceProductCalc
? order.TotalPriceProductCalc.toFixed(2)
: 0
}})
</span>
<span v-if="isApplicatoSconto()"> <span v-if="isApplicatoSconto()">
&nbsp;<span class="ordine_scontato" &nbsp;<span class="ordine_scontato"
>(<span class="barrato" >(<span class="barrato"
> >
{{ {{
( (
order.price * order.quantity + (order.price * order.quantity) +
order.price * order.quantitypreordered (order.price * order.quantitypreordered)
).toFixed(2) ).toFixed(2)
}}</span }}</span
>)</span >)</span
>&nbsp; >&nbsp;
</span> </span>
<span v-if="isApplicatoSconto()" class="ordine_scritta_sconto">{{ <span v-if="isApplicatoSconto() && !editmode" class="ordine_scritta_sconto">{{
$t('ecomm.sconto_applicato', { risparmio: getRisparmio() }) $t('ecomm.sconto_applicato', { risparmio: getRisparmio() })
}}</span> }}</span>
</div> </div>
</q-item-label> </q-item-label>
</q-item-section> </q-item-section>
<q-item-section side top> <q-item-section side>
<q-item-label> <q-item-label>
<div class="col-1"> <div class="col-2">
<q-btn <q-btn
v-if="!nomodif && editmode" v-if="!nomodif"
icon="fas fa-trash" icon="fas fa-trash"
color="negative" color="negative"
round round

View File

@@ -222,7 +222,7 @@ export default defineComponent({
function setLangAtt(mylang: string) { function setLangAtt(mylang: string) {
console.log('LANG =', mylang) // console.log('LANG =', mylang)
// console.log('PRIMA $q.lang.isoName', $q.lang.isoName) // console.log('PRIMA $q.lang.isoName', $q.lang.isoName)
// dynamic import, so loading on demand only // dynamic import, so loading on demand only

View File

@@ -77,6 +77,7 @@ export interface IOrder {
idStorehouse?: string idStorehouse?: string
idGasordine?: string idGasordine?: string
TotalPriceProduct: number TotalPriceProduct: number
TotalPriceProductCalc: number
price: number price: number
after_price?: string after_price?: string
quantity: number quantity: number
@@ -227,6 +228,7 @@ export interface IOrderCart {
user: IUserFields | null, user: IUserFields | null,
totalQty: number totalQty: number
totalPrice: number totalPrice: number
totalPriceCalc: number
department?: string department?: string
items?: IBaseOrder[] items?: IBaseOrder[]
nameSurname?: string nameSurname?: string

View File

@@ -1388,7 +1388,7 @@ const msg_it = {
ask: 'Entra nel Circuito', ask: 'Entra nel Circuito',
ask_italia: 'Apri Circuito RIS Italia', ask_italia: 'Apri Circuito RIS Italia',
exit: 'Esci dal Circuito', exit: 'Esci dal Circuito',
accept: 'Accetta la Fiducia Concessa', accept: 'Abilita Fiducia',
add_to_circuit: 'Aggiungi al Circuito', add_to_circuit: 'Aggiungi al Circuito',
exit_circuit: 'Esci dal Circuito', exit_circuit: 'Esci dal Circuito',
domanda_cancel_req: 'Annullare la richiesta d\'invito di {username} al {circuitname}?', domanda_cancel_req: 'Annullare la richiesta d\'invito di {username} al {circuitname}?',
@@ -1696,6 +1696,7 @@ const msg_it = {
carrello_vuoto: 'Il Carrello è Vuoto', carrello_vuoto: 'Il Carrello è Vuoto',
note: 'Scrivi qui per eventuali note o chiarimenti:', note: 'Scrivi qui per eventuali note o chiarimenti:',
totale: 'Totale', totale: 'Totale',
calcolato: 'Calcolato',
carrello: 'Carrello', carrello: 'Carrello',
settings: 'Impostazioni', settings: 'Impostazioni',
qta_in_attesa: '(Ordinati In attesa {qty})', qta_in_attesa: '(Ordinati In attesa {qty})',
@@ -1741,6 +1742,8 @@ const msg_it = {
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',
TotalPriceProduct: 'Prezzo Totale',
}, },
cash: { cash: {
creatorUserId: 'Creatore', creatorUserId: 'Creatore',

View File

@@ -5,7 +5,7 @@ import { Api } from '@api'
import * as Types from '@src/store/Api/ApiTypes' import * as Types from '@src/store/Api/ApiTypes'
async function sendRequest(url: string, method: string, mydata: any) { async function sendRequest(url: string, method: string, mydata: any) {
if (process.env.DEBUG) console.log('sendRequest', method, url) // if (process.env.DEBUG) console.log('sendRequest', method, url)
let request let request
if (method === 'GET') request = Api.get(url, mydata) if (method === 'GET') request = Api.get(url, mydata)

View File

@@ -357,6 +357,8 @@ export const getcolorderscart = [
AddCol({ name: 'date_confermato', label_trans: 'order.date_confermato', fieldtype: costanti.FieldType.date }), AddCol({ name: 'date_confermato', label_trans: 'order.date_confermato', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'consegnato', label_trans: 'order.consegnato', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'consegnato', label_trans: 'order.consegnato', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'date_consegnato', label_trans: 'order.date_consegnato', fieldtype: costanti.FieldType.date }), AddCol({ name: 'date_consegnato', label_trans: 'order.date_consegnato', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'preparato', label_trans: 'order.preparato', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'date_preparato', label_trans: 'order.date_preparato', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'pagato', label_trans: 'order.pagato', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'pagato', label_trans: 'order.pagato', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'date_pagato', label_trans: 'order.date_pagato', fieldtype: costanti.FieldType.date }), AddCol({ name: 'date_pagato', label_trans: 'order.date_pagato', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'spedito', label_trans: 'order.spedito', fieldtype: costanti.FieldType.boolean }), AddCol({ name: 'spedito', label_trans: 'order.spedito', fieldtype: costanti.FieldType.boolean }),

View File

@@ -3864,19 +3864,19 @@ export const tools = {
}, },
setLangAtt($q: any, $router: Router, mylang: string) { setLangAtt($q: any, $router: Router, mylang: string) {
console.log('setLangAtt =', mylang) // console.log('setLangAtt =', mylang)
// console.log('PRIMA this.$q.lang.isoName', this.$q.lang.isoName) // console.log('PRIMA this.$q.lang.isoName', this.$q.lang.isoName)
const globalStore = useGlobalStore() const globalStore = useGlobalStore()
// dynamic import, so loading on demand only // dynamic import, so loading on demand only
import(`quasar/lang/${this.getlangforQuasar(mylang)}`).then((lang) => { import(`quasar/lang/${this.getlangforQuasar(mylang)}`).then((lang) => {
console.log(' Import dinamically lang =', lang) // console.log(' Import dinamically lang =', lang)
if ($q.lang) if ($q.lang)
$q.lang.set(this.getlangforQuasar(lang.default.isoName)) $q.lang.set(this.getlangforQuasar(lang.default.isoName))
import('../../statics/i18n').then(() => { import('../../statics/i18n').then(() => {
console.log(' *** MY LANG DOPO=', $q.lang.isoName) // console.log(' *** MY LANG DOPO=', $q.lang.isoName)
}) })
}) })

View File

@@ -143,16 +143,16 @@ export const toolsext = {
setLangAtt($q: any, $router: Router, mylang: string) { setLangAtt($q: any, $router: Router, mylang: string) {
const globalStore = useGlobalStore() const globalStore = useGlobalStore()
console.log('setLangAtt =', mylang) // console.log('setLangAtt =', mylang)
// console.log('PRIMA this.$q.lang.isoName', this.$q.lang.isoName) // console.log('PRIMA this.$q.lang.isoName', this.$q.lang.isoName)
// dynamic import, so loading on demand only // dynamic import, so loading on demand only
import(`quasar/lang/${this.getlangforQuasar(mylang)}`).then((lang) => { import(`quasar/lang/${this.getlangforQuasar(mylang)}`).then((lang) => {
console.log(' Import dinamically lang =', lang) // console.log(' Import dinamically lang =', lang)
$q.lang.set(this.getlangforQuasar(lang.default.isoName)) $q.lang.set(this.getlangforQuasar(lang.default.isoName))
import('../../statics/i18n').then(() => { import('../../statics/i18n').then(() => {
console.log(' *** MY LANG DOPO=', $q.lang.isoName) // console.log(' *** MY LANG DOPO=', $q.lang.isoName)
}) })
}) })

View File

@@ -22,6 +22,7 @@ function getRecordOrdersCartEmpty(): IOrderCart {
user: null, user: null,
totalQty: 0, totalQty: 0,
totalPrice: 0, totalPrice: 0,
totalPriceCalc: 0,
status: 0, status: 0,
confermato: false, confermato: false,
consegnato: false, consegnato: false,
@@ -198,6 +199,9 @@ export const useProducts = defineStore('Products', {
if (tipoord === shared_consts.OrderStat.IN_CORSO.value) if (tipoord === shared_consts.OrderStat.IN_CORSO.value)
return state.orders.filter((rec: IOrderCart) => ((rec.status ? rec.status : 0) <= shared_consts.OrderStatus.CHECKOUT_SENT) return state.orders.filter((rec: IOrderCart) => ((rec.status ? rec.status : 0) <= shared_consts.OrderStatus.CHECKOUT_SENT)
&& (hasGasordine ? rec.items?.some(item => item.order.idGasordine) : true)) && (hasGasordine ? rec.items?.some(item => item.order.idGasordine) : true))
else if (tipoord === shared_consts.OrderStat.PREPARED.value)
return state.orders.filter((rec: IOrderCart) => (rec.status === shared_consts.OrderStatus.PREPARED)
&& (hasGasordine ? rec.items?.some(item => item.order.idGasordine) : true))
else if (tipoord === shared_consts.OrderStat.CONFERMATI.value) else if (tipoord === shared_consts.OrderStat.CONFERMATI.value)
return state.orders.filter((rec: IOrderCart) => (rec.status === shared_consts.OrderStatus.ORDER_CONFIRMED) return state.orders.filter((rec: IOrderCart) => (rec.status === shared_consts.OrderStatus.ORDER_CONFIRMED)
&& (hasGasordine ? rec.items?.some(item => item.order.idGasordine) : true)) && (hasGasordine ? rec.items?.some(item => item.order.idGasordine) : true))
@@ -356,6 +360,7 @@ export const useProducts = defineStore('Products', {
idapp: process.env.APP_ID, idapp: process.env.APP_ID,
status: shared_consts.OrderStatus.IN_CART, status: shared_consts.OrderStatus.IN_CART,
TotalPriceProduct: 0, TotalPriceProduct: 0,
TotalPriceProductCalc: 0,
idProduct: product._id, idProduct: product._id,
product, // Copia tutto l'oggetto Product ! product, // Copia tutto l'oggetto Product !
@@ -396,7 +401,7 @@ export const useProducts = defineStore('Products', {
if (!globalStore.site.confpages.enableEcommerce) if (!globalStore.site.confpages.enableEcommerce)
return null return null
console.log('getProducts', 'userid=', userStore.my._id) // console.log('getProducts', 'userid=', userStore.my._id)
// if (userStore.my._id === '') { // if (userStore.my._id === '') {
// return new Types.AxiosError(0, null, 0, '') // return new Types.AxiosError(0, null, 0, '')
@@ -407,7 +412,7 @@ export const useProducts = defineStore('Products', {
ris = await Api.SendReq('/products', 'POST', { userId: userStore.my._id }) ris = await Api.SendReq('/products', 'POST', { userId: userStore.my._id })
.then((res) => { .then((res) => {
if (res.data.products) { if (res.data.products) {
console.log('aggiorna prodotti') // console.log('aggiorna prodotti')
this.products = [] this.products = []
this.products = res.data.products this.products = res.data.products
} else { } else {
@@ -551,7 +556,7 @@ export const useProducts = defineStore('Products', {
async loadOrders() { async loadOrders() {
console.log('loadOrders') // console.log('loadOrders')
const userStore = useUserStore() const userStore = useUserStore()
const globalStore = useGlobalStore() const globalStore = useGlobalStore()

View File

@@ -1134,7 +1134,7 @@ export const useUserStore = defineStore('UserStore', {
}, },
setlang($q: any, router: Router, newstr: string) { setlang($q: any, router: Router, newstr: string) {
console.log('SETLANG', newstr) // console.log('SETLANG', newstr)
this.lang = newstr this.lang = newstr
toolsext.setLangAtt($q, router, newstr) toolsext.setLangAtt($q, router, newstr)
toolsext.setLangAtt($q, router, newstr) toolsext.setLangAtt($q, router, newstr)

View File

@@ -488,7 +488,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
addDynamicPages($router: Router | null) { addDynamicPages($router: Router | null) {
// console.log('this.mypage', this.mypage) // console.log('this.mypage', this.mypage)
console.log('addDynamicPages.........') /// console.log('addDynamicPages.........')
const arrpagesroute: IListRoutes[] = [] const arrpagesroute: IListRoutes[] = []
for (const page of this.mypage) { for (const page of this.mypage) {
@@ -907,7 +907,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
}, },
async loadAfterLogin() { async loadAfterLogin() {
console.log('loadAfterLogin') // console.log('loadAfterLogin')
this.clearDataAfterLoginOnlyIfActiveConnection() this.clearDataAfterLoginOnlyIfActiveConnection()
let isok = false let isok = false

View File

@@ -289,6 +289,11 @@
color="negative" color="negative"
@click="EseguiFunz('dropAllCarts')" @click="EseguiFunz('dropAllCarts')"
></q-btn> ></q-btn>
<q-btn
label="CopyPriceToCalc"
color="positive"
@click="EseguiFunz('CopyPriceToCalc')"
></q-btn>
<br /> <br />
</div> </div>

View File

@@ -108,6 +108,14 @@ export default defineComponent({
field: 'apri', field: 'apri',
sortable: false sortable: false
}, },
{
name: 'comandi',
align: 'center',
required: false,
label: 'Comandi',
field: 'comandi',
sortable: false
},
{ {
name: 'numorder', name: 'numorder',
required: true, required: true,
@@ -154,14 +162,6 @@ export default defineComponent({
field: 'status', field: 'status',
sortable: true sortable: true
}, },
{
name: 'comandi',
align: 'center',
required: false,
label: 'Comandi',
field: 'comandi',
sortable: false
}
]) ])
watch(() => cosa.value, (newval, oldval) => { watch(() => cosa.value, (newval, oldval) => {
@@ -197,6 +197,7 @@ export default defineComponent({
status: 0, status: 0,
// Add other properties as needed // Add other properties as needed
totalPrice: orderscart.reduce((total: number, rec: any) => total + rec.totalPrice, 0), totalPrice: orderscart.reduce((total: number, rec: any) => total + rec.totalPrice, 0),
totalPriceCalc: orderscart.reduce((total: number, rec: any) => total + rec.totalPriceCalc, 0),
}; };
let rowsWithTotals: any = [...orderscart]; let rowsWithTotals: any = [...orderscart];
@@ -227,12 +228,14 @@ export default defineComponent({
} }
const allorders = getAllOrdersCart() const allorders = getAllOrdersCart()
for (const status of [2, 3, 4, 5, 6, 7, 8, 10]) { for (const status of [15, 2, 3, 4, 5, 6, 7, 8, 10]) {
arrnumstatus.value[status] = allorders.filter((rec) => (rec.status === status)).reduce((sum, item) => sum + 1, 0) arrnumstatus.value[status] = allorders.filter((rec) => (rec.status === status)).reduce((sum, item) => sum + 1, 0)
} }
selectfirstavailable() selectfirstavailable()
} }
function selectfirstavailable() { function selectfirstavailable() {

View File

@@ -112,6 +112,9 @@
<q-item-label v-else-if="col.name === 'totalPrice'" caption> <q-item-label v-else-if="col.name === 'totalPrice'" caption>
{{ props.row.totalPrice }} € {{ props.row.totalPrice }} €
</q-item-label> </q-item-label>
<q-item-label v-else-if="col.name === 'totalPriceCalc'" caption>
{{ props.row.totalPriceCalc }} €
</q-item-label>
<q-item-label v-else-if="col.name === 'status'" caption> <q-item-label v-else-if="col.name === 'status'" caption>
{{ shared_consts.getStatusStr(props.row.status) }} {{ shared_consts.getStatusStr(props.row.status) }}
</q-item-label> </q-item-label>
@@ -137,14 +140,14 @@
</div> </div>
</q-item-label> </q-item-label>
<q-item-label v-else-if="col.name === 'apri'" caption> <q-item-label v-else-if="col.name === 'apri' && props.row._id" caption>
<div class="q-pa-sm"> <div class="q-pa-sm">
<q-btn <q-btn
size="sm" size="sm"
dense dense
icon="fas fa-filter" icon="fas fa-filter"
:label="t('ecomm.apriordine')" :label="t('ecomm.apriordine')"
:to="`/orderscart/{$idOrdersCart}`" :to="`/orderscart/${props.row._id}`"
></q-btn> ></q-btn>
</div> </div>
</q-item-label> </q-item-label>
@@ -162,6 +165,7 @@
<q-td key="apri" :props="props"> <q-td key="apri" :props="props">
<div class="q-pa-sm"> <div class="q-pa-sm">
<q-btn <q-btn
v-if="props.row._id"
color="primary" color="primary"
size="sm" size="sm"
dense dense
@@ -171,6 +175,23 @@
></q-btn> ></q-btn>
</div> </div>
</q-td> </q-td>
<q-td key="comandi" :props="props">
<div v-if="tools.isManager() && props.row.user.name !== 'TOTALI'" 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, cmd.value)">
<q-item-section avatar>
<q-avatar :icon="cmd.icon" :color="cmd.color" text-color="white" />
</q-item-section>
<q-item-section>
<q-item-label>{{ cmd.label }}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
</q-td>
<q-td key="numorder" :props="props"> <q-td key="numorder" :props="props">
<span v-if="props.row.numorder"> <span v-if="props.row.numorder">
&nbsp; n. {{ props.row.numorder }}</span> &nbsp; n. {{ props.row.numorder }}</span>
@@ -235,6 +256,10 @@
{{ tools.getstrDateTime(props.row.date_consegnato) }}: {{ tools.getstrDateTime(props.row.date_consegnato) }}:
<span class="ordstat">{{ $t('ecomm.consegnato') }}</span> <span class="ordstat">{{ $t('ecomm.consegnato') }}</span>
</div> </div>
<div v-if="props.row.preparato" class="ordstat">
{{ tools.getstrDateTime(props.row.date_preparato) }}:
<span class="ordstat">{{ $t('ecomm.preparato') }}</span>
</div>
<div v-if="props.row.spedito"> <div v-if="props.row.spedito">
{{ tools.getstrDateTime(props.row.date_spedito) }}: {{ tools.getstrDateTime(props.row.date_spedito) }}:
<span class="ordstat">{{ $t('ecomm.spedito') }}</span> <span class="ordstat">{{ $t('ecomm.spedito') }}</span>
@@ -244,23 +269,6 @@
<span class="ordstat">{{ $t('ecomm.ricevuto') }}</span> <span class="ordstat">{{ $t('ecomm.ricevuto') }}</span>
</div> </div>
</q-td> </q-td>
<q-td key="comandi" :props="props">
<div v-if="tools.isManager() && props.row.user.name !== 'TOTALI'" 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, cmd.value)">
<q-item-section avatar>
<q-avatar :icon="cmd.icon" :color="cmd.color" text-color="white" />
</q-item-section>
<q-item-section>
<q-item-label>{{ cmd.label }}</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</div>
</q-td>
</q-tr> </q-tr>
</template> </template>
</q-table> </q-table>