@bookipi/htmlgenerator 1.14.1-alpha.6 → 1.14.1-alpha.8
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 +25 -15
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +25 -15
- package/dist/index.modern.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/utils.modern.js +1 -1
- package/dist/utils.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -8894,6 +8894,16 @@ var updateLocale = function updateLocale() {
|
|
|
8894
8894
|
});
|
|
8895
8895
|
};
|
|
8896
8896
|
|
|
8897
|
+
var getCustomLabel = function getCustomLabel() {
|
|
8898
|
+
var _labels$find;
|
|
8899
|
+
for (var _len = arguments.length, labels = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8900
|
+
labels[_key] = arguments[_key];
|
|
8901
|
+
}
|
|
8902
|
+
return (_labels$find = labels.find(function (label) {
|
|
8903
|
+
return typeof label === 'string' && label.trim();
|
|
8904
|
+
})) === null || _labels$find === void 0 ? void 0 : _labels$find.trim();
|
|
8905
|
+
};
|
|
8906
|
+
|
|
8897
8907
|
var getOldTaxDetails = function getOldTaxDetails(document, company, defaultLang) {
|
|
8898
8908
|
var taxPercent1 = document.tp ? parseFloat(document.tp) : 0;
|
|
8899
8909
|
var taxPercent2 = document.tp2 ? parseFloat(document.tp2) : 0;
|
|
@@ -8904,11 +8914,11 @@ var getOldTaxDetails = function getOldTaxDetails(document, company, defaultLang)
|
|
|
8904
8914
|
var discountOnItem = false;
|
|
8905
8915
|
var hasNonTaxableItem = false;
|
|
8906
8916
|
if (document.tx != 0) {
|
|
8907
|
-
taxName1 = document.tn
|
|
8917
|
+
taxName1 = getCustomLabel(document.tn, company.tn, 'Tax');
|
|
8908
8918
|
taxIncluded1 = document.ti && !document.t1d ? ' ' + (company.r_ic ? company.r_ic : defaultLang['included']) + ' ' : ' ';
|
|
8909
8919
|
}
|
|
8910
8920
|
if (document.ttx && document.tx2 != 0) {
|
|
8911
|
-
taxName2 = document.tn2
|
|
8921
|
+
taxName2 = getCustomLabel(document.tn2, company.tn2, 'Tax');
|
|
8912
8922
|
taxIncluded2 = document.ti && !document.t2d ? ' ' + (company.r_ic ? company.r_ic : defaultLang['included']) + ' ' : ' ';
|
|
8913
8923
|
}
|
|
8914
8924
|
if (document.it) {
|
|
@@ -9067,11 +9077,11 @@ var getTaxDetails = function getTaxDetails(document, company, defaultLang, _temp
|
|
|
9067
9077
|
var taxName2;
|
|
9068
9078
|
var taxIncluded2;
|
|
9069
9079
|
if (document.tx != 0) {
|
|
9070
|
-
taxName1 = document.tn
|
|
9080
|
+
taxName1 = getCustomLabel(document.tn, company.tn, 'Tax');
|
|
9071
9081
|
taxIncluded1 = document.ti && !document.t1d ? ' ' + (company.r_ic ? company.r_ic : defaultLang['included']) + ' ' : ' ';
|
|
9072
9082
|
}
|
|
9073
9083
|
if (document.ttx && document.tx2 != 0) {
|
|
9074
|
-
taxName2 = document.tn2
|
|
9084
|
+
taxName2 = getCustomLabel(document.tn2, company.tn2, 'Tax');
|
|
9075
9085
|
taxIncluded2 = document.ti && !document.t2d ? ' ' + (company.r_ic ? company.r_ic : defaultLang['included']) + ' ' : ' ';
|
|
9076
9086
|
}
|
|
9077
9087
|
var discountOnItem = (document.it || []).some(function (item) {
|
|
@@ -18096,11 +18106,11 @@ var formatTaxRate = function formatTaxRate(rate, locale) {
|
|
|
18096
18106
|
return String(Number(rate) || 0);
|
|
18097
18107
|
}
|
|
18098
18108
|
};
|
|
18099
|
-
var getEInvoiceTaxLabel = function getEInvoiceTaxLabel(company, defaultLang) {
|
|
18109
|
+
var getEInvoiceTaxLabel = function getEInvoiceTaxLabel(document, company, defaultLang) {
|
|
18100
18110
|
var _ref, _ref2, _defaultLang$vat;
|
|
18101
18111
|
var eInvoiceConfig = getEInvoiceConfig(company === null || company === void 0 ? void 0 : company.co);
|
|
18102
18112
|
var configLabel = eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang[eInvoiceConfig.taxLabel] : null;
|
|
18103
|
-
return (_ref = (_ref2 = (_defaultLang$vat = defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang.vat) != null ? _defaultLang$vat : configLabel) != null ? _ref2 : defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang.tax) != null ? _ref : 'Tax';
|
|
18113
|
+
return getCustomLabel(document === null || document === void 0 ? void 0 : document.tn, company === null || company === void 0 ? void 0 : company.tn, (_ref = (_ref2 = (_defaultLang$vat = defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang.vat) != null ? _defaultLang$vat : configLabel) != null ? _ref2 : defaultLang === null || defaultLang === void 0 ? void 0 : defaultLang.tax) != null ? _ref : 'Tax');
|
|
18104
18114
|
};
|
|
18105
18115
|
|
|
18106
18116
|
var toCalcCompany = function toCalcCompany(company, currencyCode) {
|
|
@@ -18558,8 +18568,8 @@ var InvoiceContent = function InvoiceContent(_ref) {
|
|
|
18558
18568
|
taxIncluded2 = _getTaxDetails.taxIncluded2;
|
|
18559
18569
|
var eInvoiceConfig = getEInvoiceConfig(company.co);
|
|
18560
18570
|
var eInvoiceTaxLabel = document.eInvoicing && eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang[eInvoiceConfig.taxLabel] : null;
|
|
18561
|
-
var displayTaxName1 = document.tn
|
|
18562
|
-
var displayTaxName2 = document.tn2
|
|
18571
|
+
var displayTaxName1 = getCustomLabel(document.tn, company.tn, eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName1);
|
|
18572
|
+
var displayTaxName2 = getCustomLabel(document.tn2, company.tn2, eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName2);
|
|
18563
18573
|
var timeZone = company.tz;
|
|
18564
18574
|
var formatDate = function formatDate(date) {
|
|
18565
18575
|
return getFormatDate({
|
|
@@ -18587,7 +18597,7 @@ var InvoiceContent = function InvoiceContent(_ref) {
|
|
|
18587
18597
|
});
|
|
18588
18598
|
var effectiveCurrency = document.currency || company.cr;
|
|
18589
18599
|
var eInvoiceTaxLines = getEInvoiceTaxLines(document);
|
|
18590
|
-
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
|
|
18600
|
+
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(document, company, defaultLang);
|
|
18591
18601
|
var shippingBreakdown = getShippingTaxBreakdown(document, effectiveCurrency, showShippingTaxBreakdown, calculationOptions);
|
|
18592
18602
|
var formatAmount = function formatAmount(amount) {
|
|
18593
18603
|
return FormatCurrency$3(amount, effectiveCurrency, company.la, company.cf);
|
|
@@ -19490,8 +19500,8 @@ var InvoiceContent$1 = function InvoiceContent(_ref) {
|
|
|
19490
19500
|
taxIncluded2 = _getTaxDetails.taxIncluded2;
|
|
19491
19501
|
var eInvoiceConfig = getEInvoiceConfig(company.co);
|
|
19492
19502
|
var eInvoiceTaxLabel = document.eInvoicing && eInvoiceConfig !== null && eInvoiceConfig !== void 0 && eInvoiceConfig.taxLabel ? defaultLang[eInvoiceConfig.taxLabel] : null;
|
|
19493
|
-
var displayTaxName1 = document.tn
|
|
19494
|
-
var displayTaxName2 = document.tn2
|
|
19503
|
+
var displayTaxName1 = getCustomLabel(document.tn, company.tn, eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName1);
|
|
19504
|
+
var displayTaxName2 = getCustomLabel(document.tn2, company.tn2, eInvoiceTaxLabel != null ? eInvoiceTaxLabel : taxName2);
|
|
19495
19505
|
var timeZone = company.tz;
|
|
19496
19506
|
var formatDate = function formatDate(date) {
|
|
19497
19507
|
return getFormatDate({
|
|
@@ -19519,7 +19529,7 @@ var InvoiceContent$1 = function InvoiceContent(_ref) {
|
|
|
19519
19529
|
});
|
|
19520
19530
|
var effectiveCurrency = document.currency || company.cr;
|
|
19521
19531
|
var eInvoiceTaxLines = getEInvoiceTaxLines(document);
|
|
19522
|
-
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(company, defaultLang);
|
|
19532
|
+
var eInvoiceTaxRowLabel = getEInvoiceTaxLabel(document, company, defaultLang);
|
|
19523
19533
|
var shippingBreakdown = getShippingTaxBreakdown(document, effectiveCurrency, showShippingTaxBreakdown, calculationOptions);
|
|
19524
19534
|
var formatAmount = function formatAmount(amount) {
|
|
19525
19535
|
return FormatCurrency$7(amount, effectiveCurrency, company.la, company.cf);
|
|
@@ -19946,7 +19956,7 @@ var InvoiceCompat = function InvoiceCompat(doc) {
|
|
|
19946
19956
|
};
|
|
19947
19957
|
var TemplateCompat = function TemplateCompat(template) {
|
|
19948
19958
|
if (template == null) return null;
|
|
19949
|
-
var mapping = new Map([["billTo", "r_bt"], ["shipTo", "r_st"], ["item", "r_it"], ["quantity", "r_q"], ["price", "r_p"], ["amount", "r_a"], ["date", "r_d"], ["dueDate", "r_dd"], ["
|
|
19959
|
+
var mapping = new Map([["billTo", "r_bt"], ["shipTo", "r_st"], ["item", "r_it"], ["quantity", "r_q"], ["price", "r_p"], ["amount", "r_a"], ["date", "r_d"], ["dueDate", "r_dd"], ["purchaseOrder", "r_po"], ["shipping", "r_sp"], ["included", "r_ic"], ["subtotal", "r_sb"], ["net", "r_n"], ["total", "r_tt"], ["amountDue", "r_ad"], ["grandTotal", "r_gt"], ["payInt", "r_pi"], ["note", "r_nt"], ["Tos", "r_tc"], ["bySigning", "r_bs"]]);
|
|
19950
19960
|
return Object.fromEntries(Object.entries(template).map(function (_ref5) {
|
|
19951
19961
|
var k = _ref5[0],
|
|
19952
19962
|
v = _ref5[1];
|
|
@@ -20856,8 +20866,8 @@ var TaxTable = function TaxTable(_ref) {
|
|
|
20856
20866
|
if (!(document !== null && document !== void 0 && document.it)) {
|
|
20857
20867
|
return '';
|
|
20858
20868
|
}
|
|
20859
|
-
var taxName1 = document.tn;
|
|
20860
|
-
var taxTable = html$C(_templateObject$E || (_templateObject$E = _taggedTemplateLiteralLoose(["\n <div>", "</div>\n <div class=\"tax-table-wrapper mt-2 mb-5\">\n <table class=\"tax-table table table-sm\">\n <thead>\n <tr>\n <th>", "</th>\n <th>", "</th>\n <th>", "</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td style=\"border-top: none;\">\n ", "%", "\n </td>\n <td style=\"border-top: none;\">\n ", "\n </td>\n <td style=\"border-top: none;\">\n ", "\n </td>\n </tr>\n <tr>\n <td>\n ", "", "%", "\n </td>\n <td>\n ", "\n </td>\n <td>\n ", "\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n "])), defaultLang['reduced_tax_description'], defaultLang['tax_rate_category'], taxName1
|
|
20869
|
+
var taxName1 = getCustomLabel(document.tn, company === null || company === void 0 ? void 0 : company.tn, defaultLang['consumption_tax']);
|
|
20870
|
+
var taxTable = html$C(_templateObject$E || (_templateObject$E = _taggedTemplateLiteralLoose(["\n <div>", "</div>\n <div class=\"tax-table-wrapper mt-2 mb-5\">\n <table class=\"tax-table table table-sm\">\n <thead>\n <tr>\n <th>", "</th>\n <th>", "</th>\n <th>", "</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td style=\"border-top: none;\">\n ", "%", "\n </td>\n <td style=\"border-top: none;\">\n ", "\n </td>\n <td style=\"border-top: none;\">\n ", "\n </td>\n </tr>\n <tr>\n <td>\n ", "", "%", "\n </td>\n <td>\n ", "\n </td>\n <td>\n ", "\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n "])), defaultLang['reduced_tax_description'], defaultLang['tax_rate_category'], taxName1, defaultLang['amount_of_tax'], document.tp, defaultLang['tax_subject'], FormatCurrencyJP(document.tx, company.cr, company.la, company.cf), FormatCurrencyJP(document.tax1BaseAmount || 0, company.cr, company.la, company.cf), defaultLang['reduced'], document.tp2, defaultLang['tax_subject'], FormatCurrencyJP(document.tx2, company.cr, company.la, company.cf), FormatCurrencyJP(document.tax2BaseAmount || 0, company.cr, company.la, company.cf));
|
|
20861
20871
|
return taxTable;
|
|
20862
20872
|
};
|
|
20863
20873
|
|