@bookipi/htmlgenerator 1.0.8 → 1.1.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.
- package/README.md +5 -2
- package/dist/index.js +123 -146
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +124 -145
- 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) {
|
|
@@ -1811,9 +1810,131 @@ var invoiceHtml = (function (_ref) {
|
|
|
1811
1810
|
|
|
1812
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>" || '';
|
|
1813
1812
|
var clientSignature = (document.customer || customerSignBase64) && "\n <div className=\"col-6\" style={{textAlign: 'center'}}>\n <strong>{customer.companyName}</strong>\n <div style={{height:'130px',borderBottom:'2px solid #dee2e6', marginRight:'40px', marginLeft:'40px'}}>\n { customerSignBase64 && <img src=" + customerSignBase64 + " style={{width:'220px',marginTop:'20px'}} />}\n </div>\n <div>{customerSignBase64 ? formatDate(new Date()) : '(   /  /  )'}</div>\n </div>" || '';
|
|
1814
|
-
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";
|
|
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";
|
|
1815
1814
|
});
|
|
1816
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
|
+
|
|
1817
1938
|
var defaultLang = {
|
|
1818
1939
|
terms: "Terms and conditions",
|
|
1819
1940
|
privacy: "Privacy Policy",
|
|
@@ -2196,137 +2317,6 @@ var defaultLang = {
|
|
|
2196
2317
|
search_item: "Search item"
|
|
2197
2318
|
};
|
|
2198
2319
|
|
|
2199
|
-
var PreviewDocument = function PreviewDocument(_ref) {
|
|
2200
|
-
var previewDocument = _ref.invoice;
|
|
2201
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
2202
|
-
dangerouslySetInnerHTML: {
|
|
2203
|
-
__html: invoiceHtml(previewDocument)
|
|
2204
|
-
}
|
|
2205
|
-
});
|
|
2206
|
-
};
|
|
2207
|
-
|
|
2208
|
-
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]]);
|
|
2209
|
-
|
|
2210
|
-
var ItemCompat = function ItemCompat(item) {
|
|
2211
|
-
var mapping = new Map([['name', 'n'], ['description', 'dsc'], ['price', 'p'], ['quantity', 'q'], ['tax', 'tx'], ['tax2', 'tx2'], ['discount', 'dc'], ['total', 't']]);
|
|
2212
|
-
return Object.fromEntries(Object.entries(item).map(function (_ref) {
|
|
2213
|
-
var k = _ref[0],
|
|
2214
|
-
v = _ref[1];
|
|
2215
|
-
return [mapping.get(k) || k, v];
|
|
2216
|
-
}));
|
|
2217
|
-
};
|
|
2218
|
-
|
|
2219
|
-
var PaymentCompat = function PaymentCompat(payment) {
|
|
2220
|
-
var mapping = new Map([['amount', 'a'], ['date', 'd'], ['chargeId', 'cid'], ['surchargeRate', 'sr'], ['last4', 'l'], ['brand', 'b']]);
|
|
2221
|
-
return Object.fromEntries(Object.entries(payment).map(function (_ref2) {
|
|
2222
|
-
var k = _ref2[0],
|
|
2223
|
-
v = _ref2[1];
|
|
2224
|
-
return [mapping.get(k) || k, v];
|
|
2225
|
-
}));
|
|
2226
|
-
};
|
|
2227
|
-
|
|
2228
|
-
var CustomerCompat = function CustomerCompat(customer) {
|
|
2229
|
-
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']]);
|
|
2230
|
-
return Object.fromEntries(Object.entries(customer).map(function (_ref3) {
|
|
2231
|
-
var k = _ref3[0],
|
|
2232
|
-
v = _ref3[1];
|
|
2233
|
-
return [mapping.get(k) || k, v];
|
|
2234
|
-
}));
|
|
2235
|
-
};
|
|
2236
|
-
|
|
2237
|
-
var InvoiceCompat = function InvoiceCompat(doc) {
|
|
2238
|
-
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']]);
|
|
2239
|
-
return Object.fromEntries(Object.entries(doc).map(function (_ref4) {
|
|
2240
|
-
var k = _ref4[0],
|
|
2241
|
-
v = _ref4[1];
|
|
2242
|
-
var mapV = mapping.get(k);
|
|
2243
|
-
|
|
2244
|
-
if (!mapV) {
|
|
2245
|
-
return [k, v];
|
|
2246
|
-
} else if (!Array.isArray(mapV)) {
|
|
2247
|
-
return [mapV || k, v];
|
|
2248
|
-
} else {
|
|
2249
|
-
if (Array.isArray(v)) {
|
|
2250
|
-
return [mapV[0] || k, v.map(function (val) {
|
|
2251
|
-
return mapV[1](val);
|
|
2252
|
-
})];
|
|
2253
|
-
} else {
|
|
2254
|
-
return [mapV[0] || k, mapV[1](v)];
|
|
2255
|
-
}
|
|
2256
|
-
}
|
|
2257
|
-
}));
|
|
2258
|
-
};
|
|
2259
|
-
|
|
2260
|
-
var TemplateCompat = function TemplateCompat(template) {
|
|
2261
|
-
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']]);
|
|
2262
|
-
return Object.fromEntries(Object.entries(template).map(function (_ref5) {
|
|
2263
|
-
var k = _ref5[0],
|
|
2264
|
-
v = _ref5[1];
|
|
2265
|
-
return [mapping.get(k) || k, v];
|
|
2266
|
-
}));
|
|
2267
|
-
};
|
|
2268
|
-
|
|
2269
|
-
var CompanyCompat = function CompanyCompat(doc) {
|
|
2270
|
-
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']]);
|
|
2271
|
-
var rootMapping = new Map([['template', TemplateCompat]]);
|
|
2272
|
-
var newCompany = Object.fromEntries(Object.entries(doc).map(function (_ref6) {
|
|
2273
|
-
var k = _ref6[0],
|
|
2274
|
-
v = _ref6[1];
|
|
2275
|
-
return [mapping.get(k) || k, v];
|
|
2276
|
-
}));
|
|
2277
|
-
var subDoc = {};
|
|
2278
|
-
Object.entries(newCompany).forEach(function (_ref7) {
|
|
2279
|
-
var k = _ref7[0],
|
|
2280
|
-
v = _ref7[1];
|
|
2281
|
-
|
|
2282
|
-
if (rootMapping.get(k)) {
|
|
2283
|
-
var mapped = rootMapping.get(k)(v);
|
|
2284
|
-
delete mapped.__typename;
|
|
2285
|
-
subDoc = _extends({}, subDoc, mapped);
|
|
2286
|
-
}
|
|
2287
|
-
});
|
|
2288
|
-
newCompany = _extends({}, newCompany, subDoc);
|
|
2289
|
-
|
|
2290
|
-
var documentDefinitionCompat = function documentDefinitionCompat(doc) {
|
|
2291
|
-
if (!doc.documentDefinitions) {
|
|
2292
|
-
return {
|
|
2293
|
-
value: []
|
|
2294
|
-
};
|
|
2295
|
-
}
|
|
2296
|
-
|
|
2297
|
-
doc.ms = [];
|
|
2298
|
-
doc.pf = [];
|
|
2299
|
-
doc.tc = [];
|
|
2300
|
-
var ret = doc.documentDefinitions.map(function (def, idx) {
|
|
2301
|
-
var enabled = false;
|
|
2302
|
-
|
|
2303
|
-
if (typeof def.enabled === 'undefined') {
|
|
2304
|
-
if (def.name) {
|
|
2305
|
-
enabled = true;
|
|
2306
|
-
}
|
|
2307
|
-
} else {
|
|
2308
|
-
enabled = def.enabled;
|
|
2309
|
-
}
|
|
2310
|
-
|
|
2311
|
-
var obj = {
|
|
2312
|
-
n: def.name,
|
|
2313
|
-
enabled: enabled,
|
|
2314
|
-
ty: docTypeMapping.get(def.type),
|
|
2315
|
-
note: def.note,
|
|
2316
|
-
docType: def.docType
|
|
2317
|
-
};
|
|
2318
|
-
doc.ms.push(obj.defaultMessage);
|
|
2319
|
-
doc.pf.push(obj.prefix);
|
|
2320
|
-
doc.tc.push(obj.terms);
|
|
2321
|
-
return obj;
|
|
2322
|
-
});
|
|
2323
|
-
return ret;
|
|
2324
|
-
};
|
|
2325
|
-
|
|
2326
|
-
newCompany.documentDefinitions = documentDefinitionCompat(newCompany);
|
|
2327
|
-
return newCompany;
|
|
2328
|
-
};
|
|
2329
|
-
|
|
2330
2320
|
var InvoiceCompatHtml = function InvoiceCompatHtml(invoice, lang) {
|
|
2331
2321
|
if (lang === void 0) {
|
|
2332
2322
|
lang = defaultLang;
|
|
@@ -2341,16 +2331,5 @@ var InvoiceCompatHtml = function InvoiceCompatHtml(invoice, lang) {
|
|
|
2341
2331
|
});
|
|
2342
2332
|
};
|
|
2343
2333
|
|
|
2344
|
-
|
|
2345
|
-
var previewDocument = _ref.invoice,
|
|
2346
|
-
_ref$lang = _ref.lang,
|
|
2347
|
-
lang = _ref$lang === void 0 ? defaultLang : _ref$lang;
|
|
2348
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
2349
|
-
dangerouslySetInnerHTML: {
|
|
2350
|
-
__html: InvoiceCompatHtml(previewDocument, lang)
|
|
2351
|
-
}
|
|
2352
|
-
});
|
|
2353
|
-
};
|
|
2354
|
-
|
|
2355
|
-
export { PreviewDocument as Invoice, PreviewDocumentCompat as InvoiceCompat, InvoiceCompatHtml, invoiceHtml as InvoiceHtml };
|
|
2334
|
+
export { InvoiceCompatHtml, invoiceHtml as InvoiceHtml };
|
|
2356
2335
|
//# sourceMappingURL=index.modern.js.map
|