@bookipi/htmlgenerator 1.12.0-alpha9 → 1.13.0-alpha.1

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.
@@ -413,7 +413,29 @@ var en = (_deposit_due$terms$pr = {
413
413
  return "This offer is valid from the date of issue and will expire at the close of business (" + x + "). Acceptance will be in the form of accepting and signing this proposal.";
414
414
  }, _deposit_due$terms$pr.details_line_3 = function details_line_3(x, y, z) {
415
415
  return x + " (" + y + "). " + z;
416
- }, _deposit_due$terms$pr.details_line_3_1 = 'This offer is valid from the date of issue and will expire at the close of business', _deposit_due$terms$pr.details_line_3_2 = 'Acceptance will be in the form of accepting and signing this proposal.', _deposit_due$terms$pr.details_line_4 = "Please accept this proposal and terms of service. This creates a legally binding contract between us. At any time if you have any questions please contact us on the details above. These terms will be effective throughout the period of our engagement and may only be changed by the Parties' agreement in writing.", _deposit_due$terms$pr.supplier_details = 'Supplier Details', _deposit_due$terms$pr.customer_details = 'Customer Details', _deposit_due$terms$pr.effective_date = 'Dated', _deposit_due$terms$pr.supplier_empty = 'No supplier added yet.', _deposit_due$terms$pr.customer_empty = 'No customer added yet.', _deposit_due$terms$pr.kind_regards = 'Kind regards', _deposit_due$terms$pr.services_title = 'Billing Schedule', _deposit_due$terms$pr["total"] = 'Total:', _deposit_due$terms$pr.items_empty = 'No services added yet.', _deposit_due$terms$pr.agreement_title = 'Terms and Conditions', _deposit_due$terms$pr["signature"] = 'Signature', _deposit_due$terms$pr.proposal_id = 'Proposal ID:', _deposit_due$terms$pr.client = 'Client:', _deposit_due$terms$pr.email_addresses = 'Email address:', _deposit_due$terms$pr.ip = 'IP:', _deposit_due$terms$pr.time = 'Time:', _deposit_due$terms$pr.upgradeRequired = 'Upgrade required', _deposit_due$terms$pr.document = 'Document', _deposit_due$terms$pr["invoice"] = 'Invoice', _deposit_due$terms$pr.estimate = 'Estimate', _deposit_due$terms$pr.creditNote = 'Credit Note', _deposit_due$terms$pr.deliveryNote = 'Delivery Note', _deposit_due$terms$pr.purchaseOrder = 'Purchase Order', _deposit_due$terms$pr.Invoice = 'Invoice', _deposit_due$terms$pr["Estimate"] = 'Estimate', _deposit_due$terms$pr.creditnote = 'Credit Note', _deposit_due$terms$pr.service_delivery_date = 'Date of delivery or completion of service', _deposit_due$terms$pr["tax_label"] = 'VAT Rate', _deposit_due$terms$pr.label_siren = 'SIREN', _deposit_due$terms$pr.vat = 'VAT', _deposit_due$terms$pr.total_tax = 'Total tax', _deposit_due$terms$pr);
416
+ }, _deposit_due$terms$pr.details_line_3_1 = 'This offer is valid from the date of issue and will expire at the close of business', _deposit_due$terms$pr.details_line_3_2 = 'Acceptance will be in the form of accepting and signing this proposal.', _deposit_due$terms$pr.details_line_4 = "Please accept this proposal and terms of service. This creates a legally binding contract between us. At any time if you have any questions please contact us on the details above. These terms will be effective throughout the period of our engagement and may only be changed by the Parties' agreement in writing.", _deposit_due$terms$pr.supplier_details = 'Supplier Details', _deposit_due$terms$pr.customer_details = 'Customer Details', _deposit_due$terms$pr.effective_date = 'Dated', _deposit_due$terms$pr.supplier_empty = 'No supplier added yet.', _deposit_due$terms$pr.customer_empty = 'No customer added yet.', _deposit_due$terms$pr.kind_regards = 'Kind regards', _deposit_due$terms$pr.services_title = 'Billing Schedule', _deposit_due$terms$pr["total"] = 'Total:', _deposit_due$terms$pr.items_empty = 'No services added yet.', _deposit_due$terms$pr.agreement_title = 'Terms and Conditions', _deposit_due$terms$pr["signature"] = 'Signature', _deposit_due$terms$pr.proposal_id = 'Proposal ID:', _deposit_due$terms$pr.client = 'Client:', _deposit_due$terms$pr.email_addresses = 'Email address:', _deposit_due$terms$pr.ip = 'IP:', _deposit_due$terms$pr.time = 'Time:', _deposit_due$terms$pr.upgradeRequired = 'Upgrade required', _deposit_due$terms$pr.document = 'Document', _deposit_due$terms$pr["invoice"] = 'Invoice', _deposit_due$terms$pr.estimate = 'Estimate', _deposit_due$terms$pr.creditNote = 'Credit Note', _deposit_due$terms$pr.deliveryNote = 'Delivery Note', _deposit_due$terms$pr.purchaseOrder = 'Purchase Order', _deposit_due$terms$pr.Invoice = 'Invoice', _deposit_due$terms$pr["Estimate"] = 'Estimate', _deposit_due$terms$pr.creditnote = 'Credit Note', _deposit_due$terms$pr.service_delivery_date = 'Date of delivery or completion of service', _deposit_due$terms$pr["tax_label"] = 'VAT Rate', _deposit_due$terms$pr.label_siren = 'SIREN', _deposit_due$terms$pr.vat = 'VAT', _deposit_due$terms$pr.total_tax = 'Total tax', _deposit_due$terms$pr.item_unit_unit = 'Unit', _deposit_due$terms$pr.item_unit_unit_short = function item_unit_unit_short(n) {
417
+ return n === 1 ? 'unit' : 'units';
418
+ }, _deposit_due$terms$pr.item_unit_piece = 'Piece', _deposit_due$terms$pr.item_unit_piece_short = function item_unit_piece_short(n) {
419
+ return n === 1 ? 'pc' : 'pcs';
420
+ }, _deposit_due$terms$pr.item_unit_each = 'Each', _deposit_due$terms$pr.item_unit_each_short = 'ea', _deposit_due$terms$pr.item_unit_pair = 'Pair', _deposit_due$terms$pr.item_unit_pair_short = function item_unit_pair_short(n) {
421
+ return n === 1 ? 'pr' : 'prs';
422
+ }, _deposit_due$terms$pr.item_unit_dozen = 'Dozen', _deposit_due$terms$pr.item_unit_dozen_short = 'dz', _deposit_due$terms$pr.item_unit_set = 'Set', _deposit_due$terms$pr.item_unit_set_short = function item_unit_set_short(n) {
423
+ return n === 1 ? 'set' : 'sets';
424
+ }, _deposit_due$terms$pr.item_unit_box = 'Box', _deposit_due$terms$pr.item_unit_box_short = function item_unit_box_short(n) {
425
+ return n === 1 ? 'box' : 'boxes';
426
+ }, _deposit_due$terms$pr.item_unit_pack = 'Pack', _deposit_due$terms$pr.item_unit_pack_short = function item_unit_pack_short(n) {
427
+ return n === 1 ? 'pk' : 'pks';
428
+ }, _deposit_due$terms$pr.item_unit_kg = 'Kilogram', _deposit_due$terms$pr.item_unit_kg_short = 'kg', _deposit_due$terms$pr.item_unit_gram = 'Gram', _deposit_due$terms$pr.item_unit_gram_short = 'g', _deposit_due$terms$pr.item_unit_tonne = 'Tonne', _deposit_due$terms$pr.item_unit_tonne_short = 't', _deposit_due$terms$pr.item_unit_litre = 'Litre', _deposit_due$terms$pr.item_unit_litre_short = 'L', _deposit_due$terms$pr.item_unit_millilitre = 'Millilitre', _deposit_due$terms$pr.item_unit_millilitre_short = 'mL', _deposit_due$terms$pr.item_unit_metre = 'Metre', _deposit_due$terms$pr.item_unit_metre_short = 'm', _deposit_due$terms$pr.item_unit_centimetre = 'Centimetre', _deposit_due$terms$pr.item_unit_centimetre_short = 'cm', _deposit_due$terms$pr.item_unit_hour = 'Hour', _deposit_due$terms$pr.item_unit_hour_short = function item_unit_hour_short(n) {
429
+ return n === 1 ? 'hr' : 'hrs';
430
+ }, _deposit_due$terms$pr.item_unit_day = 'Day', _deposit_due$terms$pr.item_unit_day_short = function item_unit_day_short(n) {
431
+ return n === 1 ? 'day' : 'days';
432
+ }, _deposit_due$terms$pr.item_unit_week = 'Week', _deposit_due$terms$pr.item_unit_week_short = function item_unit_week_short(n) {
433
+ return n === 1 ? 'wk' : 'wks';
434
+ }, _deposit_due$terms$pr.item_unit_month = 'Month', _deposit_due$terms$pr.item_unit_month_short = function item_unit_month_short(n) {
435
+ return n === 1 ? 'mo' : 'mos';
436
+ }, _deposit_due$terms$pr.item_unit_year = 'Year', _deposit_due$terms$pr.item_unit_year_short = function item_unit_year_short(n) {
437
+ return n === 1 ? 'yr' : 'yrs';
438
+ }, _deposit_due$terms$pr);
417
439
 
418
440
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
419
441
 
@@ -9102,7 +9124,8 @@ var frConfig = {
9102
9124
  format: formatVatNumber
9103
9125
  }],
9104
9126
  serviceDeliveryDate: true,
9105
- taxLabel: 'tax_label'
9127
+ taxLabel: 'tax_label',
9128
+ itemUnitType: true
9106
9129
  };
9107
9130
 
9108
9131
  var EINVOICE_CONFIGS = {
@@ -11995,6 +12018,36 @@ var nl2br = function nl2br(str, is_xhtml) {
11995
12018
  return (str + "").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, "$1" + breakTag + "$2");
11996
12019
  };
11997
12020
 
12021
+ var getItemUnitLabel = function getItemUnitLabel(_ref) {
12022
+ var _lang;
12023
+ var company = _ref.company,
12024
+ item = _ref.item,
12025
+ lang = _ref.lang,
12026
+ _ref$short = _ref["short"],
12027
+ _short = _ref$short === void 0 ? true : _ref$short;
12028
+ var config = getEInvoiceConfig(company === null || company === void 0 ? void 0 : company.co);
12029
+ if (!(config !== null && config !== void 0 && config.itemUnitType) || !(item !== null && item !== void 0 && item.unitType)) {
12030
+ return '';
12031
+ }
12032
+ var label = _short ? (_lang = lang === null || lang === void 0 ? void 0 : lang["item_unit_" + item.unitType + "_short"]) != null ? _lang : lang === null || lang === void 0 ? void 0 : lang["item_unit_" + item.unitType] : lang === null || lang === void 0 ? void 0 : lang["item_unit_" + item.unitType];
12033
+ if (typeof label === 'function') {
12034
+ return label(Number(item.q) || 0);
12035
+ }
12036
+ return label != null ? label : item.unitType;
12037
+ };
12038
+ var getItemQuantityWithUnit = function getItemQuantityWithUnit(_ref2) {
12039
+ var company = _ref2.company,
12040
+ item = _ref2.item,
12041
+ lang = _ref2.lang,
12042
+ quantity = _ref2.quantity;
12043
+ var unit = getItemUnitLabel({
12044
+ company: company,
12045
+ item: item,
12046
+ lang: lang
12047
+ });
12048
+ return unit ? quantity + " " + unit : "" + quantity;
12049
+ };
12050
+
11998
12051
  var _templateObject$6, _templateObject2$1, _templateObject3;
11999
12052
  var FormatCurrency$1 = util.FormatCurrency;
12000
12053
  var html$6 = String.raw;
@@ -12003,7 +12056,8 @@ var ItemsContainer = function ItemsContainer(_ref) {
12003
12056
  discountOnItem = _ref.discountOnItem,
12004
12057
  document = _ref.document,
12005
12058
  forceItemUnitPriceDecimal = _ref.forceItemUnitPriceDecimal,
12006
- defaultLang = _ref.defaultLang;
12059
+ defaultLang = _ref.defaultLang,
12060
+ lang = _ref.lang;
12007
12061
  if (!(document !== null && document !== void 0 && document.it)) {
12008
12062
  return '';
12009
12063
  }
@@ -12015,9 +12069,19 @@ var ItemsContainer = function ItemsContainer(_ref) {
12015
12069
  var photoUrl = (_item$photos = item.photos) !== null && _item$photos !== void 0 && _item$photos[0] ? item.photos[0].url || "https://s3.amazonaws.com/bookipi/" + company._id + "/item/images/" + item.photos[0].filename + ".jpg" : '';
12016
12070
  itemsContainer = itemsContainer + html$6(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["<tr>\n <td>\n ", "\n <div style=\"display: block;page-break-inside: auto!important;\">\n <span class=\"text-inverse\"><strong>", "</strong></span>\n ", "\n <div class=\"mt-2\" style=\"page-break-inside: auto!important;\">\n ", "\n </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>"])), photoUrl ? "<img style=\"width:56px;height:56px;display:inline-block;margin-right:12px;border-radius:4px;vertical-align:top;\" src=\"" + photoUrl + "\" />" : '', item.n || '', item.productCode ? html$6(_templateObject2$1 || (_templateObject2$1 = _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, effectiveCurrency, company.la, company.cf, {
12017
12071
  forceDecimal: forceItemUnitPriceDecimal
12018
- }) + ' ✕ ' + (item.q || '0') : '', discountOnItem && (item.p || item.p == 0) && item.dc ? "" + (item.dc > 0 ? ' - ' : ' + ') + FormatCurrency$1(Math.abs(item.dc), effectiveCurrency, company.la, company.cf, {
12072
+ }) + ' ✕ ' + getItemQuantityWithUnit({
12073
+ company: company,
12074
+ item: item,
12075
+ lang: lang,
12076
+ quantity: item.q || '0'
12077
+ }) : '', discountOnItem && (item.p || item.p == 0) && item.dc ? "" + (item.dc > 0 ? ' - ' : ' + ') + FormatCurrency$1(Math.abs(item.dc), effectiveCurrency, company.la, company.cf, {
12019
12078
  forceDecimal: forceItemUnitPriceDecimal
12020
- }) + " (" + (company.r_dc ? company.r_dc : defaultLang.discount) + ")" : '', (item.p || item.p == 0) && (item.q || item.q == 0) ? item.q : '', item.p || item.p == 0 ? FormatCurrency$1(item.p, effectiveCurrency, company.la, company.cf, {
12079
+ }) + " (" + (company.r_dc ? company.r_dc : defaultLang.discount) + ")" : '', (item.p || item.p == 0) && (item.q || item.q == 0) ? getItemQuantityWithUnit({
12080
+ company: company,
12081
+ item: item,
12082
+ lang: lang,
12083
+ quantity: item.q
12084
+ }) : '', item.p || item.p == 0 ? FormatCurrency$1(item.p, effectiveCurrency, company.la, company.cf, {
12021
12085
  forceDecimal: forceItemUnitPriceDecimal
12022
12086
  }) : '', discountOnItem ? html$6(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["<td class=\"text-right d-none d-md-table-cell\">\n ", "\n </td>"])), (item.p || item.p == 0) && item.dc ? FormatCurrency$1(item.dc, effectiveCurrency, company.la, company.cf) : '') : '', item.p || item.p == 0 ? FormatCurrency$1(item.t, effectiveCurrency, company.la, company.cf) : '');
12023
12087
  }
@@ -12102,7 +12166,8 @@ var InvoiceContent = function InvoiceContent(_ref) {
12102
12166
  forceItemUnitPriceDecimal: forceItemUnitPriceDecimal,
12103
12167
  defaultLang: {
12104
12168
  discount: defaultLang.discount
12105
- }
12169
+ },
12170
+ lang: lang
12106
12171
  });
12107
12172
  var paymentContainer = PaymentContainer({
12108
12173
  document: document,
@@ -12851,7 +12916,8 @@ var ItemsContainer$1 = function ItemsContainer(_ref) {
12851
12916
  discountOnItem = _ref.discountOnItem,
12852
12917
  document = _ref.document,
12853
12918
  forceItemUnitPriceDecimal = _ref.forceItemUnitPriceDecimal,
12854
- defaultLang = _ref.defaultLang;
12919
+ defaultLang = _ref.defaultLang,
12920
+ lang = _ref.lang;
12855
12921
  if (!(document !== null && document !== void 0 && document.it)) {
12856
12922
  return "";
12857
12923
  }
@@ -12863,11 +12929,21 @@ var ItemsContainer$1 = function ItemsContainer(_ref) {
12863
12929
  var photoUrl = (_item$photos = item.photos) !== null && _item$photos !== void 0 && _item$photos[0] ? item.photos[0].url || "https://s3.amazonaws.com/bookipi/" + company._id + "/item/images/" + item.photos[0].filename + ".jpg" : "";
12864
12930
  itemsContainer = itemsContainer + html$o(_templateObject$p || (_templateObject$p = _taggedTemplateLiteralLoose(["<tr>\n <td>\n ", "\n <div style=\"display:block;page-break-inside: auto!important;\">\n <span class=\"text-inverse\"\n ><span class=\"item-name\">", "</span></span\n >\n ", "\n <div class=\"item-description mt-2\" style=\"page-break-inside: auto!important;\">", "</div>\n <div class=\"d-block d-md-none mt-1\">\n ", "\n ", "\n </div>\n </div>\n </td>\n <td class=\"item-detail-cell text-center d-none d-md-table-cell\">\n ", "\n </td>\n <td class=\"item-detail-cell text-center d-none d-md-table-cell\">\n ", "\n </td>\n ", "\n <td class=\"item-detail-cell t text-right\" style=\"color: #000000;\">\n ", "\n </td>\n </tr>"])), photoUrl ? "<img style=\"width:56px;height:56px;display:inline-block;margin-right:12px;border-radius:4px;vertical-align:top;\" src=\"" + photoUrl + "\" />" : "", item.n || "", item.productCode ? html$o(_templateObject2$b || (_templateObject2$b = _taggedTemplateLiteralLoose(["<div class=\"item-productcode text-inverse\">\n ", "\n </div>"])), item.productCode) : "", nl2br(item.dsc) || "", (item.p || item.p == 0) && (item.q || item.q == 0) ? FormatCurrency$5(item.p, effectiveCurrency, company.la, company.cf, {
12865
12931
  forceDecimal: forceItemUnitPriceDecimal
12866
- }) + " ✕ " + (item.q || "0") : "", discountOnItem && (item.p || item.p == 0) && item.dc ? "" + (item.dc > 0 ? " - " : " + ") + FormatCurrency$5(Math.abs(item.dc), effectiveCurrency, company.la, company.cf, {
12932
+ }) + " ✕ " + getItemQuantityWithUnit({
12933
+ company: company,
12934
+ item: item,
12935
+ lang: lang,
12936
+ quantity: item.q || "0"
12937
+ }) : "", discountOnItem && (item.p || item.p == 0) && item.dc ? "" + (item.dc > 0 ? " - " : " + ") + FormatCurrency$5(Math.abs(item.dc), effectiveCurrency, company.la, company.cf, {
12867
12938
  forceDecimal: forceItemUnitPriceDecimal
12868
12939
  }) + " (" + (company.r_dc ? company.r_dc : defaultLang.discount) + ")" : "", item.p || item.p == 0 ? FormatCurrency$5(item.p, effectiveCurrency, company.la, company.cf, {
12869
12940
  forceDecimal: forceItemUnitPriceDecimal
12870
- }) : "", (item.p || item.p == 0) && (item.q || item.q == 0) ? item.q : "", discountOnItem ? html$o(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteralLoose(["<td class=\"item-detail-cell text-right d-none d-md-table-cell\">\n ", "\n </td>"])), (item.p || item.p == 0) && item.dc ? FormatCurrency$5(item.dc, effectiveCurrency, company.la, company.cf) : "") : "", item.p || item.p == 0 ? FormatCurrency$5(item.t, effectiveCurrency, company.la, company.cf) : "");
12941
+ }) : "", (item.p || item.p == 0) && (item.q || item.q == 0) ? getItemQuantityWithUnit({
12942
+ company: company,
12943
+ item: item,
12944
+ lang: lang,
12945
+ quantity: item.q
12946
+ }) : "", discountOnItem ? html$o(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteralLoose(["<td class=\"item-detail-cell text-right d-none d-md-table-cell\">\n ", "\n </td>"])), (item.p || item.p == 0) && item.dc ? FormatCurrency$5(item.dc, effectiveCurrency, company.la, company.cf) : "") : "", item.p || item.p == 0 ? FormatCurrency$5(item.t, effectiveCurrency, company.la, company.cf) : "");
12871
12947
  }
12872
12948
  return itemsContainer;
12873
12949
  };
@@ -12950,7 +13026,8 @@ var InvoiceContent$1 = function InvoiceContent(_ref) {
12950
13026
  forceItemUnitPriceDecimal: forceItemUnitPriceDecimal,
12951
13027
  defaultLang: {
12952
13028
  discount: defaultLang.discount
12953
- }
13029
+ },
13030
+ lang: lang
12954
13031
  });
12955
13032
  var paymentContainer = PaymentContainer$1({
12956
13033
  document: document,