umwd-components 0.1.762 → 0.1.764

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
- "use strict";var e=require("react/jsx-runtime"),t=require("@react-pdf/renderer"),i=require("react"),s=require("@mui/material/IconButton"),n=require("@mui/material/Dialog"),l=require("@mui/material/DialogContent"),c=require("@mui/material/DialogActions"),o=require("@mui/material/Button"),r=require("@mui/icons-material/PictureAsPdf");const x=t.StyleSheet.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"}});function d({props:s}){const{invoice:n}=s;console.log("invoice from invoicePDF",n);const{seller_business_credentials:l,seller_company_address:c,buyer_company_address:o,buyer_business_credentials:r,type:d,invoice_number:h}=n;return console.log("type",d),"credit"===d?e.jsx(t.Document,{title:`credit_${n?.invoice_number}`,children:e.jsxs(t.Page,{size:"A4",style:x.page,children:[e.jsx(t.View,{style:x.header,children:e.jsx(t.Text,{style:x.h1,children:l?.company_name})}),e.jsx(t.View,{style:x.section,children:e.jsx(t.Text,{style:x.h2,children:"CREDIT NOTE"})}),e.jsx(t.View,{style:x.section,children:e.jsxs(t.View,{style:x.row,children:[e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:x.h3,children:"BILLING DETAILS"}),e.jsx(t.Text,{children:r?.company_name}),e.jsxs(t.Text,{children:[n?.buyer_first_name," ",n?.buyer_last_name]}),e.jsxs(t.Text,{children:[o?.street," ",o?.street_number," ",o?.street_number_addition]}),e.jsxs(t.Text,{children:[o?.postal_code," ",o?.city]})]}),e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:x.h3,children:"FROM"}),e.jsx(t.Text,{children:l?.company_name}),e.jsxs(t.Text,{children:[c?.street," ",c?.street_number," ",c?.street_number_addition]}),e.jsxs(t.Text,{children:[c?.postal_code," ",c?.city]}),e.jsx(t.Text,{style:{fontWeight:"bold",marginTop:10},children:"CoC Number"}),e.jsx(t.Text,{children:l?.coc_number}),e.jsx(t.Text,{style:{fontWeight:"bold",marginTop:10},children:"VAT Number"}),e.jsx(t.Text,{children:l?.vat_number})]})]})}),e.jsx(t.View,{style:x.section,children:e.jsxs(t.View,{style:x.row,children:[e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Invoice number: "}),e.jsx(t.Text,{children:n?.invoice_number})]}),n?.customer_reference&&e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Your reference: "}),e.jsx(t.Text,{children:n?.customer_reference})]}),e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Invoice date"}),e.jsx(t.Text,{children:n?.invoice_date})]})]})}),e.jsxs(t.View,{style:x.section,children:[e.jsx(t.Text,{style:x.h3,children:"SUMMARY"}),e.jsxs(t.View,{style:x.row,children:[n?.admin_items?.length>0&&e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Line Item Number"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Title"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Amount"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT rate"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Incl. VAT"})})]}),n?.items?.map((s,n)=>e.jsx(i.Fragment,{children:e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["product_title"in s&&s.product_title,"item_description"in s&&s.item_description]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.quantity})}),e.jsxs(t.View,{style:x.productRowSection,children:[e.jsxs(t.Text,{style:{fontSize:"10px"},children:[s.vat_rate," %"]})," "]}),e.jsx(t.View,{style:x.productRowSection,children:s.price_excl_vat&&s.price_incl_vat&&e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€"," ",(s.price_incl_vat-s.price_excl_vat)?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s.price_excl_vat?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s.price_incl_vat?.toFixed(2)]})})]})},n)),n?.admin_items?.map((s,n)=>e.jsx(i.Fragment,{children:e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.line_item_number})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.description})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.quantity})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:[s?.price?.vat_rate," %"]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s?.price?.vat?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s?.price?.price?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s?.price?.price_incl_vat?.toFixed(2)]})})]})},n))]}),e.jsxs(t.View,{style:x.section,children:[e.jsx(t.Text,{style:x.h3,children:"TOTALS"}),e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontWeight:"bold"},children:"VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Incl. VAT"})})]}),e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{children:["€ ",n?.VAT_total?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{children:["€ ",n?.total_excl_vat?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{children:["€ ",n?.total_incl_vat?.toFixed(2)]})})]})]}),e.jsx(t.View,{style:x.section,children:e.jsxs(t.Text,{style:{...x.h3,border:"2px solid black",padding:10},children:["Total: € ",n?.total_incl_vat?.toFixed(2)]})})]})}):"proforma"===d?e.jsx(t.Document,{title:`proforma_${n?.invoice_number}`,children:e.jsxs(t.Page,{size:"A4",style:x.page,children:[e.jsx(t.View,{style:x.header,children:e.jsx(t.Text,{style:x.h1,children:l?.company_name})}),e.jsxs(t.View,{style:x.section,children:[e.jsx(t.Text,{style:x.h2,children:"PROFORMA INVOICE"}),e.jsx(t.Text,{style:{fontSize:10,marginTop:5},children:"This is not a final invoice and cannot be used for tax purposes"})]}),e.jsx(t.View,{style:x.section,children:e.jsxs(t.View,{style:x.row,children:[e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:x.h3,children:"BILLING DETAILS"}),e.jsx(t.Text,{children:r?.company_name}),e.jsxs(t.Text,{children:[n?.buyer_first_name," ",n?.buyer_last_name]}),e.jsxs(t.Text,{children:[o?.street," ",o?.street_number," ",o?.street_number_addition]}),e.jsxs(t.Text,{children:[o?.postal_code," ",o?.city]})]}),e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:x.h3,children:"FROM"}),e.jsx(t.Text,{children:l?.company_name}),e.jsxs(t.Text,{children:[c?.street," ",c?.street_number," ",c?.street_number_addition]}),e.jsxs(t.Text,{children:[c?.postal_code," ",c?.city]}),e.jsx(t.Text,{style:{fontWeight:"bold",marginTop:10},children:"CoC Number"}),e.jsx(t.Text,{children:l?.coc_number}),e.jsx(t.Text,{style:{fontWeight:"bold",marginTop:10},children:"VAT Number"}),e.jsx(t.Text,{children:l?.vat_number})]})]})}),e.jsx(t.View,{style:x.section,children:e.jsxs(t.View,{style:x.row,children:[e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Invoice number: "}),e.jsx(t.Text,{children:n?.invoice_number})]}),n?.customer_reference&&e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Your reference: "}),e.jsx(t.Text,{children:n?.customer_reference})]}),e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Invoice date"}),e.jsx(t.Text,{children:n?.invoice_date})]})]})}),e.jsxs(t.View,{style:x.section,children:[e.jsx(t.Text,{style:x.h3,children:"SUMMARY"}),e.jsxs(t.View,{style:x.row,children:[n?.admin_items?.length>0&&e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Line Item Number"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Title"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Amount"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT rate"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Incl. VAT"})})]}),n?.items?.map((s,n)=>e.jsx(i.Fragment,{children:e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["product_title"in s&&s.product_title,"item_description"in s&&s.item_description]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.quantity})}),e.jsxs(t.View,{style:x.productRowSection,children:[e.jsxs(t.Text,{style:{fontSize:"10px"},children:[s.vat_rate," %"]})," "]}),e.jsx(t.View,{style:x.productRowSection,children:s.price_excl_vat&&s.price_incl_vat&&e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€"," ",(s.price_incl_vat-s.price_excl_vat)?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s.price_excl_vat?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s.price_incl_vat?.toFixed(2)]})})]})},n)),n?.admin_items?.map((s,n)=>e.jsx(i.Fragment,{children:e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.line_item_number})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.description})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.quantity})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:[s?.price?.vat_rate," %"]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s?.price?.vat?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s?.price?.price?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s?.price?.price_incl_vat?.toFixed(2)]})})]})},n))]}),e.jsxs(t.View,{style:x.section,children:[e.jsx(t.Text,{style:x.h3,children:"TOTALS"}),e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontWeight:"bold"},children:"VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Incl. VAT"})})]}),e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{children:["€ ",n?.VAT_total?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{children:["€ ",n?.total_excl_vat?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{children:["€ ",n?.total_incl_vat?.toFixed(2)]})})]})]}),e.jsx(t.View,{style:x.section,children:e.jsxs(t.Text,{style:{...x.h3,border:"2px solid black",padding:10},children:["Total Due: € ",n?.total_incl_vat?.toFixed(2)]})})]})}):e.jsx(t.Document,{title:`invoice_${n?.invoice_number}`,children:e.jsxs(t.Page,{size:"A4",style:x.page,children:[e.jsx(t.View,{style:x.header,children:e.jsx(t.Text,{style:x.h1,children:l?.company_name})}),e.jsx(t.View,{style:x.section,children:e.jsx(t.Text,{style:x.h2,children:"INVOICE"})}),e.jsx(t.View,{style:x.section,children:e.jsxs(t.View,{style:x.row,children:[e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:x.h3,children:"BILLING DETAILS"}),e.jsx(t.Text,{children:r?.company_name}),e.jsxs(t.Text,{children:[n?.buyer_first_name," ",n?.buyer_last_name]}),e.jsxs(t.Text,{children:[o?.street," ",o?.street_number," ",o?.street_number_addition]}),e.jsxs(t.Text,{children:[o?.postal_code," ",o?.city]})]}),e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:x.h3,children:"FROM"}),e.jsx(t.Text,{children:l?.company_name}),e.jsxs(t.Text,{children:[c?.street," ",c?.street_number," ",c?.street_number_addition]}),e.jsxs(t.Text,{children:[c?.postal_code," ",c?.city]}),e.jsx(t.Text,{style:{fontWeight:"bold",marginTop:10},children:"CoC Number"}),e.jsx(t.Text,{children:l?.coc_number}),e.jsx(t.Text,{style:{fontWeight:"bold",marginTop:10},children:"VAT Number"}),e.jsx(t.Text,{children:l?.vat_number})]})]})}),e.jsx(t.View,{style:x.section,children:e.jsxs(t.View,{style:x.row,children:[e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Invoice number: "}),e.jsx(t.Text,{children:n?.invoice_number})]}),n?.customer_reference&&e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Your reference: "}),e.jsx(t.Text,{children:n?.customer_reference})]}),e.jsxs(t.View,{style:x.rowSection,children:[e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Invoice date"}),e.jsx(t.Text,{children:n?.invoice_date})]})]})}),e.jsxs(t.View,{style:x.section,children:[e.jsx(t.Text,{style:x.h3,children:"SUMMARY"}),e.jsxs(t.View,{style:x.row,children:[n?.admin_items?.length>0&&e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Line Item Number"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Title"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Amount"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT rate"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px",fontWeight:"bold"},children:"Incl. VAT"})})]}),n?.items?.map((s,n)=>e.jsx(i.Fragment,{children:e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["product_title"in s&&s.product_title,"item_description"in s&&s.item_description]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.quantity})}),e.jsxs(t.View,{style:x.productRowSection,children:[e.jsxs(t.Text,{style:{fontSize:"10px"},children:[s.vat_rate," %"]})," "]}),e.jsx(t.View,{style:x.productRowSection,children:s.price_excl_vat&&s.price_incl_vat&&e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€"," ",(s.price_incl_vat-s.price_excl_vat)?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s.price_excl_vat?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s.price_incl_vat?.toFixed(2)]})})]})},n)),n?.admin_items?.map((s,n)=>e.jsx(i.Fragment,{children:e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.line_item_number})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.description})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontSize:"10px"},children:s.quantity})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:[s?.price?.vat_rate," %"]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s?.price?.vat?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s?.price?.price?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{style:{fontSize:"10px"},children:["€ ",s?.price?.price_incl_vat?.toFixed(2)]})})]})},n))]}),e.jsxs(t.View,{style:x.section,children:[e.jsx(t.Text,{style:x.h3,children:"TOTALS"}),e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontWeight:"bold"},children:"VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsx(t.Text,{style:{fontWeight:"bold"},children:"Incl. VAT"})})]}),e.jsxs(t.View,{style:x.row,children:[e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{children:["€ ",n?.VAT_total?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{children:["€ ",n?.total_excl_vat?.toFixed(2)]})}),e.jsx(t.View,{style:x.productRowSection,children:e.jsxs(t.Text,{children:["€ ",n?.total_incl_vat?.toFixed(2)]})})]})]}),e.jsx(t.View,{style:x.section,children:e.jsxs(t.Text,{style:{...x.h3,border:"2px solid black",padding:10},children:["Total Due: € ",n?.total_incl_vat?.toFixed(2)]})})]})})}exports.InvoiceDownloadLink=function({invoice:i}){return e.jsx(t.PDFDownloadLink,{document:e.jsx(d,{props:{invoice:i}}),fileName:`invoice_${i?.invoice_number}`,children:e.jsx(s,{children:e.jsx(r,{})})})},exports.InvoicePDFViewer=function({invoice:x}){const[h,j]=i.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx(s,{onClick:()=>j(!0),children:e.jsx(r,{})}),e.jsxs(n,{open:h,fullWidth:!0,maxWidth:"lg",children:[e.jsx(l,{children:e.jsx(t.PDFViewer,{style:{width:"100%",minHeight:"70vh"},children:e.jsx(d,{props:{invoice:x}})})}),e.jsx(c,{children:e.jsx(o,{variant:"contained",onClick:()=>j(!1),children:"Close"})})]})]})};
7
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("@mui/material/IconButton"),s=require("@mui/material/Dialog"),n=require("@mui/material/DialogContent"),l=require("@mui/material/DialogActions"),c=require("@mui/material/Button"),o=require("@mui/material/CircularProgress"),r=require("@mui/icons-material/PictureAsPdf");let d=null;const x=async()=>("undefined"==typeof window||d||(d=await import("@react-pdf/renderer")),d),h=({props:i})=>{const{invoice:s}=i,[n,l]=t.useState(null),[c,r]=t.useState(null);if(t.useEffect(()=>{(async()=>{const e=await x();e&&(l(e),r(e.StyleSheet.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"}})))})()},[]),!n||!c)return e.jsx(o,{});const{Document:d,Page:h,View:j,Text:y}=n,{seller_business_credentials:p,seller_company_address:a,buyer_company_address:u,buyer_business_credentials:S,type:_,invoice_number:f}=s;console.log("type",_);return"credit"===_?e.jsx(d,{title:`credit_${s?.invoice_number}`,children:e.jsxs(h,{size:"A4",style:c.page,children:[e.jsx(j,{style:c.header,children:e.jsx(y,{style:c.h1,children:p?.company_name})}),e.jsx(j,{style:c.section,children:e.jsx(y,{style:c.h2,children:"CREDIT NOTE"})}),e.jsx(j,{style:c.section,children:e.jsxs(j,{style:c.row,children:[e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:c.h3,children:"BILLING DETAILS"}),e.jsx(y,{children:S?.company_name}),e.jsxs(y,{children:[s?.buyer_first_name," ",s?.buyer_last_name]}),e.jsxs(y,{children:[u?.street," ",u?.street_number," ",u?.street_number_addition]}),e.jsxs(y,{children:[u?.postal_code," ",u?.city]})]}),e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:c.h3,children:"FROM"}),e.jsx(y,{children:p?.company_name}),e.jsxs(y,{children:[a?.street," ",a?.street_number," ",a?.street_number_addition]}),e.jsxs(y,{children:[a?.postal_code," ",a?.city]}),e.jsx(y,{style:{fontWeight:"bold",marginTop:10},children:"CoC Number"}),e.jsx(y,{children:p?.coc_number}),e.jsx(y,{style:{fontWeight:"bold",marginTop:10},children:"VAT Number"}),e.jsx(y,{children:p?.vat_number})]})]})}),e.jsx(j,{style:c.section,children:e.jsxs(j,{style:c.row,children:[e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:{fontWeight:"bold"},children:"Invoice number: "}),e.jsx(y,{children:s?.invoice_number})]}),s?.customer_reference&&e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:{fontWeight:"bold"},children:"Your reference: "}),e.jsx(y,{children:s?.customer_reference})]}),e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:{fontWeight:"bold"},children:"Invoice date"}),e.jsx(y,{children:s?.invoice_date})]})]})}),e.jsxs(j,{style:c.section,children:[e.jsx(y,{style:c.h3,children:"SUMMARY"}),e.jsxs(j,{style:c.row,children:[s?.admin_items?.length>0&&e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Line Item Number"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Title"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Amount"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT rate"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Incl. VAT"})})]}),s?.items?.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["product_title"in i&&i.product_title,"item_description"in i&&i.item_description]})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.quantity})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:[i.vat_rate," %"]})}),e.jsx(j,{style:c.productRowSection,children:i.price_excl_vat&&i.price_incl_vat&&e.jsxs(y,{style:{fontSize:"10px"},children:["€"," ",(i.price_incl_vat-i.price_excl_vat)?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i.price_excl_vat?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i.price_incl_vat?.toFixed(2)]})})]})},s)),s?.admin_items?.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.line_item_number})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.description})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.quantity})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:[i?.price?.vat_rate," %"]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i?.price?.vat?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i?.price?.price?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i?.price?.price_incl_vat?.toFixed(2)]})})]})},s))]}),e.jsxs(j,{style:c.section,children:[e.jsx(y,{style:c.h3,children:"TOTALS"}),e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontWeight:"bold"},children:"VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontWeight:"bold"},children:"Incl. VAT"})})]}),e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{children:["€ ",s?.VAT_total?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{children:["€ ",s?.total_excl_vat?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{children:["€ ",s?.total_incl_vat?.toFixed(2)]})})]})]}),e.jsx(j,{style:c.section,children:e.jsxs(y,{style:{...c.h3,border:"2px solid black",padding:10},children:["Total: € ",s?.total_incl_vat?.toFixed(2)]})})]})}):"proforma"===_?e.jsx(d,{title:`proforma_${s?.invoice_number}`,children:e.jsxs(h,{size:"A4",style:c.page,children:[e.jsx(j,{style:c.header,children:e.jsx(y,{style:c.h1,children:p?.company_name})}),e.jsxs(j,{style:c.section,children:[e.jsx(y,{style:c.h2,children:"PROFORMA INVOICE"}),e.jsx(y,{style:{fontSize:10,marginTop:5},children:"This is not a final invoice and cannot be used for tax purposes"})]}),e.jsx(j,{style:c.section,children:e.jsxs(j,{style:c.row,children:[e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:c.h3,children:"BILLING DETAILS"}),e.jsx(y,{children:S?.company_name}),e.jsxs(y,{children:[s?.buyer_first_name," ",s?.buyer_last_name]}),e.jsxs(y,{children:[u?.street," ",u?.street_number," ",u?.street_number_addition]}),e.jsxs(y,{children:[u?.postal_code," ",u?.city]})]}),e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:c.h3,children:"FROM"}),e.jsx(y,{children:p?.company_name}),e.jsxs(y,{children:[a?.street," ",a?.street_number," ",a?.street_number_addition]}),e.jsxs(y,{children:[a?.postal_code," ",a?.city]}),e.jsx(y,{style:{fontWeight:"bold",marginTop:10},children:"CoC Number"}),e.jsx(y,{children:p?.coc_number}),e.jsx(y,{style:{fontWeight:"bold",marginTop:10},children:"VAT Number"}),e.jsx(y,{children:p?.vat_number})]})]})}),e.jsx(j,{style:c.section,children:e.jsxs(j,{style:c.row,children:[e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:{fontWeight:"bold"},children:"Invoice number: "}),e.jsx(y,{children:s?.invoice_number})]}),s?.customer_reference&&e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:{fontWeight:"bold"},children:"Your reference: "}),e.jsx(y,{children:s?.customer_reference})]}),e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:{fontWeight:"bold"},children:"Invoice date"}),e.jsx(y,{children:s?.invoice_date})]})]})}),e.jsxs(j,{style:c.section,children:[e.jsx(y,{style:c.h3,children:"SUMMARY"}),e.jsxs(j,{style:c.row,children:[s?.admin_items?.length>0&&e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Line Item Number"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Title"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Amount"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT rate"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Incl. VAT"})})]}),s?.items?.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["product_title"in i&&i.product_title,"item_description"in i&&i.item_description]})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.quantity})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:[i.vat_rate," %"]})}),e.jsx(j,{style:c.productRowSection,children:i.price_excl_vat&&i.price_incl_vat&&e.jsxs(y,{style:{fontSize:"10px"},children:["€"," ",(i.price_incl_vat-i.price_excl_vat)?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i.price_excl_vat?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i.price_incl_vat?.toFixed(2)]})})]})},s)),s?.admin_items?.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.line_item_number})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.description})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.quantity})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:[i?.price?.vat_rate," %"]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i?.price?.vat?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i?.price?.price?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i?.price?.price_incl_vat?.toFixed(2)]})})]})},s))]}),e.jsxs(j,{style:c.section,children:[e.jsx(y,{style:c.h3,children:"TOTALS"}),e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontWeight:"bold"},children:"VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontWeight:"bold"},children:"Incl. VAT"})})]}),e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{children:["€ ",s?.VAT_total?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{children:["€ ",s?.total_excl_vat?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{children:["€ ",s?.total_incl_vat?.toFixed(2)]})})]})]}),e.jsx(j,{style:c.section,children:e.jsxs(y,{style:{...c.h3,border:"2px solid black",padding:10},children:["Total Due: € ",s?.total_incl_vat?.toFixed(2)]})})]})}):e.jsx(d,{title:`invoice_${s?.invoice_number}`,children:e.jsxs(h,{size:"A4",style:c.page,children:[e.jsx(j,{style:c.header,children:e.jsx(y,{style:c.h1,children:p?.company_name})}),e.jsx(j,{style:c.section,children:e.jsx(y,{style:c.h2,children:"INVOICE"})}),e.jsx(j,{style:c.section,children:e.jsxs(j,{style:c.row,children:[e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:c.h3,children:"BILLING DETAILS"}),e.jsx(y,{children:S?.company_name}),e.jsxs(y,{children:[s?.buyer_first_name," ",s?.buyer_last_name]}),e.jsxs(y,{children:[u?.street," ",u?.street_number," ",u?.street_number_addition]}),e.jsxs(y,{children:[u?.postal_code," ",u?.city]})]}),e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:c.h3,children:"FROM"}),e.jsx(y,{children:p?.company_name}),e.jsxs(y,{children:[a?.street," ",a?.street_number," ",a?.street_number_addition]}),e.jsxs(y,{children:[a?.postal_code," ",a?.city]}),e.jsx(y,{style:{fontWeight:"bold",marginTop:10},children:"CoC Number"}),e.jsx(y,{children:p?.coc_number}),e.jsx(y,{style:{fontWeight:"bold",marginTop:10},children:"VAT Number"}),e.jsx(y,{children:p?.vat_number})]})]})}),e.jsx(j,{style:c.section,children:e.jsxs(j,{style:c.row,children:[e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:{fontWeight:"bold"},children:"Invoice number: "}),e.jsx(y,{children:s?.invoice_number})]}),s?.customer_reference&&e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:{fontWeight:"bold"},children:"Your reference: "}),e.jsx(y,{children:s?.customer_reference})]}),e.jsxs(j,{style:c.rowSection,children:[e.jsx(y,{style:{fontWeight:"bold"},children:"Invoice date"}),e.jsx(y,{children:s?.invoice_date})]})]})}),e.jsxs(j,{style:c.section,children:[e.jsx(y,{style:c.h3,children:"SUMMARY"}),e.jsxs(j,{style:c.row,children:[s?.admin_items?.length>0&&e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Line Item Number"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Title"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Amount"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT rate"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px",fontWeight:"bold"},children:"Incl. VAT"})})]}),s?.items?.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["product_title"in i&&i.product_title,"item_description"in i&&i.item_description]})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.quantity})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:[i.vat_rate," %"]})}),e.jsx(j,{style:c.productRowSection,children:i.price_excl_vat&&i.price_incl_vat&&e.jsxs(y,{style:{fontSize:"10px"},children:["€"," ",(i.price_incl_vat-i.price_excl_vat)?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i.price_excl_vat?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i.price_incl_vat?.toFixed(2)]})})]})},s)),s?.admin_items?.map((i,s)=>e.jsx(t.Fragment,{children:e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.line_item_number})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.description})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontSize:"10px"},children:i.quantity})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:[i?.price?.vat_rate," %"]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i?.price?.vat?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i?.price?.price?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{style:{fontSize:"10px"},children:["€ ",i?.price?.price_incl_vat?.toFixed(2)]})})]})},s))]}),e.jsxs(j,{style:c.section,children:[e.jsx(y,{style:c.h3,children:"TOTALS"}),e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontWeight:"bold"},children:"VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontWeight:"bold"},children:"Excl. VAT"})}),e.jsx(j,{style:c.productRowSection,children:e.jsx(y,{style:{fontWeight:"bold"},children:"Incl. VAT"})})]}),e.jsxs(j,{style:c.row,children:[e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{children:["€ ",s?.VAT_total?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{children:["€ ",s?.total_excl_vat?.toFixed(2)]})}),e.jsx(j,{style:c.productRowSection,children:e.jsxs(y,{children:["€ ",s?.total_incl_vat?.toFixed(2)]})})]})]}),e.jsx(j,{style:c.section,children:e.jsxs(y,{style:{...c.h3,border:"2px solid black",padding:10},children:["Total Due: € ",s?.total_incl_vat?.toFixed(2)]})})]})})};exports.InvoiceDownloadLink=function({invoice:s}){const[n,l]=t.useState(null);if(t.useEffect(()=>{(async()=>{const e=await x();l(e)})()},[]),!n)return e.jsx(i,{disabled:!0,children:e.jsx(o,{size:20})});const{PDFDownloadLink:c}=n;return e.jsx(c,{document:e.jsx(h,{props:{invoice:s}}),fileName:`invoice_${s?.invoice_number}`,children:e.jsx(i,{children:e.jsx(r,{})})})},exports.InvoicePDFViewer=function({invoice:d}){const[j,y]=t.useState(!1),[p,a]=t.useState(null);if(t.useEffect(()=>{(async()=>{const e=await x();a(e)})()},[]),!p)return e.jsx(i,{disabled:!0,children:e.jsx(o,{size:20})});const{PDFViewer:u}=p;return e.jsxs(e.Fragment,{children:[e.jsx(i,{onClick:()=>y(!0),children:e.jsx(r,{})}),e.jsxs(s,{open:j,fullWidth:!0,maxWidth:"lg",children:[e.jsx(n,{children:e.jsx(u,{style:{width:"100%",minHeight:"70vh"},children:e.jsx(h,{props:{invoice:d}})})}),e.jsx(l,{children:e.jsx(c,{variant:"contained",onClick:()=>y(!1),children:"Close"})})]})]})},exports.default=h;