umwd-components 0.1.461 → 0.1.463
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/src/components/e-commerce/invoice/InvoiceItemFields.js +1 -1
- package/dist/src/data/actions/e-commerce/invoices/createInvoiceAction.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/e-commerce/invoice/InvoiceItemFields.tsx +20 -9
- package/src/data/actions/e-commerce/invoices/createInvoiceAction.tsx +6 -4
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r}from"react";import i from"@mui/material/Table";import n from"@mui/material/TableHead";import l from"@mui/material/TableBody";import m from"@mui/material/TableCell";import c from"@mui/material/TableRow";import o from"@mui/material/IconButton";import u from"@mui/icons-material/Add";import
|
|
6
|
+
import{__read as e,__spreadArray as t}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r}from"react";import i from"@mui/material/Table";import n from"@mui/material/TableHead";import l from"@mui/material/TableBody";import m from"@mui/material/TableCell";import c from"@mui/material/TableRow";import o from"@mui/material/IconButton";import u from"@mui/icons-material/Add";import p from"@mui/material/Typography";import s from"@mui/material/Stack";import d from"@mui/material/TextField";import v from"@mui/icons-material/Delete";function _(_){var E=_.onChangeCallback,x=e(r([]),2),h=x[0],g=x[1],f=e(r(""),2),w=f[0],b=f[1],y=e(r(0),2),I=y[0],T=y[1],A=e(r(0),2),C=A[0],q=A[1],V=e(r(0),2),k=V[0],D=V[1];return a.createElement(s,{spacing:2},a.createElement(p,{variant:"h5"},"Adding the items to the invoice"),a.createElement(p,{variant:"body1"}),a.createElement(p,{variant:"body2"}),a.createElement(i,null,a.createElement(n,null,a.createElement(c,null,a.createElement(m,{id:"line_item_number",sx:[{width:"15%"}]},"Line Item Number"),a.createElement(m,{sx:[{width:"35%"}]},"Item Description"),a.createElement(m,{sx:[{width:"10%"}]},"Price excl. VAT"),a.createElement(m,{sx:[{width:"10%"}]},"VAT Rate"),a.createElement(m,{sx:[{width:"10%"}]},"VAT"),a.createElement(m,{sx:[{width:"10%"}]},"Price incl. VAT"),a.createElement(m,{sx:[{width:"10%"}]},"Amount"),a.createElement(m,null))),a.createElement(l,null,h.map((function(e,t){return a.createElement(c,{key:t},a.createElement(m,{sx:[{width:"15%"}]},t+1,".0.0"),a.createElement(m,{sx:[{width:"35%"}]},e.item_description),a.createElement(m,{sx:{width:"10%"}},e.price_excl_vat),a.createElement(m,{sx:{width:"10%"}},e.vat_rate),a.createElement(m,{sx:{width:"10%"}},e.price_excl_vat*(e.vat_rate/100)),a.createElement(m,{sx:{width:"10%"}},e.price_excl_vat*(1+e.vat_rate/100)),a.createElement(m,{sx:{width:"5%"}},e.quantity),a.createElement(m,{align:"right",sx:{width:"5%"}},a.createElement(o,null,a.createElement(v,null))))})))),a.createElement("input",{type:"hidden",name:"admin_items",value:JSON.stringify(function(e){return e.map((function(e,t){return{product_number:t+1+".0.0",product_title:e.item_description,vat_rate:e.vat_rate,price_excl_vat:e.price_excl_vat,price_incl_vat:e.price_incl_vat,quantity:e.quantity}}))}(h))}),a.createElement(s,{direction:"row",spacing:1,alignItems:"center",sx:{p:2,width:"100%"}},a.createElement(p,{variant:"body1",sx:{width:"15%"}},h.length+1,".0.0"),a.createElement(d,{id:"item_description",name:"item_description",label:"Item Description",sx:{width:"35%"},value:w,onChange:function(e){return b(e.target.value)}}),a.createElement(d,{id:"price_excl_vat",name:"price_excl_vat",type:"number",label:"Price",value:C,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?q(0):q(parseInt(e.target.value)):q(0)},sx:{width:"10%"}}),a.createElement(d,{id:"vat_rate",name:"vat_rate",type:"number",label:"VAT Rate",value:k,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?D(0):D(parseInt(e.target.value)):D(0)},sx:{width:"30%"}}),a.createElement(d,{id:"quantity",name:"quantity",type:"number",label:"Amount",value:I,onChange:function(e){""!==e.target.value?parseInt(e.target.value)<0?T(0):T(parseInt(e.target.value)):T(0)},sx:{width:"5%"}}),a.createElement(o,{onClick:function(){if(null!==w&&null!==I){var a={item_description:w,quantity:I,price_excl_vat:C,vat_rate:k,vat:C*(k/100),price_incl_vat:C*(1+k/100)};g(t(t([],e(h),!1),[a],!1)),E&&E(t(t([],e(h),!1),[a],!1)),b(""),T(0),q(0),D(0)}else console.log("nextItemDescription or nextAmount is null")}},a.createElement(u,null))))}export{_ as InvoiceItemFields};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as
|
|
7
|
+
import{__awaiter as r,__generator as e,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as i}from"../../../../lib/utils.js";import{parseFormData as a}from"../../../../lib/parseFormData.js";function o(o,n){return r(this,void 0,void 0,(function(){var r,m,l,d;return e(this,(function(e){switch(e.label){case 0:return r=Object.fromEntries(n),console.log(r),m=a(n),console.log(m),m.data.admin_items&&(m.data.admin_items=JSON.parse(m.data.admin_items)),[4,s("POST","/api/invoices/createAdmin",m)];case 1:return(l=e.sent())?l.error?[2,t(t({},o),{strapiErrors:l.error,message:"Failed to Create Invoice."})]:(d=i(l),[2,t(t({},o),{message:"Invoice Created",data:d,strapiErrors:null})]):[2,t(t({},o),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{o as createInvoiceAction};
|