UNPKG

@rsc-labs/medusa-documents

Version:
36 lines (35 loc) 1.61 kB
"use strict"; /* * Copyright 2024 RSC-Labs, https://rsoftcon.com/ * * MIT License * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.generateOrderInfoTable = void 0; const hr_1 = require("./hr"); const i18next_1 = require("i18next"); function generateTableRow(doc, y, orderNumber, orderDate, shippingMethod) { doc .fontSize(6) .text(orderNumber, 25, y) .text(orderDate, 80, y) .text(shippingMethod, 90, y, { align: "right", width: 100 }); } function generateOrderInfoTable(doc, y, order, items) { const invoiceTableTop = y + 25; doc.font("Bold"); generateTableRow(doc, invoiceTableTop, (0, i18next_1.t)("packing-slip-table-header-order-number", "Order #"), (0, i18next_1.t)("packing-slip-table-header-order-date", "Order date"), (0, i18next_1.t)("packing-slip-table-header-shipping-method", "Shipping method")); (0, hr_1.generateHrInA7)(doc, invoiceTableTop + 10); doc.font("Regular"); const position = invoiceTableTop + 20; generateTableRow(doc, position, order.display_id, order.created_at.toLocaleDateString(), order.shipping_methods[0].shipping_option.name); (0, hr_1.generateHrInA7)(doc, position + 10); return position + 10; } exports.generateOrderInfoTable = generateOrderInfoTable;