server-core-module 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -16,6 +16,7 @@ exports.schemaOrder = joi_1.default.object({
|
|
|
16
16
|
name: joi_1.default.string().required(),
|
|
17
17
|
price: joi_1.default.number().min(0).required(),
|
|
18
18
|
quantity: joi_1.default.number().min(1).required(),
|
|
19
|
+
note: joi_1.default.string().optional().allow(''),
|
|
19
20
|
})).required(),
|
|
20
21
|
totalAmount: joi_1.default.number().min(0).required(),
|
|
21
22
|
note: joi_1.default.string().optional(),
|
|
@@ -34,6 +35,7 @@ exports.schemaOrderUpdate = joi_1.default.object({
|
|
|
34
35
|
name: joi_1.default.string().required(),
|
|
35
36
|
price: joi_1.default.number().min(0).required(),
|
|
36
37
|
quantity: joi_1.default.number().min(1).required(),
|
|
38
|
+
note: joi_1.default.string().optional().allow(''),
|
|
37
39
|
})),
|
|
38
40
|
totalAmount: joi_1.default.number().min(0),
|
|
39
41
|
note: joi_1.default.string(),
|
|
@@ -10,11 +10,12 @@ async function sendOrderConfirmation(email, name, items, totalAmount, deliveryFe
|
|
|
10
10
|
console.log("Sending email to:", email);
|
|
11
11
|
try {
|
|
12
12
|
const itemsList = items.map(item => `<tr>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
<td>${item.name}</td>
|
|
14
|
+
<td>${item.quantity}</td>
|
|
15
|
+
<td>₱${item.price}</td>
|
|
16
|
+
<td>₱${item.price * item.quantity}</td>
|
|
17
|
+
<td>${item.note || '-'}</td>
|
|
18
|
+
</tr>`).join("");
|
|
18
19
|
resend.emails.send({
|
|
19
20
|
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
20
21
|
to: email,
|
|
@@ -28,6 +29,7 @@ async function sendOrderConfirmation(email, name, items, totalAmount, deliveryFe
|
|
|
28
29
|
<th>Qty</th>
|
|
29
30
|
<th>Price</th>
|
|
30
31
|
<th>Subtotal</th>
|
|
32
|
+
<th>Note</th>
|
|
31
33
|
</tr>
|
|
32
34
|
${itemsList}
|
|
33
35
|
</table>
|
|
@@ -66,11 +68,12 @@ async function sendOrderStatusUpdate(email, name, status) {
|
|
|
66
68
|
async function sendAdminNotification(name, items, totalAmount, customerEmail, deliveryFee) {
|
|
67
69
|
try {
|
|
68
70
|
const itemsList = items.map(item => `<tr>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
<td>${item.name}</td>
|
|
72
|
+
<td>${item.quantity}</td>
|
|
73
|
+
<td>₱${item.price}</td>
|
|
74
|
+
<td>₱${item.price * item.quantity}</td>
|
|
75
|
+
<td>${item.note || '-'}</td>
|
|
76
|
+
</tr>`).join("");
|
|
74
77
|
resend.emails.send({
|
|
75
78
|
from: "Cesar's Flower Shop 🌸 <noreply@cesarsflowershop.com>",
|
|
76
79
|
to: process.env.ADMIN_EMAIL,
|
|
@@ -85,18 +88,19 @@ async function sendAdminNotification(name, items, totalAmount, customerEmail, de
|
|
|
85
88
|
<th>Qty</th>
|
|
86
89
|
<th>Price</th>
|
|
87
90
|
<th>Subtotal</th>
|
|
91
|
+
<th>Note</th>
|
|
88
92
|
</tr>
|
|
89
93
|
${itemsList}
|
|
90
94
|
<tr>
|
|
91
|
-
<td colspan="
|
|
95
|
+
<td colspan="4"><strong>Items Subtotal</strong></td>
|
|
92
96
|
<td>₱${totalAmount - (deliveryFee || 0)}</td>
|
|
93
97
|
</tr>
|
|
94
98
|
<tr>
|
|
95
|
-
<td colspan="
|
|
99
|
+
<td colspan="4"><strong>Delivery Fee</strong></td>
|
|
96
100
|
<td>₱${deliveryFee || 0}</td>
|
|
97
101
|
</tr>
|
|
98
102
|
<tr>
|
|
99
|
-
<td colspan="
|
|
103
|
+
<td colspan="4"><strong>Total</strong></td>
|
|
100
104
|
<td><strong>₱${totalAmount}</strong></td>
|
|
101
105
|
</tr>
|
|
102
106
|
</table>
|