umwd-components 0.1.529 → 0.1.530

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.
@@ -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 p from"@mui/material/DialogActions";import v 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,p=e.props.invoice;console.log("invoice from invoicePDF",p);var v=p.seller_business_credentials,S=p.seller_company_address,_=p.buyer_company_address,w=p.buyer_business_credentials;return m.createElement(r,null,m.createElement(i,{size:"A4",style:f.page},m.createElement(c,{style:f.header},m.createElement(a,{style:f.h1},null==v?void 0:v.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==p?void 0:p.buyer_first_name," ",null==p?void 0:p.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==v?void 0:v.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==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(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==p?void 0:p.invoice_number)),(null==p?void 0:p.customer_internal_reference)&&m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==p?void 0:p.customer_internal_reference)),m.createElement(c,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==p?void 0:p.invoice_date)))),m.createElement(c,{style:f.section},m.createElement(a,{style:f.h3},"SUMMARY"),m.createElement(c,{style:f.row},(null===(l=null==p?void 0:p.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==p?void 0:p.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==p?void 0:p.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==p?void 0:p.VAT_total)||void 0===d?void 0:d.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(s=null==p?void 0:p.total_excl_vat)||void 0===s?void 0:s.toFixed(2))),m.createElement(c,{style:f.productRowSection},m.createElement(a,null,"€ ",null===(E=null==p?void 0:p.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==p?void 0:p.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(p,null,m.createElement(v,{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 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_internal_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_internal_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};