@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.modern.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import moment from 'moment-timezone';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
|
|
4
3
|
function _extends() {
|
|
5
4
|
_extends = Object.assign || function (target) {
|
|
@@ -1757,12 +1756,13 @@ var invoiceHtml = (function (_ref) {
|
|
|
1757
1756
|
}
|
|
1758
1757
|
}
|
|
1759
1758
|
|
|
1760
|
-
console.log('end of item loop');
|
|
1761
1759
|
var itemsContainer = '';
|
|
1762
1760
|
|
|
1763
|
-
|
|
1764
|
-
var
|
|
1765
|
-
|
|
1761
|
+
if (document.it) {
|
|
1762
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(document.it), _step2; !(_step2 = _iterator2()).done;) {
|
|
1763
|
+
var _item = _step2.value;
|
|
1764
|
+
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>");
|
|
1765
|
+
}
|
|
1766
1766
|
}
|
|
1767
1767
|
|
|
1768
1768
|
var taxName1;
|
|
@@ -1792,16 +1792,20 @@ var invoiceHtml = (function (_ref) {
|
|
|
1792
1792
|
|
|
1793
1793
|
var paymentContainer = '';
|
|
1794
1794
|
|
|
1795
|
-
|
|
1796
|
-
var
|
|
1797
|
-
|
|
1795
|
+
if (document.pm) {
|
|
1796
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(document.pm), _step3; !(_step3 = _iterator3()).done;) {
|
|
1797
|
+
var payment = _step3.value;
|
|
1798
|
+
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>");
|
|
1799
|
+
}
|
|
1798
1800
|
}
|
|
1799
1801
|
|
|
1800
1802
|
var paymentOn = company.pi && document.ty === 1 && (company.p1 || company.p2 || company.p3);
|
|
1801
1803
|
var attachmentContainer = '';
|
|
1802
1804
|
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
+
if (attachments) {
|
|
1806
|
+
for (var i = 0; i < attachments.length; i++) {
|
|
1807
|
+
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>");
|
|
1808
|
+
}
|
|
1805
1809
|
}
|
|
1806
1810
|
|
|
1807
1811
|
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>" || '';
|
|
@@ -1809,6 +1813,128 @@ var invoiceHtml = (function (_ref) {
|
|
|
1809
1813
|
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";
|
|
1810
1814
|
});
|
|
1811
1815
|
|
|
1816
|
+
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]]);
|
|
1817
|
+
|
|
1818
|
+
var ItemCompat = function ItemCompat(item) {
|
|
1819
|
+
var mapping = new Map([['name', 'n'], ['description', 'dsc'], ['price', 'p'], ['quantity', 'q'], ['tax', 'tx'], ['tax2', 'tx2'], ['discount', 'dc'], ['total', 't']]);
|
|
1820
|
+
return Object.fromEntries(Object.entries(item).map(function (_ref) {
|
|
1821
|
+
var k = _ref[0],
|
|
1822
|
+
v = _ref[1];
|
|
1823
|
+
return [mapping.get(k) || k, v];
|
|
1824
|
+
}));
|
|
1825
|
+
};
|
|
1826
|
+
|
|
1827
|
+
var PaymentCompat = function PaymentCompat(payment) {
|
|
1828
|
+
var mapping = new Map([['amount', 'a'], ['date', 'd'], ['chargeId', 'cid'], ['surchargeRate', 'sr'], ['last4', 'l'], ['brand', 'b']]);
|
|
1829
|
+
return Object.fromEntries(Object.entries(payment).map(function (_ref2) {
|
|
1830
|
+
var k = _ref2[0],
|
|
1831
|
+
v = _ref2[1];
|
|
1832
|
+
return [mapping.get(k) || k, v];
|
|
1833
|
+
}));
|
|
1834
|
+
};
|
|
1835
|
+
|
|
1836
|
+
var CustomerCompat = function CustomerCompat(customer) {
|
|
1837
|
+
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']]);
|
|
1838
|
+
return Object.fromEntries(Object.entries(customer).map(function (_ref3) {
|
|
1839
|
+
var k = _ref3[0],
|
|
1840
|
+
v = _ref3[1];
|
|
1841
|
+
return [mapping.get(k) || k, v];
|
|
1842
|
+
}));
|
|
1843
|
+
};
|
|
1844
|
+
|
|
1845
|
+
var InvoiceCompat = function InvoiceCompat(doc) {
|
|
1846
|
+
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']]);
|
|
1847
|
+
return Object.fromEntries(Object.entries(doc).map(function (_ref4) {
|
|
1848
|
+
var k = _ref4[0],
|
|
1849
|
+
v = _ref4[1];
|
|
1850
|
+
var mapV = mapping.get(k);
|
|
1851
|
+
|
|
1852
|
+
if (!mapV) {
|
|
1853
|
+
return [k, v];
|
|
1854
|
+
} else if (!Array.isArray(mapV)) {
|
|
1855
|
+
return [mapV || k, v];
|
|
1856
|
+
} else {
|
|
1857
|
+
if (Array.isArray(v)) {
|
|
1858
|
+
return [mapV[0] || k, v.map(function (val) {
|
|
1859
|
+
return mapV[1](val);
|
|
1860
|
+
})];
|
|
1861
|
+
} else {
|
|
1862
|
+
return [mapV[0] || k, mapV[1](v)];
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
}));
|
|
1866
|
+
};
|
|
1867
|
+
|
|
1868
|
+
var TemplateCompat = function TemplateCompat(template) {
|
|
1869
|
+
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']]);
|
|
1870
|
+
return Object.fromEntries(Object.entries(template).map(function (_ref5) {
|
|
1871
|
+
var k = _ref5[0],
|
|
1872
|
+
v = _ref5[1];
|
|
1873
|
+
return [mapping.get(k) || k, v];
|
|
1874
|
+
}));
|
|
1875
|
+
};
|
|
1876
|
+
|
|
1877
|
+
var CompanyCompat = function CompanyCompat(doc) {
|
|
1878
|
+
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']]);
|
|
1879
|
+
var rootMapping = new Map([['template', TemplateCompat]]);
|
|
1880
|
+
var newCompany = Object.fromEntries(Object.entries(doc).map(function (_ref6) {
|
|
1881
|
+
var k = _ref6[0],
|
|
1882
|
+
v = _ref6[1];
|
|
1883
|
+
return [mapping.get(k) || k, v];
|
|
1884
|
+
}));
|
|
1885
|
+
var subDoc = {};
|
|
1886
|
+
Object.entries(newCompany).forEach(function (_ref7) {
|
|
1887
|
+
var k = _ref7[0],
|
|
1888
|
+
v = _ref7[1];
|
|
1889
|
+
|
|
1890
|
+
if (rootMapping.get(k)) {
|
|
1891
|
+
var mapped = rootMapping.get(k)(v);
|
|
1892
|
+
delete mapped.__typename;
|
|
1893
|
+
subDoc = _extends({}, subDoc, mapped);
|
|
1894
|
+
}
|
|
1895
|
+
});
|
|
1896
|
+
newCompany = _extends({}, newCompany, subDoc);
|
|
1897
|
+
|
|
1898
|
+
var documentDefinitionCompat = function documentDefinitionCompat(doc) {
|
|
1899
|
+
if (!doc.documentDefinitions) {
|
|
1900
|
+
return {
|
|
1901
|
+
value: []
|
|
1902
|
+
};
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
doc.ms = [];
|
|
1906
|
+
doc.pf = [];
|
|
1907
|
+
doc.tc = [];
|
|
1908
|
+
var ret = doc.documentDefinitions.map(function (def, idx) {
|
|
1909
|
+
var enabled = false;
|
|
1910
|
+
|
|
1911
|
+
if (typeof def.enabled === 'undefined') {
|
|
1912
|
+
if (def.name) {
|
|
1913
|
+
enabled = true;
|
|
1914
|
+
}
|
|
1915
|
+
} else {
|
|
1916
|
+
enabled = def.enabled;
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
var obj = {
|
|
1920
|
+
n: def.name,
|
|
1921
|
+
enabled: enabled,
|
|
1922
|
+
ty: docTypeMapping.get(def.type),
|
|
1923
|
+
note: def.note,
|
|
1924
|
+
docType: def.docType
|
|
1925
|
+
};
|
|
1926
|
+
doc.ms.push(obj.defaultMessage);
|
|
1927
|
+
doc.pf.push(obj.prefix);
|
|
1928
|
+
doc.tc.push(obj.terms);
|
|
1929
|
+
return obj;
|
|
1930
|
+
});
|
|
1931
|
+
return ret;
|
|
1932
|
+
};
|
|
1933
|
+
|
|
1934
|
+
newCompany.documentDefinitions = documentDefinitionCompat(newCompany);
|
|
1935
|
+
return newCompany;
|
|
1936
|
+
};
|
|
1937
|
+
|
|
1812
1938
|
var defaultLang = {
|
|
1813
1939
|
terms: "Terms and conditions",
|
|
1814
1940
|
privacy: "Privacy Policy",
|
|
@@ -2191,137 +2317,6 @@ var defaultLang = {
|
|
|
2191
2317
|
search_item: "Search item"
|
|
2192
2318
|
};
|
|
2193
2319
|
|
|
2194
|
-
var PreviewDocument = function PreviewDocument(_ref) {
|
|
2195
|
-
var previewDocument = _ref.invoice;
|
|
2196
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
2197
|
-
dangerouslySetInnerHTML: {
|
|
2198
|
-
__html: invoiceHtml(previewDocument)
|
|
2199
|
-
}
|
|
2200
|
-
});
|
|
2201
|
-
};
|
|
2202
|
-
|
|
2203
|
-
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]]);
|
|
2204
|
-
|
|
2205
|
-
var ItemCompat = function ItemCompat(item) {
|
|
2206
|
-
var mapping = new Map([['name', 'n'], ['description', 'dsc'], ['price', 'p'], ['quantity', 'q'], ['tax', 'tx'], ['tax2', 'tx2'], ['discount', 'dc'], ['total', 't']]);
|
|
2207
|
-
return Object.fromEntries(Object.entries(item).map(function (_ref) {
|
|
2208
|
-
var k = _ref[0],
|
|
2209
|
-
v = _ref[1];
|
|
2210
|
-
return [mapping.get(k) || k, v];
|
|
2211
|
-
}));
|
|
2212
|
-
};
|
|
2213
|
-
|
|
2214
|
-
var PaymentCompat = function PaymentCompat(payment) {
|
|
2215
|
-
var mapping = new Map([['amount', 'a'], ['date', 'd'], ['chargeId', 'cid'], ['surchargeRate', 'sr'], ['last4', 'l'], ['brand', 'b']]);
|
|
2216
|
-
return Object.fromEntries(Object.entries(payment).map(function (_ref2) {
|
|
2217
|
-
var k = _ref2[0],
|
|
2218
|
-
v = _ref2[1];
|
|
2219
|
-
return [mapping.get(k) || k, v];
|
|
2220
|
-
}));
|
|
2221
|
-
};
|
|
2222
|
-
|
|
2223
|
-
var CustomerCompat = function CustomerCompat(customer) {
|
|
2224
|
-
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']]);
|
|
2225
|
-
return Object.fromEntries(Object.entries(customer).map(function (_ref3) {
|
|
2226
|
-
var k = _ref3[0],
|
|
2227
|
-
v = _ref3[1];
|
|
2228
|
-
return [mapping.get(k) || k, v];
|
|
2229
|
-
}));
|
|
2230
|
-
};
|
|
2231
|
-
|
|
2232
|
-
var InvoiceCompat = function InvoiceCompat(doc) {
|
|
2233
|
-
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']]);
|
|
2234
|
-
return Object.fromEntries(Object.entries(doc).map(function (_ref4) {
|
|
2235
|
-
var k = _ref4[0],
|
|
2236
|
-
v = _ref4[1];
|
|
2237
|
-
var mapV = mapping.get(k);
|
|
2238
|
-
|
|
2239
|
-
if (!mapV) {
|
|
2240
|
-
return [k, v];
|
|
2241
|
-
} else if (!Array.isArray(mapV)) {
|
|
2242
|
-
return [mapV || k, v];
|
|
2243
|
-
} else {
|
|
2244
|
-
if (Array.isArray(v)) {
|
|
2245
|
-
return [mapV[0] || k, v.map(function (val) {
|
|
2246
|
-
return mapV[1](val);
|
|
2247
|
-
})];
|
|
2248
|
-
} else {
|
|
2249
|
-
return [mapV[0] || k, mapV[1](v)];
|
|
2250
|
-
}
|
|
2251
|
-
}
|
|
2252
|
-
}));
|
|
2253
|
-
};
|
|
2254
|
-
|
|
2255
|
-
var TemplateCompat = function TemplateCompat(template) {
|
|
2256
|
-
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']]);
|
|
2257
|
-
return Object.fromEntries(Object.entries(template).map(function (_ref5) {
|
|
2258
|
-
var k = _ref5[0],
|
|
2259
|
-
v = _ref5[1];
|
|
2260
|
-
return [mapping.get(k) || k, v];
|
|
2261
|
-
}));
|
|
2262
|
-
};
|
|
2263
|
-
|
|
2264
|
-
var CompanyCompat = function CompanyCompat(doc) {
|
|
2265
|
-
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']]);
|
|
2266
|
-
var rootMapping = new Map([['template', TemplateCompat]]);
|
|
2267
|
-
var newCompany = Object.fromEntries(Object.entries(doc).map(function (_ref6) {
|
|
2268
|
-
var k = _ref6[0],
|
|
2269
|
-
v = _ref6[1];
|
|
2270
|
-
return [mapping.get(k) || k, v];
|
|
2271
|
-
}));
|
|
2272
|
-
var subDoc = {};
|
|
2273
|
-
Object.entries(newCompany).forEach(function (_ref7) {
|
|
2274
|
-
var k = _ref7[0],
|
|
2275
|
-
v = _ref7[1];
|
|
2276
|
-
|
|
2277
|
-
if (rootMapping.get(k)) {
|
|
2278
|
-
var mapped = rootMapping.get(k)(v);
|
|
2279
|
-
delete mapped.__typename;
|
|
2280
|
-
subDoc = _extends({}, subDoc, mapped);
|
|
2281
|
-
}
|
|
2282
|
-
});
|
|
2283
|
-
newCompany = _extends({}, newCompany, subDoc);
|
|
2284
|
-
|
|
2285
|
-
var documentDefinitionCompat = function documentDefinitionCompat(doc) {
|
|
2286
|
-
if (!doc.documentDefinitions) {
|
|
2287
|
-
return {
|
|
2288
|
-
value: []
|
|
2289
|
-
};
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
|
-
doc.ms = [];
|
|
2293
|
-
doc.pf = [];
|
|
2294
|
-
doc.tc = [];
|
|
2295
|
-
var ret = doc.documentDefinitions.map(function (def, idx) {
|
|
2296
|
-
var enabled = false;
|
|
2297
|
-
|
|
2298
|
-
if (typeof def.enabled === 'undefined') {
|
|
2299
|
-
if (def.name) {
|
|
2300
|
-
enabled = true;
|
|
2301
|
-
}
|
|
2302
|
-
} else {
|
|
2303
|
-
enabled = def.enabled;
|
|
2304
|
-
}
|
|
2305
|
-
|
|
2306
|
-
var obj = {
|
|
2307
|
-
n: def.name,
|
|
2308
|
-
enabled: enabled,
|
|
2309
|
-
ty: docTypeMapping.get(def.type),
|
|
2310
|
-
note: def.note,
|
|
2311
|
-
docType: def.docType
|
|
2312
|
-
};
|
|
2313
|
-
doc.ms.push(obj.defaultMessage);
|
|
2314
|
-
doc.pf.push(obj.prefix);
|
|
2315
|
-
doc.tc.push(obj.terms);
|
|
2316
|
-
return obj;
|
|
2317
|
-
});
|
|
2318
|
-
return ret;
|
|
2319
|
-
};
|
|
2320
|
-
|
|
2321
|
-
newCompany.documentDefinitions = documentDefinitionCompat(newCompany);
|
|
2322
|
-
return newCompany;
|
|
2323
|
-
};
|
|
2324
|
-
|
|
2325
2320
|
var InvoiceCompatHtml = function InvoiceCompatHtml(invoice, lang) {
|
|
2326
2321
|
if (lang === void 0) {
|
|
2327
2322
|
lang = defaultLang;
|
|
@@ -2336,16 +2331,5 @@ var InvoiceCompatHtml = function InvoiceCompatHtml(invoice, lang) {
|
|
|
2336
2331
|
});
|
|
2337
2332
|
};
|
|
2338
2333
|
|
|
2339
|
-
|
|
2340
|
-
var previewDocument = _ref.invoice,
|
|
2341
|
-
_ref$lang = _ref.lang,
|
|
2342
|
-
lang = _ref$lang === void 0 ? defaultLang : _ref$lang;
|
|
2343
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
2344
|
-
dangerouslySetInnerHTML: {
|
|
2345
|
-
__html: InvoiceCompatHtml(previewDocument, lang)
|
|
2346
|
-
}
|
|
2347
|
-
});
|
|
2348
|
-
};
|
|
2349
|
-
|
|
2350
|
-
export { PreviewDocument as Invoice, PreviewDocumentCompat as InvoiceCompat, InvoiceCompatHtml, invoiceHtml as InvoiceHtml };
|
|
2334
|
+
export { InvoiceCompatHtml, invoiceHtml as InvoiceHtml };
|
|
2351
2335
|
//# sourceMappingURL=index.modern.js.map
|