@bookipi/htmlgenerator 1.1.41 → 1.1.42-alpha2
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.
- package/dist/index.js +27 -11
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +27 -11
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11845,8 +11845,9 @@ var ItemsContainer = function ItemsContainer(_ref) {
|
|
|
11845
11845
|
}
|
|
11846
11846
|
var itemsContainer = "";
|
|
11847
11847
|
for (var _iterator = _createForOfIteratorHelperLoose(document.it), _step; !(_step = _iterator()).done;) {
|
|
11848
|
+
var _item$photos;
|
|
11848
11849
|
var item = _step.value;
|
|
11849
|
-
itemsContainer = itemsContainer + html$5(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["<tr>\n <td>\n <span class=\"text-inverse\"><strong>", "</strong></span>\n
|
|
11850
|
+
itemsContainer = itemsContainer + html$5(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["<tr>\n <td>\n ", "\n <div style=\"display: inline-block\">\n <span class=\"text-inverse\"><strong>", "</strong></span>\n ", "\n <div class=\"mt-2\">", "</div>\n <div class=\"d-block d-md-none mt-1\">\n ", "\n ", "\n </div>\n </div>\n </td>\n <td class=\"text-center d-none d-md-table-cell\">\n ", "\n </td>\n <td class=\"text-right d-none d-md-table-cell\">\n ", "\n </td>\n ", "\n <td class=\"text-right\">\n ", "\n </td>\n </tr>"])), (_item$photos = item.photos) !== null && _item$photos !== void 0 && _item$photos[0] ? "<img style=\"width:56px;height:56px;display:inline-block;margin-right:12px;border-radius:4px;\" src=\"https://s3.amazonaws.com/bookipi/" + company._id + "/item/images/" + item.photos[0].filename + ".jpg\" />" : "", item.n || "", item.productCode ? html$5(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["<div class=\"text-inverse\">", "</div>"])), item.productCode) : "", nl2br(item.dsc) || "", (item.p || item.p == 0) && (item.q || item.q == 0) ? FormatCurrency$1(item.p, company.cr, company.la, company.cf, {
|
|
11850
11851
|
forceDecimal: forceItemUnitPriceDecimal
|
|
11851
11852
|
}) + " ✕ " + (item.q || "0") : "", discountOnItem && (item.p || item.p == 0) && item.dc ? "" + (item.dc > 0 ? " - " : " + ") + FormatCurrency$1(Math.abs(item.dc), company.cr, company.la, company.cf, {
|
|
11852
11853
|
forceDecimal: forceItemUnitPriceDecimal
|
|
@@ -12564,7 +12565,7 @@ var getRecurringPeriodType = function getRecurringPeriodType(recurringPeriodType
|
|
|
12564
12565
|
return recurringPeriodType;
|
|
12565
12566
|
}
|
|
12566
12567
|
};
|
|
12567
|
-
function getBilling(item, proposal, company) {
|
|
12568
|
+
function getBilling(item, proposal, company, t) {
|
|
12568
12569
|
var billingType = item.billingType,
|
|
12569
12570
|
recurringPeriodFrequency = item.recurringPeriodFrequency,
|
|
12570
12571
|
recurringPeriodType = item.recurringPeriodType,
|
|
@@ -12572,20 +12573,23 @@ function getBilling(item, proposal, company) {
|
|
|
12572
12573
|
recurringStartType = item.recurringStartType;
|
|
12573
12574
|
switch (billingType) {
|
|
12574
12575
|
case "acceptance":
|
|
12575
|
-
return "Billed today";
|
|
12576
|
+
return t ? t("Billed today") : "Billed today";
|
|
12576
12577
|
case "completion":
|
|
12577
12578
|
if (proposal.endType === "fixed_date") {
|
|
12578
|
-
return "Billed on completion";
|
|
12579
|
+
return t ? t("Billed on completion") : "Billed on completion";
|
|
12579
12580
|
} else if (proposal.endDate !== null) {
|
|
12580
|
-
return "Billed on " + formatDate(proposal.endDate, company);
|
|
12581
|
+
return (t ? t("Billed on") : "Billed on") + " " + formatDate(proposal.endDate, company);
|
|
12581
12582
|
} else {
|
|
12582
|
-
return "Billed on completion";
|
|
12583
|
+
return t ? t("Billed on completion") : "Billed on completion";
|
|
12583
12584
|
}
|
|
12584
12585
|
case "recurring":
|
|
12585
12586
|
var startDate = recurringStartType === "on_acceptance" ? "acceptance" : formatDate(recurringStartDate, company);
|
|
12586
|
-
return
|
|
12587
|
+
return t ? t("Billed every {{recurringPeriod}} " + getRecurringPeriodType(recurringPeriodType || "month", recurringPeriodFrequency) + " from {{startDate}}", {
|
|
12588
|
+
recurringPeriod: recurringPeriodFrequency === 1 ? "" : recurringPeriodFrequency,
|
|
12589
|
+
startDate: startDate
|
|
12590
|
+
}) : "Billed every " + (recurringPeriodFrequency === 1 ? "" : recurringPeriodFrequency) + " " + getRecurringPeriodType(recurringPeriodType || "month", recurringPeriodFrequency) + " from " + startDate;
|
|
12587
12591
|
default:
|
|
12588
|
-
return "Billing type should be selected";
|
|
12592
|
+
return t ? t("Billing type should be selected") : "Billing type should be selected";
|
|
12589
12593
|
}
|
|
12590
12594
|
}
|
|
12591
12595
|
|
|
@@ -12750,7 +12754,7 @@ var contractHtml = (function (props) {
|
|
|
12750
12754
|
sectionServices += "</div>";
|
|
12751
12755
|
}
|
|
12752
12756
|
sectionServices += '</td><td align="right">';
|
|
12753
|
-
sectionServices += "<p>" + (
|
|
12757
|
+
sectionServices += "<p>" + (getBilling(it, proposal, company, t) + "</p>");
|
|
12754
12758
|
sectionServices += "</td></tr>";
|
|
12755
12759
|
});
|
|
12756
12760
|
} else {
|
|
@@ -12825,7 +12829,9 @@ var subscriptionInvoiceHtml = (function (_ref) {
|
|
|
12825
12829
|
t = _ref.t;
|
|
12826
12830
|
var _ref2 = vendor != null ? vendor : {},
|
|
12827
12831
|
vendorName = _ref2.name,
|
|
12828
|
-
logoUrl = _ref2.logoUrl
|
|
12832
|
+
logoUrl = _ref2.logoUrl,
|
|
12833
|
+
businessNumber = _ref2.businessNumber,
|
|
12834
|
+
address = _ref2.address;
|
|
12829
12835
|
var _ref3 = invoice != null ? invoice : {},
|
|
12830
12836
|
invoiceNumber = _ref3.no,
|
|
12831
12837
|
total = _ref3.total,
|
|
@@ -12882,10 +12888,20 @@ var subscriptionInvoiceHtml = (function (_ref) {
|
|
|
12882
12888
|
var isDiscount = type === 'discount';
|
|
12883
12889
|
return "\n <div class=\"invoice-order-item\">\n <div class=\"invoice-order-details\">\n <div>\n <div class=\"invoice-spacing invoice-body3\">" + itemLang.title + "</div>\n " + (isDiscount ? "<div class=\"invoice-subtitle4\">" + itemLang.description + "</div>" : '') + "\n </div>\n <div style=\"font-size:16px;color:" + (isDiscount ? '#C81E1E' : 'inherit') + ";\">\n " + (isDiscount ? '-' : '') + formatPrice(item.total, currency) + "\n </div>\n </div>\n </div>\n ";
|
|
12884
12890
|
};
|
|
12891
|
+
var renderAddressItems = function renderAddressItems(addressItems) {
|
|
12892
|
+
if (addressItems === void 0) {
|
|
12893
|
+
addressItems = [];
|
|
12894
|
+
}
|
|
12895
|
+
return addressItems.filter(function (item) {
|
|
12896
|
+
return !!item;
|
|
12897
|
+
}).join(', ');
|
|
12898
|
+
};
|
|
12885
12899
|
var hasDiscount = discountItem && (discountItem === null || discountItem === void 0 ? void 0 : discountItem.total) > 0;
|
|
12886
12900
|
var hasTax = taxItem && (taxItem === null || taxItem === void 0 ? void 0 : taxItem.total) > 0;
|
|
12887
12901
|
var hasSubtotal = subtotalItem && (subtotalItem === null || subtotalItem === void 0 ? void 0 : subtotalItem.total) > 0;
|
|
12888
|
-
var
|
|
12902
|
+
var hasAddressLine = (address === null || address === void 0 ? void 0 : address.address1) || (address === null || address === void 0 ? void 0 : address.address2) || (address === null || address === void 0 ? void 0 : address.address3);
|
|
12903
|
+
var hasAddress = (address === null || address === void 0 ? void 0 : address.city) || (address === null || address === void 0 ? void 0 : address.zip) || (address === null || address === void 0 ? void 0 : address.country);
|
|
12904
|
+
var html = "\n " + (includeHtmlWrapper ? '<!DOCTYPE html>\n<html>\n<head>\n<meta charset="utf-8">\n<title>Invoice</title>' : "") + "\n <style>\n @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;900&family=Lato:wght@400;700&display=swap');\n .bookipay-invoice {\n width: 100%;\n max-width: 600px;\n background-color: white;\n display:flex;\n border-radius: 16px;\n flex-direction: column;\n overflow: hidden;\n font-family: 'Inter', sans-serif;\n line-height: 1.2;\n color: black;\n font-size: 16px;\n }\n .invoice-content {\n padding: 40px 30px;\n }\n .invoice-header {\n display: flex;\n padding: 10px;\n margin-bottom: 40px;\n justify-content: space-between;\n }\n .invoice-footer {\n padding: 30px 38px 40px;\n background-color: rgb(245, 246, 250);\n }\n .invoice-footer p {\n display: block;\n margin: 0;\n }\n .invoice-footer-logo {\n height: 20px;\n margin-bottom: 12px;\n }\n .invoice-logo {\n object-fit: contain;\n max-height: 52px;\n width: auto;\n height: auto;\n }\n .invoice-body {\n color: color: rgb(15, 23, 42);\n font-size: 16px;\n }\n .invoice-company {\n text-align: right;\n }\n .invoice-spacing {\n margin-bottom: 4px;\n }\n .invoice-semi-bold {\n color: rgb(15, 23, 42);\n font-weight: 600;\n font-size: 16px;\n }\n .invoice-bold {\n font-family: 'Lato', sans-serif;\n color: black;\n font-weight: 700;\n font-size: 20px;\n }\n .invoice-subtitle {\n color: rgba(0, 0, 0, 0.6);\n font-size: 14px;\n }\n .invoice-subtitle2 {\n color: rgb(147, 154, 172);\n font-size: 14px;\n }\n .invoice-subtitle3 {\n color: rgb(100, 116, 139);\n font-size: 14px;\n }\n .invoice-subtitle4 {\n font-size: 10px;\n }\n .invoice-summary {\n background-color: rgb(245, 246, 250);\n padding: 32px 24px;\n border-radius: 16px;\n margin-bottom: 40px;\n }\n .invoice-summary-total {\n display: flex;\n margin-top: 24px;\n flex-direction: column;\n }\n .invoice-summary-customer {\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n text-align: left;\n }\n .invoice-customer-email {\n margin-left: 8px;\n }\n .invoice-order-header {\n padding: 8px 0;\n margin-bottom: 8px;\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\n display: flex;\n justify-content: space-between;\n }\n .invoice-order-container {\n display: flex;\n justify-content: space-between;\n }\n .invoice-order-item {\n padding: 12px 0px 5px;\n }\n .invoice-order-details {\n display: flex;\n justify-content: space-between;\n }\n .invoice-tax {\n display: flex;\n justify-content:space-between;\n margin-top: 8px;\n }\n .invoice-payment {\n display: flex;\n padding: 12px 0px 16px;\n justify-content: space-between;\n border-top: 1px solid rgba(0, 0, 0, 0.06);\n margin-top: 15px;\n }\n .invoice-card {\n display: flex;\n }\n .invoice-card img {\n height: 18px;\n margin-right: 6px;\n }\n .invoice-bill-to {\n display: none;\n }\n @media (max-width: 600px) {\n .bookipay-invoice {\n border-radius: 0;\n }\n }\n @media (max-width: 799px) {\n .invoice-header {\n flex-direction: column;\n padding: 10px 0;\n }\n .invoice-company {\n text-align: left;\n }\n .invoice-logo {\n max-width: 100px;\n margin-bottom: 16px;\n }\n .invoice-header, .invoice-summary {\n margin-bottom: 20px;\n }\n .invoice-summary {\n margin-left: -30px;\n margin-right: -30px;\n border-radius: 0;\n padding: 32px 30px;\n }\n .invoice-content {\n padding: 20px 30px;\n }\n .invoice-bill-to {\n display: flex;\n }\n }\n @media (max-width: 399px) {\n .footer-actions {\n flex-direction: column;\n }\n .footer-action {\n margin-bottom: 12px;\n }\n footer {\n margin: 30px 0;\n }\n footer p {\n margin-top: 0;\n }\n }\n @media print {\n * {\n color-adjust: exact;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n }\n .invoice-footer {\n width: 100%;\n max-width: 100%;\n margin: 0;\n }\n .bookipay-invoice {\n max-width: 100%;\n }\n @page { margin: 0; }\n body { margin: 1.6cm; }\n }\n </style>\n <div class=\"bookipay-invoice\">\n <div class=\"invoice-content\">\n <div class=\"invoice-header\">\n <img class=\"invoice-logo\" src=\"" + vendorLogoUrl + "\" />\n <div class=\"invoice-company\">\n <div class=\"invoice-company-name invoice-semi-bold invoice-spacing\">" + vendorName + "</div>\n <div class=\"invoice-number invoice-subtitle invoice-spacing\">" + defaultLang.invoiceNo + "</div>\n <div class=\"invoice-date invoice-subtitle invoice-spacing\">" + date + "</div>\n </div>\n </div>\n <div class=\"invoice-summary\">\n <div class=\"invoice-summary-customer\">\n <div>\n <div class=\"invoice-bold invoice-spacing\">" + companyName + "</div>\n " + (businessNumber ? "<div class=\"invoice-subtitle2\">" + businessNumber + "</div>" : '') + "\n " + (hasAddressLine ? "<div class=\"invoice-subtitle2\">" + renderAddressItems([address.address1, address.address2, address.address3]) + "</div>" : '') + "\n " + (hasAddress ? "<div class=\"invoice-subtitle2\">" + renderAddressItems([address.city, address.zip, address.country]) + "</div>" : '') + "\n </div>\n <div class=\"invoice-customer-email invoice-subtitle2\">" + email + "</div>\n </div>\n <div class=\"invoice-summary-total\">\n <div class=\"invoice-subtitle3 invoice-spacing\">" + defaultLang.total + "</div>\n <div class=\"invoice-summary-total-value invoice-bold invoice-spacing\">" + formatPrice(total, currency) + "</div>\n </div>\n </div>\n <div class=\"invoice-order\">\n <div class=\"invoice-order-header\">\n <div class=\"invoice-subtitle3\">" + defaultLang.item + "</div>\n <div class=\"invoice-subtitle3\">" + defaultLang.amount + "</div>\n </div>\n <div class=\"invoice-order-item-container\">\n " + productItems.map(renderItem) + "\n " + (hasDiscount ? renderItem(discountItem, 'discount') : '') + "\n " + (hasDiscount && hasTax && hasSubtotal ? renderItem(subtotalItem, 'subtotal') : '') + "\n " + (hasTax ? renderItem(taxItem, 'tax') : '') + "\n <div class=\"invoice-payment\">\n <div class=\"invoice-bold\" style=\"font-size: 16px;\">" + defaultLang.totalCharged + "</div>\n <div class=\"invoice-body3\">\n <div class=\"invoice-bold invoice-spacing\" style=\"font-size: 18px;text-align: right;\">" + formatPrice(amountPaid, currency) + "</div>\n <div class=\"invoice-card\">\n <img src=" + cardLogo + " alt=" + cardBrand + " />\n <div class=\"invoice-semi-bold\" style=\"font-weight: 400;\">" + (cardBrand.charAt(0).toUpperCase() + cardBrand.slice(1)) + " \u2022\u2022\u2022\u2022 " + cardNumber + "</div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"invoice-footer invoice-subtitle2\" style=\"font-size: 12px;\">\n <img class=\"invoice-footer-logo\" src=\"" + vendorLogoUrl + "\" />\n <!-- TODO: Dynamic company info -->\n <p>\xA92023 Bookipi Pty Ltd.</p>\n <p>9 George St, North Strathfield NSW 2137, Australia</p>\n <p>ABN: 91617668185</p>\n </div>\n </div>\n " + (includeHtmlWrapper ? "</body></html>" : "") + "\n ";
|
|
12889
12905
|
return {
|
|
12890
12906
|
html: html
|
|
12891
12907
|
};
|