- Uscita PRIMA VERSIONE PiuCheBuono.app

This commit is contained in:
Surya Paolo
2023-12-30 21:34:09 +01:00
parent 632d05bbfb
commit a32ba4ec7a
16 changed files with 341 additions and 201 deletions

View File

@@ -352,8 +352,8 @@ export const getcolorderscart = [
AddCol({ name: 'items', label_trans: 'order.items' }),
AddCol({ name: 'userId', label_trans: 'order.users', fieldtype: costanti.FieldType.select, jointable: 'users' }),
AddCol({ name: 'note', label_trans: 'order.note' }),
AddCol({ name: 'evaso', label_trans: 'order.evaso', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'date_evaso', label_trans: 'order.date_evaso', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'confermato', label_trans: 'order.confermato', fieldtype: costanti.FieldType.boolean }),
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: 'date_consegnato', label_trans: 'order.date_consegnato', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'pagato', label_trans: 'order.pagato', fieldtype: costanti.FieldType.boolean }),
@@ -438,8 +438,11 @@ export const colTableStorehouse = [
AddCol({ name: 'email_html_header', label_trans: 'store.email_html_header', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'email_html_footer', label_trans: 'store.email_html_footer', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'email_html_makeorder', label_trans: 'store.email_html_makeorder', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'email_html_GAS_makeorder', label_trans: 'store.email_html_GAS_makeorder', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'email_html_order_confirmed', label_trans: 'store.email_html_order_confirmed', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'email_html_GAS_order_confirmed', label_trans: 'store.email_html_GAS_order_confirmed', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'email_html_order_consegnato', label_trans: 'store.email_html_order_consegnato', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'email_html_GAS_order_consegnato', label_trans: 'store.email_GAS_html_order_consegnato', fieldtype: costanti.FieldType.html }),
AddCol(DeleteRec),
AddCol(DuplicateRec),
]
@@ -2057,8 +2060,8 @@ export const colTableProducts = [
fieldtype: costanti.FieldType.number
}),
AddCol({
name: 'maxBookableQty',
label_trans: 'products.maxBookableQty',
name: 'maxBookableSinglePersQty',
label_trans: 'products.maxBookableSinglePersQty',
fieldtype: costanti.FieldType.number
}),
AddCol({
@@ -2066,21 +2069,43 @@ export const colTableProducts = [
label_trans: 'products.stockQty',
fieldtype: costanti.FieldType.number
}),
AddCol({
name: 'bookableQty',
label_trans: 'products.bookableQty',
fieldtype: costanti.FieldType.number
}),
AddCol({
name: 'stockBloccatiQty',
label_trans: 'products.stockBloccatiQty',
fieldtype: costanti.FieldType.number
}),
AddCol({
name: 'bookableBloccatiQty',
label_trans: 'products.bookableBloccatiQty',
name: 'bookedQtyConfirmed',
label_trans: 'products.bookedQtyConfirmed',
fieldtype: costanti.FieldType.number
}),
AddCol({
name: 'qtyToReachForGas',
label_trans: 'ecomm.qtyToReachForGas',
fieldtype: costanti.FieldType.number
}),
AddCol({
name: 'note',
label_trans: 'ecomm.note',
fieldtype: costanti.FieldType.html
}),
AddCol({
name: 'maxbookableGASQty',
label_trans: 'ecomm.maxbookableGASQty',
fieldtype: costanti.FieldType.number
}),
AddCol({
name: 'bookedGASQtyOrdered',
label_trans: 'ecomm.bookedGASQtyOrdered',
fieldtype: costanti.FieldType.number
}),
AddCol({
name: 'bookableGASBloccatiQty',
label_trans: 'ecomm.bookableGASBloccatiQty',
fieldtype: costanti.FieldType.number
}),
AddCol({ name: 'canBeShipped', label_trans: 'products.canBeShipped', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'canBeBuyOnline', label_trans: 'products.canBeBuyOnline', fieldtype: costanti.FieldType.boolean }),
AddCol(DeleteRec),

View File

@@ -8274,7 +8274,8 @@ export const tools = {
},
convertPriceEurToValue(inputString: string): string {
if (inputString === '')
return '0';
// Rimuovi il simbolo della valuta (€) e sostituisci la virgola con un punto
return inputString.replace(/[^\d.,]/g, '').replace(',', '.');
},
@@ -8316,6 +8317,13 @@ export const tools = {
return (`${strgg} ${this.pad(hours)}:${this.pad(minutes)}:${this.pad(seconds)}`);
},
calcperc(val1: number, valmax: number): number {
if (valmax > 0)
return (val1 / valmax * 100)
else
return 0
}
// FINE !

View File

@@ -32,18 +32,45 @@ function getRecordProductInfoEmpty(): IProductInfo {
}
}
function getRecordProductEmpty() {
return {
active: false,
productInfo: {
img: '', code: '', name: '',
function getRecordProductEmpty(): IProduct {
},
storehouses: [], scontisticas: [],
price: 0, stockQty: 0, bookableQty: 0, gasordines: [],
stockBloccatiQty: 0, bookableBloccatiQty: 0,
idGasordines: [], minBuyQty: 1, maxBookableQty: 0,
const tomorrow = tools.getDateNow()
tomorrow.setDate(tomorrow.getDate() + 1)
return {
productInfo: getRecordProductInfoEmpty(),
// _id: tools.getDateNow().toISOString(), // Create NEW
active: false,
idProducer: '',
idStorehouses: [],
idGasordines: [],
idScontisticas: [],
scontisticas: [],
gasordines: [],
idProvider: '',
producer: {},
storehouses: [],
provider: {},
price: 0.0,
quantityAvailable: 0,
bookableAvailableQty: 0,
minBuyQty: 1,
minStepQty: 1,
maxBookableSinglePersQty: 0,
stockQty: 0,
stockBloccatiQty: 0,
bookedQtyConfirmed: 0,
qtyToReachForGas: 0,
maxbookableGASQty: 0,
bookedGASQtyOrdered: 0,
bookableGASBloccatiQty: 0,
canBeShipped: false,
QuantitaOrdinateInAttesa: 0,
QuantitaPrenotateInAttesa: 0,
canBeBuyOnline: false,
}
}
@@ -283,39 +310,7 @@ export const useProducts = defineStore('Products', {
getRecordEmpty: (state: IProductsState) => (): IProduct => {
const tomorrow = tools.getDateNow()
tomorrow.setDate(tomorrow.getDate() + 1)
return {
productInfo: getRecordProductInfoEmpty(),
// _id: tools.getDateNow().toISOString(), // Create NEW
active: false,
idProducer: '',
idStorehouses: [],
idGasordines: [],
idScontisticas: [],
scontisticas: [],
gasordines: [],
idProvider: '',
producer: {},
storehouses: [],
provider: {},
price: 0.0,
quantityAvailable: 0,
bookableAvailableQty: 0,
stockQty: 0,
stockBloccatiQty: 0,
minBuyQty: 1,
minStepQty: 1,
maxBookableQty: 0,
bookableQty: 0,
bookableBloccatiQty: 0,
canBeShipped: false,
QuantitaOrdinateInAttesa: 0,
QuantitaPrenotateInAttesa: 0,
canBeBuyOnline: false,
}
return getRecordProductEmpty()
},
},
@@ -380,12 +375,15 @@ export const useProducts = defineStore('Products', {
ris = await Api.SendReq('/products', 'POST', { userId: userStore.my._id })
.then((res) => {
if (res.data.products) {
console.log('aggiorna prodotti')
this.products = []
this.products = res.data.products
} else {
this.products = []
}
if (res.data.orders) {
this.orders = []
this.orders = res.data.orders
} else {
this.orders = []
@@ -831,7 +829,7 @@ export const useProducts = defineStore('Products', {
},
getQtyBloccataBookableAvailable(myproduct: IProduct): number {
let qty = myproduct.bookableBloccatiQty
let qty = myproduct.bookableGASBloccatiQty
return qty
},
@@ -844,17 +842,17 @@ export const useProducts = defineStore('Products', {
const globalStore = useGlobalStore()
if (globalStore.site.ecomm && globalStore.site.ecomm.enablePreOrders) {
return (this.getQtyBookableAvailable(myproduct) > 0
&& (myproduct.maxBookableQty === 0
|| (myorder.quantitypreordered + 1 < myproduct.maxBookableQty))
&& (myproduct.maxBookableSinglePersQty === 0
|| (myorder.quantitypreordered + 1 < myproduct.maxBookableSinglePersQty))
)
|| (this.getQtyAvailable(myproduct) > 0)
&& (myproduct.maxBookableQty === 0
|| (myorder.quantity + 1 < myproduct.maxBookableQty))
&& (myproduct.maxBookableSinglePersQty === 0
|| (myorder.quantity + 1 < myproduct.maxBookableSinglePersQty))
} else {
return (this.getQtyAvailable(myproduct) > 0)
&& (myproduct.maxBookableQty === 0
|| (myorder.quantity + 1 < myproduct.maxBookableQty))
&& (myproduct.maxBookableSinglePersQty === 0
|| (myorder.quantity + 1 < myproduct.maxBookableSinglePersQty))
}
},