umwd-components 0.1.445 → 0.1.448

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/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};
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};
@@ -3,5 +3,5 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{__exports as a}from"../../_virtual/index8.js";
6
+ import{__exports as a}from"../../_virtual/index7.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};
@@ -3,4 +3,4 @@
3
3
  * @copyright Jelle Paulus
4
4
  * @license MIT
5
5
  */
6
- import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import r from"@mui/material/Paper";import n from"@mui/material/Stack";import i from"@mui/material/Typography";import a from"@mui/material/Autocomplete";import l from"@mui/material/Grid";import o from"@mui/material/Checkbox";import m from"@mui/material/TextField";import s from"../../common/Address.js";function d(d){var c,p,u=d.user,f=d.prefersBillingAddress,E=void 0===f||f,v=d.prefersDeliveryAddress,g=void 0===v||v,y=d.delivery_options,_=d.payment_options,b=d.togglePrefersBillingAddress,h=d.togglePrefersDeliveryAddress;return t.createElement(r,{sx:{p:2}},t.createElement(n,{spacing:2},null!==u&&t.createElement("form",null,t.createElement(l,{container:!0,spacing:2},t.createElement(l,{item:!0,xs:12,md:6},t.createElement(n,{spacing:2,justifyContent:"space-between"},t.createElement(i,{variant:"h5"},"Delivery Options"),t.createElement(i,{variant:"body1"},"Your order will be delivered at this address"),g&&u.customer_profile.delivery_address?t.createElement(s,{data:u.customer_profile.delivery_address}):t.createElement(s,{data:u.customer_profile.company_address}),null!=(null===(c=null==u?void 0:u.customer_profile)||void 0===c?void 0:c.delivery_address)&&t.createElement(n,{direction:"row",spacing:2,alignItems:"center"},t.createElement(o,{checked:!g,onChange:h}),t.createElement(i,null,"Use company address instead")),y&&y.length>0&&t.createElement(a,{options:y,renderInput:function(r){return t.createElement(m,e({},r,{label:"Delivery Options"}))}}))),t.createElement(l,{item:!0,xs:12,md:6},t.createElement(n,{spacing:2,justifyContent:"space-between"},t.createElement(i,{variant:"h5"},"Payment Options"),t.createElement(i,{variant:"body1"},"Your invoice will be shipped to this address"),E&&u.customer_profile.billing_address?t.createElement(s,{data:u.customer_profile.billing_address}):t.createElement(s,{data:u.customer_profile.company_address}),null!=(null===(p=null==u?void 0:u.customer_profile)||void 0===p?void 0:p.billing_address)&&t.createElement(n,{direction:"row",spacing:2,alignItems:"center"},t.createElement(o,{checked:!E,onChange:b}),t.createElement(i,null,"Use company address instead")),_&&_.length>0&&t.createElement(a,{options:_,renderInput:function(r){return t.createElement(m,e({},r,{label:"Payment Options"}))}})))))))}export{d as default};
6
+ import{extends as e}from"../../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import r from"@mui/material/Paper";import n from"@mui/material/Stack";import a from"@mui/material/Typography";import l from"@mui/material/Autocomplete";import i from"@mui/material/Grid";import o from"@mui/material/Checkbox";import m from"@mui/material/TextField";import s from"../../common/Address.js";function c(c){var d,p,u=c.user,f=c.prefersBillingAddress,E=void 0===f||f,v=c.prefersDeliveryAddress,g=void 0===v||v,_=c.delivery_options,y=c.payment_options,h=c.togglePrefersBillingAddress,b=c.togglePrefersDeliveryAddress;return t.createElement(r,{sx:{p:2}},t.createElement(n,{spacing:2},null!==u&&t.createElement("form",null,t.createElement(i,{container:!0,spacing:2},t.createElement(i,{item:!0,xs:12,md:6},t.createElement(n,{spacing:2,justifyContent:"space-between"},t.createElement(a,{variant:"h5"},"Delivery Options"),t.createElement(a,{variant:"body1"},"Your order will be delivered at this address"),g&&u.customer_profile.delivery_address?t.createElement(s,{data:u.customer_profile.delivery_address}):t.createElement(s,{data:u.customer_profile.company_address}),null!=(null===(d=null==u?void 0:u.customer_profile)||void 0===d?void 0:d.delivery_address)&&t.createElement(n,{direction:"row",spacing:2,alignItems:"center"},t.createElement(o,{checked:!g,onChange:b}),t.createElement(a,null,"Use company address instead")),_&&_.length>0&&t.createElement(l,{options:_,renderInput:function(r){return t.createElement(m,e({},r,{label:"Delivery Options"}))}}))),t.createElement(i,{item:!0,xs:12,md:6},t.createElement(n,{spacing:2,justifyContent:"space-between"},t.createElement(a,{variant:"h5"},"Payment Options"),t.createElement(a,{variant:"body1"},"Your invoice will be shipped to this address"),E&&u.customer_profile.billing_address?t.createElement(s,{data:u.customer_profile.billing_address}):t.createElement(s,{data:u.customer_profile.company_address}),null!=(null===(p=null==u?void 0:u.customer_profile)||void 0===p?void 0:p.billing_address)&&t.createElement(n,{direction:"row",spacing:2,alignItems:"center"},t.createElement(o,{checked:!E,onChange:h}),t.createElement(a,null,"Use company address instead")),y&&y.length>0&&t.createElement(l,{options:y,renderInput:function(r){return t.createElement(m,e({},r,{label:"Payment Options"}))}}))),t.createElement(i,{item:!0,xs:12},t.createElement(n,{spacing:2},t.createElement(a,{variant:"h5"},"Internal Reference"),t.createElement(a,{variant:"body1"},"Optionaly attach an internal reference to this order"),t.createElement(m,{id:"customer_internal_reference",name:"customer_internal_reference",label:"Internal Reference"})))))))}export{c as default};
@@ -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 l from"next/dynamic";import{StyleSheet as n,Document as o,Page as r,View as c,Text as i}from"@react-pdf/renderer";import a,{useState as m,Fragment as u}from"react";import d from"@mui/material/IconButton";import s from"@mui/material/Dialog";import E from"@mui/material/DialogContent";import y from"@mui/material/DialogActions";import p from"@mui/material/Button";import v from"@mui/icons-material/PictureAsPdf";var _=n.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,m=e.props.invoice,d=m.seller_business_credentials,s=m.seller_company_address,E=m.buyer_company_address,y=m.buyer_business_credentials;return a.createElement(o,null,a.createElement(r,{size:"A4",style:_.page},a.createElement(c,{style:_.header},a.createElement(i,{style:_.h1},null==d?void 0:d.company_name)),a.createElement(c,{style:_.section},a.createElement(i,{style:_.h2},"INVOICE")),a.createElement(c,{style:_.section},a.createElement(c,{style:_.row},a.createElement(c,{style:_.rowSection},a.createElement(i,{style:_.h3},"BILLING DETAILS"),a.createElement(i,null,null==y?void 0:y.company_name),a.createElement(i,null,null==m?void 0:m.buyer_first_name," ",null==m?void 0:m.buyer_last_name),a.createElement(i,null,null==E?void 0:E.street," ",null==E?void 0:E.street_number," ",null==E?void 0:E.street_number_addition),a.createElement(i,null,null==E?void 0:E.postal_code," ",null==E?void 0:E.city)),a.createElement(c,{style:_.rowSection},a.createElement(i,{style:_.h3},"FROM"),a.createElement(i,null,null==d?void 0:d.company_name),a.createElement(i,null,null==s?void 0:s.street," ",null==s?void 0:s.street_number," ",null==s?void 0:s.street_number_addition),a.createElement(i,null,null==s?void 0:s.postal_code," ",null==s?void 0:s.city),a.createElement(i,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),a.createElement(i,null,null==d?void 0:d.coc_number),a.createElement(i,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),a.createElement(i,null,null==d?void 0:d.vat_number)))),a.createElement(c,{style:_.section},a.createElement(c,{style:_.row},a.createElement(c,{style:_.rowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Invoice number"),a.createElement(i,null,null==m?void 0:m.invoice_number)),a.createElement(c,{style:_.rowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Invoice date"),a.createElement(i,null,null==m?void 0:m.invoice_date)))),a.createElement(c,{style:_.section},a.createElement(i,{style:_.h3},"SUMMARY"),a.createElement(c,{style:_.row},a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Title")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Amount")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"VAT rate")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"VAT")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Excl. VAT")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Incl. VAT"))),null===(l=null==m?void 0:m.items)||void 0===l?void 0:l.map((function(e,t){return a.createElement(u,{key:t},a.createElement(c,{style:_.row},a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,e.quantity)),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,e.vat_rate," %")," "),a.createElement(c,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&a.createElement(i,null,"€"," ",(e.price_incl_vat-e.price_excl_vat).toFixed(2))),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"€ ",e.price_excl_vat)),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"€ ",e.price_incl_vat))))}))),a.createElement(c,{style:_.section},a.createElement(i,{style:_.h3},"TOTALS"),a.createElement(c,{style:_.row},a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"VAT")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Excl. VAT")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Incl. VAT"))),a.createElement(c,{style:_.row},a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"€ ",null===(n=null==m?void 0:m.VAT_total)||void 0===n?void 0:n.toFixed(2))),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"€ ",null==m?void 0:m.total_excl_vat)),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"€ ",null==m?void 0:m.total_incl_vat)))),a.createElement(c,{style:_.section},a.createElement(i,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null==m?void 0:m.total_incl_vat))))}function S(e){var t=e.invoice,n=l((function(){return import("@react-pdf/renderer").then((function(e){return e.PDFDownloadLink}))}),{ssr:!1,loading:function(){return a.createElement("p",null,"Loading...")}});return a.createElement(n,{document:a.createElement(f,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},a.createElement(d,null,a.createElement(v,null)))}function w(t){var n=t.invoice,o=l((function(){return import("@react-pdf/renderer").then((function(e){return e.PDFViewer}))}),{ssr:!1,loading:function(){return a.createElement("p",null,"Loading...")}}),r=e(m(!1),2),c=r[0],i=r[1];return a.createElement(a.Fragment,null,a.createElement(d,{onClick:function(){return i(!0)}},a.createElement(v,null)),a.createElement(s,{open:c,fullWidth:!0,maxWidth:"lg"},a.createElement(E,null,a.createElement(o,{style:{width:"100%",minHeight:"70vh"}},a.createElement(f,{props:{invoice:n}}))),a.createElement(y,null,a.createElement(p,{variant:"contained",onClick:function(){return i(!1)}},"Close"))))}export{S as InvoiceDownloadLink,w as InvoicePDFViewer};
7
+ import{__read as e,__assign as t}from"../../../../node_modules/tslib/tslib.es6.js";import l from"next/dynamic";import{StyleSheet as n,Document as o,Page as r,View as c,Text as i}from"@react-pdf/renderer";import a,{useState as m,Fragment as u}from"react";import d from"@mui/material/IconButton";import s from"@mui/material/Dialog";import E from"@mui/material/DialogContent";import y from"@mui/material/DialogActions";import p from"@mui/material/Button";import v from"@mui/icons-material/PictureAsPdf";var _=n.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,m=e.props.invoice,d=m.seller_business_credentials,s=m.seller_company_address,E=m.buyer_company_address,y=m.buyer_business_credentials;return a.createElement(o,null,a.createElement(r,{size:"A4",style:_.page},a.createElement(c,{style:_.header},a.createElement(i,{style:_.h1},null==d?void 0:d.company_name)),a.createElement(c,{style:_.section},a.createElement(i,{style:_.h2},"INVOICE")),a.createElement(c,{style:_.section},a.createElement(c,{style:_.row},a.createElement(c,{style:_.rowSection},a.createElement(i,{style:_.h3},"BILLING DETAILS"),a.createElement(i,null,null==y?void 0:y.company_name),a.createElement(i,null,null==m?void 0:m.buyer_first_name," ",null==m?void 0:m.buyer_last_name),a.createElement(i,null,null==E?void 0:E.street," ",null==E?void 0:E.street_number," ",null==E?void 0:E.street_number_addition),a.createElement(i,null,null==E?void 0:E.postal_code," ",null==E?void 0:E.city)),a.createElement(c,{style:_.rowSection},a.createElement(i,{style:_.h3},"FROM"),a.createElement(i,null,null==d?void 0:d.company_name),a.createElement(i,null,null==s?void 0:s.street," ",null==s?void 0:s.street_number," ",null==s?void 0:s.street_number_addition),a.createElement(i,null,null==s?void 0:s.postal_code," ",null==s?void 0:s.city),a.createElement(i,{style:{fontStyle:"bold",marginTop:10}},"CoC Number"),a.createElement(i,null,null==d?void 0:d.coc_number),a.createElement(i,{style:{fontStyle:"bold",marginTop:10}},"VAT Number"),a.createElement(i,null,null==d?void 0:d.vat_number)))),a.createElement(c,{style:_.section},a.createElement(c,{style:_.row},a.createElement(c,{style:_.rowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Invoice number: "),a.createElement(i,null,null==m?void 0:m.invoice_number)),a.createElement(c,{style:_.rowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Invoice date"),a.createElement(i,null,null==m?void 0:m.invoice_date)))),a.createElement(c,{style:_.section},a.createElement(i,{style:_.h3},"SUMMARY"),a.createElement(c,{style:_.row},a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Title")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Amount")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"VAT rate")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"VAT")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Excl. VAT")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Incl. VAT"))),null===(l=null==m?void 0:m.items)||void 0===l?void 0:l.map((function(e,t){return a.createElement(u,{key:t},a.createElement(c,{style:_.row},a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"product_title"in e&&e.product_title,"item_description"in e&&e.item_description)),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,e.quantity)),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,e.vat_rate," %")," "),a.createElement(c,{style:_.productRowSection},e.price_excl_vat&&e.price_incl_vat&&a.createElement(i,null,"€"," ",(e.price_incl_vat-e.price_excl_vat).toFixed(2))),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"€ ",e.price_excl_vat)),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"€ ",e.price_incl_vat))))}))),a.createElement(c,{style:_.section},a.createElement(i,{style:_.h3},"TOTALS"),a.createElement(c,{style:_.row},a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"VAT")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Excl. VAT")),a.createElement(c,{style:_.productRowSection},a.createElement(i,{style:{fontStyle:"bold"}},"Incl. VAT"))),a.createElement(c,{style:_.row},a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection}),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"€ ",null===(n=null==m?void 0:m.VAT_total)||void 0===n?void 0:n.toFixed(2))),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"€ ",null==m?void 0:m.total_excl_vat)),a.createElement(c,{style:_.productRowSection},a.createElement(i,null,"€ ",null==m?void 0:m.total_incl_vat)))),a.createElement(c,{style:_.section},a.createElement(i,{style:t(t({},_.h3),{border:"2px solid black",padding:10})},"Total Due: € ",null==m?void 0:m.total_incl_vat))))}function S(e){var t=e.invoice,n=l((function(){return import("@react-pdf/renderer").then((function(e){return e.PDFDownloadLink}))}),{ssr:!1,loading:function(){return a.createElement("p",null,"Loading...")}});return a.createElement(n,{document:a.createElement(f,{props:{invoice:t}}),fileName:"invoice_".concat(null==t?void 0:t.invoice_number)},a.createElement(d,null,a.createElement(v,null)))}function w(t){var n=t.invoice,o=l((function(){return import("@react-pdf/renderer").then((function(e){return e.PDFViewer}))}),{ssr:!1,loading:function(){return a.createElement("p",null,"Loading...")}}),r=e(m(!1),2),c=r[0],i=r[1];return a.createElement(a.Fragment,null,a.createElement(d,{onClick:function(){return i(!0)}},a.createElement(v,null)),a.createElement(s,{open:c,fullWidth:!0,maxWidth:"lg"},a.createElement(E,null,a.createElement(o,{style:{width:"100%",minHeight:"70vh"}},a.createElement(f,{props:{invoice:n}}))),a.createElement(y,null,a.createElement(p,{variant:"contained",onClick:function(){return i(!1)}},"Close"))))}export{S as InvoiceDownloadLink,w as InvoicePDFViewer};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n}from"react";import i from"@mui/material/Paper";import m from"@mui/material/Box";import a from"@mui/material/Stack";import l from"@mui/material/Alert";import o from"@mui/material/TextField";import c from"@mui/material/Typography";import{SubmitButton as s}from"../../SubmitButton.js";import{useFormState as d}from"react-dom";import{StrapiErrors as u}from"../../StrapiErrors.js";import{createProductAction as p}from"../../../data/actions/e-commerce/product/createProductAction.js";import{MediaLibraryDialog as E}from"../../common/media/MediaLibraryDialog.js";import f from"@mui/material/Button";import g from"@mui/material/Grid";import{StrapiImage as h}from"../../StrapiImage.js";import{PriceFields as v}from"./PriceFields.js";import x from"../categories/CategorySelectorV2.js";import{DimensionsFields as y}from"../../common/Dimensions.js";import j from"../../logistics/vendor/VendorSelector.js";import w from"../../common/markdown/MarkdownEditor.js";var S={zodErrors:null,strapiErrors:null,data:null,message:null};function b(b){var C=b.vendorArr,k=b.categories,T=e(d(p,S),2),P=T[0],V=T[1],D=e(n(null),2),I=D[0],N=D[1],A=e(n(null),2),B=A[0],O=A[1],F=e(n([]),2),G=F[0],M=F[1];return r.createElement(m,{component:i,sx:{p:2}},r.createElement("form",{action:V},r.createElement(g,{container:!0,spacing:2},r.createElement(g,{item:!0,xs:12},r.createElement(a,{spacing:2},r.createElement(o,{id:"title",name:"title",label:"Title"}),r.createElement(w,{name:"description",label:"Description"}))),r.createElement(g,{item:!0,xs:6},r.createElement(c,{variant:"h6"},"Product Image"),r.createElement("input",{id:"image",type:"hidden",name:"image",value:(null==B?void 0:B.id)||""}),r.createElement(h,{id:(null==B?void 0:B.id)||"",url:(null==B?void 0:B.url)||"",alternativeText:"product image",width:(null==B?void 0:B.width)&&(null==B?void 0:B.height)?B.width/B.height*200:200,height:200}),r.createElement(f,{onClick:function(){return N("image")}},"open media library"),r.createElement(E,{open:"image"===I,handleClose:function(){return N(null)},handleCancel:function(){O(null),N(null)},handleSelect:function(e){O(e)},selected:B?[B]:[]})),r.createElement(g,{item:!0,xs:6},r.createElement(c,{variant:"h6"},"Image Gallery"),r.createElement("input",{id:"gallery",type:"hidden",name:"gallery",value:JSON.stringify(G.map((function(e){return e.id})))}),r.createElement(a,{direction:"row",spacing:2},G.map((function(e){return r.createElement(h,{key:e.id,id:e.id,url:e.url,alternativeText:"gallery image",width:e.width/e.height*100,height:100})}))),r.createElement(f,{onClick:function(){return N("gallery")}},"open media library"),r.createElement(E,{open:"gallery"===I,handleClose:function(){return N(null)},handleCancel:function(){M([]),N(null)},handleSelect:function(r){if(G.indexOf(r)>-1){var n=t([],e(G),!1);n.splice(G.indexOf(r),1),M(n)}else G.length>=5?M(t([],e(G),!1)):M(t(t([],e(G),!1),[r],!1))},selected:G})),r.createElement(g,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Price"),r.createElement(v,{componentName:"price",componentReference:"e-commerce-elements.price"})),r.createElement(g,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Categories"),r.createElement(x,{categories:k,currentValue:[]})),r.createElement(g,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Dimensions"),r.createElement(y,{componentName:"dimensions",componentReference:"e-commerce-elements.dimensions"})),r.createElement(g,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Vendors"),r.createElement(j,{vendorNames:C,currentValue:null}))),r.createElement(g,{item:!0,xs:12},r.createElement(a,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:2}},r.createElement(s,{text:"create new product",loadingText:"loading"}),r.createElement(u,{error:null==P?void 0:P.strapiErrors}),(null==P?void 0:P.message)&&r.createElement(l,{severity:"error"},null==P?void 0:P.message)))))}export{b as AddProductForm};
7
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n}from"react";import{useFormState as i}from"react-dom";import m from"@mui/material/Paper";import a from"@mui/material/Box";import l from"@mui/material/Stack";import o from"@mui/material/Alert";import c from"@mui/material/TextField";import d from"@mui/material/Typography";import s from"@mui/material/Button";import u from"@mui/material/Grid";import{SubmitButton as p}from"../../SubmitButton.js";import{StrapiErrors as E}from"../../StrapiErrors.js";import{createProductAction as f}from"../../../data/actions/e-commerce/product/createProductAction.js";import{MediaLibraryDialog as g}from"../../common/media/MediaLibraryDialog.js";import{StrapiImage as h}from"../../StrapiImage.js";import{PriceFields as v}from"./PriceFields.js";import x from"../categories/CategorySelectorV2.js";import{DimensionsFields as y}from"../../common/Dimensions.js";import b from"../../logistics/vendor/VendorSelector.js";import j from"../../common/markdown/MarkdownEditor.js";var w={zodErrors:null,strapiErrors:null,data:null,message:null};function S(S){var C=S.vendorArr,k=S.categories,P=e(i(f,w),2),T=P[0],N=P[1],V=e(n(null),2),_=V[0],D=V[1],I=e(n(null),2),A=I[0],B=I[1],O=e(n([]),2),F=O[0],G=O[1];return r.createElement(a,{component:m,sx:{p:2}},r.createElement("form",{action:N},r.createElement(u,{container:!0,spacing:2},r.createElement(u,{item:!0,xs:12},r.createElement(l,{spacing:2},r.createElement(c,{id:"title",name:"title",label:"Title"}),r.createElement(j,{name:"description",label:"Description"}),r.createElement(c,{id:"external_product_number",name:"external_product_number",label:"External Product Number"}))),r.createElement(u,{item:!0,xs:6},r.createElement(d,{variant:"h6"},"Product Image"),r.createElement("input",{id:"image",type:"hidden",name:"image",value:(null==A?void 0:A.id)||""}),r.createElement(h,{id:(null==A?void 0:A.id)||"",url:(null==A?void 0:A.url)||"",alternativeText:"product image",width:(null==A?void 0:A.width)&&(null==A?void 0:A.height)?A.width/A.height*200:200,height:200}),r.createElement(s,{onClick:function(){return D("image")}},"open media library"),r.createElement(g,{open:"image"===_,handleClose:function(){return D(null)},handleCancel:function(){B(null),D(null)},handleSelect:function(e){B(e)},selected:A?[A]:[]})),r.createElement(u,{item:!0,xs:6},r.createElement(d,{variant:"h6"},"Image Gallery"),r.createElement("input",{id:"gallery",type:"hidden",name:"gallery",value:JSON.stringify(F.map((function(e){return e.id})))}),r.createElement(l,{direction:"row",spacing:2},F.map((function(e){return r.createElement(h,{key:e.id,id:e.id,url:e.url,alternativeText:"gallery image",width:e.width/e.height*100,height:100})}))),r.createElement(s,{onClick:function(){return D("gallery")}},"open media library"),r.createElement(g,{open:"gallery"===_,handleClose:function(){return D(null)},handleCancel:function(){G([]),D(null)},handleSelect:function(r){if(F.indexOf(r)>-1){var n=t([],e(F),!1);n.splice(F.indexOf(r),1),G(n)}else F.length>=5?G(t([],e(F),!1)):G(t(t([],e(F),!1),[r],!1))},selected:F})),r.createElement(u,{item:!0,xs:12},r.createElement(d,{variant:"h6"},"Price"),r.createElement(v,{componentName:"price",componentReference:"e-commerce-elements.price"})),r.createElement(u,{item:!0,xs:12},r.createElement(d,{variant:"h6"},"Categories"),r.createElement(x,{categories:k,currentValue:[]})),r.createElement(u,{item:!0,xs:12},r.createElement(d,{variant:"h6"},"Dimensions"),r.createElement(y,{componentName:"dimensions",componentReference:"e-commerce-elements.dimensions"})),r.createElement(u,{item:!0,xs:12},r.createElement(d,{variant:"h6"},"Vendors"),r.createElement(b,{vendorNames:C,currentValue:null}))),r.createElement(u,{item:!0,xs:12},r.createElement(l,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:2}},r.createElement(p,{text:"create new product",loadingText:"loading"}),r.createElement(E,{error:null==T?void 0:T.strapiErrors}),(null==T?void 0:T.message)&&r.createElement(o,{severity:"error"},null==T?void 0:T.message)))))}export{S as AddProductForm};
@@ -4,4 +4,4 @@
4
4
  * @copyright Jelle Paulus
5
5
  * @license MIT
6
6
  */
7
- import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as i}from"react";import n from"@mui/material/Paper";import a from"@mui/material/Box";import l from"@mui/material/Stack";import m from"@mui/material/Alert";import o from"@mui/material/TextField";import c from"@mui/material/Typography";import{SubmitButton as d}from"../../SubmitButton.js";import{useFormState as u}from"react-dom";import{StrapiErrors as s}from"../../StrapiErrors.js";import{updateProductAction as p}from"../../../data/actions/e-commerce/product/updateProductAction.js";import{MediaLibraryDialog as E}from"../../common/media/MediaLibraryDialog.js";import g from"@mui/material/Button";import f from"@mui/material/Grid";import{StrapiImage as v}from"../../StrapiImage.js";import{PriceFields as h}from"./PriceFields.js";import y from"../categories/CategorySelectorV2.js";import{DimensionsFields as x}from"../../common/Dimensions.js";import w from"../../logistics/vendor/VendorSelector.js";import j from"../../common/markdown/MarkdownEditor.js";var b={zodErrors:null,strapiErrors:null,data:null,message:null};function S(S){var C,V,k=S.data,T=S.vendorArr,D=S.categoriesArray,I=k.id,P=k.title,A=k.description,N=k.image,R=k.gallery,B=k.price,F=k.dimensions,G=k.categories,M=k.vendors;console.log("data",k);var z=(null==R?void 0:R.data)||[],J=(null==G?void 0:G.data)||[],L=e(u(p,b),2),O=L[0],_=L[1],q=e(i(null),2),H=q[0],K=q[1],Q=e(i(N||null),2),U=Q[0],W=Q[1],X=e(i(t([],e(z),!1)),2),Y=X[0],Z=X[1];return r.createElement(a,{component:n,sx:{p:2}},r.createElement("form",{action:_},I&&r.createElement("input",{id:"id",type:"hidden",name:"id",value:I}),r.createElement(f,{container:!0,spacing:2},r.createElement(f,{item:!0,xs:12},r.createElement(l,{spacing:2},r.createElement(o,{id:"title",name:"title",label:"Title",defaultValue:P}),r.createElement(o,{id:"description",name:"description",label:"Description",multiline:!0,minRows:4,maxRows:8,defaultValue:A}),r.createElement(j,{name:"description",label:"Description",defaultValue:A}))),r.createElement(f,{item:!0,xs:6},r.createElement(c,{variant:"h6"},"Product Image"),r.createElement("input",{id:"image",type:"hidden",name:"image",value:null==U?void 0:U.id}),r.createElement(v,{id:(null==U?void 0:U.id)||"",url:(null==U?void 0:U.url)||"",alternativeText:"product image",width:(null==U?void 0:U.width)&&(null==U?void 0:U.height)?U.width/U.height*200:200,height:200}),r.createElement(g,{onClick:function(){return K("image")}},"open media library"),r.createElement(E,{open:"image"===H,handleClose:function(){return K(null)},handleCancel:function(){W(null),K(null)},handleSelect:function(e){W(e)},selected:U?[U]:[]})),r.createElement(f,{item:!0,xs:6},r.createElement(c,{variant:"h6"},"Image Gallery"),r.createElement("input",{id:"gallery",type:"hidden",name:"gallery",value:JSON.stringify(Y.map((function(e){return e.id})))}),r.createElement(l,{direction:"row",spacing:2},Y.map((function(e){return r.createElement(v,{key:e.id,id:e.id,url:e.url,alternativeText:"gallery image",width:(null==e?void 0:e.width)&&(null==e?void 0:e.height)?e.width/e.height*100:100,height:100})}))),r.createElement(g,{onClick:function(){return K("gallery")}},"open media library"),r.createElement(E,{open:"gallery"===H,handleClose:function(){return K(null)},handleCancel:function(){Z([]),K(null)},handleSelect:function(r){var i=Y.findIndex((function(e){return e.id===r.id}));if(i>-1){var n=t([],e(Y),!1);n.splice(i,1),Z(n)}else Y.length>=5?Z(t([],e(Y),!1)):Z(t(t([],e(Y),!1),[r],!1))},selected:Y})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Price"),r.createElement(h,{componentName:"price",componentReference:"e-commerce-elements.price",data:B})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Categories"),r.createElement(y,{categories:D,currentValue:t([],e(J.map((function(e){return e.id}))),!1)})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Dimensions"),r.createElement(x,{componentName:"dimensions",componentReference:"e-commerce-elements.dimensions",data:F})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Vendors"),r.createElement(w,{vendorNames:T,currentValue:null===(V=null===(C=M.data)||void 0===C?void 0:C[0])||void 0===V?void 0:V.id}))),r.createElement(f,{item:!0,xs:12},r.createElement(l,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},r.createElement(d,{text:"update product",loadingText:"loading"}),(null==O?void 0:O.strapiErrors)&&r.createElement(s,{error:null==O?void 0:O.strapiErrors}),(null==O?void 0:O.message)&&r.createElement(m,{severity:"error"},null==O?void 0:O.message)))))}export{S as EditProductForm};
7
+ import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import r,{useState as n}from"react";import i from"@mui/material/Paper";import a from"@mui/material/Box";import l from"@mui/material/Stack";import m from"@mui/material/Alert";import o from"@mui/material/TextField";import c from"@mui/material/Typography";import{SubmitButton as d}from"../../SubmitButton.js";import{useFormState as u}from"react-dom";import{StrapiErrors as s}from"../../StrapiErrors.js";import{updateProductAction as p}from"../../../data/actions/e-commerce/product/updateProductAction.js";import{MediaLibraryDialog as E}from"../../common/media/MediaLibraryDialog.js";import g from"@mui/material/Button";import f from"@mui/material/Grid";import{StrapiImage as v}from"../../StrapiImage.js";import{PriceFields as h}from"./PriceFields.js";import x from"../categories/CategorySelectorV2.js";import{DimensionsFields as y}from"../../common/Dimensions.js";import b from"../../logistics/vendor/VendorSelector.js";import j from"../../common/markdown/MarkdownEditor.js";var w={zodErrors:null,strapiErrors:null,data:null,message:null};function S(S){var C,V,_=S.data,k=S.vendorArr,P=S.categoriesArray,T=_.id,I=_.title,N=_.description,A=_.external_product_number,D=_.image,B=_.gallery,F=_.price,G=_.dimensions,M=_.categories,R=_.vendors;console.log("data",_);var z=(null==B?void 0:B.data)||[],J=(null==M?void 0:M.data)||[],L=e(u(p,w),2),O=L[0],q=L[1],H=e(n(null),2),K=H[0],Q=H[1],U=e(n(D||null),2),W=U[0],X=U[1],Y=e(n(t([],e(z),!1)),2),Z=Y[0],$=Y[1];return r.createElement(a,{component:i,sx:{p:2}},r.createElement("form",{action:q},T&&r.createElement("input",{id:"id",type:"hidden",name:"id",value:T}),r.createElement(f,{container:!0,spacing:2},r.createElement(f,{item:!0,xs:12},r.createElement(l,{spacing:2},r.createElement(o,{id:"title",name:"title",label:"Title",defaultValue:I}),r.createElement(j,{name:"description",label:"Description",defaultValue:N}),r.createElement(o,{id:"external_product_number",name:"external_product_number",label:"External Product Number",defaultValue:A}))),r.createElement(f,{item:!0,xs:6},r.createElement(c,{variant:"h6"},"Product Image"),r.createElement("input",{id:"image",type:"hidden",name:"image",value:null==W?void 0:W.id}),r.createElement(v,{id:(null==W?void 0:W.id)||"",url:(null==W?void 0:W.url)||"",alternativeText:"product image",width:(null==W?void 0:W.width)&&(null==W?void 0:W.height)?W.width/W.height*200:200,height:200}),r.createElement(g,{onClick:function(){return Q("image")}},"open media library"),r.createElement(E,{open:"image"===K,handleClose:function(){return Q(null)},handleCancel:function(){X(null),Q(null)},handleSelect:function(e){X(e)},selected:W?[W]:[]})),r.createElement(f,{item:!0,xs:6},r.createElement(c,{variant:"h6"},"Image Gallery"),r.createElement("input",{id:"gallery",type:"hidden",name:"gallery",value:JSON.stringify(Z.map((function(e){return e.id})))}),r.createElement(l,{direction:"row",spacing:2},Z.map((function(e){return r.createElement(v,{key:e.id,id:e.id,url:e.url,alternativeText:"gallery image",width:(null==e?void 0:e.width)&&(null==e?void 0:e.height)?e.width/e.height*100:100,height:100})}))),r.createElement(g,{onClick:function(){return Q("gallery")}},"open media library"),r.createElement(E,{open:"gallery"===K,handleClose:function(){return Q(null)},handleCancel:function(){$([]),Q(null)},handleSelect:function(r){var n=Z.findIndex((function(e){return e.id===r.id}));if(n>-1){var i=t([],e(Z),!1);i.splice(n,1),$(i)}else Z.length>=5?$(t([],e(Z),!1)):$(t(t([],e(Z),!1),[r],!1))},selected:Z})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Price"),r.createElement(h,{componentName:"price",componentReference:"e-commerce-elements.price",data:F})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Categories"),r.createElement(x,{categories:P,currentValue:t([],e(J.map((function(e){return e.id}))),!1)})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Dimensions"),r.createElement(y,{componentName:"dimensions",componentReference:"e-commerce-elements.dimensions",data:G})),r.createElement(f,{item:!0,xs:12},r.createElement(c,{variant:"h6"},"Vendors"),r.createElement(b,{vendorNames:k,currentValue:null===(V=null===(C=R.data)||void 0===C?void 0:C[0])||void 0===V?void 0:V.id}))),r.createElement(f,{item:!0,xs:12},r.createElement(l,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},r.createElement(d,{text:"update product",loadingText:"loading"}),(null==O?void 0:O.strapiErrors)&&r.createElement(s,{error:null==O?void 0:O.strapiErrors}),(null==O?void 0:O.message)&&r.createElement(m,{severity:"error"},null==O?void 0:O.message)))))}export{S as EditProductForm};