@bookipi/htmlgenerator 1.0.1 → 1.0.3

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
2
2
 
3
- var React = require('react');
4
- var React__default = _interopDefault(React);
3
+ var React = _interopDefault(require('react'));
5
4
  var Moment = _interopDefault(require('moment'));
5
+ var moment = _interopDefault(require('moment-timezone'));
6
6
 
7
7
  var currencies = {
8
8
  "AED": {
@@ -1584,6 +1584,7 @@ var currencyFormat = function currencyFormat(value, currency, lang, cFormat, rtl
1584
1584
  formattedValue = formattedValue.replace("$$", symbol);
1585
1585
  return formattedValue;
1586
1586
  };
1587
+
1587
1588
  var FormatCurrency = function FormatCurrency(value, currency, language, cFormat) {
1588
1589
  return currencyFormat(value, currency, language, cFormat);
1589
1590
  };
@@ -1599,43 +1600,15 @@ var nl2br = function nl2br(str, is_xhtml) {
1599
1600
 
1600
1601
  var PreviewDocument = function PreviewDocument(_ref) {
1601
1602
  var previewDocument = _ref.invoice,
1602
- documentDefinitions = _ref.documentDefinitions;
1603
- var lang = {};
1604
-
1605
- var _useState = React.useState(null),
1606
- company = _useState[0],
1607
- setCompany = _useState[1];
1608
-
1609
- var _useState2 = React.useState(null),
1610
- document = _useState2[0],
1611
- setDocument = _useState2[1];
1612
-
1613
- var _useState3 = React.useState(null),
1614
- logoBase64 = _useState3[0],
1615
- setLogoBase64 = _useState3[1];
1616
-
1617
- var _useState4 = React.useState(null),
1618
- attachments = _useState4[0],
1619
- setAttachments = _useState4[1];
1620
-
1621
- var _useState5 = React.useState(null),
1622
- customerSignBase64 = _useState5[0],
1623
- setCustomerSignBase64 = _useState5[1];
1624
-
1625
- var _useState6 = React.useState(null),
1626
- signatureBase64 = _useState6[0],
1627
- setSignatureBase64 = _useState6[1];
1628
-
1629
- React.useEffect(function () {
1630
- if (previewDocument != null) {
1631
- setCompany(previewDocument.company);
1632
- setDocument(previewDocument.document);
1633
- setLogoBase64(previewDocument.logoBase64);
1634
- setAttachments(previewDocument.attachments);
1635
- setCustomerSignBase64(previewDocument.customerSignBase64);
1636
- setSignatureBase64(previewDocument.signatureBase64);
1637
- }
1638
- }, [previewDocument]);
1603
+ documentDefinitions = _ref.documentDefinitions,
1604
+ _ref$lang = _ref.lang,
1605
+ lang = _ref$lang === void 0 ? {} : _ref$lang;
1606
+ var company = previewDocument.company;
1607
+ var document = previewDocument.document;
1608
+ var logoBase64 = previewDocument.logoBase64;
1609
+ var attachments = previewDocument.attachments;
1610
+ var customerSignBase64 = previewDocument.customerSignBase64;
1611
+ var signatureBase64 = previewDocument.signatureBase64;
1639
1612
 
1640
1613
  if (!company || !document || !document.customer || !document.items) {
1641
1614
  return false;
@@ -1774,23 +1747,26 @@ var PreviewDocument = function PreviewDocument(_ref) {
1774
1747
 
1775
1748
  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>" || '';
1776
1749
  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()) : '( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp)'}</div>\n </div>" || '';
1777
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("link", {
1750
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("link", {
1778
1751
  rel: "stylesheet",
1779
1752
  href: "https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css",
1780
1753
  integrity: "sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh",
1781
1754
  crossOrigin: "anonymous"
1782
- }), /*#__PURE__*/React__default.createElement("div", {
1755
+ }), /*#__PURE__*/React.createElement("link", {
1756
+ href: "https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css",
1757
+ rel: "stylesheet"
1758
+ }), /*#__PURE__*/React.createElement("div", {
1783
1759
  className: "print invoice-preview"
1784
- }, /*#__PURE__*/React__default.createElement("div", {
1760
+ }, /*#__PURE__*/React.createElement("div", {
1785
1761
  className: "invoice-body"
1786
- }, /*#__PURE__*/React__default.createElement("div", {
1762
+ }, /*#__PURE__*/React.createElement("div", {
1787
1763
  className: "row"
1788
- }, /*#__PURE__*/React__default.createElement("div", {
1764
+ }, /*#__PURE__*/React.createElement("div", {
1789
1765
  className: "col-sm",
1790
1766
  style: {
1791
1767
  paddingTop: '10px'
1792
1768
  }
1793
- }, logoBase64 ? /*#__PURE__*/React__default.createElement("img", {
1769
+ }, logoBase64 ? /*#__PURE__*/React.createElement("img", {
1794
1770
  src: logoBase64,
1795
1771
  id: "invoice-logo",
1796
1772
  className: "img-fluid",
@@ -1798,229 +1774,982 @@ var PreviewDocument = function PreviewDocument(_ref) {
1798
1774
  width: company.ls * 2 || 200,
1799
1775
  height: 'auto'
1800
1776
  }
1801
- }) : /*#__PURE__*/React__default.createElement("h1", null, company.name)), /*#__PURE__*/React__default.createElement("div", {
1777
+ }) : /*#__PURE__*/React.createElement("h1", null, company.name)), /*#__PURE__*/React.createElement("div", {
1802
1778
  className: "col-sm text-right"
1803
- }, /*#__PURE__*/React__default.createElement("h1", null, documentName), /*#__PURE__*/React__default.createElement("div", {
1779
+ }, /*#__PURE__*/React.createElement("h1", null, documentName), /*#__PURE__*/React.createElement("div", {
1804
1780
  className: "text-inverse mb-1",
1805
1781
  style: {
1806
1782
  fontSize: '20px'
1807
1783
  }
1808
- }, /*#__PURE__*/React__default.createElement("strong", null, company.name)), /*#__PURE__*/React__default.createElement("address", {
1784
+ }, /*#__PURE__*/React.createElement("strong", null, company.name)), /*#__PURE__*/React.createElement("address", {
1809
1785
  className: "m-t-5 m-b-5"
1810
- }, /*#__PURE__*/React__default.createElement("div", {
1786
+ }, /*#__PURE__*/React.createElement("div", {
1811
1787
  className: "mb-2"
1812
- }, companyAddress.address1 && /*#__PURE__*/React__default.createElement("div", null, companyAddress.address1), companyAddress.address2 && /*#__PURE__*/React__default.createElement("div", null, companyAddress.address2), companyAddress.address3 && /*#__PURE__*/React__default.createElement("div", null, companyAddress.address3), (companyAddress.city || companyAddress.state || companyAddress.zip) && /*#__PURE__*/React__default.createElement("div", null, (companyAddress.city ? companyAddress.city + ' ' : '') + (companyAddress.state ? companyAddress.state + ' ' : '') + (companyAddress.zip ? companyAddress.zip + ' ' : '')), companyAddress.country && /*#__PURE__*/React__default.createElement("div", null, companyAddress.country)), company.additionalInfo && /*#__PURE__*/React__default.createElement("div", null, company.additionalInfo), company.phoneNumber && /*#__PURE__*/React__default.createElement("div", null, company.phoneNumber), company.displayEmail && /*#__PURE__*/React__default.createElement("div", null, company.displayEmail), company.TFN && /*#__PURE__*/React__default.createElement("div", null, businessNumberName + ' : ' + company.TFN)))), /*#__PURE__*/React__default.createElement("div", {
1788
+ }, companyAddress.address1 && /*#__PURE__*/React.createElement("div", null, companyAddress.address1), companyAddress.address2 && /*#__PURE__*/React.createElement("div", null, companyAddress.address2), companyAddress.address3 && /*#__PURE__*/React.createElement("div", null, companyAddress.address3), (companyAddress.city || companyAddress.state || companyAddress.zip) && /*#__PURE__*/React.createElement("div", null, (companyAddress.city ? companyAddress.city + ' ' : '') + (companyAddress.state ? companyAddress.state + ' ' : '') + (companyAddress.zip ? companyAddress.zip + ' ' : '')), companyAddress.country && /*#__PURE__*/React.createElement("div", null, companyAddress.country)), company.additionalInfo && /*#__PURE__*/React.createElement("div", null, company.additionalInfo), company.phoneNumber && /*#__PURE__*/React.createElement("div", null, company.phoneNumber), company.displayEmail && /*#__PURE__*/React.createElement("div", null, company.displayEmail), company.TFN && /*#__PURE__*/React.createElement("div", null, businessNumberName + ' : ' + company.TFN)))), /*#__PURE__*/React.createElement("div", {
1813
1789
  className: "invoice-header"
1814
- }, /*#__PURE__*/React__default.createElement("div", {
1790
+ }, /*#__PURE__*/React.createElement("div", {
1815
1791
  className: "invoice-to"
1816
- }, /*#__PURE__*/React__default.createElement("strong", null, company.template.billTo ? company.template.billTo : 'Bill to'), /*#__PURE__*/React__default.createElement("div", {
1792
+ }, /*#__PURE__*/React.createElement("strong", null, company.template.billTo ? company.template.billTo : 'Bill to'), /*#__PURE__*/React.createElement("div", {
1817
1793
  className: "text-inverse mb-1"
1818
- }, /*#__PURE__*/React__default.createElement("small", {
1794
+ }, /*#__PURE__*/React.createElement("small", {
1819
1795
  style: {
1820
1796
  fontSize: '18px'
1821
1797
  }
1822
- }, customer.companyName)), /*#__PURE__*/React__default.createElement("address", {
1798
+ }, customer.companyName)), /*#__PURE__*/React.createElement("address", {
1823
1799
  className: "m-t-5 m-b-5"
1824
- }, customerAddress.address1 && /*#__PURE__*/React__default.createElement("div", null, customerAddress.address1), customerAddress.address2 && /*#__PURE__*/React__default.createElement("div", null, customerAddress.address2), customerAddress.address3 && /*#__PURE__*/React__default.createElement("div", null, customerAddress.address3), customerAddress.city || customerAddress.state || customerAddress.zip && /*#__PURE__*/React__default.createElement("div", null, (customerAddress.city ? customerAddress.city + ' ' : '') + (customerAddress.state ? customerAddress.state + ' ' : '') + (customerAddress.zip ? customerAddress.zip + ' ' : '')), customerAddress.country && /*#__PURE__*/React__default.createElement("div", null, customerAddress.country), document.customer.TFN && /*#__PURE__*/React__default.createElement("div", null, document.cu.TFN ? businessNumberName + ' : ' + document.cu.TFN : ''), document.customer.phone && /*#__PURE__*/React__default.createElement("div", null, document.cu.phone)), shippingAddressExists && /*#__PURE__*/React__default.createElement("strong", {
1800
+ }, customerAddress.address1 && /*#__PURE__*/React.createElement("div", null, customerAddress.address1), customerAddress.address2 && /*#__PURE__*/React.createElement("div", null, customerAddress.address2), customerAddress.address3 && /*#__PURE__*/React.createElement("div", null, customerAddress.address3), customerAddress.city || customerAddress.state || customerAddress.zip && /*#__PURE__*/React.createElement("div", null, (customerAddress.city ? customerAddress.city + ' ' : '') + (customerAddress.state ? customerAddress.state + ' ' : '') + (customerAddress.zip ? customerAddress.zip + ' ' : '')), customerAddress.country && /*#__PURE__*/React.createElement("div", null, customerAddress.country), document.customer.TFN && /*#__PURE__*/React.createElement("div", null, document.cu.TFN ? businessNumberName + ' : ' + document.cu.TFN : ''), document.customer.phone && /*#__PURE__*/React.createElement("div", null, document.cu.phone)), shippingAddressExists && /*#__PURE__*/React.createElement("strong", {
1825
1801
  style: {
1826
1802
  marginTop: '10px'
1827
1803
  }
1828
- }, company.template.shipTo ? company.template.shipTo : 'Ship to'), shippingAddressExists && /*#__PURE__*/React__default.createElement("address", {
1804
+ }, company.template.shipTo ? company.template.shipTo : 'Ship to'), shippingAddressExists && /*#__PURE__*/React.createElement("address", {
1829
1805
  className: "m-t-5 m-b-5"
1830
- }, customerShippingAddress.address1 && /*#__PURE__*/React__default.createElement("div", null, customerShippingAddress.address1), customerShippingAddress.address2 && /*#__PURE__*/React__default.createElement("div", null, customerShippingAddress.address2), customerShippingAddress.address3 && /*#__PURE__*/React__default.createElement("div", null, customerShippingAddress.address3), customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip && /*#__PURE__*/React__default.createElement("div", null, (customerShippingAddress.city ? customerShippingAddress.city + ' ' : '') + (customerShippingAddress.state ? customerShippingAddress.state + ' ' : '') + (customerShippingAddress.zip ? customerShippingAddress.zip + ' ' : '')), customerShippingAddress.country && /*#__PURE__*/React__default.createElement("div", null, customerShippingAddress.country), document.shippingInfo && /*#__PURE__*/React__default.createElement("div", null, document.shippingInfo))), /*#__PURE__*/React__default.createElement("div", {
1806
+ }, customerShippingAddress.address1 && /*#__PURE__*/React.createElement("div", null, customerShippingAddress.address1), customerShippingAddress.address2 && /*#__PURE__*/React.createElement("div", null, customerShippingAddress.address2), customerShippingAddress.address3 && /*#__PURE__*/React.createElement("div", null, customerShippingAddress.address3), customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip && /*#__PURE__*/React.createElement("div", null, (customerShippingAddress.city ? customerShippingAddress.city + ' ' : '') + (customerShippingAddress.state ? customerShippingAddress.state + ' ' : '') + (customerShippingAddress.zip ? customerShippingAddress.zip + ' ' : '')), customerShippingAddress.country && /*#__PURE__*/React.createElement("div", null, customerShippingAddress.country), document.shippingInfo && /*#__PURE__*/React.createElement("div", null, document.shippingInfo))), /*#__PURE__*/React.createElement("div", {
1831
1807
  className: "invoice-date"
1832
- }, /*#__PURE__*/React__default.createElement("small", null, "\xA0"), /*#__PURE__*/React__default.createElement("div", {
1808
+ }, /*#__PURE__*/React.createElement("small", null, "\xA0"), /*#__PURE__*/React.createElement("div", {
1833
1809
  className: "row"
1834
- }, /*#__PURE__*/React__default.createElement("div", {
1810
+ }, /*#__PURE__*/React.createElement("div", {
1835
1811
  className: "col text-right"
1836
- }, /*#__PURE__*/React__default.createElement("strong", null, documentName, " #")), /*#__PURE__*/React__default.createElement("div", {
1812
+ }, /*#__PURE__*/React.createElement("strong", null, documentName, " #")), /*#__PURE__*/React.createElement("div", {
1837
1813
  className: "col text-right",
1838
1814
  style: {
1839
1815
  maxWidth: '200px'
1840
1816
  }
1841
- }, document.no ? document.no : '')), /*#__PURE__*/React__default.createElement("div", {
1817
+ }, document.no ? document.no : '')), /*#__PURE__*/React.createElement("div", {
1842
1818
  className: "row"
1843
- }, /*#__PURE__*/React__default.createElement("div", {
1819
+ }, /*#__PURE__*/React.createElement("div", {
1844
1820
  className: "col"
1845
- }, /*#__PURE__*/React__default.createElement("strong", null, company.template.date ? company.template.date : 'date' )), /*#__PURE__*/React__default.createElement("div", {
1821
+ }, /*#__PURE__*/React.createElement("strong", null, company.template.date ? company.template.date : 'date' )), /*#__PURE__*/React.createElement("div", {
1846
1822
  className: "col",
1847
1823
  style: {
1848
1824
  maxWidth: '200px'
1849
1825
  }
1850
- }, invoiceDate)), document.type == 'invoice' && !document.removeDueDate && /*#__PURE__*/React__default.createElement("div", {
1826
+ }, invoiceDate)), document.type == 'invoice' && !document.removeDueDate && /*#__PURE__*/React.createElement("div", {
1851
1827
  className: "row"
1852
- }, /*#__PURE__*/React__default.createElement("div", {
1828
+ }, /*#__PURE__*/React.createElement("div", {
1853
1829
  className: "col text-right"
1854
- }, /*#__PURE__*/React__default.createElement("strong", null, company.template.dueDate ? company.template.dueDate : 'Due date')), /*#__PURE__*/React__default.createElement("div", {
1830
+ }, /*#__PURE__*/React.createElement("strong", null, company.template.dueDate ? company.template.dueDate : 'Due date')), /*#__PURE__*/React.createElement("div", {
1855
1831
  className: "col",
1856
1832
  style: {
1857
1833
  maxWidth: '200px'
1858
1834
  }
1859
- }, invoiceDue)), !!document.purchaseOrderNumber && /*#__PURE__*/React__default.createElement("div", {
1835
+ }, invoiceDue)), !!document.purchaseOrderNumber && /*#__PURE__*/React.createElement("div", {
1860
1836
  className: "row"
1861
- }, /*#__PURE__*/React__default.createElement("div", {
1837
+ }, /*#__PURE__*/React.createElement("div", {
1862
1838
  className: "col text-right"
1863
- }, /*#__PURE__*/React__default.createElement("strong", null, company.template.postCode ? company.template.postCode : 'PO #')), /*#__PURE__*/React__default.createElement("div", {
1839
+ }, /*#__PURE__*/React.createElement("strong", null, company.template.postCode ? company.template.postCode : 'PO #')), /*#__PURE__*/React.createElement("div", {
1864
1840
  className: "col",
1865
1841
  style: {
1866
1842
  maxWidth: '200px'
1867
1843
  }
1868
- }, document.purchaseOrderNumber)))), /*#__PURE__*/React__default.createElement("div", {
1844
+ }, document.purchaseOrderNumber)))), /*#__PURE__*/React.createElement("div", {
1869
1845
  className: "invoice-content"
1870
- }, /*#__PURE__*/React__default.createElement("div", {
1846
+ }, /*#__PURE__*/React.createElement("div", {
1871
1847
  className: "table-responsive"
1872
- }, /*#__PURE__*/React__default.createElement("table", {
1848
+ }, /*#__PURE__*/React.createElement("table", {
1873
1849
  className: "table table-invoice"
1874
- }, /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", {
1850
+ }, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", {
1875
1851
  className: "table table-invoice"
1876
- }, /*#__PURE__*/React__default.createElement("th", {
1852
+ }, /*#__PURE__*/React.createElement("th", {
1877
1853
  className: "text-left"
1878
- }, company.template.item ? company.template.item : 'Item'), /*#__PURE__*/React__default.createElement("th", {
1854
+ }, company.template.item ? company.template.item : 'Item'), /*#__PURE__*/React.createElement("th", {
1879
1855
  className: "text-right",
1880
1856
  width: "15%"
1881
- }, document.unitMeasure ? document.unitMeasure : company.template.quantity ? company.template.quantity : 'Quantity'), /*#__PURE__*/React__default.createElement("th", {
1857
+ }, document.unitMeasure ? document.unitMeasure : company.template.quantity ? company.template.quantity : 'Quantity'), /*#__PURE__*/React.createElement("th", {
1882
1858
  className: "text-right",
1883
1859
  width: "15%"
1884
- }, company.template.price ? company.template.price : 'Price'), discountOnItem && /*#__PURE__*/React__default.createElement("th", {
1860
+ }, company.template.price ? company.template.price : 'Price'), discountOnItem && /*#__PURE__*/React.createElement("th", {
1885
1861
  className: "text-right",
1886
1862
  width: "15%"
1887
- }, company.r_dc ? company.r_dc : 'Discount'), /*#__PURE__*/React__default.createElement("th", {
1863
+ }, company.r_dc ? company.r_dc : 'Discount'), /*#__PURE__*/React.createElement("th", {
1888
1864
  className: "text-right",
1889
1865
  width: "15%"
1890
- }, company.template.amount ? company.template.amount : 'Amount'))), /*#__PURE__*/React__default.createElement("tbody", null, document.items.map(function (item, idx) {
1891
- return /*#__PURE__*/React__default.createElement("tr", {
1866
+ }, company.template.amount ? company.template.amount : 'Amount'))), /*#__PURE__*/React.createElement("tbody", null, document.items.map(function (item, idx) {
1867
+ return /*#__PURE__*/React.createElement("tr", {
1892
1868
  key: "item-" + idx
1893
- }, /*#__PURE__*/React__default.createElement("td", null, /*#__PURE__*/React__default.createElement("span", {
1869
+ }, /*#__PURE__*/React.createElement("td", null, /*#__PURE__*/React.createElement("span", {
1894
1870
  className: "text-inverse"
1895
- }, /*#__PURE__*/React__default.createElement("strong", null, item.name || '')), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("small", null, item.description || '')), /*#__PURE__*/React__default.createElement("td", {
1871
+ }, /*#__PURE__*/React.createElement("strong", null, item.name || '')), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("small", null, item.description || '')), /*#__PURE__*/React.createElement("td", {
1896
1872
  className: "text-center"
1897
- }, (item.price || item.price == 0) && (item.quantity || item.quantity == 0) ? item.quantity : ''), /*#__PURE__*/React__default.createElement("td", {
1873
+ }, (item.price || item.price == 0) && (item.quantity || item.quantity == 0) ? item.quantity : ''), /*#__PURE__*/React.createElement("td", {
1898
1874
  className: "text-right"
1899
- }, item.price || item.price == 0 ? FormatCurrency(item.price, company.defaultCurrency, company.language, company.currencyFormat) : ''), discountOnItem && /*#__PURE__*/React__default.createElement("td", {
1875
+ }, item.price || item.price == 0 ? FormatCurrency(item.price, company.defaultCurrency, company.language, company.currencyFormat) : ''), discountOnItem && /*#__PURE__*/React.createElement("td", {
1900
1876
  className: "text-right"
1901
- }, (item.price || item.price == 0) && item.discount ? FormatCurrency(item.dc, company.defaultCurrency, company.language, company.currencyFormat) : ''), /*#__PURE__*/React__default.createElement("td", {
1877
+ }, (item.price || item.price == 0) && item.discount ? FormatCurrency(item.dc, company.defaultCurrency, company.language, company.currencyFormat) : ''), /*#__PURE__*/React.createElement("td", {
1902
1878
  className: "text-right"
1903
1879
  }, item.price || item.price == 0 ? FormatCurrency(item.total, company.defaultCurrency, company.language, company.currencyFormat) : ''));
1904
- })))), /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("hr", null), /*#__PURE__*/React__default.createElement("div", {
1880
+ })))), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("hr", null), /*#__PURE__*/React.createElement("div", {
1905
1881
  className: "row"
1906
- }, /*#__PURE__*/React__default.createElement("div", {
1882
+ }, /*#__PURE__*/React.createElement("div", {
1907
1883
  className: "col-12"
1908
- }, /*#__PURE__*/React__default.createElement("table", {
1884
+ }, /*#__PURE__*/React.createElement("table", {
1909
1885
  className: "table table-borderless table-small"
1910
- }, /*#__PURE__*/React__default.createElement("tbody", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", null), /*#__PURE__*/React__default.createElement("td", {
1886
+ }, /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null), /*#__PURE__*/React.createElement("td", {
1911
1887
  className: "text-right",
1912
1888
  width: "25%"
1913
- }, company.template.subtotal ? company.template.subtotal : 'Subtotal' ), /*#__PURE__*/React__default.createElement("td", {
1889
+ }, company.template.subtotal ? company.template.subtotal : 'Subtotal' ), /*#__PURE__*/React.createElement("td", {
1914
1890
  className: "text-right",
1915
1891
  width: "25%"
1916
- }, /*#__PURE__*/React__default.createElement("strong", null, FormatCurrency(document.total, company.currency, company.language, company.currencyFormat)))), !!document.discount && document.discount != 0 && /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", null), /*#__PURE__*/React__default.createElement("td", {
1892
+ }, /*#__PURE__*/React.createElement("strong", null, FormatCurrency(document.total, company.currency, company.language, company.currencyFormat)))), !!document.discount && document.discount != 0 && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null), /*#__PURE__*/React.createElement("td", {
1917
1893
  className: "text-right",
1918
1894
  width: "25%"
1919
- }, (company.r_dc ? company.r_dc : 'Discount' ) + (document.discountPercentageOption && document.discountPercentage ? ' (' + document.discountPercentage + '%)' : '')), /*#__PURE__*/React__default.createElement("td", {
1895
+ }, (company.r_dc ? company.r_dc : 'Discount' ) + (document.discountPercentageOption && document.discountPercentage ? ' (' + document.discountPercentage + '%)' : '')), /*#__PURE__*/React.createElement("td", {
1920
1896
  className: "text-right",
1921
1897
  width: "25%"
1922
- }, FormatCurrency(document.discount, company.currency, company.language, company.currencyFormat))), !!document.shippingCost && !document.shippingNonTax && /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", null), /*#__PURE__*/React__default.createElement("td", {
1898
+ }, FormatCurrency(document.discount, company.currency, company.language, company.currencyFormat))), !!document.shippingCost && !document.shippingNonTax && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null), /*#__PURE__*/React.createElement("td", {
1923
1899
  className: "text-right",
1924
1900
  width: "25%"
1925
- }, company.template.shipping ? company.template.shipping : 'Shipping' ), /*#__PURE__*/React__default.createElement("td", {
1901
+ }, company.template.shipping ? company.template.shipping : 'Shipping' ), /*#__PURE__*/React.createElement("td", {
1926
1902
  className: "text-right",
1927
1903
  width: "25%"
1928
- }, FormatCurrency(document.shippingCost, company.currency, company.language, company.currencyFormat))), !!document.tax1 && document.tax1_total != 0 && /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", null), /*#__PURE__*/React__default.createElement("td", {
1904
+ }, FormatCurrency(document.shippingCost, company.currency, company.language, company.currencyFormat))), !!document.tax1 && document.tax1_total != 0 && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null), /*#__PURE__*/React.createElement("td", {
1929
1905
  className: "text-right",
1930
1906
  width: "25%"
1931
- }, taxName1 + taxIncluded1 + '(' + document.taxPercentage + '%)'), /*#__PURE__*/React__default.createElement("td", {
1907
+ }, taxName1 + taxIncluded1 + '(' + document.taxPercentage + '%)'), /*#__PURE__*/React.createElement("td", {
1932
1908
  className: "text-right",
1933
1909
  width: "25%"
1934
- }, FormatCurrency(document.tax1_total, company.currency, company.language, company.currencyFormat))), !!document.twoTaxes && !!document.tax2 && document.tax2_total != 0 && /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", null), /*#__PURE__*/React__default.createElement("td", {
1910
+ }, FormatCurrency(document.tax1_total, company.currency, company.language, company.currencyFormat))), !!document.twoTaxes && !!document.tax2 && document.tax2_total != 0 && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null), /*#__PURE__*/React.createElement("td", {
1935
1911
  className: "text-right",
1936
1912
  width: "25%"
1937
- }, taxName2 + taxIncluded2 + '(' + document.taxPercentage2 + '%)'), /*#__PURE__*/React__default.createElement("td", {
1913
+ }, taxName2 + taxIncluded2 + '(' + document.taxPercentage2 + '%)'), /*#__PURE__*/React.createElement("td", {
1938
1914
  className: "text-right",
1939
1915
  width: "25%"
1940
- }, FormatCurrency(document.tax2_total, company.currency, company.language, company.currencyFormat))), !!document.shippingCost && document.shippingNonTax && /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", null), /*#__PURE__*/React__default.createElement("td", {
1916
+ }, FormatCurrency(document.tax2_total, company.currency, company.language, company.currencyFormat))), !!document.shippingCost && document.shippingNonTax && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null), /*#__PURE__*/React.createElement("td", {
1941
1917
  className: "text-right",
1942
1918
  width: "25%"
1943
- }, company.r_sp ? company.r_sp : 'Shipping' ), /*#__PURE__*/React__default.createElement("td", {
1919
+ }, company.r_sp ? company.r_sp : 'Shipping' ), /*#__PURE__*/React.createElement("td", {
1944
1920
  className: "text-right",
1945
1921
  width: "25%"
1946
- }, FormatCurrency(document.shippingCost, company.currency, company.language, company.currencyFormat))), !!document.taxInclusive && /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", null), /*#__PURE__*/React__default.createElement("td", {
1922
+ }, FormatCurrency(document.shippingCost, company.currency, company.language, company.currencyFormat))), !!document.taxInclusive && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null), /*#__PURE__*/React.createElement("td", {
1947
1923
  className: "text-right",
1948
1924
  width: "25%",
1949
1925
  style: {
1950
1926
  borderTop: '1px solid #ddd'
1951
1927
  }
1952
- }, company.template.net ? company.template.net : 'Net' ), /*#__PURE__*/React__default.createElement("td", {
1928
+ }, company.template.net ? company.template.net : 'Net' ), /*#__PURE__*/React.createElement("td", {
1953
1929
  className: "text-right",
1954
1930
  width: "25%",
1955
1931
  style: {
1956
1932
  borderTop: '1px solid #ddd'
1957
1933
  }
1958
- }, FormatCurrency(document.total + (document.taxInclusive ? 0 : document.tax1_total || 0) + (document.taxInclusive2 ? 0 : document.tax2_total || 0), company.currency, company.language, company.currencyFormat))), document.type == 'invoice' || document.type != 'invoice' && (document.taxDeductible || document.twoTaxes && document.tax2 > 0 && document.taxDeductible2) && /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", null), /*#__PURE__*/React__default.createElement("td", {
1934
+ }, FormatCurrency(document.total + (document.taxInclusive ? 0 : document.tax1_total || 0) + (document.taxInclusive2 ? 0 : document.tax2_total || 0), company.currency, company.language, company.currencyFormat))), document.type == 'invoice' || document.type != 'invoice' && (document.taxDeductible || document.twoTaxes && document.tax2 > 0 && document.taxDeductible2) && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null), /*#__PURE__*/React.createElement("td", {
1959
1935
  className: "text-right",
1960
1936
  width: "25%",
1961
1937
  style: {
1962
1938
  borderBottom: '1px solid #ddd'
1963
1939
  }
1964
- }, company.template.total ? company.template.total : 'Total' ), /*#__PURE__*/React__default.createElement("td", {
1940
+ }, company.template.total ? company.template.total : 'Total' ), /*#__PURE__*/React.createElement("td", {
1965
1941
  className: "text-right",
1966
1942
  width: "25%",
1967
1943
  style: {
1968
1944
  borderBottom: '1px solid #ddd'
1969
1945
  }
1970
- }, FormatCurrency(document.subTotal ? document.subTotal : 0, company.currency, company.language, company.currencyFormat))), !!document.surchargeAmount && /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("td", null), /*#__PURE__*/React__default.createElement("td", {
1946
+ }, FormatCurrency(document.subTotal ? document.subTotal : 0, company.currency, company.language, company.currencyFormat))), !!document.surchargeAmount && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", null), /*#__PURE__*/React.createElement("td", {
1971
1947
  className: "text-right",
1972
1948
  width: "25%"
1973
- }, 'Credit Card Surcharge' ), /*#__PURE__*/React__default.createElement("td", {
1949
+ }, 'Credit Card Surcharge' ), /*#__PURE__*/React.createElement("td", {
1974
1950
  className: "text-right",
1975
1951
  width: "25%"
1976
1952
  }, FormatCurrency(document.surchargeAmount, company.currency, company.language, company.currencyFormat))), !!document.paymentAmount && document.payments && document.payments.map(function (payment, idx, index) {
1977
- return /*#__PURE__*/React__default.createElement("tr", {
1953
+ return /*#__PURE__*/React.createElement("tr", {
1978
1954
  key: "paymeny-" + idx
1979
- }, /*#__PURE__*/React__default.createElement("td", null), /*#__PURE__*/React__default.createElement("td", {
1955
+ }, /*#__PURE__*/React.createElement("td", null), /*#__PURE__*/React.createElement("td", {
1980
1956
  className: "text-right",
1981
1957
  width: "25%"
1982
- }, payment_on(formatDate(payment.date), payment.brand)), /*#__PURE__*/React__default.createElement("td", {
1958
+ }, payment_on(formatDate(payment.date), payment.brand)), /*#__PURE__*/React.createElement("td", {
1983
1959
  className: "text-right",
1984
1960
  width: "25%"
1985
1961
  }, FormatCurrency(payment.amount, company.currency, company.language, company.currencyFormat)));
1986
- })))))), /*#__PURE__*/React__default.createElement("div", {
1962
+ })))))), /*#__PURE__*/React.createElement("div", {
1987
1963
  className: "invoice-price"
1988
- }, /*#__PURE__*/React__default.createElement("div", {
1964
+ }, /*#__PURE__*/React.createElement("div", {
1989
1965
  className: "invoice-price-left"
1990
- }, /*#__PURE__*/React__default.createElement("div", {
1966
+ }, /*#__PURE__*/React.createElement("div", {
1991
1967
  className: "invoice-price-row"
1992
- })), /*#__PURE__*/React__default.createElement("div", {
1968
+ })), /*#__PURE__*/React.createElement("div", {
1993
1969
  className: "invoice-price-right"
1994
- }, /*#__PURE__*/React__default.createElement("small", null, document.ty == 1 ? company.template.amountDue ? company.template.amountDue : 'Amount Due' : company.template.grandTotal ? company.template.grandTotal : 'Grand total' ), /*#__PURE__*/React__default.createElement("span", {
1970
+ }, /*#__PURE__*/React.createElement("small", null, document.ty == 1 ? company.template.amountDue ? company.template.amountDue : 'Amount Due' : company.template.grandTotal ? company.template.grandTotal : 'Grand total' ), /*#__PURE__*/React.createElement("span", {
1995
1971
  className: "f-w-600"
1996
- }, FormatCurrency(document.amountDue, company.currency, company.language, company.currencyFormat)))), company.hasPaymentInstruction && document.amountDue > 0 && /*#__PURE__*/React__default.createElement("h2", null, company.template.payInt ? company.template.payInt : 'Payment Instruction' ), company.paymentInstruction1 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, company.paymentInstruction1, /*#__PURE__*/React__default.createElement("br", null)), company.paymentInstruction2 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, company.paymentInstruction2, /*#__PURE__*/React__default.createElement("br", null)), company.paymentInstruction3 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, company.paymentInstruction3, /*#__PURE__*/React__default.createElement("br", null)), /*#__PURE__*/React__default.createElement("div", {
1972
+ }, FormatCurrency(document.amountDue, company.currency, company.language, company.currencyFormat)))), company.hasPaymentInstruction && document.amountDue > 0 && /*#__PURE__*/React.createElement("h2", null, company.template.payInt ? company.template.payInt : 'Payment Instruction' ), company.paymentInstruction1 && /*#__PURE__*/React.createElement(React.Fragment, null, company.paymentInstruction1, /*#__PURE__*/React.createElement("br", null)), company.paymentInstruction2 && /*#__PURE__*/React.createElement(React.Fragment, null, company.paymentInstruction2, /*#__PURE__*/React.createElement("br", null)), company.paymentInstruction3 && /*#__PURE__*/React.createElement(React.Fragment, null, company.paymentInstruction3, /*#__PURE__*/React.createElement("br", null)), /*#__PURE__*/React.createElement("div", {
1997
1973
  className: "mt-4"
1998
- }, document.note && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, document.note && /*#__PURE__*/React__default.createElement("div", {
1974
+ }, document.note && /*#__PURE__*/React.createElement(React.Fragment, null, document.note && /*#__PURE__*/React.createElement("div", {
1999
1975
  className: "mt-4"
2000
- }, /*#__PURE__*/React__default.createElement("small", null, /*#__PURE__*/React__default.createElement("strong", null, company.template.note ? company.template.note : 'Note' )), /*#__PURE__*/React__default.createElement("div", {
1976
+ }, /*#__PURE__*/React.createElement("small", null, /*#__PURE__*/React.createElement("strong", null, company.template.note ? company.template.note : 'Note' )), /*#__PURE__*/React.createElement("div", {
2001
1977
  dangerouslySetInnerHTML: {
2002
1978
  __html: nl2br(document.note)
2003
1979
  }
2004
- })), document.tc && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("small", null, /*#__PURE__*/React__default.createElement("strong", null, company.template.Tos ? company.template.Tos : 'Terms' )), /*#__PURE__*/React__default.createElement("div", {
1980
+ })), document.tc && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("small", null, /*#__PURE__*/React.createElement("strong", null, company.template.Tos ? company.template.Tos : 'Terms' )), /*#__PURE__*/React.createElement("div", {
2005
1981
  dangerouslySetInnerHTML: {
2006
1982
  __html: nl2br(document.tc)
2007
1983
  }
2008
- })))), document.signDate || document.customerSignature || customerSignBase64 && /*#__PURE__*/React__default.createElement("hr", {
1984
+ })))), document.signDate || document.customerSignature || customerSignBase64 && /*#__PURE__*/React.createElement("hr", {
2009
1985
  className: "mt-5"
2010
- }, /*#__PURE__*/React__default.createElement("div", null, company.template.bySigning || 'By signing this document, the customer agrees to the services and conditions described in this document.' || ''), /*#__PURE__*/React__default.createElement("div", {
1986
+ }, /*#__PURE__*/React.createElement("div", null, company.template.bySigning || 'By signing this document, the customer agrees to the services and conditions described in this document.' || ''), /*#__PURE__*/React.createElement("div", {
2011
1987
  className: "row mt-4"
2012
- }, signatureContainer || clientSignature || '', signatureContainer && clientSignature || '')), /*#__PURE__*/React__default.createElement("div", {
1988
+ }, signatureContainer || clientSignature || '', signatureContainer && clientSignature || '')), /*#__PURE__*/React.createElement("div", {
2013
1989
  style: {
2014
1990
  textAlign: 'center'
2015
1991
  }
2016
1992
  }, attachments && attachments.map(function (photo, idx) {
2017
- return /*#__PURE__*/React__default.createElement("div", {
1993
+ return /*#__PURE__*/React.createElement("div", {
2018
1994
  key: "photo-" + idx
2019
- }, /*#__PURE__*/React__default.createElement("img", {
1995
+ }, /*#__PURE__*/React.createElement("img", {
2020
1996
  src: photo.imageBase64
2021
- }), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("strong", null, photo.text)), /*#__PURE__*/React__default.createElement("div", null, photo.description));
1997
+ }), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("strong", null, photo.text)), /*#__PURE__*/React.createElement("div", null, photo.description));
2022
1998
  }))), lang.empowered_by));
2023
1999
  };
2024
2000
 
2001
+ function _extends() {
2002
+ _extends = Object.assign || function (target) {
2003
+ for (var i = 1; i < arguments.length; i++) {
2004
+ var source = arguments[i];
2005
+
2006
+ for (var key in source) {
2007
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
2008
+ target[key] = source[key];
2009
+ }
2010
+ }
2011
+ }
2012
+
2013
+ return target;
2014
+ };
2015
+
2016
+ return _extends.apply(this, arguments);
2017
+ }
2018
+
2019
+ function _unsupportedIterableToArray(o, minLen) {
2020
+ if (!o) return;
2021
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
2022
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2023
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2024
+ if (n === "Map" || n === "Set") return Array.from(o);
2025
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
2026
+ }
2027
+
2028
+ function _arrayLikeToArray(arr, len) {
2029
+ if (len == null || len > arr.length) len = arr.length;
2030
+
2031
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
2032
+
2033
+ return arr2;
2034
+ }
2035
+
2036
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
2037
+ var it;
2038
+
2039
+ if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
2040
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
2041
+ if (it) o = it;
2042
+ var i = 0;
2043
+ return function () {
2044
+ if (i >= o.length) return {
2045
+ done: true
2046
+ };
2047
+ return {
2048
+ done: false,
2049
+ value: o[i++]
2050
+ };
2051
+ };
2052
+ }
2053
+
2054
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2055
+ }
2056
+
2057
+ it = o[Symbol.iterator]();
2058
+ return it.next.bind(it);
2059
+ }
2060
+
2061
+ var invoiceHtml = (function (_ref) {
2062
+ var invoice = _ref.invoice,
2063
+ lang = _ref.lang,
2064
+ referral = _ref.referral,
2065
+ _ref$companyLogoBase = _ref.companyLogoBase,
2066
+ companyLogoBase = _ref$companyLogoBase === void 0 ? 'https://s3.amazonaws.com/bookipi/' : _ref$companyLogoBase;
2067
+ var company = invoice.company;
2068
+ var document = invoice.document;
2069
+ var logoBase64 = invoice.logoBase64;
2070
+ var attachments = invoice.attachments || [];
2071
+ var customerSignBase64 = invoice.customerSignBase64;
2072
+ var signatureBase64 = invoice.signatureBase64;
2073
+ var logoPath = invoice.logoPath || company.logoExists && "" + companyLogoBase + company._id + "/logo.jpg?" + new Date().getTime();
2074
+ var documentName = null;
2075
+
2076
+ if (company.doc && company.doc[document.ty] && company.doc[document.ty].n) {
2077
+ documentName = company.doc[document.ty].n;
2078
+ } else {
2079
+ if (document.ty === 1) {
2080
+ documentName = company.r_inv ? company.r_inv : lang['document'];
2081
+ } else if (document.ty === 2) {
2082
+ documentName = company.r_crd ? company.r_crd : lang['creditnote'];
2083
+ } else {
2084
+ documentName = company.r_est ? company.r_est : lang['Estimate'];
2085
+ }
2086
+ }
2087
+
2088
+ var logoContainer = null;
2089
+
2090
+ if (logoPath) {
2091
+ logoContainer = "<img src=\"" + logoPath + "\" id=\"invoice-logo\" class=\"img-fluid\" style=\"padding-top: 10px;width: " + (company.ls ? company.ls * 1.8 + 'px' : '250px') + ";height:auto;\">";
2092
+ } else if (logoBase64) {
2093
+ logoContainer = "<img\n src=\"" + logoBase64 + "\"\n id='invoice-logo'\n className='img-fluid'\n style=\"width:" + (company.ls * 2 || 200) + "px, height: 'auto'\"\n />";
2094
+ } else {
2095
+ logoContainer = " <h1>" + company.c + " </h1>";
2096
+ }
2097
+
2098
+ console.log(company);
2099
+ console.log(document);
2100
+ var timeZone = company.tz;
2101
+
2102
+ var formatDate = function formatDate(date) {
2103
+ var d = moment(date);
2104
+
2105
+ if (timeZone) {
2106
+ d = d.tz(timeZone);
2107
+ }
2108
+
2109
+ return d.format(company.df === 0 ? 'D MMM YYYY' : company.df === 1 ? 'DD/MM/YYYY' : company.df === 3 ? 'MM/D/YYYY' : company.df === 4 ? 'YYYY/MM/DD' : 'MMM D, YYYY');
2110
+ };
2111
+
2112
+ var companyAddress = {
2113
+ address1: company && (company.address && company.address.address1 || company.address1) || null,
2114
+ address2: company && (company.address && company.address.address2 || company.address2) || null,
2115
+ address3: company && (company.address && company.address.address3 || company.address3) || null,
2116
+ city: company && company.address && company.address.city || null,
2117
+ state: company && company.address && company.address.state || null,
2118
+ zip: company && company.address && company.address.zip || null,
2119
+ country: company && company.address && company.address.country || null
2120
+ };
2121
+ var customer = document.cu;
2122
+ console.log("customer");
2123
+ console.log(customer);
2124
+ console.log("company");
2125
+ console.log(company);
2126
+ var customerAddress = customer.address || {};
2127
+ var customerShippingAddress = customer.shippingAddress || {};
2128
+ var shippingAddressExists = customerShippingAddress.address1 || customerShippingAddress.address2 || customerShippingAddress.address3 || customerShippingAddress.city || customerShippingAddress.state || customerShippingAddress.zip || document.asi;
2129
+ var taxPercent1 = document.tp ? parseFloat(document.tp) : 0;
2130
+ var taxPercent2 = document.tp2 ? parseFloat(document.tp2) : 0;
2131
+ var discountOnItem = false;
2132
+
2133
+ for (var _iterator = _createForOfIteratorHelperLoose(document.it), _step; !(_step = _iterator()).done;) {
2134
+ var item = _step.value;
2135
+
2136
+ if (item.dc && item.dc > 0) {
2137
+ discountOnItem = true;
2138
+ }
2139
+
2140
+ if (taxPercent1 > 0 && item.tx) {
2141
+ if (document.ti && !document.t1d) {
2142
+ var totalTaxRate = void 0;
2143
+
2144
+ if (document.ttx && !document.t2d) {
2145
+ totalTaxRate = taxPercent1 + taxPercent2;
2146
+ } else {
2147
+ totalTaxRate = taxPercent1;
2148
+ }
2149
+
2150
+ item.taxAmount1 = item.t * (1 - 1 / (1 + totalTaxRate / 100)) * (taxPercent1 / totalTaxRate);
2151
+ } else {
2152
+ item.taxAmount1 = item.t * taxPercent1 / 100;
2153
+ }
2154
+ }
2155
+
2156
+ if (document.ttx && taxPercent2 > 0 && item.tx2) {
2157
+ if (document.ti && !document.t2d) {
2158
+ var _totalTaxRate = taxPercent1 + taxPercent2;
2159
+
2160
+ item.taxAmount2 = item.t * (1 - 1 / (1 + _totalTaxRate / 100)) * (taxPercent2 / _totalTaxRate);
2161
+ } else {
2162
+ item.taxAmount2 = item.t * taxPercent2 / 100;
2163
+ }
2164
+ }
2165
+ }
2166
+
2167
+ var itemsContainer = '';
2168
+
2169
+ for (var _iterator2 = _createForOfIteratorHelperLoose(document.it), _step2; !(_step2 = _iterator2()).done;) {
2170
+ var _item = _step2.value;
2171
+ 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>");
2172
+ }
2173
+
2174
+ var taxName1;
2175
+ var taxIncluded1;
2176
+ var taxName2;
2177
+ var taxIncluded2;
2178
+
2179
+ if (document.tx != 0) {
2180
+ taxName1 = document.tn ? document.tn : 'Tax';
2181
+ taxIncluded1 = document.ti ? ' ' + (company.r_ic ? company.r_ic : lang["included"]) : ' ';
2182
+ }
2183
+
2184
+ if (document.ttx && document.tx2 != 0) {
2185
+ taxName2 = document.tn2 ? document.tn2 : 'Tax 2';
2186
+ taxIncluded2 = document.ti ? ' ' + (company.r_ic ? company.r_ic : lang["included"]) : ' ';
2187
+ }
2188
+
2189
+ function payment_on(date, brand, endNumber) {
2190
+ if (brand && endNumber) {
2191
+ return 'Paid on ' + date + ' using ' + brand + ' ending in ' + endNumber;
2192
+ } else if (brand && !endNumber) {
2193
+ return 'Paid on ' + date + ' using ' + brand;
2194
+ } else {
2195
+ return 'Paid on ' + date;
2196
+ }
2197
+ }
2198
+
2199
+ var paymentContainer = '';
2200
+
2201
+ for (var _iterator3 = _createForOfIteratorHelperLoose(document.pm), _step3; !(_step3 = _iterator3()).done;) {
2202
+ var payment = _step3.value;
2203
+ 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>");
2204
+ }
2205
+
2206
+ var paymentOn = company.pi && document.ty === 1 && (company.p1 || company.p2 || company.p3);
2207
+ var attachmentContainer = '';
2208
+
2209
+ for (var i = 0; i < attachments.length; i++) {
2210
+ 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>");
2211
+ }
2212
+
2213
+ 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>" || '';
2214
+ 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()) : '( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp/ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp)'}</div>\n </div>" || '';
2215
+ 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>&nbsp;</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>" : 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";
2216
+ });
2217
+
2218
+ 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]]);
2219
+
2220
+ var ItemCompat = function ItemCompat(item) {
2221
+ var mapping = new Map([['name', 'n'], ['description', 'dsc'], ['price', 'p'], ['quantity', 'q'], ['tax', 'tx'], ['tax2', 'tx2'], ['discount', 'dc'], ['total', 't']]);
2222
+ return Object.fromEntries(Object.entries(item).map(function (_ref) {
2223
+ var k = _ref[0],
2224
+ v = _ref[1];
2225
+ return [mapping.get(k) || k, v];
2226
+ }));
2227
+ };
2228
+
2229
+ var PaymentCompat = function PaymentCompat(payment) {
2230
+ var mapping = new Map([['amount', 'a'], ['date', 'd'], ['chargeId', 'cid'], ['surchargeRate', 'sr'], ['last4', 'l'], ['brand', 'b']]);
2231
+ return Object.fromEntries(Object.entries(payment).map(function (_ref2) {
2232
+ var k = _ref2[0],
2233
+ v = _ref2[1];
2234
+ return [mapping.get(k) || k, v];
2235
+ }));
2236
+ };
2237
+
2238
+ var CustomerCompat = function CustomerCompat(customer) {
2239
+ 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']]);
2240
+ return Object.fromEntries(Object.entries(customer).map(function (_ref3) {
2241
+ var k = _ref3[0],
2242
+ v = _ref3[1];
2243
+ return [mapping.get(k) || k, v];
2244
+ }));
2245
+ };
2246
+
2247
+ var InvoiceCompat = function InvoiceCompat(doc) {
2248
+ 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']]);
2249
+ return Object.fromEntries(Object.entries(doc).map(function (_ref4) {
2250
+ var k = _ref4[0],
2251
+ v = _ref4[1];
2252
+ var mapV = mapping.get(k);
2253
+
2254
+ if (!mapV) {
2255
+ return [k, v];
2256
+ } else if (!Array.isArray(mapV)) {
2257
+ return [mapV || k, v];
2258
+ } else {
2259
+ if (Array.isArray(v)) {
2260
+ return [mapV[0] || k, v.map(function (val) {
2261
+ return mapV[1](val);
2262
+ })];
2263
+ } else {
2264
+ return [mapV[0] || k, mapV[1](v)];
2265
+ }
2266
+ }
2267
+ }));
2268
+ };
2269
+
2270
+ var TemplateCompat = function TemplateCompat(template) {
2271
+ console.log('template');
2272
+ console.log(template);
2273
+ 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']]);
2274
+ return Object.fromEntries(Object.entries(template).map(function (_ref5) {
2275
+ var k = _ref5[0],
2276
+ v = _ref5[1];
2277
+ return [mapping.get(k) || k, v];
2278
+ }));
2279
+ };
2280
+
2281
+ var CompanyCompat = function CompanyCompat(doc) {
2282
+ console.log('company');
2283
+ console.log(doc);
2284
+ 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']]);
2285
+ var rootMapping = new Map([['template', TemplateCompat]]);
2286
+ var newCompany = Object.fromEntries(Object.entries(doc).map(function (_ref6) {
2287
+ var k = _ref6[0],
2288
+ v = _ref6[1];
2289
+ return [mapping.get(k) || k, v];
2290
+ }));
2291
+ var subDoc = {};
2292
+ Object.entries(newCompany).forEach(function (_ref7) {
2293
+ var k = _ref7[0],
2294
+ v = _ref7[1];
2295
+
2296
+ if (rootMapping.get(k)) {
2297
+ var mapped = rootMapping.get(k)(v);
2298
+ delete mapped.__typename;
2299
+ subDoc = _extends({}, subDoc, mapped);
2300
+ }
2301
+ });
2302
+ newCompany = _extends({}, newCompany, subDoc);
2303
+
2304
+ var documentDefinitionCompat = function documentDefinitionCompat(doc) {
2305
+ if (!doc.documentDefinitions) {
2306
+ return {
2307
+ value: []
2308
+ };
2309
+ }
2310
+
2311
+ doc.ms = [];
2312
+ doc.pf = [];
2313
+ doc.tc = [];
2314
+ var ret = doc.documentDefinitions.map(function (def, idx) {
2315
+ var enabled = false;
2316
+
2317
+ if (typeof def.enabled === 'undefined') {
2318
+ if (def.name) {
2319
+ enabled = true;
2320
+ }
2321
+ } else {
2322
+ enabled = def.enabled;
2323
+ }
2324
+
2325
+ var obj = {
2326
+ n: def.name,
2327
+ enabled: enabled,
2328
+ ty: docTypeMapping.get(def.type),
2329
+ note: def.note,
2330
+ docType: def.docType
2331
+ };
2332
+ doc.ms.push(obj.defaultMessage);
2333
+ doc.pf.push(obj.prefix);
2334
+ doc.tc.push(obj.terms);
2335
+ return obj;
2336
+ });
2337
+ return ret;
2338
+ };
2339
+
2340
+ newCompany.documentDefinitions = documentDefinitionCompat(newCompany);
2341
+ return newCompany;
2342
+ };
2343
+
2344
+ var defaultLang = {
2345
+ terms: "Terms and conditions",
2346
+ privacy: "Privacy Policy",
2347
+ firstname: "First Name",
2348
+ lastname: "Last Name",
2349
+ optional: "Optional",
2350
+ whats_name: "What's your name?",
2351
+ username: "USERNAME",
2352
+ already_have_id: "Already have a user ID?",
2353
+ submit: "Submit",
2354
+ password: "Password",
2355
+ company_name_required: "Company name is required.",
2356
+ email_required: "Email address is required.",
2357
+ email_not_valid: "Email address is invalid.",
2358
+ password_required: "Password is required.",
2359
+ password_length_check: "Password must be at least 8 characters.",
2360
+ get_started_with_google: "Get Started with Google",
2361
+ forgot_password: "Forgot Password",
2362
+ signup: "Sign Up",
2363
+ login: "Log In",
2364
+ login_with_google: "Log in with Google",
2365
+ reset_password: "Reset your password",
2366
+ enter_email_to_reset: "Please enter your email address and we'll send you an email to reset your password.",
2367
+ send_email: "Send Email",
2368
+ next: "Next",
2369
+ done: "Done",
2370
+ upload_logo: "Upload your logo",
2371
+ "export": "Export",
2372
+ export_to_csv: "Export data to CSV",
2373
+ time_period: "Time Period",
2374
+ start_date: "Start Date",
2375
+ end_date: "End Date",
2376
+ select_action: "Select Action",
2377
+ more: "More",
2378
+ "new": "New",
2379
+ cancel: "Cancel",
2380
+ save: "Save",
2381
+ menu: "Menu",
2382
+ options: "Options",
2383
+ invoice: "Invoice",
2384
+ estimate: "Estimate",
2385
+ customer: "Customer",
2386
+ settings: "Settings",
2387
+ support: "Support",
2388
+ desktop_app: "MAC/PC App",
2389
+ logout: "Logout",
2390
+ overdue: "Overdue",
2391
+ paid: "Paid",
2392
+ partial: "Partial",
2393
+ unpaid: "Unpaid",
2394
+ sent: "Sent",
2395
+ saved: "Saved",
2396
+ read: "Read",
2397
+ undelivered: "Undelivered",
2398
+ search: "Search",
2399
+ details: "Details",
2400
+ number: "Number",
2401
+ prefix: "Prefix",
2402
+ date: "Date",
2403
+ due_in: "Due in (days)",
2404
+ sameday: "Same day",
2405
+ due_date: "Due date",
2406
+ remove_due_date: "Remove due date",
2407
+ due_on: "Due on",
2408
+ po_number: "PO #",
2409
+ enter_date: "Enter date",
2410
+ add_customer: "Add Customer",
2411
+ item: "Item",
2412
+ add_item: "Add Item",
2413
+ total: "Total",
2414
+ subtotal: "Subtotal",
2415
+ discount: "Discount",
2416
+ amount_due: "Amount Due",
2417
+ grand_total: "Grand Total",
2418
+ sign: "Sign",
2419
+ mysign: "My Signature",
2420
+ clientsign: "Client's Signature",
2421
+ note: "Note",
2422
+ signed_on: "Signed on",
2423
+ leave_with_out_saving: "Are you sure you want to leave without saving?",
2424
+ included: "included",
2425
+ company_name: "Company Name",
2426
+ email: "Email",
2427
+ phone_number: "Phone Number",
2428
+ address: "Address",
2429
+ import_contact: "Import Contact",
2430
+ from_mobile_contacts: "From mobile contacts",
2431
+ from_saved_customers: "From saved customers",
2432
+ "import": "Import",
2433
+ item_name: "Name",
2434
+ price: "Price",
2435
+ quantity: "Quantity",
2436
+ taxable: "Taxable",
2437
+ non_taxable: "Non-taxable",
2438
+ description: "Description",
2439
+ amount: "Amount",
2440
+ save_for_future_invoices: "Save for future invoices",
2441
+ tax_discount: "Tax & Discount",
2442
+ tax: "Tax",
2443
+ tax_label: "Tax label",
2444
+ tax_rate: "Tax %",
2445
+ second: "Second",
2446
+ inclusive: "Inclusive",
2447
+ deductible: "Deductible",
2448
+ none: "None",
2449
+ preview: "Preview",
2450
+ send: "Send",
2451
+ payment: "Payment",
2452
+ copy: "Copy",
2453
+ print: "Print",
2454
+ share: "Share",
2455
+ record: "Record",
2456
+ recipient: "Recipient",
2457
+ message: "Message",
2458
+ record_payment: "Record Payment",
2459
+ get_paid_with_credit_card: "Get paid with credit card",
2460
+ fully_paid: "Fully paid",
2461
+ amount_paid: "Amount paid",
2462
+ date_paid: "Date paid",
2463
+ signature: "Signature",
2464
+ add_photo: "Add Photo",
2465
+ logo: "Logo",
2466
+ company: "Company",
2467
+ company_info: "Company Information",
2468
+ payment_instruction: "Payment Instruction",
2469
+ accept_debit_or_credit_card: "Accept Credit Card",
2470
+ currency: "Currency",
2471
+ default_note: "Default Note",
2472
+ default_email_message: "Default Email Message",
2473
+ Send_me_a_copy: "Send me a copy",
2474
+ rename_fields: "Rename Fields",
2475
+ general: "General",
2476
+ passcode: "Passcode",
2477
+ set_passcode: "Set your passcode",
2478
+ language: "Language",
2479
+ purchase_subscription: "Purchase Subscription",
2480
+ credit_card_surcharge: "Credit Card Surcharge",
2481
+ click_to_pay: "Please click the following link if you would like to pay with a credit card.",
2482
+ imposing_surcharge_available: "Imposing surcharge to your customers available",
2483
+ surcharge_rate: "Surcharge Rate",
2484
+ surcharge: "Surcharge",
2485
+ see_transaction_fees: "See available countries and fees",
2486
+ prepare_followings: "Prepare the followings",
2487
+ your_bank_and_website: "1.Your bank account details \n2.Website address (any web link related to your business. eg. Blog, Facebook page, LinkedIn, or etc)",
2488
+ "delete": "Delete",
2489
+ surcharge_shoulbe_be_0_5: "Surcharge rate should be between 0% and 5%.",
2490
+ email_address_on_the_invoice: "Email address on the invoice",
2491
+ display_payment_instruction: "Display payment instruction",
2492
+ symbol_at_start: "Symbol at start",
2493
+ tax_info: "Tax Information",
2494
+ bn_abbreviation: "Abbreviation",
2495
+ business_number: "Business Number",
2496
+ name: "Name",
2497
+ color_theme: "Color Theme",
2498
+ set_color_theme: "Set color theme",
2499
+ date_format: "Date Format",
2500
+ error: "Error!",
2501
+ are_you_sure: "Are you sure?",
2502
+ customer_required: "Customer Required",
2503
+ item_required: "Item Required",
2504
+ subscribe_now: "Subscribe Now",
2505
+ subscribe: "Subscribe",
2506
+ later: "Later",
2507
+ problem_processing: "Sorry, there was a problem processing your request. Please try again.",
2508
+ yes: "Yes!",
2509
+ no: "No",
2510
+ sub_status: "Subscription Status",
2511
+ sub_info: "Subscription Information",
2512
+ subscribed_on: "You have already subscribed to Bookipi on ",
2513
+ enjoying_bookipi: "Enjoying Bookipi?",
2514
+ not_really: "Not really",
2515
+ giving_me_some_feedback: "Would you mind giving us some feedback?",
2516
+ rate_us: "Rate us",
2517
+ no_thanks: "No, thanks",
2518
+ ok_sure: "Ok, sure!",
2519
+ dont_ask_me_again: "Don't ask me again",
2520
+ want_send_email: "Would you like to send a receipt?",
2521
+ provide_email_for_receipt: "Provide email address to send a receipt.",
2522
+ receipt_sent_successfully: "Receipt has been sent successfully.",
2523
+ sent_successfully: "Sent successfully.",
2524
+ thank_you_for_subscribing: "Thank you for subscribing to Bookipi. Enjoy your business journey with us!",
2525
+ by_signing: "By signing this document, the customer agrees to the services and conditions described in this document.",
2526
+ bill_to: "BILL TO",
2527
+ ship_to: "SHIP TO",
2528
+ shipping: "Shipping",
2529
+ shipping_address: "Shipping Address",
2530
+ add_info: "Additional information",
2531
+ add_info_ci: "Additional information",
2532
+ add_recipients_email: "Please add recipient's email address.",
2533
+ Recipient_email_not_your_email: "Recipient's email address shouldn't be your email address.",
2534
+ thank_you_for_your_business: "Thank you for your business.",
2535
+ alert: "Alert",
2536
+ payment_greater_than_zero: "Payment amount must be greater than zero",
2537
+ overdue_reminder: "Overdue Reminder",
2538
+ overdue_msg: "This is a reminder that your payment is now overdue. If you have already sent your payment, please disregard this email.",
2539
+ tips: "Helpful tips",
2540
+ pull_down_refresh: "Pull down to refresh data",
2541
+ send_reminder: "Send a reminder for overdue invoices",
2542
+ "40_inv_yr": "FREE 40 invoices & estimates per year",
2543
+ "5_in_30": "Max. 5 within 30 days",
2544
+ you_user: function you_user(xx) {
2545
+ return "You are a " + xx + " user";
2546
+ },
2547
+ how_about_rating: function how_about_rating(appStore) {
2548
+ return "Would you like to rate us on " + appStore + "?";
2549
+ },
2550
+ give_5: "Give us a 5 star rating",
2551
+ payment_on: function payment_on(date, brand, endNumber) {
2552
+ if (brand && endNumber) {
2553
+ return "Paid on " + date + " using " + brand + " ending in " + endNumber;
2554
+ } else if (brand && !endNumber) {
2555
+ return "Paid on " + date + " using " + brand;
2556
+ } else {
2557
+ return "Paid on " + date;
2558
+ }
2559
+ },
2560
+ sign_doc_appear: "“Sign the document“ button will appear on sent email.",
2561
+ max_10_sign_free: "Maximum of 10 client's signatures for free",
2562
+ reached_max_limit: "You have reached the maximum limit.\n\nTo use this function, please subscribe at bookipi.com.",
2563
+ click_to_sign: "Click below to sign.",
2564
+ not_found: function not_found(q) {
2565
+ return "We couldn't find anything for “" + q + "“";
2566
+ },
2567
+ get_signature: "Get Signature",
2568
+ sign_directly: "Your client can also sign directly on the app.",
2569
+ how_to_sign: '(Tap on "More" > "Get Signature")',
2570
+ enter_paypal: "Enter a PayPal email address",
2571
+ receive_pay_online: "Receive Payment Online",
2572
+ accept_paypal: "Accept PayPal",
2573
+ payment_option: "Payment Option",
2574
+ customer_payment_option: "Customer Payment Option",
2575
+ already_signed: "This document has already been signed",
2576
+ add_note_question: "Would you like to add the default note to the note field?",
2577
+ freq_used: "Frequently used",
2578
+ empty: "It's empty",
2579
+ notification: "Notification",
2580
+ notified_once_read: "Would you like to get notified once your customer read your invoice?",
2581
+ tap_to_add: "Tap on + button to add a document",
2582
+ by_date: "By Date",
2583
+ by_no: "By Number",
2584
+ call: "Call",
2585
+ add_new_type: "Add a new category",
2586
+ name_doc: "Document name",
2587
+ type_doc_name: "Type the name of the document you want to create.",
2588
+ create: "Create",
2589
+ copy_to: "Copy to",
2590
+ select: "Select",
2591
+ record_full: "Record as fully paid",
2592
+ change_unit: "Change Unit of measure",
2593
+ photos: "Photos",
2594
+ restore: "Restore",
2595
+ move_to_trash: "Move to trash",
2596
+ moved_to_trash: "Moved to trash",
2597
+ custom: "Custom",
2598
+ last_1: "Last 1 year",
2599
+ user_acc: "User Account",
2600
+ sent_to_reset: function sent_to_reset(e) {
2601
+ return "Email has been sent to “" + e + "” to reset your password.";
2602
+ },
2603
+ trashed_item: "Trashed Item",
2604
+ trash: "Trash",
2605
+ nothing_in_trash: "There is nothing in the Trash!",
2606
+ empty_trash: "Empty trash",
2607
+ disconnect_stripe: "Disconnect Stripe account",
2608
+ import_data: "Import Data",
2609
+ import_msg: "You are currently an InvoiceBee user. Would you like to import your data from InvoiceBee?",
2610
+ agree_tc_pp: "You accept and agree to our terms of services and privacy policy.",
2611
+ agree: "Agree",
2612
+ view: "View",
2613
+ document_signed: "Document was signed",
2614
+ signed: "Signed",
2615
+ sign_added_success: "Customer's signature has been successfully added.",
2616
+ finger_scan: "Scan fingerprint",
2617
+ place_finger: "Place your finger over the touch sensor and press scan",
2618
+ scan: "Scan",
2619
+ re_upload_logo: "Re-upload your logo in Settings.",
2620
+ re_upload_sign: "Re-upload your signature in Settings.",
2621
+ cannot_delete_dc: "This category cannot be deleted.",
2622
+ clear_all_dc: "Clear all documents and trashes before you delete it.",
2623
+ tap_to_resort: "Tap & hold to re-sort items",
2624
+ email_exists: "This user ID already exists.",
2625
+ go_to_login: "Would you like to go to the login page? (You can use your InvoiceBee login )",
2626
+ i_agree: ["By tapping 'Get Started', I agree to the ", "Terms of Service ", "and ", "Privacy Policy", "."],
2627
+ doc_list: ["Quote", "Estimate", "Credit Note", "Delivery Note", "Debit Note", "Purchase Order"],
2628
+ report: "Report",
2629
+ tell_company: "Enter company name for invoice.",
2630
+ tell_email: "Enter displayed email address on invoice.",
2631
+ setup_pw: "Set your password.",
2632
+ new_cate_added: "A new category has been successfully added.",
2633
+ doc_name_required: "The document name is required",
2634
+ history: "History",
2635
+ setup_acc_first: "Set up your payment account first",
2636
+ setup_acc_content: "Go to Settings > Customer Payment Option > Accept Credit Card.",
2637
+ pay_title: function pay_title(x) {
2638
+ return "Would you like to pay " + x + " with this card?";
2639
+ },
2640
+ pay_content: function pay_content(x) {
2641
+ return "Please note that the above amount includes " + x + "% surcharge.";
2642
+ },
2643
+ payment_success: "Payment has been made successfully.",
2644
+ sign_here: "Sign here",
2645
+ new_logo_applied: "The new logo will only be applied to updated or new invoices.",
2646
+ tutorials: "Tutorial videos",
2647
+ goback: "Go back",
2648
+ help: "Help",
2649
+ use_commas: "Use commas(,) for multiple recipients",
2650
+ tell_friend: "Tell a friend",
2651
+ including_tax: "Including tax",
2652
+ tell_friend_msg: "I use this to send free invoices and estimates in seconds, save time and get paid faster. \nDownload Bookipi for FREE at bookipi.com.",
2653
+ view_more_tutorials: "View More Tutorials",
2654
+ try_expense: "Try Bookipi Expense app",
2655
+ sync_expense: "Sync perfectly with Bookipi Invoice.\nTrack income and expenses!\nWould you like to try?",
2656
+ download: "Download",
2657
+ net: "Net",
2658
+ feature_request: "Bug Report / Feature Request",
2659
+ want_contact_us: "Do you want to contact Bookipi support?",
2660
+ expense: "Expense",
2661
+ set_overdue_reminder: "Set up the automatic overdue reminder",
2662
+ on_due: "On due date",
2663
+ after_3: "After 3 days",
2664
+ after_7: "After 7 days",
2665
+ currency_format: "Currency Format",
2666
+ "default": "Default",
2667
+ change_email: "Change email",
2668
+ get_started_with_huawei: "Get Started with Huawei ID",
2669
+ login_with_huawei: "Log in with Huawei ID",
2670
+ after_tax: "After-tax",
2671
+ due: "due",
2672
+ due_in_days: function due_in_days(x) {
2673
+ return "Due in " + (Math.abs(x) + (Math.abs(x) === 1 ? " day" : " days"));
2674
+ },
2675
+ overdue_days: function overdue_days(x) {
2676
+ return "Overdue " + (Math.abs(x) + (Math.abs(x) === 1 ? " day" : " days"));
2677
+ },
2678
+ inbox: "Inbox",
2679
+ archived: "Archived",
2680
+ get_started: "Get Started",
2681
+ its_free: ["it's free", "like forever..."],
2682
+ enter_company: ["Enter company name", "for invoice."],
2683
+ enable_face_id: "Enable Face ID",
2684
+ enable_touch_id: "Enable Touch ID",
2685
+ almost_done: "Almost done",
2686
+ skip: "Skip",
2687
+ type_of_business: "Type of business",
2688
+ enter_email: ["Enter displayed email", "address on invoice."],
2689
+ finish_setup: "Finish Setup",
2690
+ biz_type_100: "Art, Photography & Creative Services",
2691
+ biz_type_200: "Construction",
2692
+ biz_type_300: "Home Improvement",
2693
+ biz_type_400: "Home Maintenance",
2694
+ biz_type_500: "Financial Services & Insurance",
2695
+ biz_type_600: "Hair, Spa & Aesthetics",
2696
+ biz_type_700: "Medical, Dental & Health",
2697
+ biz_type_800: "Non-profits, Associations & Groups",
2698
+ biz_type_900: "Retailers, Resellers & Sales",
2699
+ biz_type_1000: "Web, Tech & Media",
2700
+ biz_type_1100: "Food & Catering",
2701
+ biz_type_1200: "Care Services (eg. childcare, aged care)",
2702
+ biz_type_1300: "Consulting & Professional Services",
2703
+ biz_type_1400: "Agriculture",
2704
+ biz_type_1500: "Transport",
2705
+ biz_type_1600: "Education",
2706
+ biz_type_1700: "Travel & Recreation",
2707
+ biz_type_1800: "Other: I provide a SERVICE",
2708
+ biz_type_1900: "Other: I make or sell a PRODUCT",
2709
+ archive: "Archive",
2710
+ unarchive: "Unarchive",
2711
+ create_new_customer: "Create new customer",
2712
+ view_all: "View all",
2713
+ import_from_contacts: "Import from your contacts",
2714
+ did_you_send: "Did you send this document?",
2715
+ mark_as_sent: "Mark as Sent",
2716
+ add_note: "Add Note",
2717
+ city: "City",
2718
+ state: "State",
2719
+ zip: "Zip",
2720
+ country: "Country",
2721
+ add: "Add",
2722
+ search_company: "Search customer",
2723
+ search_item: "Search item"
2724
+ };
2725
+
2726
+ var InvoiceCompatHtml = function InvoiceCompatHtml(invoice, lang) {
2727
+ if (lang === void 0) {
2728
+ lang = defaultLang;
2729
+ }
2730
+
2731
+ return invoiceHtml({
2732
+ invoice: _extends({}, invoice, {
2733
+ document: InvoiceCompat(invoice.document),
2734
+ company: CompanyCompat(invoice.company)
2735
+ }),
2736
+ lang: lang
2737
+ });
2738
+ };
2739
+
2740
+ var PreviewDocumentCompat = function PreviewDocumentCompat(_ref) {
2741
+ var previewDocument = _ref.invoice,
2742
+ _ref$lang = _ref.lang,
2743
+ lang = _ref$lang === void 0 ? defaultLang : _ref$lang;
2744
+ return /*#__PURE__*/React.createElement("div", {
2745
+ dangerouslySetInnerHTML: {
2746
+ __html: InvoiceCompatHtml(previewDocument, lang)
2747
+ }
2748
+ });
2749
+ };
2750
+
2025
2751
  exports.Invoice = PreviewDocument;
2752
+ exports.InvoiceCompat = PreviewDocumentCompat;
2753
+ exports.InvoiceCompatHtml = InvoiceCompatHtml;
2754
+ exports.InvoiceHtml = invoiceHtml;
2026
2755
  //# sourceMappingURL=index.js.map