umwd-components 0.1.816 → 0.1.818
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/cjs/node_modules/color-string/index.js +1 -1
- package/dist/cjs/node_modules/crypto-js/index.js +1 -1
- package/dist/cjs/src/components/e-commerce/invoice/InvoicePDF.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/_virtual/index4.js +2 -2
- package/dist/esm/_virtual/index5.js +2 -2
- package/dist/esm/_virtual/index6.js +2 -2
- package/dist/esm/node_modules/color-string/index.js +1 -1
- package/dist/esm/node_modules/crypto-js/index.js +1 -1
- package/dist/esm/node_modules/prop-types/node_modules/react-is/index.js +1 -1
- package/dist/esm/src/components/e-commerce/invoice/InvoicePDF.js +58 -9
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/components/e-commerce/invoice/InvoicePDF.d.ts +10 -3
- package/dist/esm/types/components/e-commerce/invoice/InvoicePDFOLDIMPROVED.d.ts +3 -3
- package/dist/esm/types/components/e-commerce/invoice/InvoicePDFTEST.d.ts +4 -0
- package/package.json +1 -1
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("../../_virtual/_commonjsHelpers.js"),e=require("../../_virtual/
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("../../_virtual/_commonjsHelpers.js"),e=require("../../_virtual/index5.js"),t=require("../color-name/index.js"),a=require("../simple-swizzle/index.js"),s=t.colorName,n=a.simpleSwizzleExports,o=Object.hasOwnProperty,l=Object.create(null);for(var u in s)o.call(s,u)&&(l[s[u]]=u);var d=e.__module.exports={to:{},get:{}};function i(r,e,t){return Math.min(Math.max(e,r),t)}function h(r){var e=Math.round(r).toString(16).toUpperCase();return e.length<2?"0"+e:e}d.get=function(r){var e,t;switch(r.substring(0,3).toLowerCase()){case"hsl":e=d.get.hsl(r),t="hsl";break;case"hwb":e=d.get.hwb(r),t="hwb";break;default:e=d.get.rgb(r),t="rgb"}return e?{model:t,value:e}:null},d.get.rgb=function(r){if(!r)return null;var e,t,a,n=[0,0,0,1];if(e=r.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(a=e[2],e=e[1],t=0;t<3;t++){var l=2*t;n[t]=parseInt(e.slice(l,l+2),16)}a&&(n[3]=parseInt(a,16)/255)}else if(e=r.match(/^#([a-f0-9]{3,4})$/i)){for(a=(e=e[1])[3],t=0;t<3;t++)n[t]=parseInt(e[t]+e[t],16);a&&(n[3]=parseInt(a+a,16)/255)}else if(e=r.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(t=0;t<3;t++)n[t]=parseInt(e[t+1],0);e[4]&&(e[5]?n[3]=.01*parseFloat(e[4]):n[3]=parseFloat(e[4]))}else{if(!(e=r.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=r.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:o.call(s,e[1])?((n=s[e[1]])[3]=1,n):null:null;for(t=0;t<3;t++)n[t]=Math.round(2.55*parseFloat(e[t+1]));e[4]&&(e[5]?n[3]=.01*parseFloat(e[4]):n[3]=parseFloat(e[4]))}for(t=0;t<3;t++)n[t]=i(n[t],0,255);return n[3]=i(n[3],0,1),n},d.get.hsl=function(r){if(!r)return null;var e=r.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var t=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,i(parseFloat(e[2]),0,100),i(parseFloat(e[3]),0,100),i(isNaN(t)?1:t,0,1)]}return null},d.get.hwb=function(r){if(!r)return null;var e=r.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var t=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,i(parseFloat(e[2]),0,100),i(parseFloat(e[3]),0,100),i(isNaN(t)?1:t,0,1)]}return null},d.to.hex=function(){var r=n(arguments);return"#"+h(r[0])+h(r[1])+h(r[2])+(r[3]<1?h(Math.round(255*r[3])):"")},d.to.rgb=function(){var r=n(arguments);return r.length<4||1===r[3]?"rgb("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+")":"rgba("+Math.round(r[0])+", "+Math.round(r[1])+", "+Math.round(r[2])+", "+r[3]+")"},d.to.rgb.percent=function(){var r=n(arguments),e=Math.round(r[0]/255*100),t=Math.round(r[1]/255*100),a=Math.round(r[2]/255*100);return r.length<4||1===r[3]?"rgb("+e+"%, "+t+"%, "+a+"%)":"rgba("+e+"%, "+t+"%, "+a+"%, "+r[3]+")"},d.to.hsl=function(){var r=n(arguments);return r.length<4||1===r[3]?"hsl("+r[0]+", "+r[1]+"%, "+r[2]+"%)":"hsla("+r[0]+", "+r[1]+"%, "+r[2]+"%, "+r[3]+")"},d.to.hwb=function(){var r=n(arguments),e="";return r.length>=4&&1!==r[3]&&(e=", "+r[3]),"hwb("+r[0]+", "+r[1]+"%, "+r[2]+"%"+e+")"},d.to.keyword=function(r){return l[r.slice(0,3)]};var c=e.__module.exports,f=r.getDefaultExportFromCjs(c);exports.default=f;
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("../../_virtual/_commonjsHelpers.js"),i=require("../../_virtual/
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,r=require("../../_virtual/_commonjsHelpers.js"),i=require("../../_virtual/index6.js"),u=require("./core.js"),_=require("./x64-core.js"),q=require("./lib-typedarrays.js"),s=require("./enc-utf16.js"),j=require("./enc-base64.js"),a=require("./enc-base64url.js"),o=require("./md5.js"),d=require("./sha1.js"),t=require("./sha256.js"),p=require("./sha224.js"),c=require("./sha512.js"),m=require("./sha384.js"),l=require("./sha3.js"),n=require("./ripemd160.js"),b=require("./hmac.js"),f=require("./pbkdf2.js"),h=require("./evpkdf.js"),x=require("./cipher-core.js"),v=require("./mode-cfb.js"),g=require("./mode-ctr.js"),y=require("./mode-ctr-gladman.js"),k=require("./mode-ofb.js"),E=require("./mode-ecb.js"),w=require("./pad-ansix923.js"),z=require("./pad-iso10126.js"),C=require("./pad-iso97971.js"),D=require("./pad-zeropadding.js"),F=require("./pad-nopadding.js"),G=require("./format-hex.js"),H=require("./aes.js"),M=require("./tripledes.js"),O=require("./rc4.js"),P=require("./rabbit.js"),A=require("./rabbit-legacy.js"),B=require("./blowfish.js");e=i.__module,r.commonjsGlobal,e.exports=function(e){return e}(u.__require(),_.__require(),q.__require(),s.__require(),j.__require(),a.__require(),o.md5Exports,d.__require(),t.__require(),p.__require(),c.__require(),m.__require(),l.__require(),n.__require(),b.__require(),f.__require(),h.__require(),x.__require(),v.__require(),g.__require(),y.__require(),k.__require(),E.__require(),w.__require(),z.__require(),C.__require(),D.__require(),F.__require(),G.__require(),H.__require(),M.__require(),O.__require(),P.__require(),A.__require(),B.__require());var I=i.__module.exports,J=r.getDefaultExportFromCjs(I);exports.default=J;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),n=require("@mui/material/IconButton"),i=require("@mui/material/Dialog"),t=require("@mui/material/DialogContent"),o=require("@mui/material/DialogActions"),s=require("@mui/material/Button"),l=require("@mui/material/CircularProgress"),c=require("@mui/icons-material/PictureAsPdf");const a=()=>{const[e,n]=r.useState(null),[i,t]=r.useState(!0),[o,s]=r.useState(null);return r.useEffect(()=>{let e=!0;return(async()=>{try{const r=await Promise.resolve().then(function(){return require("../../../../node_modules/@react-pdf/renderer/lib/react-pdf.browser.js")});e&&(n(r),t(!1))}catch(r){console.error("Failed to load PDF renderer:",r),e&&(s("Failed to load PDF components"),t(!1))}})(),()=>{e=!1}},[]),{pdfComponents:e,loading:i,error:o}},d=()=>{const{pdfComponents:r,loading:n,error:i}=a();if(n)return e.jsx(l,{});if(i)return e.jsxs("div",{children:["Error loading PDF components: ",i]});if(!r)return e.jsx("div",{children:"PDF components not available"});const{Document:t,Page:o,View:s,Text:c,StyleSheet:d}=r,u=(e=>e.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,fontWeight:"bold"},h3:{fontSize:16,fontWeight:"bold"}}))(d);return e.jsx(t,{children:e.jsxs(o,{size:"A4",style:u.page,children:[e.jsx(s,{style:u.header,children:e.jsx(c,{style:u.h2,children:"Invoice"})}),e.jsx(s,{style:u.section,children:e.jsx(c,{children:"Invoice details go here..."})})]})})};exports.InvoiceDownloadLink=function(){const{pdfComponents:r,loading:i,error:t}=a();if(i||t||!r)return e.jsx(n,{disabled:!0,children:e.jsx(l,{size:20})});const{PDFDownloadLink:o}=r;try{return e.jsx(o,{document:e.jsx(d,{}),fileName:"invoice_",children:e.jsx(n,{children:e.jsx(c,{})})},Date.now())}catch(r){return console.error("Error creating PDF download link:",r),e.jsx(n,{disabled:!0,children:e.jsx(c,{})})}},exports.InvoicePDF=d,exports.InvoicePDFViewer=function(){const[u,h]=r.useState(!1),[x,m]=r.useState(null),{pdfComponents:j,loading:f,error:g}=a();if(f||g||!j)return e.jsx(n,{disabled:!0,children:e.jsx(l,{size:20})});const{PDFViewer:p}=j;return e.jsxs(e.Fragment,{children:[e.jsx(n,{onClick:()=>{m(null),h(!0)},children:e.jsx(c,{})}),e.jsxs(i,{open:u,fullWidth:!0,maxWidth:"lg",children:[e.jsx(t,{children:x?e.jsxs("div",{children:["Error rendering PDF: ",x]}):e.jsx(p,{style:{width:"100%",minHeight:"70vh"},children:e.jsx(d,{})},Date.now())}),e.jsx(o,{children:e.jsx(s,{variant:"contained",onClick:()=>h(!1),children:"Close"})})]})]})};
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material/IconButton"),s=require("@mui/material/Dialog"),n=require("@mui/material/DialogContent"),r=require("@mui/material/DialogActions"),o=require("@mui/material/Button"),l=require("@mui/material/CircularProgress"),c=require("@mui/icons-material/PictureAsPdf");const d=()=>{const[e,i]=t.useState(null),[s,n]=t.useState(!0),[r,o]=t.useState(null);return t.useEffect(()=>{let e=!0;return(async()=>{try{const t=await Promise.resolve().then(function(){return require("../../../../node_modules/@react-pdf/renderer/lib/react-pdf.browser.js")});e&&(i(t),n(!1))}catch(t){console.error("Failed to load PDF renderer:",t),e&&(o("Failed to load PDF components"),n(!1))}})(),()=>{e=!1}},[]),{pdfComponents:e,loading:s,error:r}},x=(e,t,i="")=>t.split(".").reduce((e,t)=>e&&void 0!==e[t]?e[t]:i,e),h=({invoice:i})=>{const{pdfComponents:s,loading:n,error:r}=d();if(n)return e.jsx(l,{});if(r)return e.jsxs("div",{children:["Error loading PDF components: ",r]});if(!s)return e.jsx("div",{children:"PDF components not available"});if(!i)return e.jsx("div",{children:"No invoice data provided"});const{Document:o,Page:c,View:h,Text:j,StyleSheet:y}=s,p=(e=>e.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,fontWeight:"bold"},h3:{fontSize:16,fontWeight:"bold"}}))(y),{seller_business_credentials:a,seller_company_address:u,buyer_company_address:m,buyer_business_credentials:S,type:_}=i;return"credit"===_?e.jsx(o,{title:`credit_${x(i,"invoice_number","unknown")}`,children:e.jsxs(c,{size:"A4",style:p.page,children:[e.jsx(h,{style:p.header,children:e.jsx(j,{style:p.h1,children:x(a,"company_name")})}),e.jsx(h,{style:p.section,children:e.jsx(j,{style:p.h2,children:"CREDIT NOTE"})}),e.jsx(h,{style:p.section,children:e.jsxs(h,{style:p.row,children:[e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:p.h3,children:"BILLING DETAILS"}),e.jsx(j,{children:x(S,"company_name")}),e.jsxs(j,{children:[x(i,"buyer_first_name")," ",x(i,"buyer_last_name")]}),e.jsxs(j,{children:[x(m,"street")," ",x(m,"street_number")," ",x(m,"street_number_addition")]}),e.jsxs(j,{children:[x(m,"postal_code")," ",x(m,"city")]})]}),e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:p.h3,children:"FROM"}),e.jsx(j,{children:x(a,"company_name")}),e.jsxs(j,{children:[x(u,"street")," ",x(u,"street_number")," ",x(u,"street_number_addition")]}),e.jsxs(j,{children:[x(u,"postal_code")," ",x(u,"city")]}),e.jsx(j,{style:{fontWeight:"bold",marginTop:10},children:"CoC Number"}),e.jsx(j,{children:x(a,"coc_number")}),e.jsx(j,{style:{fontWeight:"bold",marginTop:10},children:"VAT Number"}),e.jsx(j,{children:x(a,"vat_number")})]})]})}),e.jsx(h,{style:p.section,children:e.jsxs(h,{style:p.row,children:[e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:{fontWeight:"bold"},children:"Invoice number: "}),e.jsx(j,{children:x(i,"invoice_number")})]}),x(i,"customer_reference")&&e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:{fontWeight:"bold"},children:"Your reference: "}),e.jsx(j,{children:x(i,"customer_reference")})]}),e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:{fontWeight:"bold"},children:"Invoice date"}),e.jsx(j,{children:x(i,"invoice_date")})]})]})}),e.jsxs(h,{style:p.section,children:[e.jsx(j,{style:p.h3,children:"SUMMARY"}),e.jsxs(h,{style:p.row,children:[i?.admin_items&&Array.isArray(i.admin_items)&&i.admin_items.length>0&&e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Line Item Number"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Title"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Amount"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT rate"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Incl. VAT"})})]}),i?.items&&Array.isArray(i.items)&&i.items.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:[i&&"product_title"in i?i.product_title:"",i&&"item_description"in i?i.item_description:""]})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"quantity")})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:[x(i,"vat_rate")," %"]})}),e.jsx(h,{style:p.productRowSection,children:i?.price_excl_vat&&i?.price_incl_vat&&e.jsxs(j,{style:{fontSize:"10px"},children:["€"," ",(i.price_incl_vat-i.price_excl_vat)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price_excl_vat",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price_incl_vat",0)?.toFixed(2)]})})]})},`credit-item-${s}`)),i?.admin_items&&Array.isArray(i.admin_items)&&i.admin_items.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"line_item_number")})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"description")})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"quantity")})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:[x(i,"price.vat_rate")," %"]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price.vat",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price.price",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price.price_incl_vat",0)?.toFixed(2)]})})]})},`credit-admin-item-${s}`))]}),e.jsxs(h,{style:p.section,children:[e.jsx(j,{style:p.h3,children:"TOTALS"}),e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontWeight:"bold"},children:"VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontWeight:"bold"},children:"Incl. VAT"})})]}),e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{children:["€ ",x(i,"VAT_total",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{children:["€ ",x(i,"total_excl_vat",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{children:["€ ",x(i,"total_incl_vat",0)?.toFixed(2)]})})]})]}),e.jsx(h,{style:p.section,children:e.jsxs(j,{style:{...p.h3,border:"2px solid black",padding:10},children:["Total: € ",x(i,"total_incl_vat",0)?.toFixed(2)]})})]})}):"proforma"===_?e.jsx(o,{title:`proforma_${x(i,"invoice_number","unknown")}`,children:e.jsxs(c,{size:"A4",style:p.page,children:[e.jsx(h,{style:p.header,children:e.jsx(j,{style:p.h1,children:x(a,"company_name")})}),e.jsxs(h,{style:p.section,children:[e.jsx(j,{style:p.h2,children:"PROFORMA INVOICE"}),e.jsx(j,{style:{fontSize:10,marginTop:5},children:"This is not a final invoice and cannot be used for tax purposes"})]}),e.jsx(h,{style:p.section,children:e.jsxs(h,{style:p.row,children:[e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:p.h3,children:"BILLING DETAILS"}),e.jsx(j,{children:x(S,"company_name")}),e.jsxs(j,{children:[x(i,"buyer_first_name")," ",x(i,"buyer_last_name")]}),e.jsxs(j,{children:[x(m,"street")," ",x(m,"street_number")," ",x(m,"street_number_addition")]}),e.jsxs(j,{children:[x(m,"postal_code")," ",x(m,"city")]})]}),e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:p.h3,children:"FROM"}),e.jsx(j,{children:x(a,"company_name")}),e.jsxs(j,{children:[x(u,"street")," ",x(u,"street_number")," ",x(u,"street_number_addition")]}),e.jsxs(j,{children:[x(u,"postal_code")," ",x(u,"city")]}),e.jsx(j,{style:{fontWeight:"bold",marginTop:10},children:"CoC Number"}),e.jsx(j,{children:x(a,"coc_number")}),e.jsx(j,{style:{fontWeight:"bold",marginTop:10},children:"VAT Number"}),e.jsx(j,{children:x(a,"vat_number")})]})]})}),e.jsx(h,{style:p.section,children:e.jsxs(h,{style:p.row,children:[e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:{fontWeight:"bold"},children:"Invoice number: "}),e.jsx(j,{children:x(i,"invoice_number")})]}),x(i,"customer_reference")&&e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:{fontWeight:"bold"},children:"Your reference: "}),e.jsx(j,{children:x(i,"customer_reference")})]}),e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:{fontWeight:"bold"},children:"Invoice date"}),e.jsx(j,{children:x(i,"invoice_date")})]})]})}),e.jsxs(h,{style:p.section,children:[e.jsx(j,{style:p.h3,children:"SUMMARY"}),e.jsxs(h,{style:p.row,children:[i?.admin_items&&Array.isArray(i.admin_items)&&i.admin_items.length>0&&e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Line Item Number"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Title"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Amount"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT rate"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Incl. VAT"})})]}),i?.items&&Array.isArray(i.items)&&i.items.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:[i&&"product_title"in i?i.product_title:"",i&&"item_description"in i?i.item_description:""]})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"quantity")})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:[x(i,"vat_rate")," %"]})}),e.jsx(h,{style:p.productRowSection,children:i?.price_excl_vat&&i?.price_incl_vat&&e.jsxs(j,{style:{fontSize:"10px"},children:["€"," ",(i.price_incl_vat-i.price_excl_vat)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price_excl_vat",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price_incl_vat",0)?.toFixed(2)]})})]})},`proforma-item-${s}`)),i?.admin_items&&Array.isArray(i.admin_items)&&i.admin_items.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"line_item_number")})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"description")})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"quantity")})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:[x(i,"price.vat_rate")," %"]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price.vat",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price.price",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price.price_incl_vat",0)?.toFixed(2)]})})]})},`proforma-admin-item-${s}`))]}),e.jsxs(h,{style:p.section,children:[e.jsx(j,{style:p.h3,children:"TOTALS"}),e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontWeight:"bold"},children:"VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontWeight:"bold"},children:"Incl. VAT"})})]}),e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{children:["€ ",x(i,"VAT_total",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{children:["€ ",x(i,"total_excl_vat",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{children:["€ ",x(i,"total_incl_vat",0)?.toFixed(2)]})})]})]}),e.jsx(h,{style:p.section,children:e.jsxs(j,{style:{...p.h3,border:"2px solid black",padding:10},children:["Total Due: € ",x(i,"total_incl_vat",0)?.toFixed(2)]})})]})}):e.jsx(o,{title:`invoice_${x(i,"invoice_number","unknown")}`,children:e.jsxs(c,{size:"A4",style:p.page,children:[e.jsx(h,{style:p.header,children:e.jsx(j,{style:p.h1,children:x(a,"company_name")})}),e.jsx(h,{style:p.section,children:e.jsx(j,{style:p.h2,children:"INVOICE"})}),e.jsx(h,{style:p.section,children:e.jsxs(h,{style:p.row,children:[e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:p.h3,children:"BILLING DETAILS"}),e.jsx(j,{children:x(S,"company_name")}),e.jsxs(j,{children:[x(i,"buyer_first_name")," ",x(i,"buyer_last_name")]}),e.jsxs(j,{children:[x(m,"street")," ",x(m,"street_number")," ",x(m,"street_number_addition")]}),e.jsxs(j,{children:[x(m,"postal_code")," ",x(m,"city")]})]}),e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:p.h3,children:"FROM"}),e.jsx(j,{children:x(a,"company_name")}),e.jsxs(j,{children:[x(u,"street")," ",x(u,"street_number")," ",x(u,"street_number_addition")]}),e.jsxs(j,{children:[x(u,"postal_code")," ",x(u,"city")]}),e.jsx(j,{style:{fontWeight:"bold",marginTop:10},children:"CoC Number"}),e.jsx(j,{children:x(a,"coc_number")}),e.jsx(j,{style:{fontWeight:"bold",marginTop:10},children:"VAT Number"}),e.jsx(j,{children:x(a,"vat_number")})]})]})}),e.jsx(h,{style:p.section,children:e.jsxs(h,{style:p.row,children:[e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:{fontWeight:"bold"},children:"Invoice number: "}),e.jsx(j,{children:x(i,"invoice_number")})]}),x(i,"customer_reference")&&e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:{fontWeight:"bold"},children:"Your reference: "}),e.jsx(j,{children:x(i,"customer_reference")})]}),e.jsxs(h,{style:p.rowSection,children:[e.jsx(j,{style:{fontWeight:"bold"},children:"Invoice date"}),e.jsx(j,{children:x(i,"invoice_date")})]})]})}),e.jsxs(h,{style:p.section,children:[e.jsx(j,{style:p.h3,children:"SUMMARY"}),e.jsxs(h,{style:p.row,children:[i?.admin_items&&Array.isArray(i.admin_items)&&i.admin_items.length>0&&e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Line Item Number"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Title"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Amount"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT rate"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px",fontWeight:"bold"},children:"Incl. VAT"})})]}),i?.items&&Array.isArray(i.items)&&i.items.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:[i&&"product_title"in i?i.product_title:"",i&&"item_description"in i?i.item_description:""]})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"quantity")})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:[x(i,"vat_rate")," %"]})}),e.jsx(h,{style:p.productRowSection,children:i?.price_excl_vat&&i?.price_incl_vat&&e.jsxs(j,{style:{fontSize:"10px"},children:["€"," ",(i.price_incl_vat-i.price_excl_vat)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price_excl_vat",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price_incl_vat",0)?.toFixed(2)]})})]})},`invoice-item-${s}`)),i?.admin_items&&Array.isArray(i.admin_items)&&i.admin_items.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"line_item_number")})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"description")})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontSize:"10px"},children:x(i,"quantity")})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:[x(i,"price.vat_rate")," %"]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price.vat",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price.price",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{style:{fontSize:"10px"},children:["€ ",x(i,"price.price_incl_vat",0)?.toFixed(2)]})})]})},`invoice-admin-item-${s}`))]}),e.jsxs(h,{style:p.section,children:[e.jsx(j,{style:p.h3,children:"TOTALS"}),e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontWeight:"bold"},children:"VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(h,{style:p.productRowSection,children:e.jsx(j,{style:{fontWeight:"bold"},children:"Incl. VAT"})})]}),e.jsxs(h,{style:p.row,children:[e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{children:["€ ",x(i,"VAT_total",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{children:["€ ",x(i,"total_excl_vat",0)?.toFixed(2)]})}),e.jsx(h,{style:p.productRowSection,children:e.jsxs(j,{children:["€ ",x(i,"total_incl_vat",0)?.toFixed(2)]})})]})]}),e.jsx(h,{style:p.section,children:e.jsxs(j,{style:{...p.h3,border:"2px solid black",padding:10},children:["Total Due: € ",x(i,"total_incl_vat",0)?.toFixed(2)]})})]})})};exports.InvoiceDownloadLink=function({invoice:t}){const{pdfComponents:s,loading:n,error:r}=d();if(n||r||!s||!t)return e.jsx(i,{disabled:!0,children:e.jsx(l,{size:20})});const{PDFDownloadLink:o}=s;try{return e.jsx(o,{document:e.jsx(h,{invoice:t}),fileName:`invoice_${x(t,"invoice_number","unknown")}`,children:e.jsx(i,{children:e.jsx(c,{})})},Date.now())}catch(t){return console.error("Error creating PDF download link:",t),e.jsx(i,{disabled:!0,children:e.jsx(c,{})})}},exports.InvoicePDF=h,exports.InvoicePDFViewer=function({invoice:x}){const[j,y]=t.useState(!1),[p,a]=t.useState(null),{pdfComponents:u,loading:m,error:S}=d();if(m||S||!u||!x)return e.jsx(i,{disabled:!0,children:e.jsx(l,{size:20})});const{PDFViewer:_}=u;return e.jsxs(e.Fragment,{children:[e.jsx(i,{onClick:()=>{a(null),y(!0)},children:e.jsx(c,{})}),e.jsxs(s,{open:j,fullWidth:!0,maxWidth:"lg",children:[e.jsx(n,{children:p?e.jsxs("div",{children:["Error rendering PDF: ",p]}):e.jsx(_,{style:{width:"100%",minHeight:"70vh"},children:e.jsx(h,{invoice:x})},Date.now())}),e.jsx(r,{children:e.jsx(o,{variant:"contained",onClick:()=>y(!1),children:"Close"})})]})]})};
|