umwd-components 0.1.642 → 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.
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__exports as r}from"../../_virtual/index8.js";var t;function e(){if(t)return r;t=1,r.byteLength=function(r){var t=i(r),e=t[0],n=t[1];return 3*(e+n)/4-n},r.toByteArray=function(r){var t,e,a=i(r),u=a[0],h=a[1],c=new o(function(r,t,e){return 3*(t+e)/4-e}(0,u,h)),f=0,d=h>0?u-4:u;for(e=0;e<d;e+=4)t=n[r.charCodeAt(e)]<<18|n[r.charCodeAt(e+1)]<<12|n[r.charCodeAt(e+2)]<<6|n[r.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===h&&(t=n[r.charCodeAt(e)]<<2|n[r.charCodeAt(e+1)]>>4,c[f++]=255&t);1===h&&(t=n[r.charCodeAt(e)]<<10|n[r.charCodeAt(e+1)]<<4|n[r.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(r){for(var t,n=r.length,o=n%3,a=[],u=16383,i=0,c=n-o;i<c;i+=u)a.push(h(r,i,i+u>c?c:i+u));1===o?(t=r[n-1],a.push(e[t>>2]+e[t<<4&63]+"==")):2===o&&(t=(r[n-2]<<8)+r[n-1],a.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return a.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)e[u]=a[u],n[a.charCodeAt(u)]=u;function i(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function h(r,t,n){for(var o,a,u=[],i=t;i<n;i+=3)o=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(255&r[i+2]),u.push(e[(a=o)>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]);return u.join("")}return n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63,r}export{e as __require};
6
+ import{__exports as r}from"../../_virtual/index7.js";var t;function e(){if(t)return r;t=1,r.byteLength=function(r){var t=i(r),e=t[0],n=t[1];return 3*(e+n)/4-n},r.toByteArray=function(r){var t,e,a=i(r),u=a[0],h=a[1],c=new o(function(r,t,e){return 3*(t+e)/4-e}(0,u,h)),f=0,d=h>0?u-4:u;for(e=0;e<d;e+=4)t=n[r.charCodeAt(e)]<<18|n[r.charCodeAt(e+1)]<<12|n[r.charCodeAt(e+2)]<<6|n[r.charCodeAt(e+3)],c[f++]=t>>16&255,c[f++]=t>>8&255,c[f++]=255&t;2===h&&(t=n[r.charCodeAt(e)]<<2|n[r.charCodeAt(e+1)]>>4,c[f++]=255&t);1===h&&(t=n[r.charCodeAt(e)]<<10|n[r.charCodeAt(e+1)]<<4|n[r.charCodeAt(e+2)]>>2,c[f++]=t>>8&255,c[f++]=255&t);return c},r.fromByteArray=function(r){for(var t,n=r.length,o=n%3,a=[],u=16383,i=0,c=n-o;i<c;i+=u)a.push(h(r,i,i+u>c?c:i+u));1===o?(t=r[n-1],a.push(e[t>>2]+e[t<<4&63]+"==")):2===o&&(t=(r[n-2]<<8)+r[n-1],a.push(e[t>>10]+e[t>>4&63]+e[t<<2&63]+"="));return a.join("")};for(var e=[],n=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0;u<64;++u)e[u]=a[u],n[a.charCodeAt(u)]=u;function i(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function h(r,t,n){for(var o,a,u=[],i=t;i<n;i+=3)o=(r[i]<<16&16711680)+(r[i+1]<<8&65280)+(255&r[i+2]),u.push(e[(a=o)>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]);return u.join("")}return n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63,r}export{e as __require};
@@ -3,5 +3,5 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__exports as a}from"../../_virtual/index7.js";
6
+ import{__exports as a}from"../../_virtual/index8.js";
7
7
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var t;function o(){return t||(t=1,a.read=function(a,t,o,r,h){var M,e,i=8*h-r-1,p=(1<<i)-1,f=p>>1,n=-7,w=o?h-1:0,s=o?-1:1,u=a[t+w];for(w+=s,M=u&(1<<-n)-1,u>>=-n,n+=i;n>0;M=256*M+a[t+w],w+=s,n-=8);for(e=M&(1<<-n)-1,M>>=-n,n+=r;n>0;e=256*e+a[t+w],w+=s,n-=8);if(0===M)M=1-f;else{if(M===p)return e?NaN:1/0*(u?-1:1);e+=Math.pow(2,r),M-=f}return(u?-1:1)*e*Math.pow(2,M-r)},a.write=function(a,t,o,r,h,M){var e,i,p,f=8*M-h-1,n=(1<<f)-1,w=n>>1,s=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,u=r?0:M-1,N=r?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,e=n):(e=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-e))<1&&(e--,p*=2),(t+=e+w>=1?s/p:s*Math.pow(2,1-w))*p>=2&&(e++,p/=2),e+w>=n?(i=0,e=n):e+w>=1?(i=(t*p-1)*Math.pow(2,h),e+=w):(i=t*Math.pow(2,w-1)*Math.pow(2,h),e=0));h>=8;a[o+u]=255&i,u+=N,i/=256,h-=8);for(e=e<<h|i,f+=h;f>0;a[o+u]=255&e,u+=N,e/=256,f-=8);a[o+u-N]|=128*_}),a}export{o as __require};
@@ -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 c,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 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,b=v.type;return v.invoice_number,console.log("type",b),"credit"===b?m.createElement(r,{title:"credit_".concat(null==v?void 0:v.invoice_number)},m.createElement(c,{size:"A4",style:f.page},m.createElement(i,{style:f.header},m.createElement(a,{style:f.h1},null==p?void 0:p.company_name)),m.createElement(a,null,"Credit note"))):"proforma"===b?m.createElement(r,{title:"proforma_".concat(null==v?void 0:v.invoice_number)},m.createElement(c,{size:"A4",style:f.page},m.createElement(i,{style:f.header},m.createElement(a,{style:f.h1},null==p?void 0:p.company_name)),m.createElement(a,null,"Proforma invoice"))):m.createElement(r,{title:"invoice_".concat(null==v?void 0:v.invoice_number)},m.createElement(c,{size:"A4",style:f.page},m.createElement(i,{style:f.header},m.createElement(a,{style:f.h1},null==p?void 0:p.company_name)),m.createElement(i,{style:f.section},m.createElement(a,{style:f.h2},"INVOICE")),m.createElement(i,{style:f.section},m.createElement(i,{style:f.row},m.createElement(i,{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(i,{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(i,{style:f.section},m.createElement(i,{style:f.row},m.createElement(i,{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(i,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Your reference: "),m.createElement(a,null,null==v?void 0:v.customer_reference)),m.createElement(i,{style:f.rowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Invoice date"),m.createElement(a,null,null==v?void 0:v.invoice_date)))),m.createElement(i,{style:f.section},m.createElement(a,{style:f.h3},"SUMMARY"),m.createElement(i,{style:f.row},(null===(l=null==v?void 0:v.admin_items)||void 0===l?void 0:l.length)>0&&m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Line Item Number")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Title")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Amount")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT rate")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"VAT")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px",fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{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(i,{style:f.row},m.createElement(i,{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(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.vat_rate," %")," "),m.createElement(i,{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(i,{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(i,{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,c,d,s;return m.createElement(u,{key:t},m.createElement(i,{style:f.row},m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.line_item_number)),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.description)),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},e.quantity)),m.createElement(i,{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(i,{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(i,{style:f.productRowSection},m.createElement(a,{style:{fontSize:"10px"}},"€ ",null===(c=null===(r=null==e?void 0:e.price)||void 0===r?void 0:r.price)||void 0===c?void 0:c.toFixed(2))),m.createElement(i,{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(i,{style:f.section},m.createElement(a,{style:f.h3},"TOTALS"),m.createElement(i,{style:f.row},m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"VAT")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Excl. VAT")),m.createElement(i,{style:f.productRowSection},m.createElement(a,{style:{fontStyle:"bold"}},"Incl. VAT"))),m.createElement(i,{style:f.row},m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection}),m.createElement(i,{style:f.productRowSection}),m.createElement(i,{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(i,{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(i,{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(i,{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 b(t){var l=t.invoice,n=e(d(!1),2),r=n[0],c=n[1];return m.createElement(m.Fragment,null,m.createElement(s,{onClick:function(){return c(!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 c(!1)}},"Close"))))}export{w as InvoiceDownloadLink,b 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};