- Aggiornamento template mail (tramite i campi in HTML)
- Aggiornato Carrello
This commit is contained in:
@@ -27,9 +27,12 @@ html
|
||||
p
|
||||
tr
|
||||
td(class="emailContainer", valign="top")
|
||||
|
||||
p Ciao #{username},
|
||||
p Ti confermiamo che hai appena inviato un'ordine di prenotazione dei seguenti prodotti:
|
||||
- var mioheader = orders.storehouse.email_html_header
|
||||
if (mioheader)
|
||||
p!= mioheader
|
||||
else
|
||||
p Ciao #{username},
|
||||
p Ti confermiamo che hai appena inviato un'ordine di prenotazione dei seguenti prodotti:
|
||||
|
||||
tr
|
||||
td(class="whitespace", height="10")
|
||||
@@ -93,9 +96,20 @@ html
|
||||
tr
|
||||
td(class="whitespace", height="10")
|
||||
|
||||
p Ti arriverà una email quando i prodotti saranno disponibili per poterli venire a ritirare.
|
||||
p Il pagamento potrai farlo direttamente in sede.
|
||||
p Grazie Mille
|
||||
tr
|
||||
td
|
||||
- var miomakeorder = orders.storehouse.email_html_makeorder
|
||||
if (miomakeorder)
|
||||
p!= miomakeorder
|
||||
else
|
||||
p Ti arriverà una email quando i prodotti saranno disponibili per poterli venire a ritirare.
|
||||
p Il pagamento, se non diversamente comunicato, potrai farlo direttamente in sede.
|
||||
|
||||
- var miofooter = orders.storehouse.email_html_footer
|
||||
if (miofooter)
|
||||
p!= miofooter
|
||||
else
|
||||
p Grazie Mille
|
||||
|
||||
table.footer(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
|
||||
tr
|
||||
|
||||
@@ -88,15 +88,27 @@ html
|
||||
td(class="sectionContent", valign="top")
|
||||
p Totale: #{TotalPriceProduct} €
|
||||
|
||||
p Note Aggiuntive: #{note}
|
||||
if (note)
|
||||
p Note Aggiuntive: #{note}
|
||||
|
||||
p.sectionContentTitle.boldhigh.sectionTotal Totale Ordine: #{totalPrice} €
|
||||
tr
|
||||
td(class="whitespace", height="10")
|
||||
|
||||
p Puoi pertanto venire a ritirarli direttamente in sede.
|
||||
p Grazie Mille
|
||||
tr
|
||||
td
|
||||
- var miordconfirmed = orders.storehouse.email_html_order_confirmed
|
||||
if (miordconfirmed)
|
||||
p!= miordconfirmed
|
||||
else
|
||||
p Puoi pertanto venire a ritirarli direttamente in sede, negli orari che ti sono stati indicati.
|
||||
|
||||
- var miofooter = orders.storehouse.email_html_footer
|
||||
if (miofooter)
|
||||
p!= miofooter
|
||||
else
|
||||
p Grazie Mille
|
||||
|
||||
table.footer(cellpadding="0", cellspacing="0", width="100%", summary="", border="0", align="center")
|
||||
tr
|
||||
td(class="whitespace", height="10")
|
||||
|
||||
@@ -589,7 +589,9 @@ module.exports.getmsgorderTelegram = async function (ordersCart) {
|
||||
|
||||
msg += '<br>';
|
||||
|
||||
msg += '<br>Totale Prodotti: ' + ordersCart.totalQty + ordersCart.totalQtyPreordered;
|
||||
let totqta = ordersCart.totalQty + ordersCart.totalQtyPreordered;
|
||||
|
||||
msg += '<br>Totale Prodotti: ' + totqta;
|
||||
msg += '<br>Totale Ordine: ' + ordersCart.totalPrice + ' € 💰';
|
||||
|
||||
|
||||
|
||||
@@ -40,15 +40,22 @@ const storehouseSchema = new Schema({
|
||||
website: {
|
||||
type: String,
|
||||
},
|
||||
stockQty: { // in magazzino
|
||||
type: Number,
|
||||
default: 0,
|
||||
email_html_header: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
bookableQty: { // Quantità prenotabili
|
||||
type: Number,
|
||||
default: 0,
|
||||
email_html_footer: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
email_html_makeorder: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
email_html_order_confirmed: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
var Storehouse = module.exports = mongoose.model('Storehouse', storehouseSchema);
|
||||
|
||||
@@ -55,6 +55,17 @@ class Cart {
|
||||
return false;
|
||||
}
|
||||
|
||||
isSameStorehouse(itemorder) {
|
||||
if (this.items.length > 0) {
|
||||
const mystorehouse = this.items[0].order.idStorehouse
|
||||
return (mystorehouse ? mystorehouse._id.toString() === itemorder.idStorehouse : true);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
async addqty(itemorder) {
|
||||
const myitem = this.items.find((rec) => rec.order._id.toString() === itemorder._id)
|
||||
if (!!myitem) {
|
||||
|
||||
@@ -67,6 +67,8 @@ router.post('/import', authenticate, async (req, res) => {
|
||||
link: product.link,
|
||||
idCatProds: [],
|
||||
img: 'upload/products/' + product.code + '.jpg',
|
||||
weight: product.weight,
|
||||
unit: tools.getIdUnitsByText(product.unit),
|
||||
}
|
||||
|
||||
if (product.cat_name) {
|
||||
|
||||
@@ -57,7 +57,7 @@ router.post('/:userId', authenticate, async function (req, res, next) {
|
||||
try {
|
||||
let mycart = await Cart.getCartByUserId(userId, idapp);
|
||||
|
||||
|
||||
|
||||
if (!order) {
|
||||
return res.send({ code: server_constants.RIS_CODE_OK, cart: null });
|
||||
}
|
||||
@@ -85,14 +85,19 @@ router.post('/:userId', authenticate, async function (req, res, next) {
|
||||
let newCart = CartClass.constructByCart(mycart);
|
||||
// order = await Product.updateProductInOrder(order);
|
||||
if (!nuovo) {
|
||||
if (addqty) {
|
||||
myord = await newCart.addqty(order);
|
||||
} else if (subqty) {
|
||||
myord = await newCart.subqty(order);
|
||||
// Controlla se sto inserendo un prodotto con 2 Negozi, non permetterlo !
|
||||
if (newCart.isSameStorehouse(order)) {
|
||||
if (addqty) {
|
||||
myord = await newCart.addqty(order);
|
||||
} else if (subqty) {
|
||||
myord = await newCart.subqty(order);
|
||||
} else {
|
||||
const ind = newCart.addItem(order);
|
||||
const arrord = await Order.getTotalOrderById(order._id);
|
||||
myord = arrord ? arrord[0] : null;
|
||||
}
|
||||
} else {
|
||||
const ind = newCart.addItem(order);
|
||||
const arrord = await Order.getTotalOrderById(order._id);
|
||||
myord = arrord ? arrord[0] : null;
|
||||
return res.send({ code: server_constants.RIS_CODE_ERR, cart: null, myord: null, msgerr: 'Non è possibile acquistare nello stesso ordine, su negozi differenti!' });
|
||||
}
|
||||
} else {
|
||||
await newCart.updatetotals();
|
||||
|
||||
@@ -78,7 +78,7 @@ router.post('/', authenticate, async (req, res) => {
|
||||
if (req.body.options !== null) {
|
||||
tools.sendBackNotif(subscription, req.body.options);
|
||||
}
|
||||
console.log('Subscription saved... ')
|
||||
// console.log('Subscription saved... ')
|
||||
return res.send({data: 'Subscription saved.'});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -824,8 +824,7 @@ module.exports = {
|
||||
headers: vapidHeaders,
|
||||
};
|
||||
|
||||
console.log('************ INVIO WEBPUSH.SENDNOTIFICATION N° ',
|
||||
conta, '/', trovati, 'A', subscription.browser);
|
||||
// console.log('************ INVIO WEBPUSH.SENDNOTIFICATION N° ', conta, '/', trovati, 'A', subscription.browser);
|
||||
|
||||
const pushPayload = JSON.stringify(payload);
|
||||
|
||||
@@ -4368,5 +4367,15 @@ module.exports = {
|
||||
return Object.keys(obj).length === 0;
|
||||
},
|
||||
|
||||
getUnitsMeasure(unit, short) {
|
||||
const unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec) => rec.value === unit)
|
||||
return unitrec ? (short ? unitrec.short : unitrec.label) : ''
|
||||
},
|
||||
|
||||
getIdUnitsByText(unitstr) {
|
||||
const unitrec = shared_consts.Units_Of_Measure_ListBox.find((rec) => rec.short === unitstr)
|
||||
return unitrec ? unitrec.value : 0
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
||||
@@ -348,22 +348,27 @@ module.exports = {
|
||||
Units_Of_Measure_ListBox: [
|
||||
{
|
||||
label: '[Nessuno]',
|
||||
short: '',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: 'Grammi (g)',
|
||||
short: 'g',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: 'Chili (kg)',
|
||||
short: 'Kg',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: 'Litri (l)',
|
||||
label: 'Litri (L)',
|
||||
short: 'L',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: 'Pezzi (p)',
|
||||
short: 'p',
|
||||
value: 4,
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user