umwd-components 0.1.641 → 0.1.643
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/src/components/e-commerce/invoice/InvoicePDF.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/types/e-commerce/invoice/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/e-commerce/invoice/InvoicePDF.tsx +727 -213
- package/src/types/e-commerce/invoice/types.ts +1 -0
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import{StyleSheet as l,PDFDownloadLink as n,PDFViewer as o,Document as r,Page as i,View as c,Text as a}from"@react-pdf/renderer";import m,{useState as d,Fragment as u}from"react";import s from"@mui/material/IconButton";import E from"@mui/material/Dialog";import y from"@mui/material/DialogContent";import v from"@mui/material/DialogActions";import p from"@mui/material/Button";import S from"@mui/icons-material/PictureAsPdf";var f=l.create({page:{flexDirection:"column",backgroundColor:"#E4E4E4"},header:{padding:10,flexDirection:"row",alignItems:"center"},logo:{width:24,height:24,marginRight:10},section:{margin:10,padding:10,fontSize:12},row:{flexDirection:"row"},rowSection:{flex:1},productRowSection:{flex:1,width:1/6},h1:{fontSize:28},h2:{fontSize:24,fontStyle:"bold"},h3:{fontSize:16,fontStyle:"bold"}});function _(e){var l,n,o,d,s,E,y,v=e.props.invoice;console.log("invoice from invoicePDF",v);var p=v.seller_business_credentials,S=v.seller_company_address,_=v.buyer_company_address,w=v.buyer_business_credentials;return m.createElement(r,{title:"invoice_".concat(null==v?void 0:v.invoice_number)},m.createElement(i,{size:"A4",style:f.page},m.createElement(c,{style:f.header},m.createElement(a,{style:f.h1},null==p?void 0:p.company_name)),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h2},"INVOICE")),m.createElement(c,{style:f.section},m.createElement(c,{style:f.row},m.createElement(c,{style:f.rowSection},m.createElement(a,{style:f.h3},"BILLING DETAILS"),m.createElement(a,null,null==w?void 0:w.company_name),m.createElement(a,null,null==v?void 0:v.buyer_first_name," ",null==v?void 0:v.buyer_last_name),m.createElement(a,null,null==_?void 0:_.street," ",null==_?void 0:_.street_number," ",null==_?void 0:_.street_number_addition),m.createElement(a,null,null==_?void 0:_.postal_code," ",null==_?void 0:_.city)),m.createElement(c,{style:f.rowSection},m.createElement(a,{style:f.h3},"FROM"),m.createElement(a,null,null==p?void 0:p.company_name),m.createElement(a,null,null==S?void 0:S.street," ",null==S?void 0:S.street_number," ",null==S?void 0:S.street_number_addition),m.createElement(a,null,null==S?void 0:S.postal_code," ",null==S?void 0:S.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==p?void 0:p.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==p?void 0:p.vat_number)))),m.createElement(c,{style:f.section},m.createElement(c,{style:f.row},m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==v?void 0:v.invoice_number)),(null==v?void 0:v.customer_reference)&&m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==v?void 0:v.customer_reference)),m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==v?void 0:v.invoice_date)))),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h3},"SUMMARY"),m.createElement(c,{style:f.row},(null===(l=null==v?void 0:v.admin_items)||void 0===l?void 0:l.length)>0&&m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Incl. VAT"))),null===(n=null==v?void 0:v.items)||void 0===n?void 0:n.map((function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(c,{style:f.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))})),null===(o=null==v?void 0:v.admin_items)||void 0===o?void 0:o.map((function(e,t){var l,n,o,r,i,d,s;return m.createElement(u,{key:t},m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(i=null===(r=null==e?void 0:e.price)||void 0===r?void 0:r.price)||void 0===i?void 0:i.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))}))),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h3},"TOTALS"),m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(c,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(c,{style:f.row},m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection}),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(d=null==v?void 0:v.VAT_total)||void 0===d?void 0:d.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(s=null==v?void 0:v.total_excl_vat)||void 0===s?void 0:s.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(E=null==v?void 0:v.total_incl_vat)||void 0===E?void 0:E.toFixed(2))))),m.createElement(c,{style:f.section},m.createElement(a,{style:t(t({},f.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null===(y=null==v?void 0:v.total_incl_vat)||void 0===y?void 0:y.toFixed(2)))))}function w(e){var t=e.invoice;return m.createElement(n,{document:m.createElement(_,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},m.createElement(s,null,m.createElement(S,null)))}function x(t){var l=t.invoice,n=e(d(!1),2),r=n[0],i=n[1];return m.createElement(m.Fragment,null,m.createElement(s,{onClick:function(){return i(!0)}},m.createElement(S,null)),m.createElement(E,{open:r,fullWidth:!0,maxWidth:"lg"},m.createElement(y,null,m.createElement(o,{style:{width:"100%",minHeight:"70vh"}},m.createElement(_,{props:{invoice:l}}))),m.createElement(v,null,m.createElement(p,{variant:"contained",onClick:function(){return i(!1)}},"Close"))))}export{w as InvoiceDownloadLink,x as InvoicePDFViewer};
|
|
7
|
+
import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import{StyleSheet as l,PDFDownloadLink as n,PDFViewer as o,Document as c,Page as r,View as i,Text as a}from"@react-pdf/renderer";import m,{useState as d,Fragment as u}from"react";import s from"@mui/material/IconButton";import y from"@mui/material/Dialog";import E from"@mui/material/DialogContent";import v from"@mui/material/DialogActions";import p from"@mui/material/Button";import S from"@mui/icons-material/PictureAsPdf";var _=l.create({page:{flexDirection:"column",backgroundColor:"#E4E4E4"},header:{padding:10,flexDirection:"row",alignItems:"center"},logo:{width:24,height:24,marginRight:10},section:{margin:10,padding:10,fontSize:12},row:{flexDirection:"row"},rowSection:{flex:1},productRowSection:{flex:1,width:1/6},h1:{fontSize:28},h2:{fontSize:24,fontStyle:"bold"},h3:{fontSize:16,fontStyle:"bold"}});function f(e){var l,n,o,d,s,y,E,v,p,S,f,w,x,b,R,z,T,A,h,F,g,I=e.props.invoice;console.log("invoice from invoicePDF",I);var V=I.seller_business_credentials,N=I.seller_company_address,L=I.buyer_company_address,C=I.buyer_business_credentials,D=I.type;return I.invoice_number,console.log("type",D),"credit"===D?m.createElement(c,{title:"credit_".concat(null==I?void 0:I.invoice_number)},m.createElement(r,{size:"A4",style:_.page},m.createElement(i,{style:_.header},m.createElement(a,{style:_.h1},null==V?void 0:V.company_name)),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h2},"CREDIT NOTE")),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"BILLING DETAILS"),m.createElement(a,null,null==C?void 0:C.company_name),m.createElement(a,null,null==I?void 0:I.buyer_first_name," ",null==I?void 0:I.buyer_last_name),m.createElement(a,null,null==L?void 0:L.street," ",null==L?void 0:L.street_number," ",null==L?void 0:L.street_number_addition),m.createElement(a,null,null==L?void 0:L.postal_code," ",null==L?void 0:L.city)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"FROM"),m.createElement(a,null,null==V?void 0:V.company_name),m.createElement(a,null,null==N?void 0:N.street," ",null==N?void 0:N.street_number," ",null==N?void 0:N.street_number_addition),m.createElement(a,null,null==N?void 0:N.postal_code," ",null==N?void 0:N.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==V?void 0:V.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==V?void 0:V.vat_number)))),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==I?void 0:I.invoice_number)),(null==I?void 0:I.customer_reference)&&m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==I?void 0:I.customer_reference)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==I?void 0:I.invoice_date)))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"SUMMARY"),m.createElement(i,{style:_.row},(null===(l=null==I?void 0:I.admin_items)||void 0===l?void 0:l.length)>0&&m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Incl. VAT"))),null===(n=null==I?void 0:I.items)||void 0===n?void 0:n.map((function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(i,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))})),null===(o=null==I?void 0:I.admin_items)||void 0===o?void 0:o.map((function(e,t){var l,n,o,c,r,d,s;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(r=null===(c=null==e?void 0:e.price)||void 0===c?void 0:c.price)||void 0===r?void 0:r.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))}))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"TOTALS"),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(d=null==I?void 0:I.VAT_total)||void 0===d?void 0:d.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(s=null==I?void 0:I.total_excl_vat)||void 0===s?void 0:s.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(y=null==I?void 0:I.total_incl_vat)||void 0===y?void 0:y.toFixed(2))))),m.createElement(i,{style:_.section},m.createElement(a,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null===(E=null==I?void 0:I.total_incl_vat)||void 0===E?void 0:E.toFixed(2))))):"proforma"===D?m.createElement(c,{title:"proforma_".concat(null==I?void 0:I.invoice_number)},m.createElement(r,{size:"A4",style:_.page},m.createElement(i,{style:_.header},m.createElement(a,{style:_.h1},null==V?void 0:V.company_name)),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h2},"PROFORMA INVOICE"),m.createElement(a,{style:{fontSize:10,marginTop:5}},"This is not a final invoice and cannot be used for tax purposes")),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"BILLING DETAILS"),m.createElement(a,null,null==C?void 0:C.company_name),m.createElement(a,null,null==I?void 0:I.buyer_first_name," ",null==I?void 0:I.buyer_last_name),m.createElement(a,null,null==L?void 0:L.street," ",null==L?void 0:L.street_number," ",null==L?void 0:L.street_number_addition),m.createElement(a,null,null==L?void 0:L.postal_code," ",null==L?void 0:L.city)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"FROM"),m.createElement(a,null,null==V?void 0:V.company_name),m.createElement(a,null,null==N?void 0:N.street," ",null==N?void 0:N.street_number," ",null==N?void 0:N.street_number_addition),m.createElement(a,null,null==N?void 0:N.postal_code," ",null==N?void 0:N.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==V?void 0:V.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==V?void 0:V.vat_number)))),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==I?void 0:I.invoice_number)),(null==I?void 0:I.customer_reference)&&m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==I?void 0:I.customer_reference)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==I?void 0:I.invoice_date)))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"SUMMARY"),m.createElement(i,{style:_.row},(null===(v=null==I?void 0:I.admin_items)||void 0===v?void 0:v.length)>0&&m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Incl. VAT"))),null===(p=null==I?void 0:I.items)||void 0===p?void 0:p.map((function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(i,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))})),null===(S=null==I?void 0:I.admin_items)||void 0===S?void 0:S.map((function(e,t){var l,n,o,c,r,d,s;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(r=null===(c=null==e?void 0:e.price)||void 0===c?void 0:c.price)||void 0===r?void 0:r.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))}))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"TOTALS"),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(f=null==I?void 0:I.VAT_total)||void 0===f?void 0:f.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(w=null==I?void 0:I.total_excl_vat)||void 0===w?void 0:w.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(x=null==I?void 0:I.total_incl_vat)||void 0===x?void 0:x.toFixed(2))))),m.createElement(i,{style:_.section},m.createElement(a,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null===(b=null==I?void 0:I.total_incl_vat)||void 0===b?void 0:b.toFixed(2))))):m.createElement(c,{title:"invoice_".concat(null==I?void 0:I.invoice_number)},m.createElement(r,{size:"A4",style:_.page},m.createElement(i,{style:_.header},m.createElement(a,{style:_.h1},null==V?void 0:V.company_name)),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h2},"INVOICE")),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"BILLING DETAILS"),m.createElement(a,null,null==C?void 0:C.company_name),m.createElement(a,null,null==I?void 0:I.buyer_first_name," ",null==I?void 0:I.buyer_last_name),m.createElement(a,null,null==L?void 0:L.street," ",null==L?void 0:L.street_number," ",null==L?void 0:L.street_number_addition),m.createElement(a,null,null==L?void 0:L.postal_code," ",null==L?void 0:L.city)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:_.h3},"FROM"),m.createElement(a,null,null==V?void 0:V.company_name),m.createElement(a,null,null==N?void 0:N.street," ",null==N?void 0:N.street_number," ",null==N?void 0:N.street_number_addition),m.createElement(a,null,null==N?void 0:N.postal_code," ",null==N?void 0:N.city),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),m.createElement(a,null,null==V?void 0:V.coc_number),m.createElement(a,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),m.createElement(a,null,null==V?void 0:V.vat_number)))),m.createElement(i,{style:_.section},m.createElement(i,{style:_.row},m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice number: "),m.createElement(a,null,null==I?void 0:I.invoice_number)),(null==I?void 0:I.customer_reference)&&m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==I?void 0:I.customer_reference)),m.createElement(i,{style:_.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==I?void 0:I.invoice_date)))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"SUMMARY"),m.createElement(i,{style:_.row},(null===(R=null==I?void 0:I.admin_items)||void 0===R?void 0:R.length)>0&&m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Incl. VAT"))),null===(z=null==I?void 0:I.items)||void 0===z?void 0:z.map((function(e,t){var l,n,o;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(i,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&m.createElement(a,{style:{fontSize:"10px"}},"€"," ",null===(l=e.price_incl_vat-e.price_excl_vat)||void 0===l?void 0:l.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(n=e.price_excl_vat)||void 0===n?void 0:n.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=e.price_incl_vat)||void 0===o?void 0:o.toFixed(2)))))})),null===(T=null==I?void 0:I.admin_items)||void 0===T?void 0:T.map((function(e,t){var l,n,o,c,r,d,s;return m.createElement(u,{key:t},m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},null===(l=null==e?void 0:e.price)||void 0===l?void 0:l.vat_rate," %")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(o=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.vat)||void 0===o?void 0:o.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(r=null===(c=null==e?void 0:e.price)||void 0===c?void 0:c.price)||void 0===r?void 0:r.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(s=null===(d=null==e?void 0:e.price)||void 0===d?void 0:d.price_incl_vat)||void 0===s?void 0:s.toFixed(2)))))}))),m.createElement(i,{style:_.section},m.createElement(a,{style:_.h3},"TOTALS"),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:_.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(i,{style:_.row},m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection}),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(A=null==I?void 0:I.VAT_total)||void 0===A?void 0:A.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(h=null==I?void 0:I.total_excl_vat)||void 0===h?void 0:h.toFixed(2))),m.createElement(i,{style:_.productRowSection},m.createElement(a,null,"€ ",null===(F=null==I?void 0:I.total_incl_vat)||void 0===F?void 0:F.toFixed(2))))),m.createElement(i,{style:_.section},m.createElement(a,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null===(g=null==I?void 0:I.total_incl_vat)||void 0===g?void 0:g.toFixed(2)))))}function w(e){var t=e.invoice;return m.createElement(n,{document:m.createElement(f,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},m.createElement(s,null,m.createElement(S,null)))}function x(t){var l=t.invoice,n=e(d(!1),2),c=n[0],r=n[1];return m.createElement(m.Fragment,null,m.createElement(s,{onClick:function(){return r(!0)}},m.createElement(S,null)),m.createElement(y,{open:c,fullWidth:!0,maxWidth:"lg"},m.createElement(E,null,m.createElement(o,{style:{width:"100%",minHeight:"70vh"}},m.createElement(f,{props:{invoice:l}}))),m.createElement(v,null,m.createElement(p,{variant:"contained",onClick:function(){return r(!1)}},"Close"))))}export{w as InvoiceDownloadLink,x as InvoicePDFViewer};
|