umwd-components 0.1.380 → 0.1.382
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/node_modules/base64-js/index.js +1 -1
- package/dist/node_modules/ieee754/index.js +1 -1
- package/dist/src/components/common/Contacts.js +1 -1
- package/dist/src/components/common/media/UploadBase64MediaForm.js +1 -1
- package/dist/src/components/common/media/UploadMediaForm.js +1 -1
- package/dist/src/components/logistics/vendor/EditVendorForm.js +1 -1
- package/dist/src/data/actions/logistics/ipo/createIPOAction.js +1 -1
- package/dist/src/data/services/file-service.js +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/common/media/UploadBase64MediaForm.d.ts +1 -1
- package/dist/types/components/common/media/UploadMediaForm.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/common/Contacts.tsx +7 -2
- package/src/components/common/media/UploadBase64MediaForm.tsx +0 -1
- package/src/components/common/media/UploadMediaForm.tsx +25 -19
- package/src/components/logistics/vendor/EditVendorForm.tsx +58 -33
- package/src/data/actions/logistics/ipo/createIPOAction.ts +0 -3
- package/src/data/services/file-service.ts +0 -5
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__exports as r}from"../../_virtual/
|
|
6
|
+
import{__exports as r}from"../../_virtual/index6.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/
|
|
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 a from"@mui/material/Stack";import n from"@mui/material/TextField";import l from"@mui/material/Typography";import m from"@mui/material/Button";import r from"@mui/icons-material/AccountCircle";import{ContactType as i}from"../../types/common/Contact.js";import o from"@mui/material/Autocomplete";import c from"@mui/material/IconButton";import{Delete as u}from"@mui/icons-material";function p(e){var n=e.data,i=n.id,o=n.first_name,c=n.last_name,u=n.email,p=n.phone_number,d=n.type,f=n.onClick;return t.createElement(a,null,t.createElement(a,{spacing:2,direction:"row"},t.createElement(r,null),t.createElement(a,null,t.createElement(l,null,o," ",c),t.createElement(l,null,u),t.createElement(l,null,p),t.createElement(l,null,d),f&&t.createElement(m,{onClick:function(e){i&&f(e,i)}},"Edit"))))}function d(l){var m=l.data,r=l.componentName,p=l.componentReference,d=l.deleteCallback,f=m||{},s=f.id,E=f.first_name,_=f.last_name,b=f.email,y=f.phone_number,h=f.type;return t.createElement(a,{spacing:1},t.createElement("input",{id:"",type:"hidden",name:"".concat(r,".__component"),value:p}),s&&t.createElement("input",{id:"",type:"hidden",name:"".concat(r,".id"),value:s}),t.createElement(a,{spacing:1,direction:"row"},t.createElement(n,{id:"first_name",name:"".concat(r,".first_name"),label:"First Name",defaultValue:E||""}),d&&t.createElement(c,{onClick:d},t.createElement(u,null))),t.createElement(n,{id:"last_name",name:"".concat(r,".last_name"),label:"Last Name",defaultValue:_||""}),t.createElement(n,{id:"email",name:"".concat(r,".email"),label:"E-mail",defaultValue:b||""}),t.createElement(n,{id:"phone_number",name:"".concat(r,".phone_number"),label:"Phone Number",defaultValue:y||""}),t.createElement(o,{id:"type",options:Object.values(i),defaultValue:h||Object.values(i)[0],renderInput:function(a){return t.createElement(n,e({},a,{name:"".concat(r,".type"),label:"Type"}))}}))}export{d as ContactsFields,p as default};
|
|
6
|
+
import{extends as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import t from"react";import a from"@mui/material/Stack";import n from"@mui/material/TextField";import l from"@mui/material/Typography";import m from"@mui/material/Button";import r from"@mui/icons-material/AccountCircle";import{ContactType as i}from"../../types/common/Contact.js";import o from"@mui/material/Autocomplete";import c from"@mui/material/IconButton";import{Delete as u}from"@mui/icons-material";function p(e){var n=e.data,i=n.id,o=n.first_name,c=n.last_name,u=n.email,p=n.phone_number,d=n.type,f=n.onClick;return t.createElement(a,null,t.createElement(a,{spacing:2,direction:"row"},t.createElement(r,null),t.createElement(a,null,t.createElement(l,null,o," ",c),t.createElement(l,null,u),t.createElement(l,null,p),t.createElement(l,null,d),f&&t.createElement(m,{onClick:function(e){i&&f(e,i)}},"Edit"))))}function d(l){var m=l.data,r=l.componentName,p=l.componentReference,d=l.deleteCallback,f=m||{},s=f.id,E=f.first_name,_=f.last_name,b=f.email,y=f.phone_number,h=f.type;return t.createElement(a,{spacing:1},t.createElement("input",{id:"".concat(r,".__component"),type:"hidden",name:"".concat(r,".__component"),value:p}),s&&t.createElement("input",{id:"".concat(r,".id"),type:"hidden",name:"".concat(r,".id"),value:s}),t.createElement(a,{spacing:1,direction:"row"},t.createElement(n,{id:"first_name",name:"".concat(r,".first_name"),label:"First Name",defaultValue:E||""}),d&&t.createElement(c,{onClick:d},t.createElement(u,null))),t.createElement(n,{id:"last_name",name:"".concat(r,".last_name"),label:"Last Name",defaultValue:_||""}),t.createElement(n,{id:"email",name:"".concat(r,".email"),label:"E-mail",defaultValue:b||""}),t.createElement(n,{id:"phone_number",name:"".concat(r,".phone_number"),label:"Phone Number",defaultValue:y||""}),t.createElement(o,{id:"type",options:Object.values(i),defaultValue:h||Object.values(i)[0],renderInput:function(a){return t.createElement(n,e({},a,{name:"".concat(r,".type"),label:"Type"}))}}))}export{d as ContactsFields,p as default};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as
|
|
7
|
+
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as n,useRef as r,useEffect as l}from"react";import a from"@mui/material/Stack";import i from"@mui/material/Typography";import o from"@mui/material/Box";import{useFormState as m}from"react-dom";import{uploadBase64MediaAction as c}from"../../../data/actions/media/uploadBase64MediaAction.js";import{StrapiErrors as p}from"../../StrapiErrors.js";import{ZodErrors as d}from"../../ZodErrors.js";import u from"@mui/material/Alert";import{SubmitButton as s}from"../../SubmitButton.js";var f={zodErrors:null,strapiErrors:null,data:null,message:null};function E(E){var v,y=E.reference,g=E.refID,x=void 0===g?0:g,h=E.field,b=E.multiple,j=void 0===b||b,k=E.accept,w=void 0===k?"image/*":k,C=E.path,I=void 0===C?"api/ipos":C,O=E.componentName,_=void 0===O?"":O,B=E.componentReference,R=E.revalidateCallback,S=e(n(null),2),z=S[0],A=S[1],H=e(n(null),2),L=H[0],N=H[1],T=c.bind(null,I,x,_),U=e(m(T,f),2),D=U[0],F=U[1],M=r(null);return l((function(){D.data&&R&&R()}),[D.data]),t.createElement("form",{action:F,id:h},t.createElement(o,{sx:[z&&z.length>0&&{border:"2px solid red",p:1}]},t.createElement(a,{spacing:1,sx:{flex:1}},y&&t.createElement("input",{type:"text",name:"ref",value:y,style:{display:"none"},readOnly:!0}),x&&t.createElement("input",{type:"text",name:"refId",value:x,style:{display:"none"},readOnly:!0})," ",h&&t.createElement("input",{type:"text",name:"field",value:h,style:{display:"none"},readOnly:!0}),t.createElement("input",{id:"component_name",type:"hidden",name:"".concat(_,".__component"),value:B}),null!==z?t.createElement(o,{onClick:function(){var e;return null===(e=M.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},void 0===w||"image/*"===w?t.createElement(a,{direction:"row",spacing:1,justifyContent:"flex-end"},z.map((function(e,n){return t.createElement("img",{key:n,src:e.url,alt:e.name,style:{width:"100px"}})}))):t.createElement(a,{spacing:1,justifyContent:"flex-end"},z.map((function(e,n){return t.createElement(i,{key:n},e.name)})))):t.createElement(o,{onClick:function(){var e;return null===(e=M.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},t.createElement(i,null,"No file","".concat(j?"s":"")," selected for upload")),t.createElement(a,{direction:"column",spacing:2,alignItems:"center",justifyContent:"space-between"},t.createElement(p,{error:D.strapiErrors}),t.createElement(d,{error:null===(v=D.zodErrors)||void 0===v?void 0:v.image}),(null==D?void 0:D.message)&&t.createElement(u,{severity:"error"},null==D?void 0:D.message),t.createElement(o,null,t.createElement("label",{htmlFor:"pictureInput"},t.createElement("input",{id:"pictureInput",accept:w,multiple:j,type:"file",name:"files",ref:M,onChange:function(e){var t=e.target.files;if(null!==t){var n=Object.keys(t).map((function(e,n){return{url:URL.createObjectURL(t[n]),name:t[n].name}}));N(t),A(n)}},style:{display:"none"}})),null!==L&&t.createElement(s,{text:"upload",loadingText:"loading"}))))))}export{E as UploadBase64MediaForm};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r,useRef as
|
|
7
|
+
import{__read as e}from"../../../../node_modules/tslib/tslib.es6.js";import t,{useState as r,useRef as l,useEffect as n}from"react";import{useFormState as a}from"react-dom";import{uploadMediaAction as i}from"../../../data/actions/media/uploadMediaAction.js";import{StrapiErrors as m}from"../../StrapiErrors.js";import{ZodErrors as o}from"../../ZodErrors.js";import{SubmitButton as c}from"../../SubmitButton.js";import u from"@mui/material/Stack";import s from"@mui/material/Typography";import d from"@mui/material/Box";import p from"@mui/material/Grid";import f from"@mui/material/Alert";var E={zodErrors:null,strapiErrors:null,data:null,message:null};function y(y){var v,g=y.reference,x=y.refID,h=y.field,b=y.multiple,k=void 0===b||b,j=y.accept,w=void 0===j?"image/*":j,C=y.revalidateCallback,I=e(r(null),2),O=I[0],S=I[1],z=e(r(null),2),A=z[0],B=z[1],H=e(a(i,E),2),L=H[0],R=H[1],T=l(null);return n((function(){L.data&&(null==C||C())}),[L.data]),t.createElement("form",{action:R},t.createElement(u,{spacing:1,sx:{flex:1}},g&&t.createElement("input",{type:"text",name:"ref",value:g,style:{display:"none"},readOnly:!0}),x&&t.createElement("input",{type:"text",name:"refId",value:x,style:{display:"none"},readOnly:!0}),h&&t.createElement("input",{type:"text",name:"field",value:h,style:{display:"none"},readOnly:!0}),null!==O?t.createElement(d,{onClick:function(){var e;return null===(e=T.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},void 0===w||"image/*"===w?t.createElement(p,{container:!0},O.map((function(e,r){return t.createElement(p,{item:!0,key:r,xs:12,sm:6,md:4,lg:2},t.createElement("img",{key:r,src:e.url,alt:e.name,style:{width:"100px"}}))}))):t.createElement(p,{container:!0},O.map((function(e,r){return t.createElement(p,{item:!0,key:r,xs:12,sm:6,md:4,lg:2},t.createElement(s,null,e.name))})))):t.createElement(d,{onClick:function(){var e;return null===(e=T.current)||void 0===e?void 0:e.click()},sx:{p:2,width:"100%",border:"1px dashed white",minHeight:"100px"}},t.createElement(s,null,"No file","".concat(k?"s":"")," selected")),t.createElement(u,{direction:"column",spacing:2,alignItems:"center",justifyContent:"space-between"},t.createElement(m,{error:L.strapiErrors}),t.createElement(o,{error:null===(v=L.zodErrors)||void 0===v?void 0:v.image}),(null==L?void 0:L.message)&&t.createElement(f,{severity:"error"},null==L?void 0:L.message),t.createElement(d,null,t.createElement("label",{htmlFor:"pictureInput"},t.createElement("input",{id:"pictureInput",accept:w,multiple:k,type:"file",name:"files",ref:T,onChange:function(e){console.log(e.target.files);var t=e.target.files;if(null!==t){var r=Object.keys(t).map((function(e,r){return{url:URL.createObjectURL(t[r]),name:t[r].name}}));B(t),S(r)}},style:{display:"none"}})),null!==A&&t.createElement(c,{text:"upload",loadingText:"loading"})))))}export{y as UploadMediaForm};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
import{__read as e,__assign as t,__spreadArray as n}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r,
|
|
7
|
+
import{__read as e,__assign as t,__spreadArray as n}from"../../../../node_modules/tslib/tslib.es6.js";import a,{useState as r,useEffect as o}from"react";import m from"@mui/material/Paper";import c from"@mui/material/Box";import i from"@mui/material/Stack";import l from"@mui/material/Alert";import s from"@mui/material/TextField";import d from"@mui/material/Typography";import{SubmitButton as u}from"../../SubmitButton.js";import{useFormState as p}from"react-dom";import{StrapiErrors as f}from"../../StrapiErrors.js";import{updateVendorAction as E}from"../../../data/actions/logistics/vendor/updateVendorAction.js";import g from"@mui/material/Grid";import{BusinessCredentialsFields as v}from"../../e-commerce/customer/BusinessCredentials.js";import{AddressFields as b}from"../../common/Address.js";import x from"../../e-commerce/products/ProductSelector.js";import h,{ContactsFields as y}from"../../common/Contacts.js";import _ from"@mui/material/IconButton";import C from"@mui/icons-material/Add";import{ContactType as j}from"../../../types/common/Contact.js";var k={zodErrors:null,strapiErrors:null,data:null,message:null};function N(N){var A=N.data,R=N.productNamesArr;N.revalidateCallback;var V=A.id,w=A.website_url,B=A.phone_number,P=A.email,S=A.business_credentials,I=A.address,T=A.products,z=A.contacts;console.log("data",A);var F=e(p(E,k),2),G=F[0],O=F[1],U=e(r([]),2),W=U[0],q=U[1],D=(null==T?void 0:T.data)||[],H=e(r([]),2),J=H[0],K=H[1],L=e(r(z.reduce((function(e,t,n){return e.push({componentName:"contacts[".concat(n,"]"),componentReference:"logistics-elements.contact",data:t}),e}),[])),2),M=L[0],Q=L[1],X=function(t,a){J.includes(a)?K(J.filter((function(e){return e!==a}))):K(n(n([],e(J),!1),[a],!1))};return o((function(){console.log("oldContacts changed:",M)}),[M]),o((function(){console.log("newContacts changed:",W)}),[W]),a.createElement(c,{component:m,sx:{p:2}},a.createElement("form",{action:O},V&&a.createElement("input",{id:"id",type:"hidden",name:"id",value:V}),a.createElement(g,{container:!0,spacing:2},a.createElement(g,{item:!0,xs:12},a.createElement(d,{variant:"h5"},"Edit Vendor")),a.createElement(g,{item:!0,xs:12,md:6},a.createElement(v,{data:S,componentName:"business_credentials",componentReference:"common.business-credentials"})),a.createElement(g,{item:!0,xs:12,md:6},a.createElement(i,{spacing:2},a.createElement(s,{id:"website_url",name:"website_url",label:"Website Url",defaultValue:w}),a.createElement(s,{id:"phone_number",name:"phone_number",label:"Phone Number",defaultValue:B}),a.createElement(s,{id:"email",name:"email",label:"Email",defaultValue:P}))),a.createElement(g,{item:!0,xs:12,md:6},a.createElement(d,{variant:"h6"},"Address"),a.createElement(b,{data:I,componentName:"address",componentReference:"common.address"})),a.createElement(g,{item:!0,xs:12,sx:{mt:1}},a.createElement(d,{variant:"h6"},"Products"),a.createElement(x,{productNames:R,currentValue:D.map((function(e){return e.id}))})),a.createElement(g,{item:!0,xs:12,sx:{mt:1}},a.createElement(d,{variant:"h6"},"Contacts")),null==M?void 0:M.map((function(e,n){var r,o;return(null===(r=e.data)||void 0===r?void 0:r.id)?J.includes(null===(o=e.data)||void 0===o?void 0:o.id)?a.createElement(g,{item:!0,xs:12,md:6,lg:4,key:e.data.id},a.createElement(y,{data:e.data,componentName:"contacts[".concat(n,"]"),componentReference:"logistics-elements.contact",deleteCallback:function(){Q(M.filter((function(e,t){return t!==n})))}})):a.createElement(g,{item:!0,xs:12,md:6,lg:4,key:e.data.id},a.createElement("input",{type:"hidden",name:"contacts[".concat(n,"].id"),value:e.data.id}),a.createElement("input",{type:"hidden",name:"contacts[".concat(n,"].__component"),value:"logistics-elements.contact"}),a.createElement(h,{data:t(t({},e.data),{onClick:X})})):null})),W.map((function(e,t){return a.createElement(g,{item:!0,xs:12,md:6,lg:4,key:t},a.createElement(y,{key:t,data:e.data,componentName:e.componentName,componentReference:"logistics-elements.contact",deleteCallback:function(){q(W.filter((function(e,n){return n!==t})))}}))})),a.createElement(g,{item:!0,xs:12,md:6,lg:4,justifyContent:"center",alignItems:"center"},a.createElement(_,{onClick:function(){q(n(n([],e(W),!1),[{componentName:"contacts[".concat(z.length+W.length,"]"),componentReference:"logistics-elements.contact",data:{first_name:"",last_name:"",email:"",phone_number:"",type:j.Other}}],!1))}},a.createElement(C,null))),a.createElement(g,{item:!0,xs:12},a.createElement(i,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1}},a.createElement(u,{text:"update vendor",loadingText:"loading"}),(null==G?void 0:G.strapiErrors)&&a.createElement(f,{error:null==G?void 0:G.strapiErrors}),(null==G?void 0:G.message)&&a.createElement(l,{severity:"error"},null==G?void 0:G.message))))))}export{N as EditVendorForm};
|
|
@@ -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
|
|
7
|
+
import{__awaiter as e,__generator as r,__assign as t}from"../../../../../node_modules/tslib/tslib.es6.js";import{mutateData as s}from"../../../services/mutate-data.js";import{flattenAttributes as a}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,m,l,p;return r(this,(function(r){switch(r.label){case 0:return Object.fromEntries(d),(e=o(d)).data.order_date?(m={data:{vendor_profile:e.data.vendors,custom_reference:e.data.custom_reference,order_date:i(e.data.order_date,"yyyy-MM-dd"),items:e.data.ipo_items}},0===JSON.parse(e.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,s("POST","/api/ipos",m)])):[2,t(t({},n),{strapiErrors:null,message:"Please select an Order Date."})];case 1:return(l=r.sent())?l.error?[2,t(t({},n),{strapiErrors:l.error,message:"Failed to Create IPO."})]:(p=a(l),[2,t(t({},n),{message:"New IPO Created",data:p,strapiErrors:null})]):[2,t(t({},n),{strapiErrors:null,message:"Ops! Something went wrong. Please try again."})]}}))}))}export{n as createIPOAction};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
import{__awaiter as e,__generator as
|
|
6
|
+
import{__awaiter as e,__generator as r}from"../../../node_modules/tslib/tslib.es6.js";import{getAuthToken as t}from"./get-token.js";import{getStrapiURL as n}from"../../lib/utils.js";function o(o){return e(this,void 0,void 0,(function(){var e,s,a,i;return r(this,(function(r){switch(r.label){case 0:return[4,t()];case 1:if(!(e=r.sent()))throw new Error("No auth token found");s=n(),a=new URL("/api/upload",s),r.label=2;case 2:return r.trys.push([2,5,,6]),[4,fetch(a,{headers:{Authorization:"Bearer ".concat(e)},method:"POST",body:o})];case 3:return[4,r.sent().json()];case 4:return[2,r.sent()];case 5:throw i=r.sent(),console.error("Error uploading image:",i),i;case 6:return[2]}}))}))}function s(o,s){return e(this,void 0,void 0,(function(){var e,a,i,u,c;return r(this,(function(r){switch(r.label){case 0:return[4,t()];case 1:if(!(e=r.sent()))throw new Error("No auth token found");a=n(),i=new URL("/api/upload?id=".concat(s),a),(u=new FormData).append("fileInfo",JSON.stringify(o)),r.label=2;case 2:return r.trys.push([2,5,,6]),[4,fetch(i,{method:"POST",headers:{Authorization:"Bearer ".concat(e)},body:u})];case 3:return[4,r.sent().json()];case 4:return[2,r.sent()];case 5:throw c=r.sent(),console.error("Error updating image:",c),c;case 6:return[2]}}))}))}export{s as fileUpdateService,o as fileUploadService};
|