UNPKG

@lynsoluciones/medusa-docs

Version:
37 lines (36 loc) 1.56 kB
"use strict"; /* * * * 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(10) .text(orderNumber, 50, y) .text(orderDate, 200, y) .text(shippingMethod, 0, y, { align: "right" }); } function generateOrderInfoTable(doc, y, order, items) { let i; const invoiceTableTop = y + 35; 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.generateHr)(doc, invoiceTableTop + 20); doc.font("Regular"); const position = invoiceTableTop + 30; generateTableRow(doc, position, order.display_id, order.created_at.toLocaleDateString(), order.shipping_methods[0].shipping_option.name); (0, hr_1.generateHr)(doc, position + 20); return position + 20; } exports.generateOrderInfoTable = generateOrderInfoTable;