umwd-components 0.1.379 → 0.1.380
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/logistics/ipo/AddIPOForm.js +1 -1
- package/dist/src/data/actions/logistics/ipo/createIPOAction.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/logistics/ipo/AddIPOForm.tsx +0 -4
- package/src/data/actions/logistics/ipo/createIPOAction.ts +12 -4
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__spreadArray as r,__awaiter as t,__generator as o}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as i
|
|
7
|
+
import{__read as e,__spreadArray as r,__awaiter as t,__generator as o}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as i}from"react";import m from"@mui/material/Paper";import n from"@mui/material/Box";import l from"@mui/material/Stack";import s from"@mui/material/Alert";import c from"@mui/material/TextField";import d from"@mui/material/Typography";import u from"@mui/material/Divider";import{SubmitButton as p}from"../../SubmitButton.js";import{useFormState as f}from"react-dom";import{StrapiErrors as E}from"../../StrapiErrors.js";import{createIPOAction as v}from"../../../data/actions/logistics/ipo/createIPOAction.js";import x from"@mui/material/Grid";import g from"../vendor/VendorSelector.js";import{getSingleVendor as y}from"../../../data/loaders/logistics/getSingleVendor.js";import{IPOItemFields as h}from"./IPOItemFields.js";import{LocalizationProvider as b}from"../../../../node_modules/@mui/x-date-pickers/LocalizationProvider/LocalizationProvider.js";import{AdapterDateFns as j}from"../../../../node_modules/@mui/x-date-pickers/AdapterDateFnsV3/AdapterDateFnsV3.js";import{DatePicker as A}from"../../../../node_modules/@mui/x-date-pickers/DatePicker/DatePicker.js";var P={zodErrors:null,strapiErrors:null,data:null,message:null};function D(D){var _=this,k=D.vendorNamesArr,I=D.sx,S=e(f(v,P),2),V=S[0],O=S[1],w=e(i([]),2),F=w[0],T=w[1],z=e(i(null),2),N=z[0],B=z[1];return a.createElement(n,{sx:r([{p:2}],e(Array.isArray(I)?I:[I]),!1),component:m},a.createElement("form",{action:O},a.createElement(x,{container:!0,spacing:2},a.createElement(x,{item:!0,xs:12},a.createElement(d,{variant:"h5"},"Add IPO")),a.createElement(x,{item:!0,xs:12,md:6,sx:{mt:1}},k?a.createElement(g,{vendorNames:k,currentValue:null,onSelectVendor:function(e){return t(_,void 0,void 0,(function(){var r,t;return o(this,(function(o){switch(o.label){case 0:return B(e),e?[4,y(e)]:(T([]),[2]);case 1:return r=o.sent(),T(null===(t=null==r?void 0:r.products)||void 0===t?void 0:t.data),[2]}}))}))}}):a.createElement(d,null,"No vendors on file, you need to create a vendor first before you are able to create incoming purchase orders")),a.createElement(x,{item:!0,xs:12},a.createElement(l,{spacing:2},a.createElement(d,{variant:"h5"},"Order Details"),a.createElement(d,{variant:"body1"},"The orderdate should be the official date of the order, don't worry, you can also set days in the past or future"),a.createElement(b,{dateAdapter:j},a.createElement(A,{name:"order_date",label:"Order Date"})),a.createElement(d,{variant:"body1"},"Please enter a custom reference for this order"),a.createElement(c,{id:"custom_reference",name:"custom_reference",type:"text",label:"Custom Reference"}),a.createElement(u,null))),a.createElement(x,{item:!0,xs:12},a.createElement(h,{productsArr:F,vendorID:N}))),a.createElement(x,{item:!0,xs:12},a.createElement(l,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},a.createElement(p,{text:"create new ipo",loadingText:"loading"}),(null==V?void 0:V.strapiErrors)&&a.createElement(E,{error:null==V?void 0:V.strapiErrors}),(null==V?void 0:V.message)&&a.createElement(s,{severity:"error"},null==V?void 0:V.message)))))}export{D as AddIPOForm};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__awaiter as e,__generator as r,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as a}from"../../../services/mutate-data.js";import{flattenAttributes as
|
|
7
|
+
import{__awaiter as e,__generator as r,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as a}from"../../../services/mutate-data.js";import{flattenAttributes as s}from"../../../../lib/utils.js";import{parseFormData as o}from"../../../../lib/parseFormData.js";import{formatDate as i}from"../../../../../node_modules/date-fns/format.js";function n(n,d){return e(this,void 0,void 0,(function(){var e,l,m,p,c;return r(this,(function(r){switch(r.label){case 0:return e=Object.fromEntries(d),console.log("rawFormData",e),l=o(d),console.log("parsedFormData",l),l.data.order_date?(m={data:{vendor_profile:l.data.vendors,custom_reference:l.data.custom_reference,order_date:i(l.data.order_date,"yyyy-MM-dd"),items:l.data.ipo_items}},0===JSON.parse(l.data.ipo_items).length?(console.log("No items in IPO"),[2,t(t({},n),{strapiErrors:null,message:"Please add items to the IPO."})]):(console.log("ipoData",m),[4,a("POST","/api/ipos",m)])):[2,t(t({},n),{strapiErrors:null,message:"Please select an Order Date."})];case 1:return(p=r.sent())?p.error?[2,t(t({},n),{strapiErrors:p.error,message:"Failed to Create IPO."})]:(c=s(p),[2,t(t({},n),{message:"New IPO Created",data:c,strapiErrors:null})]):[2,t(t({},n),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{n as createIPOAction};
|