resolve merge conflicts and verify mail functionality
This commit is contained in:
parent
31ba073a3c
commit
7894b656e3
@ -29,15 +29,9 @@ async function sendTestShippingLabelEmail() {
|
|||||||
},
|
},
|
||||||
email: process.env.SMTP_USER,
|
email: process.env.SMTP_USER,
|
||||||
line_items: [
|
line_items: [
|
||||||
<<<<<<< HEAD
|
|
||||||
{ name: 'Flat Bangle 4 Cut - Each Box', quantity: 1, price: '130.00' },
|
|
||||||
{ name: 'Glue Stick pencil - 1 piece', quantity: 3, price: '35.00' },
|
|
||||||
{ name: 'E-8000 - 50ML - 1 Piece', quantity: 2, price: '60.00' }
|
|
||||||
=======
|
|
||||||
{ name: 'Flat Bangle 4 Cut - Each Box', quantity: 1, price: '130.00', image_url: 'https://picsum.photos/200' },
|
{ name: 'Flat Bangle 4 Cut - Each Box', quantity: 1, price: '130.00', image_url: 'https://picsum.photos/200' },
|
||||||
{ name: 'Glue Stick pencil - 1 piece', quantity: 3, price: '35.00', image_url: 'https://picsum.photos/200' },
|
{ name: 'Glue Stick pencil - 1 piece', quantity: 3, price: '35.00', image_url: 'https://picsum.photos/200' },
|
||||||
{ name: 'E-8000 - 50ML - 1 Piece', quantity: 2, price: '60.00', image_url: 'https://picsum.photos/200' }
|
{ name: 'E-8000 - 50ML - 1 Piece', quantity: 2, price: '60.00', image_url: 'https://picsum.photos/200' }
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@ -23,11 +23,7 @@ function drawBarcode(doc, x, y, width, height, text) {
|
|||||||
currentX += lineWidth + spacing;
|
currentX += lineWidth + spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// Barcode number text below bars
|
|
||||||
=======
|
|
||||||
// Barcode number text below bars (with extra vertical gap and letter spacing)
|
// Barcode number text below bars (with extra vertical gap and letter spacing)
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
doc.fontSize(8.5)
|
doc.fontSize(8.5)
|
||||||
.font('Helvetica-Bold')
|
.font('Helvetica-Bold')
|
||||||
.fillColor('#000000')
|
.fillColor('#000000')
|
||||||
@ -74,22 +70,14 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
// --- BACKGROUND ---
|
// --- BACKGROUND ---
|
||||||
doc.rect(0, 0, W, H).fill('#ffffff');
|
doc.rect(0, 0, W, H).fill('#ffffff');
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// --- OUTER BORDER ---
|
|
||||||
=======
|
|
||||||
// --- OUTER BORDER (Thicker, professional frame) ---
|
// --- OUTER BORDER (Thicker, professional frame) ---
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
doc.rect(6, 6, W - 12, H - 12)
|
doc.rect(6, 6, W - 12, H - 12)
|
||||||
.lineWidth(2)
|
.lineWidth(2)
|
||||||
.strokeColor('#1e293b')
|
.strokeColor('#1e293b')
|
||||||
.stroke();
|
.stroke();
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
<<<<<<< HEAD
|
|
||||||
// SECTION 1: HEADER STRIP
|
|
||||||
=======
|
|
||||||
// SECTION 1: HEADER STRIP (FROM shop info)
|
// SECTION 1: HEADER STRIP (FROM shop info)
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
const headerY = 6;
|
const headerY = 6;
|
||||||
const headerH = 58;
|
const headerH = 58;
|
||||||
@ -105,11 +93,7 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
} catch (e) { /* silent fail */ }
|
} catch (e) { /* silent fail */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// Shop name text
|
|
||||||
=======
|
|
||||||
// Shop name text (right side of header)
|
// Shop name text (right side of header)
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
doc.fontSize(12.5)
|
doc.fontSize(12.5)
|
||||||
.font('Helvetica-Bold')
|
.font('Helvetica-Bold')
|
||||||
.fillColor('#ffffff')
|
.fillColor('#ffffff')
|
||||||
@ -122,11 +106,7 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
.text('Madurai 625016, Tamil Nadu, India | Ph: 9994333548', logoLoaded ? 95 : PAD, headerY + 38, { width: W - (logoLoaded ? 111 : PAD * 2) });
|
.text('Madurai 625016, Tamil Nadu, India | Ph: 9994333548', logoLoaded ? 95 : PAD, headerY + 38, { width: W - (logoLoaded ? 111 : PAD * 2) });
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
<<<<<<< HEAD
|
|
||||||
// SECTION 2: ORDER INFO STRIP
|
|
||||||
=======
|
|
||||||
// SECTION 2: ORDER INFO STRIP (Left-Right Aligned)
|
// SECTION 2: ORDER INFO STRIP (Left-Right Aligned)
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
const orderStripY = headerY + headerH;
|
const orderStripY = headerY + headerH;
|
||||||
const orderStripH = 30;
|
const orderStripH = 30;
|
||||||
@ -136,32 +116,20 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
const orderDate = new Date(orderData.created_at || Date.now()).toLocaleDateString('en-GB');
|
const orderDate = new Date(orderData.created_at || Date.now()).toLocaleDateString('en-GB');
|
||||||
const shippingMethod = orderData.shipping_lines?.[0]?.title || 'Standard Courier';
|
const shippingMethod = orderData.shipping_lines?.[0]?.title || 'Standard Courier';
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// Order Number
|
|
||||||
=======
|
|
||||||
// Order Number on Left
|
// Order Number on Left
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
doc.fontSize(9.5)
|
doc.fontSize(9.5)
|
||||||
.font('Helvetica-Bold')
|
.font('Helvetica-Bold')
|
||||||
.fillColor('#0f172a')
|
.fillColor('#0f172a')
|
||||||
.text(`ORDER: #${orderNumber}`, PAD, orderStripY + 10);
|
.text(`ORDER: #${orderNumber}`, PAD, orderStripY + 10);
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// Date | Courier Method
|
|
||||||
=======
|
|
||||||
// Date | Courier Method on Right
|
// Date | Courier Method on Right
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
doc.fontSize(8)
|
doc.fontSize(8)
|
||||||
.font('Helvetica-Bold')
|
.font('Helvetica-Bold')
|
||||||
.fillColor('#475569')
|
.fillColor('#475569')
|
||||||
.text(`${orderDate} | ${shippingMethod}`, PAD, orderStripY + 11, { width: W - PAD * 2, align: 'right' });
|
.text(`${orderDate} | ${shippingMethod}`, PAD, orderStripY + 11, { width: W - PAD * 2, align: 'right' });
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
<<<<<<< HEAD
|
|
||||||
// SECTION 3: SHIP TO SECTION HEADER
|
|
||||||
=======
|
|
||||||
// SECTION 3: SHIP TO SECTION
|
// SECTION 3: SHIP TO SECTION
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
const shipToLabelY = orderStripY + orderStripH;
|
const shipToLabelY = orderStripY + orderStripH;
|
||||||
const shipToLabelH = 18;
|
const shipToLabelH = 18;
|
||||||
@ -173,11 +141,7 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
.text('SHIP TO', PAD, shipToLabelY + 5, { width: W - PAD * 2, align: 'center' });
|
.text('SHIP TO', PAD, shipToLabelY + 5, { width: W - PAD * 2, align: 'center' });
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
<<<<<<< HEAD
|
|
||||||
// SECTION 4: CUSTOMER ADDRESS
|
|
||||||
=======
|
|
||||||
// SECTION 4: CUSTOMER ADDRESS (Clean typesetting)
|
// SECTION 4: CUSTOMER ADDRESS (Clean typesetting)
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
const addressStartY = shipToLabelY + shipToLabelH + 12;
|
const addressStartY = shipToLabelY + shipToLabelH + 12;
|
||||||
const shipping = orderData.shipping_address || orderData.billing_address || {};
|
const shipping = orderData.shipping_address || orderData.billing_address || {};
|
||||||
@ -191,10 +155,7 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
const toZip = shipping.zip || '';
|
const toZip = shipping.zip || '';
|
||||||
const toCountry = shipping.country || 'India';
|
const toCountry = shipping.country || 'India';
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
// Customer Name
|
// Customer Name
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
doc.fontSize(14)
|
doc.fontSize(14)
|
||||||
.font('Helvetica-Bold')
|
.font('Helvetica-Bold')
|
||||||
.fillColor('#0f172a')
|
.fillColor('#0f172a')
|
||||||
@ -202,10 +163,7 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
|
|
||||||
let currentY = addressStartY + 18;
|
let currentY = addressStartY + 18;
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
// Customer Phone (Clean phone icon fallback)
|
// Customer Phone (Clean phone icon fallback)
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
if (toPhone) {
|
if (toPhone) {
|
||||||
doc.fontSize(9.5)
|
doc.fontSize(9.5)
|
||||||
.font('Helvetica-Bold')
|
.font('Helvetica-Bold')
|
||||||
@ -214,10 +172,7 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
currentY += 14;
|
currentY += 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
// Customer Address lines combined with consistent spacing
|
// Customer Address lines combined with consistent spacing
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
const addressParts = [];
|
const addressParts = [];
|
||||||
if (toAddr1) addressParts.push(toAddr1);
|
if (toAddr1) addressParts.push(toAddr1);
|
||||||
if (toAddr2) addressParts.push(toAddr2);
|
if (toAddr2) addressParts.push(toAddr2);
|
||||||
@ -238,17 +193,11 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
.fillColor('#334155')
|
.fillColor('#334155')
|
||||||
.text(addressText, PAD, currentY, { width: W - PAD * 2, lineGap: 3.5 });
|
.text(addressText, PAD, currentY, { width: W - PAD * 2, lineGap: 3.5 });
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
const addressHeight = doc.heightOfString(addressText, { width: W - PAD * 2, lineGap: 3.5 });
|
|
||||||
currentY += addressHeight + 10;
|
|
||||||
|
|
||||||
=======
|
|
||||||
// Calculate height of the address block to dynamically place the separator
|
// Calculate height of the address block to dynamically place the separator
|
||||||
const addressHeight = doc.heightOfString(addressText, { width: W - PAD * 2, lineGap: 3.5 });
|
const addressHeight = doc.heightOfString(addressText, { width: W - PAD * 2, lineGap: 3.5 });
|
||||||
currentY += addressHeight + 10;
|
currentY += addressHeight + 10;
|
||||||
|
|
||||||
// Ensure the separator doesn't overflow if address is short or long
|
// Ensure the separator doesn't overflow if address is short or long
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
const minSeparatorY = 250;
|
const minSeparatorY = 250;
|
||||||
const sepY = Math.max(currentY, minSeparatorY);
|
const sepY = Math.max(currentY, minSeparatorY);
|
||||||
|
|
||||||
@ -262,11 +211,7 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
.stroke();
|
.stroke();
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
<<<<<<< HEAD
|
|
||||||
// SECTION 6: FROM ADDRESS (Return address)
|
|
||||||
=======
|
|
||||||
// SECTION 6: FROM ADDRESS (Ray Aari Shop - Return address)
|
// SECTION 6: FROM ADDRESS (Ray Aari Shop - Return address)
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
const fromY = sepY + 10;
|
const fromY = sepY + 10;
|
||||||
|
|
||||||
@ -291,11 +236,7 @@ const generateShippingLabelPDF = async (orderData) => {
|
|||||||
.text(shopAddressText, PAD, fromY + 24, { width: W - PAD * 2, lineGap: 2 });
|
.text(shopAddressText, PAD, fromY + 24, { width: W - PAD * 2, lineGap: 2 });
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
<<<<<<< HEAD
|
|
||||||
// SECTION 7: BARCODE STRIP
|
|
||||||
=======
|
|
||||||
// SECTION 7: BARCODE STRIP (Locked to Bottom)
|
// SECTION 7: BARCODE STRIP (Locked to Bottom)
|
||||||
>>>>>>> a15558d565f56829553c2991c516ac93d4428ff5
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
const barcodeAreaY = H - 75;
|
const barcodeAreaY = H - 75;
|
||||||
doc.rect(6, barcodeAreaY, W - 12, 1).fill('#cbd5e1');
|
doc.rect(6, barcodeAreaY, W - 12, 1).fill('#cbd5e1');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user