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