@bookipi/htmlgenerator 1.0.7 → 1.1.0
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 +136 -154
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +137 -153
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
2
2
|
|
|
3
3
|
var moment = _interopDefault(require('moment-timezone'));
|
|
4
|
-
var React = _interopDefault(require('react'));
|
|
5
4
|
|
|
6
5
|
function _extends() {
|
|
7
6
|
_extends = Object.assign || function (target) {
|
|
@@ -1759,12 +1758,13 @@ var invoiceHtml = (function (_ref) {
|
|
|
1759
1758
|
}
|
|
1760
1759
|
}
|
|
1761
1760
|
|
|
1762
|
-
console.log('end of item loop');
|
|
1763
1761
|
var itemsContainer = '';
|
|
1764
1762
|
|
|
1765
|
-
|
|
1766
|
-
var
|
|
1767
|
-
|
|
1763
|
+
if (document.it) {
|
|
1764
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(document.it), _step2; !(_step2 = _iterator2()).done;) {
|
|
1765
|
+
var _item = _step2.value;
|
|
1766
|
+
itemsContainer = itemsContainer + ("<tr>\n <td>\n <span class=\"text-inverse\"><strong>" + (_item.n || "") + "</strong></span>\n <div><small>" + (nl2br(_item.dsc) || "") + "</small></div>\n <div class=\"d-block d-sm-none mt-1\">\n " + ((_item.p || _item.p == 0) && (_item.q || _item.q == 0) ? FormatCurrency(_item.p, company.cr, company.la, company.cf) + " \u2715 " + _item.q : '') + "\n " + (discountOnItem && (_item.p || _item.p == 0) && _item.dc ? (_item.dc > 0 ? " - " : " + ") + FormatCurrency(Math.abs(_item.dc), company.cr, company.la, company.cf) : "") + "\n </div>\n</td>\n<td class=\"text-center d-none d-sm-table-cell\">" + ((_item.p || _item.p == 0) && (_item.q || _item.q == 0) ? _item.q : "") + "</td>\n<td class=\"text-right d-none d-sm-table-cell\">\n" + (_item.p || _item.p == 0 ? FormatCurrency(_item.p, company.cr, company.la, company.cf) : "") + "\n</td>\n" + (discountOnItem ? "<td class=\"text-right\">" + ((_item.p || _item.p == 0) && _item.dc ? FormatCurrency(_item.dc, company.cr, company.la, company.cf) : "") + "</td>" : '') + "\n<td class=\"text-right\">" + (_item.p || _item.p == 0 ? FormatCurrency(_item.t, company.cr, company.la, company.cf) : "") + "</td>\n</tr>");
|
|
1767
|
+
}
|
|
1768
1768
|
}
|
|
1769
1769
|
|
|
1770
1770
|
var taxName1;
|
|
@@ -1794,16 +1794,20 @@ var invoiceHtml = (function (_ref) {
|
|
|
1794
1794
|
|
|
1795
1795
|
var paymentContainer = '';
|
|
1796
1796
|
|
|
1797
|
-
|
|
1798
|
-
var
|
|
1799
|
-
|
|
1797
|
+
if (document.pm) {
|
|
1798
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(document.pm), _step3; !(_step3 = _iterator3()).done;) {
|
|
1799
|
+
var payment = _step3.value;
|
|
1800
|
+
paymentContainer = paymentContainer + ("<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (lang.payment_on ? lang.payment_on(formatDate(payment.d), payment.b) : payment_on(formatDate(payment.d), payment.b)) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(payment.a, company.cr, company.la, company.cf) + "</td>\n </tr>");
|
|
1801
|
+
}
|
|
1800
1802
|
}
|
|
1801
1803
|
|
|
1802
1804
|
var paymentOn = company.pi && document.ty === 1 && (company.p1 || company.p2 || company.p3);
|
|
1803
1805
|
var attachmentContainer = '';
|
|
1804
1806
|
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
+
if (attachments) {
|
|
1808
|
+
for (var i = 0; i < attachments.length; i++) {
|
|
1809
|
+
attachmentContainer = attachmentContainer + ("<div class=\"mt-5\">\n <img src=\"" + attachments[i].imageUrl + "\" style=\"max-width:100%\"/>\n <div><strong>" + attachments[i].t + "</strong></div>\n <div>" + attachments[i].d + "</div>\n </div>");
|
|
1810
|
+
}
|
|
1807
1811
|
}
|
|
1808
1812
|
|
|
1809
1813
|
var signatureContainer = document.signDate && "\n <div className=\"col-6\" style={textAlign:'center'}>\n <strong>{document.customerSignature || customerSignBase64 ? company.name : ''}</strong>\n <div style={{height:'130px',borderBottom:'2px solid #dee2e6', marginRight:'40px', marginLeft:'40px'}}>\n { signatureBase64 && <img src=" + signatureBase64 + " style={{width:'220px',marginTop:'20px'}} />}\n </div>\n <div>{document.signDate && formatDate(document.signDate) }</div>\n </div>" || '';
|
|
@@ -1811,6 +1815,128 @@ var invoiceHtml = (function (_ref) {
|
|
|
1811
1815
|
return "\n<!DOCTYPE html>\n<html>\n <head>\n <meta charset=\"utf-8\">\n <title>Invoice</title>\n <link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css\" integrity=\"sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh\" crossorigin=\"anonymous\">\n <link href=\"https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\n </head>\n <style>\n body {\n font-size: 18px;\n }\n .invoice-body {\n background: #fff;\n padding: 50px\n }\n\n .invoice-company {\n font-size: 20px\n }\n\n .invoice-header {\n /* margin: 0 -50px; */\n background: #f0f3f4;\n padding: 30px 50px;\n }\n .invoice-content {\n padding: 38px;\n }\n .invoice-date,\n .invoice-from,\n .invoice-to {\n /* display: table-cell; */\n /* width: 1% */\n }\n\n .invoice-from,\n .invoice-to {\n padding-right: 20px\n }\n\n .invoice-date .date,\n .invoice-from strong,\n .invoice-to strong {\n font-size: 18px;\n font-weight: 600\n }\n\n .invoice-date {\n /* text-align: right; */\n padding-left: 20px\n }\n\n .invoice-price {\n /* background: #f0f3f4; */\n display: table;\n width: 100%\n }\n\n .invoice-price .invoice-price-left,\n .invoice-price .invoice-price-right {\n display: table-cell;\n padding: 28px 12px 16px;\n font-size: 20px;\n font-weight: 600;\n width: 70%;\n position: relative;\n vertical-align: middle\n }\n\n .invoice-price .invoice-price-left .sub-price {\n display: table-cell;\n vertical-align: middle;\n padding: 0 20px\n }\n\n .invoice-price small {\n font-size: 18px;\n font-weight: 400;\n display: block\n }\n\n .invoice-price .invoice-price-row {\n display: table;\n float: left\n }\n\n .invoice-price .invoice-price-right {\n width: 30%;\n background: #2d353c;\n color: #fff;\n font-size: 28px;\n text-align: right;\n vertical-align: bottom;\n font-weight: 300;\n right: 38px;\n }\n\n .invoice-price .invoice-price-right small {\n display: block;\n opacity: .7;\n position: absolute;\n top: 10px;\n left: 12px;\n font-size: 18px\n }\n\n .invoice-footer {\n border-top: 1px solid #ddd;\n padding-top: 10px;\n font-size: 18px\n }\n\n .invoice-note {\n color: #999;\n margin-top: 80px;\n font-size: 85%\n }\n\n .invoice-body > div:not(.invoice-footer) {\n margin-bottom: 20px\n }\n\n .btn.btn-white, .btn.btn-white.disabled, .btn.btn-white.disabled:focus, .btn.btn-white.disabled:hover, .btn.btn-white[disabled], .btn.btn-white[disabled]:focus, .btn.btn-white[disabled]:hover {\n color: #2d353c;\n background: #fff;\n border-color: #d9dfe3;\n }\n .table-inline-block{\n display: inline-block;\n }\n\n @media print {\n body, page {\n /* width: 21cm; */\n /* margin: 0; */\n box-shadow: 0;\n background-color: #fff\n }\n /* .invoice-body {\n padding:10;\n } */\n #invoice {\n width:100%\n }\n\n .invoice-price .invoice-price-right {\n background: #f0f3f4;\n color: black;\n border: 2px solid #f0f3f4;\n }\n }\n\n @media only screen {\n #invoice {\n margin-top:10px;\n max-width:28cm;\n zoom: 0.8;\n box-shadow: 0 0 0.5cm rgba(0,0,0,0.2);\n margin-right:auto;margin-left:auto;\n background: white;\n }\n }\n\n @media (min-width: 767.99px) {\n .invoice-detail-right {\n max-width: 200px;\n }\n }\n @media (max-width: 767.98px) {\n .invoice-body {\n padding: 30px\n }\n .invoice-header {\n padding: 20px 30px;\n }\n .invoice-content {\n padding: 18px;\n }\n .invoice-price .invoice-price-right {\n right: 18px;\n }\n #invoice-logo {\n padding-top:0;\n max-width: 250px;\n text-align: center;\n margin-right:auto;\n margin-left:auto;\n display: block;\n }\n .invoice-date {\n margin-top:10px;\n border-top: 1px solid #dee2e6;\n }\n }\n\n .table-small td{\n padding: 8px 12px\n }\n .table-invoice-header{\n background: #f0f3f4\n }\n h1,h2,h3,h4 {margin-top:15px}\n h1 {font-size:27px}\n h2 {font-size:22px}\n </style>\n <body>\n <div id=\"invoice\" class=\"print\">\n <div class=\"invoice-body\">\n <!-- begin invoice-company -->\n <div class=\"row\">\n <div class=\"col-sm-12 col-md-6 mb-3 mb-md-0\">\n " + logoContainer + "\n </div>\n <div class=\"col-sm-12 col-md-6 text-md-right\">\n <h1>" + documentName + "</h1>\n <div class=\"text-inverse mb-1\" style=\"font-size: 20px;\">\n <strong>" + company.c + "</strong>\n </div>\n <address class=\"m-t-5 m-b-5\">\n <div class=\"mb-2\">\n " + (companyAddress.address1 ? "<div>" + companyAddress.address1 + "</div>" : "") + "\n " + (companyAddress.address2 ? "<div>" + companyAddress.address2 + "</div>" : "") + "\n " + (companyAddress.address3 ? "<div>" + companyAddress.address3 + "</div>" : "") + "\n " + (companyAddress.city || companyAddress.state || companyAddress.zip ? "<div>" + ((companyAddress.city ? companyAddress.city + " " : "") + (companyAddress.state ? companyAddress.state + " " : "") + (companyAddress.zip ? companyAddress.zip + " " : "")) + "</div>" : "") + "\n " + (companyAddress.country ? "<div>" + companyAddress.country + "</div>" : "") + "\n </div>\n " + (company.ai ? "<div>" + company.ai + "</div>" : "") + "\n " + (company.ph ? "<div>" + company.ph + "</div>" : "") + "\n " + (company.de ? "<div>" + company.de + "</div>" : "") + "\n " + (company.tfn ? "<div>" + ((company.bn ? company.bn : "Tax no.") + " : " + company.tfn) + "</div>" : "") + "\n </address>\n </div>\n </div>\n </div>\n <!-- end invoice-company -->\n <!-- begin invoice-header -->\n <div class=\"invoice-header\">\n <div class=\"row\">\n <div class=\"invoice-to col-sm-12 col-md-6\">\n <strong>" + (company.r_bt ? company.r_bt : lang["bill_to"]) + "</strong>\n <div class=\"text-inverse mb-1\">\n <small style=\"font-size: 18px;\">" + document.cu.c + "</small>\n </div>\n <address class=\"m-t-5 m-b-5\">\n " + (customerAddress.address1 ? "<div>" + customerAddress.address1 + "</div>" : "") + "\n " + (customerAddress.address2 ? "<div>" + customerAddress.address2 + "</div>" : "") + "\n " + (customerAddress.address3 ? "<div>" + customerAddress.address3 + "</div>" : "") + "\n " + (customerAddress.city || customerAddress.state || customerAddress.zip ? "<div>" + ((customerAddress.city ? customerAddress.city + " " : "") + (customerAddress.state ? customerAddress.state + " " : "") + (customerAddress.zip ? customerAddress.zip + " " : "")) + "</div>" : "") + "\n " + (customerAddress.country ? "<div>" + customerAddress.country + "</div>" : "") + "\n " + (document.cu.tfn ? "<div>" + (document.cu.tfn ? (company.bn || "Tax no.") + " : " + document.cu.tfn : "") + "</div>" : "") + "\n " + (document.cu.ph ? "<div>" + document.cu.ph + "</div>" : "") + "\n </address>\n\n " + (shippingAddressExists ? "<strong stryle=\"margin-top:10px\">" + (company.r_st ? company.r_st : lang.ship_to) + "</strong>" : "") + "\n " + (shippingAddressExists ? "\n <address class=\"m-t-5 m-b-5\">\n " + (customerShippingAddress.address1 ? "<div>" + customerShippingAddress.address1 + "</div>" : "") + "\n " + (customerShippingAddress.address2 ? "<div>" + customerShippingAddress.address2 + "</div>" : "") + "\n " + (customerShippingAddress.address3 ? "<div>" + customerShippingAddress.address3 + "</div>" : "") + "\n " + (customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip ? "<div>" + ((customerShippingAddress.city ? customerShippingAddress.city + " " : "") + (customerShippingAddress.state ? customerShippingAddress.state + " " : "") + (customerShippingAddress.zip ? customerShippingAddress.zip + " " : "")) + "</div>" : "") + "\n " + (customerShippingAddress.country ? "<div>" + customerShippingAddress.country + "</div>" : "") + "\n " + (document.asi ? "<div>" + document.asi + "</div>" : "") + "\n </address>\n " : "") + "\n </div>\n\n <div class=\"invoice-date col-sm-12 col-md-6\">\n <small> </small>\n <div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + documentName + " #</strong>\n </div>\n <div class=\"col invoice-detail-right\">" + (document.no ? document.no : "") + "</div>\n </div>\n <div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + (company.r_d ? company.r_d : lang["date"]) + "</strong>\n </div>\n <div class=\"col invoice-detail-right\">" + formatDate(document.d) + "</div>\n </div>\n " + (document.ty == 1 && !document.rd ? "<div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + (company.r_dd ? company.r_dd : lang["due_date"]) + "</strong>\n </div>\n <div class=\"col invoice-detail-right\">\n " + (document.dd ? formatDate(document.dd) : formatDate(new Date(document.d).setDate(new Date(document.d).getDate() + parseInt(document.di)))) + "\n </div>\n </div>" : '') + "\n " + (document.pon ? "<div class=\"row text-md-right\">\n <div class=\"col\">\n <strong>" + (company.r_po ? company.r_po : lang['po_number']) + "</strong>\n </div>\n <div class=\"col invoice-detail-right\">" + document.pon + "</div>\n </div>\n " : '') + "\n </div>\n </div>\n </div>\n <!-- end invoice-header -->\n <!-- begin invoice-content -->\n <div class=\"invoice-content\">\n <div class=\"table-responsive\">\n <table class=\"table table-invoice\">\n <thead>\n <tr class=\"table table-invoice\">\n <th class=\"text-left\">" + (company.r_it ? company.r_it : lang['item']) + "</th>\n <th class=\"text-center d-none d-sm-table-cell\" width=\"15%\">" + (document.um ? document.um : company.r_q ? company.r_q : lang['quantity']) + "</th>\n <th class=\"text-right d-none d-sm-table-cell\" width=\"15%\">" + (company.r_p ? company.r_p : lang['price']) + "</th>\n " + (discountOnItem ? "<th class=\"text-right\" width=\"15%\">" + (company.r_dc ? company.r_dc : lang['discount']) + "</th>" : '') + "\n <th class=\"text-right\" width=\"15%\">" + (company.r_a ? company.r_a : lang['amount']) + "</th>\n </tr>\n </thead>\n <tbody>\n " + itemsContainer + "\n </tbody>\n </table>\n </div>\n \n <hr>\n <div class=\"row\">\n <div class=\"col-12\">\n <table class=\"table table-borderless table-small\">\n <tbody>\n <tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (company.r_sb ? company.r_sb : lang["subtotal"]) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.st, company.cr, company.la, company.cf) + "</td>\n </tr>\n " + (document.dc ? " <tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + ((company.r_dc ? company.r_dc : lang["discount"]) + (document.dcpo && document.dcp ? " (" + document.dcp + "%)" : "")) + "</td>\n <td class=\"text-right\" width=\"25%\">" + ("(" + FormatCurrency(document.dc, company.cr, company.la, company.cf) + ")") + "</td>\n </tr>" : '') + "\n " + (document.sp && !document.sntx ? "<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (company.r_sp ? company.r_sp : lang["shipping"]) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.sp, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.tx != 0 ? "<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (taxName1 + taxIncluded1 + "(" + document.tp + "%)") + "</td>\n <td class=\"text-right\" width=\"25%\">" + ((document.t1d ? "(" : "") + FormatCurrency(document.tx, company.cr, company.la, company.cf) + (document.t1d ? ")" : "")) + "</td>\n </tr>" : '') + "\n " + (document.ttx && document.tx2 != 0 ? "<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (taxName2 + taxIncluded2 + "(" + document.tp2 + "%)") + "</td>\n <td class=\"text-right\" width=\"25%\">" + ((document.t2d ? "(" : "") + FormatCurrency(document.tx2, company.cr, company.la, company.cf) + (document.t2d ? ")" : "")) + "</td>\n </tr>" : '') + "\n " + (document.sp && document.sntx ? " <tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + (company.r_sp ? company.r_sp : lang["shipping"]) + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.sp, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.ti ? " <tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\" style=\"border-top: 1px solid #ddd\">" + (company.r_n ? company.r_n : lang["net"]) + "</td>\n <td class=\"text-right\" width=\"25%\" style=\"border-top: 1px solid #ddd\">" + FormatCurrency(document.tt - (document.tx || 0) - (document.tx2 || 0), company.cr, company.la, company.cd) + "</td>\n </tr>" : '') + "\n " + (document.ty == 1 || document.ty !== 1 && (document.t1d || document.ttx && document.tx2 > 0 && document.t2d) ? "<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\" style=\"border-bottom: 1px solid #ddd\">" + (company.r_tt ? company.r_tt : lang["total"]) + "</td>\n <td class=\"text-right\" width=\"25%\" style=\"border-bottom: 1px solid #ddd\">" + FormatCurrency(document.tt ? document.tt : 0, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.sca ? "<tr>\n <td class=\"d-none d-sm-table-cell\"></td>\n <td class=\"text-md-right\" width=\"25%\">" + lang["credit_card_surcharge"] + "</td>\n <td class=\"text-right\" width=\"25%\">" + FormatCurrency(document.sca, company.cr, company.la, company.cf) + "</td>\n </tr>" : '') + "\n " + (document.ty == 1 && document.pma && document.pm ? paymentContainer : '') + "\n </tbody>\n </table>\n </div>\n </div>\n </div>\n <!-- end invoice-content -->\n\n <!-- begin invoice price -->\n <div class=\"invoice-price\">\n <div class=\"invoice-price-left\">\n <div class=\"invoice-price-row\"></div>\n </div>\n <div class=\"invoice-price-right\">\n <small>" + (document.ty == 1 ? company.r_ad ? company.r_ad : lang["amount_due"] : company.r_gt ? company.r_gt : lang["grand_total"]) + "</small>\n <span class=\"f-w-600\">" + FormatCurrency(document.ad, company.cr, company.la, company.cf) + "</span>\n </div>\n </div>\n <!-- end invoice price -->\n\n <div class=\"invoice-body\">\n <!-- begin payment-instruction -->\n " + (paymentOn ? "<h2>" + (company.r_pi ? company.r_pi : lang['payment_instruction']) + "</h2>" : "") + "\n " + (paymentOn && company.p1 ? company.p1 + "<br>" : "") + "\n " + (paymentOn && company.p2 ? company.p2 + "<br>" : "") + "\n " + (paymentOn && company.p3 ? company.p3 + "<br>" : "") + "\n <!-- end payment-instruction -->\n\n <!-- begin invoice-note -->\n " + (document.noteHtml ? "<div class=\"mt-4\">\n " + document.noteHtml + "\n </div>" : (document.nt ? "<div class=\"mt-4\">\n <h2>" + (company.r_nt ? company.r_nt : lang["note"]) + "</h2>\n " + nl2br(document.nt) + "\n </div>" : '') + "\n " + (document.tc ? "<div class=\"mt-4\">\n <h2>" + (company.r_tc ? company.r_tc : lang["terms"]) + "</h2>\n " + nl2br(document.tc) + "\n </div>" : '')) + "\n <!-- end invoice-note -->\n " + signatureContainer + "\n " + clientSignature + "\n \n <!--- begin company signature -->\n <!-- begin invoice-signature -->\n " + (document.sd || document.cs || customerSignBase64 ? "<hr class=\"mt-5\">\n <div>" + (company.r_bs || lang['by_signing'] || "") + "</div>\n <div class=\"row mt-4\">\n " + (signatureContainer || clientSignature || "") + "\n " + (signatureContainer && clientSignature || "") + "\n </div>" : '') + "\n <!-- end invoice-signature-->\n\n <!-- begin invoice attachments -->\n\n " + (attachments && attachments.length > 0 ? "<div style=\"text-align: center\">\n " + attachmentContainer + "\n </div>" : '') + "\n <!-- end invoice attachment -->\n </div>\n </body>\n\n " + (referral ? "<div style=\"text-align:center;color:rgb(108, 108, 108);font-size:16px;padding:10px\">\n <div style=\"font-size:14px;padding:10px\">{lang[\"try_bookipi\"]}</div>\n <div style=\"text-align:center;font-size:12px\">\n <a href=\"" + referral + "\"><img src=\"https://s3.amazonaws.com/bookipi.com/img/appstore-btn-130.png\"/></a>\n <a href=\"" + referral + "\"><img src=\"https://s3.amazonaws.com/bookipi.com/img/googleplay-btn-130.png\"/></a>\n </div>\n </div>" : '') + "\n</html>\n";
|
|
1812
1816
|
});
|
|
1813
1817
|
|
|
1818
|
+
var docTypeMapping = new Map([[0, 'estimate'], [1, 'invoice'], [2, 'credit_note'], [3, 'delivery_note'], [4, 'purchase_order'], ['estimate', 0], ['invoice', 1], ['credit_note', 2], ['delivery_note', 3], ['purchase_order', 4]]);
|
|
1819
|
+
|
|
1820
|
+
var ItemCompat = function ItemCompat(item) {
|
|
1821
|
+
var mapping = new Map([['name', 'n'], ['description', 'dsc'], ['price', 'p'], ['quantity', 'q'], ['tax', 'tx'], ['tax2', 'tx2'], ['discount', 'dc'], ['total', 't']]);
|
|
1822
|
+
return Object.fromEntries(Object.entries(item).map(function (_ref) {
|
|
1823
|
+
var k = _ref[0],
|
|
1824
|
+
v = _ref[1];
|
|
1825
|
+
return [mapping.get(k) || k, v];
|
|
1826
|
+
}));
|
|
1827
|
+
};
|
|
1828
|
+
|
|
1829
|
+
var PaymentCompat = function PaymentCompat(payment) {
|
|
1830
|
+
var mapping = new Map([['amount', 'a'], ['date', 'd'], ['chargeId', 'cid'], ['surchargeRate', 'sr'], ['last4', 'l'], ['brand', 'b']]);
|
|
1831
|
+
return Object.fromEntries(Object.entries(payment).map(function (_ref2) {
|
|
1832
|
+
var k = _ref2[0],
|
|
1833
|
+
v = _ref2[1];
|
|
1834
|
+
return [mapping.get(k) || k, v];
|
|
1835
|
+
}));
|
|
1836
|
+
};
|
|
1837
|
+
|
|
1838
|
+
var CustomerCompat = function CustomerCompat(customer) {
|
|
1839
|
+
var mapping = new Map([['companyName', 'c'], ['firstName', 'f'], ['lastName', 'l'], ['email', 'e'], ['additionalInfo', 'ai'], ['address1', 'a1'], ['address2', 'a2'], ['address3', 'a3'], ['shippingAddress1', 'sa1'], ['shippingAddress2', 'sa2'], ['shippingAddress3', 'sa3'], ['mobile', 'mb'], ['phone', 'ph'], ['TFN', 'tfn'], ['trashed', 'tr'], ['trashedDate', 'trd'], ['company', 'ui'], ['fax', 'fax']]);
|
|
1840
|
+
return Object.fromEntries(Object.entries(customer).map(function (_ref3) {
|
|
1841
|
+
var k = _ref3[0],
|
|
1842
|
+
v = _ref3[1];
|
|
1843
|
+
return [mapping.get(k) || k, v];
|
|
1844
|
+
}));
|
|
1845
|
+
};
|
|
1846
|
+
|
|
1847
|
+
var InvoiceCompat = function InvoiceCompat(doc) {
|
|
1848
|
+
var mapping = new Map([['address1', 'a1'], ['address2', 'a2'], ['address3', 'a3'], ['customer', ['cu', CustomerCompat]], ['items', ['it', ItemCompat]], ['taxInclusive', 'ti'], ['taxPercentage', 'tp'], ['taxDeductible', 't1d'], ['taxInclusive', 'ti'], ['taxName', 'tn'], ['twoTaxes', 'ttx'], ['taxName2', 'tn2'], ['taxPercentage2', 'tp2'], ['taxDeductible2', 't2d'], ['taxAmount', 'tx'], ['tax2', 'tx2'], ['taxDeductibleInc2', 't2di'], ['shippingCost', 'sp'], ['shippingNonTax', 'sntx'], ['total', 'tt'], ['subTotal', 'st'], ['amountDue', 'ad'], ['discount', 'dc'], ['discountOption', 'dco'], ['discountPercentage', 'dcp'], ['discountPercentageOption', 'dcpo'], ['payments', ['pm', PaymentCompat]], ['timeZone', 'tz'], ['type', 'ty'], ['date', 'd'], ['dueDate', 'dd'], ['dueIn', 'di'], ['removeDueDate', 'rd'], ['purchaseOrderNumber', 'pon'], ['note', 'nt']]);
|
|
1849
|
+
return Object.fromEntries(Object.entries(doc).map(function (_ref4) {
|
|
1850
|
+
var k = _ref4[0],
|
|
1851
|
+
v = _ref4[1];
|
|
1852
|
+
var mapV = mapping.get(k);
|
|
1853
|
+
|
|
1854
|
+
if (!mapV) {
|
|
1855
|
+
return [k, v];
|
|
1856
|
+
} else if (!Array.isArray(mapV)) {
|
|
1857
|
+
return [mapV || k, v];
|
|
1858
|
+
} else {
|
|
1859
|
+
if (Array.isArray(v)) {
|
|
1860
|
+
return [mapV[0] || k, v.map(function (val) {
|
|
1861
|
+
return mapV[1](val);
|
|
1862
|
+
})];
|
|
1863
|
+
} else {
|
|
1864
|
+
return [mapV[0] || k, mapV[1](v)];
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
}));
|
|
1868
|
+
};
|
|
1869
|
+
|
|
1870
|
+
var TemplateCompat = function TemplateCompat(template) {
|
|
1871
|
+
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'], ['postCode', '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']]);
|
|
1872
|
+
return Object.fromEntries(Object.entries(template).map(function (_ref5) {
|
|
1873
|
+
var k = _ref5[0],
|
|
1874
|
+
v = _ref5[1];
|
|
1875
|
+
return [mapping.get(k) || k, v];
|
|
1876
|
+
}));
|
|
1877
|
+
};
|
|
1878
|
+
|
|
1879
|
+
var CompanyCompat = function CompanyCompat(doc) {
|
|
1880
|
+
var mapping = new Map([['dateFormat', 'df'], ['timeZone', 'tz'], ['language', 'la'], ['TFN', 'tfn'], ['paymentInstruction1', 'p1'], ['paymentInstruction2', 'p2'], ['paymentInstruction3', 'p3'], ['invoiceColor', 'ct'], ['taxPercentage', 'tp'], ['taxDeductible', 't1d'], ['taxInclusive', 'ti'], ['taxName', 'tn'], ['twoTaxes', 'ttx'], ['taxName2', 'tn2'], ['taxPercentage2', 'tp2'], ['taxDeductible2', 't2d'], ['name', 'c'], ['hasPaymentInstruction', 'pi'], ['additionalInfo', 'ai'], ['phoneNumber', 'ph'], ['displayEmail', 'de'], ['email', 'e']]);
|
|
1881
|
+
var rootMapping = new Map([['template', TemplateCompat]]);
|
|
1882
|
+
var newCompany = Object.fromEntries(Object.entries(doc).map(function (_ref6) {
|
|
1883
|
+
var k = _ref6[0],
|
|
1884
|
+
v = _ref6[1];
|
|
1885
|
+
return [mapping.get(k) || k, v];
|
|
1886
|
+
}));
|
|
1887
|
+
var subDoc = {};
|
|
1888
|
+
Object.entries(newCompany).forEach(function (_ref7) {
|
|
1889
|
+
var k = _ref7[0],
|
|
1890
|
+
v = _ref7[1];
|
|
1891
|
+
|
|
1892
|
+
if (rootMapping.get(k)) {
|
|
1893
|
+
var mapped = rootMapping.get(k)(v);
|
|
1894
|
+
delete mapped.__typename;
|
|
1895
|
+
subDoc = _extends({}, subDoc, mapped);
|
|
1896
|
+
}
|
|
1897
|
+
});
|
|
1898
|
+
newCompany = _extends({}, newCompany, subDoc);
|
|
1899
|
+
|
|
1900
|
+
var documentDefinitionCompat = function documentDefinitionCompat(doc) {
|
|
1901
|
+
if (!doc.documentDefinitions) {
|
|
1902
|
+
return {
|
|
1903
|
+
value: []
|
|
1904
|
+
};
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
doc.ms = [];
|
|
1908
|
+
doc.pf = [];
|
|
1909
|
+
doc.tc = [];
|
|
1910
|
+
var ret = doc.documentDefinitions.map(function (def, idx) {
|
|
1911
|
+
var enabled = false;
|
|
1912
|
+
|
|
1913
|
+
if (typeof def.enabled === 'undefined') {
|
|
1914
|
+
if (def.name) {
|
|
1915
|
+
enabled = true;
|
|
1916
|
+
}
|
|
1917
|
+
} else {
|
|
1918
|
+
enabled = def.enabled;
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1921
|
+
var obj = {
|
|
1922
|
+
n: def.name,
|
|
1923
|
+
enabled: enabled,
|
|
1924
|
+
ty: docTypeMapping.get(def.type),
|
|
1925
|
+
note: def.note,
|
|
1926
|
+
docType: def.docType
|
|
1927
|
+
};
|
|
1928
|
+
doc.ms.push(obj.defaultMessage);
|
|
1929
|
+
doc.pf.push(obj.prefix);
|
|
1930
|
+
doc.tc.push(obj.terms);
|
|
1931
|
+
return obj;
|
|
1932
|
+
});
|
|
1933
|
+
return ret;
|
|
1934
|
+
};
|
|
1935
|
+
|
|
1936
|
+
newCompany.documentDefinitions = documentDefinitionCompat(newCompany);
|
|
1937
|
+
return newCompany;
|
|
1938
|
+
};
|
|
1939
|
+
|
|
1814
1940
|
var defaultLang = {
|
|
1815
1941
|
terms: "Terms and conditions",
|
|
1816
1942
|
privacy: "Privacy Policy",
|
|
@@ -2193,137 +2319,6 @@ var defaultLang = {
|
|
|
2193
2319
|
search_item: "Search item"
|
|
2194
2320
|
};
|
|
2195
2321
|
|
|
2196
|
-
var PreviewDocument = function PreviewDocument(_ref) {
|
|
2197
|
-
var previewDocument = _ref.invoice;
|
|
2198
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
2199
|
-
dangerouslySetInnerHTML: {
|
|
2200
|
-
__html: invoiceHtml(previewDocument)
|
|
2201
|
-
}
|
|
2202
|
-
});
|
|
2203
|
-
};
|
|
2204
|
-
|
|
2205
|
-
var docTypeMapping = new Map([[0, 'estimate'], [1, 'invoice'], [2, 'credit_note'], [3, 'delivery_note'], [4, 'purchase_order'], ['estimate', 0], ['invoice', 1], ['credit_note', 2], ['delivery_note', 3], ['purchase_order', 4]]);
|
|
2206
|
-
|
|
2207
|
-
var ItemCompat = function ItemCompat(item) {
|
|
2208
|
-
var mapping = new Map([['name', 'n'], ['description', 'dsc'], ['price', 'p'], ['quantity', 'q'], ['tax', 'tx'], ['tax2', 'tx2'], ['discount', 'dc'], ['total', 't']]);
|
|
2209
|
-
return Object.fromEntries(Object.entries(item).map(function (_ref) {
|
|
2210
|
-
var k = _ref[0],
|
|
2211
|
-
v = _ref[1];
|
|
2212
|
-
return [mapping.get(k) || k, v];
|
|
2213
|
-
}));
|
|
2214
|
-
};
|
|
2215
|
-
|
|
2216
|
-
var PaymentCompat = function PaymentCompat(payment) {
|
|
2217
|
-
var mapping = new Map([['amount', 'a'], ['date', 'd'], ['chargeId', 'cid'], ['surchargeRate', 'sr'], ['last4', 'l'], ['brand', 'b']]);
|
|
2218
|
-
return Object.fromEntries(Object.entries(payment).map(function (_ref2) {
|
|
2219
|
-
var k = _ref2[0],
|
|
2220
|
-
v = _ref2[1];
|
|
2221
|
-
return [mapping.get(k) || k, v];
|
|
2222
|
-
}));
|
|
2223
|
-
};
|
|
2224
|
-
|
|
2225
|
-
var CustomerCompat = function CustomerCompat(customer) {
|
|
2226
|
-
var mapping = new Map([['companyName', 'c'], ['firstName', 'f'], ['lastName', 'l'], ['email', 'e'], ['additionalInfo', 'ai'], ['address1', 'a1'], ['address2', 'a2'], ['address3', 'a3'], ['shippingAddress1', 'sa1'], ['shippingAddress2', 'sa2'], ['shippingAddress3', 'sa3'], ['mobile', 'mb'], ['phone', 'ph'], ['TFN', 'tfn'], ['trashed', 'tr'], ['trashedDate', 'trd'], ['company', 'ui'], ['fax', 'fax']]);
|
|
2227
|
-
return Object.fromEntries(Object.entries(customer).map(function (_ref3) {
|
|
2228
|
-
var k = _ref3[0],
|
|
2229
|
-
v = _ref3[1];
|
|
2230
|
-
return [mapping.get(k) || k, v];
|
|
2231
|
-
}));
|
|
2232
|
-
};
|
|
2233
|
-
|
|
2234
|
-
var InvoiceCompat = function InvoiceCompat(doc) {
|
|
2235
|
-
var mapping = new Map([['address1', 'a1'], ['address2', 'a2'], ['address3', 'a3'], ['customer', ['cu', CustomerCompat]], ['items', ['it', ItemCompat]], ['taxInclusive', 'ti'], ['taxPercentage', 'tp'], ['taxDeductible', 't1d'], ['taxInclusive', 'ti'], ['taxName', 'tn'], ['twoTaxes', 'ttx'], ['taxName2', 'tn2'], ['taxPercentage2', 'tp2'], ['taxDeductible2', 't2d'], ['taxAmount', 'tx'], ['tax2', 'tx2'], ['taxDeductibleInc2', 't2di'], ['shippingCost', 'sp'], ['shippingNonTax', 'sntx'], ['total', 'tt'], ['subTotal', 'st'], ['amountDue', 'ad'], ['discount', 'dc'], ['discountOption', 'dco'], ['discountPercentage', 'dcp'], ['discountPercentageOption', 'dcpo'], ['payments', ['pm', PaymentCompat]], ['timeZone', 'tz'], ['type', 'ty'], ['date', 'd'], ['dueDate', 'dd'], ['dueIn', 'di'], ['removeDueDate', 'rd'], ['purchaseOrderNumber', 'pon'], ['note', 'nt']]);
|
|
2236
|
-
return Object.fromEntries(Object.entries(doc).map(function (_ref4) {
|
|
2237
|
-
var k = _ref4[0],
|
|
2238
|
-
v = _ref4[1];
|
|
2239
|
-
var mapV = mapping.get(k);
|
|
2240
|
-
|
|
2241
|
-
if (!mapV) {
|
|
2242
|
-
return [k, v];
|
|
2243
|
-
} else if (!Array.isArray(mapV)) {
|
|
2244
|
-
return [mapV || k, v];
|
|
2245
|
-
} else {
|
|
2246
|
-
if (Array.isArray(v)) {
|
|
2247
|
-
return [mapV[0] || k, v.map(function (val) {
|
|
2248
|
-
return mapV[1](val);
|
|
2249
|
-
})];
|
|
2250
|
-
} else {
|
|
2251
|
-
return [mapV[0] || k, mapV[1](v)];
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
}));
|
|
2255
|
-
};
|
|
2256
|
-
|
|
2257
|
-
var TemplateCompat = function TemplateCompat(template) {
|
|
2258
|
-
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'], ['postCode', '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']]);
|
|
2259
|
-
return Object.fromEntries(Object.entries(template).map(function (_ref5) {
|
|
2260
|
-
var k = _ref5[0],
|
|
2261
|
-
v = _ref5[1];
|
|
2262
|
-
return [mapping.get(k) || k, v];
|
|
2263
|
-
}));
|
|
2264
|
-
};
|
|
2265
|
-
|
|
2266
|
-
var CompanyCompat = function CompanyCompat(doc) {
|
|
2267
|
-
var mapping = new Map([['dateFormat', 'df'], ['timeZone', 'tz'], ['language', 'la'], ['TFN', 'tfn'], ['paymentInstruction1', 'p1'], ['paymentInstruction2', 'p2'], ['paymentInstruction3', 'p3'], ['invoiceColor', 'ct'], ['taxPercentage', 'tp'], ['taxDeductible', 't1d'], ['taxInclusive', 'ti'], ['taxName', 'tn'], ['twoTaxes', 'ttx'], ['taxName2', 'tn2'], ['taxPercentage2', 'tp2'], ['taxDeductible2', 't2d'], ['name', 'c'], ['hasPaymentInstruction', 'pi'], ['additionalInfo', 'ai'], ['phoneNumber', 'ph'], ['displayEmail', 'de'], ['email', 'e']]);
|
|
2268
|
-
var rootMapping = new Map([['template', TemplateCompat]]);
|
|
2269
|
-
var newCompany = Object.fromEntries(Object.entries(doc).map(function (_ref6) {
|
|
2270
|
-
var k = _ref6[0],
|
|
2271
|
-
v = _ref6[1];
|
|
2272
|
-
return [mapping.get(k) || k, v];
|
|
2273
|
-
}));
|
|
2274
|
-
var subDoc = {};
|
|
2275
|
-
Object.entries(newCompany).forEach(function (_ref7) {
|
|
2276
|
-
var k = _ref7[0],
|
|
2277
|
-
v = _ref7[1];
|
|
2278
|
-
|
|
2279
|
-
if (rootMapping.get(k)) {
|
|
2280
|
-
var mapped = rootMapping.get(k)(v);
|
|
2281
|
-
delete mapped.__typename;
|
|
2282
|
-
subDoc = _extends({}, subDoc, mapped);
|
|
2283
|
-
}
|
|
2284
|
-
});
|
|
2285
|
-
newCompany = _extends({}, newCompany, subDoc);
|
|
2286
|
-
|
|
2287
|
-
var documentDefinitionCompat = function documentDefinitionCompat(doc) {
|
|
2288
|
-
if (!doc.documentDefinitions) {
|
|
2289
|
-
return {
|
|
2290
|
-
value: []
|
|
2291
|
-
};
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2294
|
-
doc.ms = [];
|
|
2295
|
-
doc.pf = [];
|
|
2296
|
-
doc.tc = [];
|
|
2297
|
-
var ret = doc.documentDefinitions.map(function (def, idx) {
|
|
2298
|
-
var enabled = false;
|
|
2299
|
-
|
|
2300
|
-
if (typeof def.enabled === 'undefined') {
|
|
2301
|
-
if (def.name) {
|
|
2302
|
-
enabled = true;
|
|
2303
|
-
}
|
|
2304
|
-
} else {
|
|
2305
|
-
enabled = def.enabled;
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
var obj = {
|
|
2309
|
-
n: def.name,
|
|
2310
|
-
enabled: enabled,
|
|
2311
|
-
ty: docTypeMapping.get(def.type),
|
|
2312
|
-
note: def.note,
|
|
2313
|
-
docType: def.docType
|
|
2314
|
-
};
|
|
2315
|
-
doc.ms.push(obj.defaultMessage);
|
|
2316
|
-
doc.pf.push(obj.prefix);
|
|
2317
|
-
doc.tc.push(obj.terms);
|
|
2318
|
-
return obj;
|
|
2319
|
-
});
|
|
2320
|
-
return ret;
|
|
2321
|
-
};
|
|
2322
|
-
|
|
2323
|
-
newCompany.documentDefinitions = documentDefinitionCompat(newCompany);
|
|
2324
|
-
return newCompany;
|
|
2325
|
-
};
|
|
2326
|
-
|
|
2327
2322
|
var InvoiceCompatHtml = function InvoiceCompatHtml(invoice, lang) {
|
|
2328
2323
|
if (lang === void 0) {
|
|
2329
2324
|
lang = defaultLang;
|
|
@@ -2338,19 +2333,6 @@ var InvoiceCompatHtml = function InvoiceCompatHtml(invoice, lang) {
|
|
|
2338
2333
|
});
|
|
2339
2334
|
};
|
|
2340
2335
|
|
|
2341
|
-
var PreviewDocumentCompat = function PreviewDocumentCompat(_ref) {
|
|
2342
|
-
var previewDocument = _ref.invoice,
|
|
2343
|
-
_ref$lang = _ref.lang,
|
|
2344
|
-
lang = _ref$lang === void 0 ? defaultLang : _ref$lang;
|
|
2345
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
2346
|
-
dangerouslySetInnerHTML: {
|
|
2347
|
-
__html: InvoiceCompatHtml(previewDocument, lang)
|
|
2348
|
-
}
|
|
2349
|
-
});
|
|
2350
|
-
};
|
|
2351
|
-
|
|
2352
|
-
exports.Invoice = PreviewDocument;
|
|
2353
|
-
exports.InvoiceCompat = PreviewDocumentCompat;
|
|
2354
2336
|
exports.InvoiceCompatHtml = InvoiceCompatHtml;
|
|
2355
2337
|
exports.InvoiceHtml = invoiceHtml;
|
|
2356
2338
|
//# sourceMappingURL=index.js.map
|