35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright (c) 2026 Niolla
|
|
* All rights reserved.
|
|
*
|
|
* This source code is proprietary and confidential.
|
|
* Unauthorized copying, modification, distribution, or use
|
|
* of this file, via any medium, is strictly prohibited.
|
|
*/
|
|
|
|
// app/templates/documents/deliveryNote/deliveryNote.template.js
|
|
|
|
const { log } = require("../../../utils/consoleLog.utill");
|
|
|
|
module.exports = async (data) => {
|
|
log("📋 Preparing Delivery Note data for PDF...");
|
|
|
|
const templateData = {
|
|
logoUrl:
|
|
data.logoUrl ||
|
|
"https://res.cloudinary.com/dtthuvvir/image/upload/v1780748661/company_logo_transperent_bg_uullzw.png",
|
|
title: data.title || "DELIVERY NOTE",
|
|
referenceNumber:
|
|
data.referenceNumber || data.reference_no || data.deliveryNoteNumber || data.delivery_note_number || "N/A",
|
|
date: data.date || new Date().toLocaleDateString(),
|
|
billToName: data.billToName || data.bill_to_name || "N/A",
|
|
billToAddress: data.billToAddress || data.bill_to_address || "N/A",
|
|
supplyDate: data.supplyDate || data.supply_date || data.date || new Date().toLocaleDateString(),
|
|
poNumber: data.poNumber || data.po_number || "N/A",
|
|
items: Array.isArray(data.items) ? data.items : [],
|
|
};
|
|
|
|
log("✅ Delivery Note data prepared");
|
|
|
|
return templateData;
|
|
}; |