umwd-components 0.1.791 → 0.1.793
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/cjs/src/components/e-commerce/products/EditStockForm.js +1 -1
- package/dist/cjs/src/components/logistics/ipo/TextualManageIPOForm.js +1 -1
- package/dist/cjs/src/components/public-information/PublicInformationForm.js +1 -1
- package/dist/cjs/src/data/actions/logistics/ipo/updateIpoAction.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/e-commerce/products/EditStockForm.js +4 -4
- package/dist/esm/src/components/logistics/ipo/TextualManageIPOForm.js +1 -0
- package/dist/esm/src/components/public-information/PublicInformationForm.js +1 -1
- package/dist/esm/src/data/actions/logistics/ipo/updateIpoAction.js +1 -0
- package/dist/esm/src/data/loaders/e-commerce/getSingleStock.js +1 -0
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/types/e-commerce/product/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material/Paper"),t=require("@mui/material/Box"),n=require("@mui/material/Stack"),s=require("@mui/material/Typography"),a=require("../../../data/actions/e-commerce/product/updateProductAction.js"),d=require("@mui/material/Grid"),c=require("../../logistics/report/ReportsDisplay.js"),l=require("../../logistics/report/ReportMakingComponent.js"),o=require("../../../context/common/SnackbarContext.js"),u=require("@mui/material/Table"),x=require("@mui/material/TableBody"),m=require("@mui/material/TableCell"),h=require("@mui/material/TableContainer"),j=require("@mui/material/TableFooter"),y=require("@mui/material/TableHead"),p=require("@mui/material/TableRow"),g=require("@mui/material/Tooltip"),q=require("@mui/material/Button"),_=require("../../common/AmountIndicator.js");const A={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.EditStockForm=function({data:k,revalidateCallback:b,handleClose:v,sx:f}){const{documentId:I,title:T,product_number:S,stock:C,ipos:E,opos:z,reports:
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("@mui/material/Paper"),t=require("@mui/material/Box"),n=require("@mui/material/Stack"),s=require("@mui/material/Typography"),a=require("../../../data/actions/e-commerce/product/updateProductAction.js"),d=require("@mui/material/Grid"),c=require("../../logistics/report/ReportsDisplay.js"),l=require("../../logistics/report/ReportMakingComponent.js"),o=require("../../../context/common/SnackbarContext.js"),u=require("@mui/material/Table"),x=require("@mui/material/TableBody"),m=require("@mui/material/TableCell"),h=require("@mui/material/TableContainer"),j=require("@mui/material/TableFooter"),y=require("@mui/material/TableHead"),p=require("@mui/material/TableRow"),g=require("@mui/material/Tooltip"),q=require("@mui/material/Button"),_=require("../../common/AmountIndicator.js");const A={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.EditStockForm=function({data:k,revalidateCallback:b,handleClose:v,sx:f}){const{documentId:I,title:T,product_number:S,stock:C,ipos:E,opos:z,opoItems:Q,reports:V}=k,{handleAddMessage:N}=o.useSnackbar(),O=a.updateProductAction.bind(null,I),[R,P]=r.useActionState(O,A);return r.useEffect(()=>{R?.message&&(N({message:R.message,severity:R.severity||"error"}),"success"===R.severity&&(b&&b(),v&&v()))},[R?.message,N,b,v]),r.useEffect(()=>{R?.strapiErrors&&N({message:R.strapiErrors.message||"Error updating stock",severity:"error"})},[R?.strapiErrors,N]),e.jsxs(t,{sx:[...Array.isArray(f)?f:[f]],children:[e.jsxs(d,{container:!0,spacing:2,children:[e.jsx(d,{size:12,children:e.jsx(s,{variant:"h6",children:T})}),e.jsx(d,{size:12,children:e.jsxs(h,{component:i,children:[e.jsx(s,{variant:"h6",sx:{pl:2},children:"Incoming orders"}),e.jsxs(u,{size:"small",children:[e.jsx(y,{children:e.jsxs(p,{children:[e.jsx(m,{children:"Number"}),e.jsx(m,{children:"Order Date"}),e.jsx(m,{children:"Line Item Number"}),e.jsx(m,{children:"Ordered Quantity"}),e.jsx(m,{children:"Received Quantity"}),e.jsx(m,{children:"Registered Quantity"}),e.jsx(m,{children:"Released Quantity"})]})}),e.jsx(x,{children:Array.isArray(E)?E.map(r=>r.items.map(i=>e.jsxs(p,{children:[e.jsx(m,{children:r.ipo_number}),e.jsx(m,{children:r.order_date}),e.jsx(m,{children:i.line_item_number}),e.jsx(m,{children:e.jsx(_.AmountIndicator,{value:i.ordered_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(m,{children:e.jsx(_.AmountIndicator,{value:i.received_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(m,{children:e.jsx(_.AmountIndicator,{value:i.registered_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(m,{children:e.jsx(_.AmountIndicator,{value:i.released_quantity,maxValue:i.ordered_quantity,color:"primary"})})]},r.documentId))):e.jsx(p,{children:e.jsx(m,{colSpan:7,align:"center",children:"No incoming orders found."})})}),e.jsx(j,{children:e.jsxs(p,{children:[e.jsx(m,{colSpan:6,align:"right",children:"Total added to stock:"}),e.jsx(m,{children:Array.isArray(E)?E.reduce((e,r)=>e+r.items.reduce((e,r)=>e+r.released_quantity,0),0):0})]})})]}),e.jsx(s,{variant:"h6",sx:{pl:2},children:"Outgoing orders"}),e.jsxs(u,{size:"small",children:[e.jsx(y,{children:e.jsxs(p,{children:[e.jsx(m,{children:"Number"}),e.jsx(m,{children:"Order Date"}),e.jsx(m,{children:"Line Item Number"}),e.jsx(m,{children:"Ordered Quantity"}),e.jsx(m,{children:"Picked Quantity"}),e.jsx(m,{children:"Packed Quantity"}),e.jsx(m,{children:"Shipped Quantity"})]})}),e.jsx(x,{children:Array.isArray(z)?z.map(r=>r.opo_items.map(i=>e.jsxs(p,{children:[e.jsx(m,{children:r.opo_number}),e.jsx(m,{children:r.order_date}),e.jsx(m,{children:i.line_item_number}),e.jsx(m,{children:e.jsx(_.AmountIndicator,{value:i.ordered_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(m,{children:e.jsx(_.AmountIndicator,{value:i.picked_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(m,{children:e.jsx(_.AmountIndicator,{value:i.packed_quantity,maxValue:i.ordered_quantity,color:"primary"})}),e.jsx(m,{children:e.jsx(_.AmountIndicator,{value:i.shipped_quantity,maxValue:i.ordered_quantity,color:"primary"})})]},r.documentId))):e.jsx(p,{children:e.jsx(m,{colSpan:7,align:"center",children:"No outgoing orders found"})})}),e.jsx(j,{children:e.jsxs(p,{children:[e.jsx(m,{colSpan:3,align:"right",children:"Total reduced from stock:"}),e.jsx(m,{children:Array.isArray(z)?z.reduce((e,r)=>e+r.opo_items.reduce((e,r)=>e+r.ordered_quantity,0),0):0})]})})]}),e.jsxs(u,{size:"small",children:[e.jsxs(p,{children:[e.jsx(m,{align:"right",children:"Total added to stock:"}),e.jsx(m,{children:Array.isArray(E)&&E.length>0?E.reduce((e,r)=>e+r.items.reduce((e,r)=>e+r.released_quantity,0),0):0})]}),e.jsxs(p,{children:[e.jsx(m,{align:"right",children:"Total reduced from stock:"}),e.jsx(m,{children:Array.isArray(z)&&z.length>0?z.reduce((e,r)=>e+r.opo_items.reduce((e,r)=>e+r.ordered_quantity,0),0):0})]}),e.jsxs(p,{children:[e.jsx(m,{align:"right",children:"Corrections:"}),e.jsx(m,{children:e.jsx(g,{title:"Total stock corrections",children:e.jsx(s,{children:V?V.reduce((e,r)=>e+r.quantity,0):0})})}),e.jsx(m,{children:e.jsx(g,{title:"Total stock corrections after updating",children:e.jsx("b",{children:V?V.reduce((e,r)=>e+r.quantity,0):0})})})]}),e.jsxs(p,{children:[e.jsx(m,{align:"right",children:"Stock:"}),e.jsx(m,{children:e.jsx(g,{title:"Total stock",children:e.jsx(s,{children:(Array.isArray(E)&&E.length>0?E.reduce((e,r)=>e+r.items.reduce((e,r)=>e+r.released_quantity,0),0):0)-(Array.isArray(z)&&z.length>0?z.reduce((e,r)=>e+r.opo_items.reduce((e,r)=>e+r.ordered_quantity,0),0):0)+(V?V.reduce((e,r)=>e+r.quantity,0):0)})})}),e.jsx(m,{children:e.jsx(g,{title:"Total stock after updating",children:e.jsx("b",{children:(Array.isArray(E)&&E.length>0?E.reduce((e,r)=>e+r.items.reduce((e,r)=>e+r.released_quantity,0),0):0)-(Array.isArray(z)&&z.length>0?z.reduce((e,r)=>e+r.opo_items.reduce((e,r)=>e+r.ordered_quantity,0),0):0)+(V?V.reduce((e,r)=>e+r.quantity,0):0)})})})]})]})]})})]}),e.jsxs("form",{action:P,children:[e.jsx("input",{id:"stock_reports",type:"hidden",name:"stock_reports",value:JSON.stringify(V)}),e.jsxs(d,{container:!0,spacing:2,children:[e.jsx(d,{size:12,sx:{mt:2},children:e.jsxs(n,{spacing:2,children:[e.jsx(s,{variant:"h5",children:"Stock corrections"}),e.jsx(s,{variant:"body2",children:"Here you can report and correct for damages wrong items etc. Do not forget to click the button!"}),e.jsx(c.default,{reports:V}),e.jsx(n,{direction:"row",justifyContent:"flex-end",children:e.jsx(l.default,{content:"content",quantity:0,type:"stock",related:[{documentId:I,__type:"api::e-commerce.product"}],revalidateCallback:b,biggerButton:!0})})]})}),e.jsx(d,{size:12,children:e.jsx(n,{direction:"row",justifyContent:"flex-end",alignItems:"center",sx:{py:1},children:v&&e.jsx(q,{onClick:v,variant:"outlined",children:"Close"})})})]})]})]})};
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* @copyright Jelle Paulus
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),i=require("../../../context/common/SnackbarContext.js"),n=require("../../../data/actions/logistics/ipo/updateIpoAction.js"),t=require("../../../data/services/common/confirmation-service.js"),a=require("../../../data/services/common/cancellation-service.js"),s=require("../../common/media/minio/UploadMinioMediaForm.js"),o=require("../note/NoteTakingComponent.js"),l=require("../note/NotesDisplay.js"),c=require("./ItemDisplay.js"),d=require("./TextualIPOItemUpdater.js"),u=require("./IpoStatusIndicator.js"),m=require("@mui/material/Box"),h=require("@mui/material/Stack"),p=require("@mui/material/Paper"),x=require("@mui/material/Dialog"),j=require("@mui/material/DialogActions"),y=require("@mui/material/DialogContent"),v=require("@mui/material/DialogTitle"),g=require("@mui/material/Typography"),f=require("@mui/material/Button"),b=require("@mui/material/Grid"),_=require("@mui/material/Divider"),C=require("@mui/material/TextField"),I=require("@mui/material/List"),q=require("@mui/material/ListItem"),k=require("@mui/material/Alert"),w=require("@mui/material/Checkbox"),S=require("@mui/material/FormControlLabel"),D=require("@mui/icons-material/Numbers"),N=require("@mui/icons-material/Description"),O=require("@mui/icons-material/CalendarToday"),z=require("@mui/icons-material/Business"),A=require("@mui/icons-material/Update"),E=require("../../SubmitButton.js"),M=require("../../common/media/minio/MinioDisplay.js");const P={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function T({open:r,handleClose:n,orderID:a,currentStatus:s,revalidateCallback:o}){const{handleAddMessage:l}=i.useSnackbar();return e.jsxs(x,{open:r,onClose:n,children:[e.jsx(v,{children:"Confirm Order"}),e.jsx(y,{children:e.jsxs(h,{spacing:2,children:[e.jsx(g,{children:"Are you sure you want to confirm this order?"}),e.jsxs(g,{children:["Current status: ",s]}),e.jsx(k,{severity:"info",children:"Once confirmed, the order will be available for processing."})]})}),e.jsxs(j,{children:[e.jsx(f,{variant:"outlined",onClick:n,children:"Cancel"}),e.jsx(f,{variant:"contained",color:"primary",onClick:async()=>{try{await t.confirmationService("ipos",[a]),l({message:"IPO confirmed successfully",severity:"success"}),o&&o(),n()}catch(e){l({message:"Failed to confirm IPO",severity:"error"})}},children:"Confirm Order"})]})]})}function U({open:n,handleClose:t,orderID:s,revalidateCallback:o}){const[l,c]=r.useState(""),[d,u]=r.useState(""),{handleAddMessage:m}=i.useSnackbar();return e.jsxs(x,{open:n,onClose:t,children:[e.jsx(v,{children:"Cancel Return"}),e.jsx(y,{children:e.jsxs(h,{spacing:2,children:[e.jsx(g,{children:"Are you sure you want to cancel this return?"}),e.jsxs(I,{children:[e.jsx(q,{children:"By cancelling this return order you will update it's status from requested to cancelled"}),e.jsx(q,{children:"Please provide a reason for the cancellation"}),e.jsx(q,{children:"The customer will be notified about the cancellation and of the reason for the cancellation"})]}),e.jsx(C,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:l,onChange:e=>c(e.target.value),placeholder:"Please provide a reason for the cancellation",error:!!d,helperText:d})]})}),e.jsxs(j,{children:[e.jsx(f,{variant:"outlined",onClick:t,children:"Close"}),e.jsx(f,{variant:"contained",color:"error",onClick:async()=>{if(l.length<5)u("Please provide a reason for the cancellation (min 5 characters)");else try{await a.cancellationService("ipos",s,l),m({message:"Order cancelled successfully",severity:"success"}),o&&o(),t()}catch(e){m({message:"Failed to cancel order",severity:"error"})}},children:"Confirm Cancellation"})]})]})}exports.default=function({data:t,sx:a,revalidateCallback:x,handleClose:j,role:y}){const[v,C]=r.useActionState((e,r)=>n.updateIpoAction(t.documentId,e,r),P),{handleAddMessage:I}=i.useSnackbar(),[q,F]=r.useState(t.items?t.items:[]),[B,R]=r.useState(!1),[W,L]=r.useState(!1),[G,J]=r.useState(["received","registered","released","reports"]);r.useEffect(()=>{v?.message&&(I({message:v.message,severity:v.severity||"error"}),"success"===v.severity&&(x&&x(),j&&j()))},[v?.message]),r.useEffect(()=>{v?.strapiErrors&&I({message:v.strapiErrors.message||"Error updating IPO",severity:"error"})},[v?.strapiErrors]);const Q=(e,r,i)=>{const n=[...q],t=n.findIndex(e=>e.documentId===r);n[t][i]=e,F(n)},H=(e,r)=>{const i=[...q],n=i.findIndex(e=>e.documentId===r),t=[...i[n]?.reports||[],e];null==i[n]?.reports&&(i[n]={...i[n],reports:[]}),i[n].reports=t,F(i)},K=(e,r)=>{const i=[...q],n=i.findIndex(r=>r.documentId===e),t=i[n]?.reports||[],a=t.filter(e=>"id"in e),s=t.filter(e=>!("id"in e));s.splice(r,1);const o=[...a,...s];i[n].reports=o,F(i)};return r.useEffect(()=>{"Ipo Updated"===v?.message&&(I({message:"Ipo Updated",severity:"success"}),j&&j(),x&&x())},[v]),r.useEffect(()=>{v?.strapiErrors&&I({message:v.strapiErrors.message||"Error updating IPO",severity:"error"})},[v?.strapiErrors]),r.useEffect(()=>{console.log("data",t),t.items&&F(t.items?t.items:[])},[t]),e.jsx(m,{sx:[...Array.isArray(a)?a:[a]],children:e.jsxs(b,{container:!0,spacing:2,children:[e.jsx(b,{size:12,children:e.jsxs(h,{spacing:2,children:[e.jsxs(h,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(h,{spacing:2,children:[e.jsx(g,{variant:"h3",component:"h1",children:"Management Inbound Purchase Order"}),e.jsx(g,{variant:"body1",children:"Manage arrival, registration and recieval of purchase order"})]}),e.jsx(o.default,{content:"",related:[{id:t.documentId,__type:"api::logistics.ipo"}],revalidateCallback:x})]}),e.jsx(_,{})]})}),e.jsx(b,{size:12,children:e.jsx(g,{variant:"h5",sx:{py:1},children:"Details"})}),e.jsx(b,{size:6,children:e.jsx(p,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(h,{spacing:2,children:[e.jsxs(h,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(D,{color:"primary"}),e.jsx(g,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Purchase Order Number"}),e.jsx(g,{variant:"body1",fontWeight:"medium",children:t.ipo_number})]}),e.jsxs(h,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(N,{color:"primary"}),e.jsx(g,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Custom Reference"}),e.jsx(g,{variant:"body1",fontWeight:"medium",children:t.customer_reference})]}),e.jsxs(h,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(O,{color:"primary"}),e.jsx(g,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Date"}),e.jsx(g,{variant:"body1",fontWeight:"medium",children:t.order_date})]}),e.jsxs(h,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(z,{color:"primary"}),e.jsx(g,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Supplier"}),e.jsx(g,{variant:"body1",fontWeight:"medium",children:t.vendor_profile?.business_credentials?.company_name})]}),e.jsxs(h,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(A,{color:"primary"}),e.jsx(g,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Status"}),e.jsx(u.IpoStatusIndicator,{status:t.internal_status})]})]})})}),"enduser"===y&&e.jsx(b,{size:6,children:e.jsx(p,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(h,{spacing:2,children:[("placed"===t.internal_status||"released_on_stock"===t.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"contained",color:"primary",onClick:()=>R(!0),children:"Confirm order"}),e.jsx(k,{severity:"warning",children:"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"}),e.jsx(T,{open:B,handleClose:()=>R(!1),orderID:t.documentId,currentStatus:t.internal_status,revalidateCallback:x})]}),("placed"===t.internal_status||"ordered"===t.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"contained",color:"error",onClick:()=>L(!0),children:"Cancel order"}),e.jsx(U,{open:W,handleClose:()=>L(!1),orderID:t.documentId,revalidateCallback:x})]})]})})}),e.jsx(b,{size:12,children:e.jsx(g,{variant:"h5",children:"Documents"})}),"enduser"===y&&e.jsx(b,{size:6,children:t.minio_order_confirmation?e.jsx(p,{sx:{p:2},children:e.jsxs(h,{spacing:2,children:[e.jsx(g,{variant:"h6",children:"Order Confirmation"}),e.jsx(M.MinioDisplay,{fileSize:t.minio_order_confirmation?.fileSize,mimeType:t.minio_order_confirmation?.mimeType,fileName:t.minio_order_confirmation?.fileName,bucketName:t.minio_order_confirmation?.bucketName,revalidateCallback:x})]})}):e.jsx(p,{sx:{p:2},children:e.jsxs(h,{spacing:2,children:[e.jsx(g,{variant:"h6",children:"Order Confirmation"}),e.jsx(g,{variant:"body2",children:"Upload the order confirmation document for this purchase order"}),e.jsx(s.UploadMinioMediaForm,{reference:"api::logistics.ipo",refID:t.documentId,field:"minio_order_confirmation",bucketName:"umwd",multiple:!1,revalidateCallback:x})]})})}),e.jsx(b,{size:6,children:t.minio_delivery_note?e.jsx(p,{sx:{p:2},children:e.jsxs(h,{spacing:2,children:[e.jsx(g,{variant:"h6",children:"Delivery Note"}),e.jsx(M.MinioDisplay,{fileSize:t.minio_delivery_note?.fileSize,mimeType:t.minio_delivery_note?.mimeType,fileName:t.minio_delivery_note?.fileName,bucketName:t.minio_delivery_note?.bucketName,revalidateCallback:x})]})}):e.jsx(p,{sx:{p:2},children:e.jsxs(h,{spacing:2,children:[e.jsx(g,{variant:"h6",children:"Delivery Note"}),e.jsx(g,{variant:"body2",children:"Upload the delivery note document for this purchase order"}),e.jsx(s.UploadMinioMediaForm,{reference:"api::logistics.ipo",refID:t.documentId,field:"minio_delivery_note",bucketName:"umwd",multiple:!1,revalidateCallback:x})]})})}),t?.notes?.length>0&&e.jsx(b,{size:12,children:e.jsxs(h,{spacing:2,children:[e.jsx(g,{variant:"h5",children:"Notes"}),e.jsx(l.default,{notes:t.notes}),e.jsx(_,{})]})}),e.jsx(b,{size:12,children:e.jsxs(h,{spacing:1,children:[e.jsx(g,{variant:"h5",children:"Items"}),e.jsxs(h,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:p,p:1,sx:{bgcolor:"background.default",border:"1px solid",borderColor:"divider",boxShadow:"none"},children:[e.jsx(g,{variant:"body2",color:"text.secondary",children:"Show:"}),["received","registered","released","reports"].map(r=>e.jsx(S,{control:e.jsx(w,{size:"small",checked:G.includes(r),onChange:e=>{e.target.checked?J([...G,r]):J(G.filter(e=>e!==r))}}),label:e.jsx(g,{variant:"body2",color:"text.secondary",children:r.charAt(0).toUpperCase()+r.slice(1)}),sx:{mr:0}},r))]}),"placed"===t.internal_status&&e.jsx(k,{severity:"warning",children:"Before confirmation you cannot update the items"}),e.jsx(_,{}),e.jsxs("form",{action:C,children:[q&&q.map((r,i)=>e.jsx(p,{sx:{p:2,mb:2},children:"placed"===t.internal_status||"cancelled"===t.internal_status||"done"===t.internal_status?e.jsx(c.default,{item:r,index:i,image:r?.product?.image}):e.jsx(d.default,{item:r,index:i,handleUpdateQuantity:Q,handleAddReport:H,image:r?.product?.image,handleRemoveReportAtIndex:K,revalidateCallback:x,showing:G})},i)),e.jsxs(h,{direction:"row",spacing:2,justifyContent:"space-between",children:[j&&e.jsx(f,{onClick:j,variant:"outlined",children:"Cancel"}),e.jsx(E.SubmitButton,{variant:"contained",text:"Update items",loadingText:"Loading..."})]}),e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({documentId:e.documentId,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:e.reports?.map(e=>({documentId:"documentId"in e?e.documentId:void 0,quantity:e.quantity,content:e.content,type:e.type}))||[]})))(q))})]})]})})]})})};
|
|
6
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),i=require("../../../context/common/SnackbarContext.js"),n=require("../../../data/actions/logistics/ipo/updateIpoAction.js"),t=require("../../../data/services/common/confirmation-service.js"),a=require("../../../data/services/common/cancellation-service.js"),s=require("../../common/media/minio/UploadMinioMediaForm.js"),o=require("../note/NoteTakingComponent.js"),l=require("../note/NotesDisplay.js"),c=require("./ItemDisplay.js"),d=require("./TextualIPOItemUpdater.js"),u=require("./IpoStatusIndicator.js"),m=require("@mui/material/Box"),h=require("@mui/material/Stack"),x=require("@mui/material/Paper"),p=require("@mui/material/Dialog"),j=require("@mui/material/DialogActions"),y=require("@mui/material/DialogContent"),g=require("@mui/material/DialogTitle"),v=require("@mui/material/Typography"),f=require("@mui/material/Button"),b=require("@mui/material/Grid"),_=require("@mui/material/Divider"),C=require("@mui/material/TextField"),I=require("@mui/material/List"),q=require("@mui/material/ListItem"),k=require("@mui/material/Alert"),w=require("@mui/material/Checkbox"),S=require("@mui/material/FormControlLabel"),D=require("@mui/icons-material/Numbers"),N=require("@mui/icons-material/Description"),O=require("@mui/icons-material/CalendarToday"),M=require("@mui/icons-material/Business"),z=require("@mui/icons-material/Update"),A=require("../../SubmitButton.js"),E=require("../../common/media/minio/MinioDisplay.js");const P={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};function T({open:r,handleClose:n,orderID:a,currentStatus:s,revalidateCallback:o}){const{handleAddMessage:l}=i.useSnackbar();return e.jsxs(p,{open:r,onClose:n,children:[e.jsx(g,{children:"Confirm Order"}),e.jsx(y,{children:e.jsxs(h,{spacing:2,children:[e.jsx(v,{children:"Are you sure you want to confirm this order?"}),e.jsxs(v,{children:["Current status: ",s]}),e.jsx(k,{severity:"info",children:"Once confirmed, the order will be available for processing."})]})}),e.jsxs(j,{children:[e.jsx(f,{variant:"outlined",onClick:n,children:"Cancel"}),e.jsx(f,{variant:"contained",color:"primary",onClick:async()=>{try{await t.confirmationService("ipos",[a]),l({message:"IPO confirmed successfully",severity:"success"}),o&&o(),n()}catch(e){l({message:"Failed to confirm IPO",severity:"error"})}},children:"Confirm Order"})]})]})}function U({open:n,handleClose:t,orderID:s,revalidateCallback:o}){const[l,c]=r.useState(""),[d,u]=r.useState(""),{handleAddMessage:m}=i.useSnackbar();return e.jsxs(p,{open:n,onClose:t,children:[e.jsx(g,{children:"Cancel Return"}),e.jsx(y,{children:e.jsxs(h,{spacing:2,children:[e.jsx(v,{children:"Are you sure you want to cancel this return?"}),e.jsxs(I,{children:[e.jsx(q,{children:"By cancelling this return order you will update it's status from requested to cancelled"}),e.jsx(q,{children:"Please provide a reason for the cancellation"}),e.jsx(q,{children:"The customer will be notified about the cancellation and of the reason for the cancellation"})]}),e.jsx(C,{label:"Cancellation reason",name:"reason",multiline:!0,rows:4,fullWidth:!0,variant:"outlined",value:l,onChange:e=>c(e.target.value),placeholder:"Please provide a reason for the cancellation",error:!!d,helperText:d})]})}),e.jsxs(j,{children:[e.jsx(f,{variant:"outlined",onClick:t,children:"Close"}),e.jsx(f,{variant:"contained",color:"error",onClick:async()=>{if(l.length<5)u("Please provide a reason for the cancellation (min 5 characters)");else try{await a.cancellationService("ipos",s,l),m({message:"Order cancelled successfully",severity:"success"}),o&&o(),t()}catch(e){m({message:"Failed to cancel order",severity:"error"})}},children:"Confirm Cancellation"})]})]})}exports.default=function({data:t,sx:a,revalidateCallback:p,handleClose:j,role:y}){console.log("TextualManageIPOForm data",t);const[g,C]=r.useActionState((e,r)=>n.updateIpoAction(t.documentId,e,r),P),{handleAddMessage:I}=i.useSnackbar(),[q,F]=r.useState(t.items?t.items:[]),[B,R]=r.useState(!1),[W,L]=r.useState(!1),[G,J]=r.useState(["received","registered","released","reports"]);r.useEffect(()=>{g?.message&&(I({message:g.message,severity:g.severity||"error"}),"success"===g.severity&&(p&&p(),j&&j()))},[g?.message]),r.useEffect(()=>{g?.strapiErrors&&I({message:g.strapiErrors.message||"Error updating IPO",severity:"error"})},[g?.strapiErrors]);const Q=(e,r,i)=>{const n=[...q],t=n.findIndex(e=>e.documentId===r);n[t][i]=e,F(n)},H=(e,r)=>{const i=[...q],n=i.findIndex(e=>e.documentId===r),t=[...i[n]?.reports||[],e];null==i[n]?.reports&&(i[n]={...i[n],reports:[]}),i[n].reports=t,F(i)},K=(e,r)=>{const i=[...q],n=i.findIndex(r=>r.documentId===e),t=i[n]?.reports||[],a=t.filter(e=>"id"in e),s=t.filter(e=>!("id"in e));s.splice(r,1);const o=[...a,...s];i[n].reports=o,F(i)};return r.useEffect(()=>{"Ipo Updated"===g?.message&&(I({message:"Ipo Updated",severity:"success"}),j&&j(),p&&p())},[g]),r.useEffect(()=>{g?.strapiErrors&&I({message:g.strapiErrors.message||"Error updating IPO",severity:"error"})},[g?.strapiErrors]),r.useEffect(()=>{console.log("data",t),t.items&&F(t.items?t.items:[])},[t]),e.jsx(m,{sx:[...Array.isArray(a)?a:[a]],children:e.jsxs(b,{container:!0,spacing:2,children:[e.jsx(b,{size:12,children:e.jsxs(h,{spacing:2,children:[e.jsxs(h,{direction:"row",spacing:2,justifyContent:"space-between",children:[e.jsxs(h,{spacing:2,children:[e.jsx(v,{variant:"h3",component:"h1",children:"Management Inbound Purchase Order"}),e.jsx(v,{variant:"body1",children:"Manage arrival, registration and recieval of purchase order"})]}),e.jsx(o.default,{content:"",related:[{id:t.documentId,__type:"api::logistics.ipo"}],revalidateCallback:p})]}),e.jsx(_,{})]})}),e.jsx(b,{size:12,children:e.jsx(v,{variant:"h5",sx:{py:1},children:"Details"})}),e.jsx(b,{size:6,children:e.jsx(x,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(h,{spacing:2,children:[e.jsxs(h,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(D,{color:"primary"}),e.jsx(v,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Purchase Order Number"}),e.jsx(v,{variant:"body1",fontWeight:"medium",children:t.ipo_number})]}),e.jsxs(h,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(N,{color:"primary"}),e.jsx(v,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Custom Reference"}),e.jsx(v,{variant:"body1",fontWeight:"medium",children:t.customer_reference})]}),e.jsxs(h,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(O,{color:"primary"}),e.jsx(v,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Date"}),e.jsx(v,{variant:"body1",fontWeight:"medium",children:t.order_date})]}),e.jsxs(h,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(M,{color:"primary"}),e.jsx(v,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Supplier"}),e.jsx(v,{variant:"body1",fontWeight:"medium",children:t.vendor_profile?.business_credentials?.company_name})]}),e.jsxs(h,{direction:"row",spacing:2,alignItems:"center",children:[e.jsx(z,{color:"primary"}),e.jsx(v,{variant:"subtitle1",color:"text.secondary",width:"200px",children:"Order Status"}),e.jsx(u.IpoStatusIndicator,{status:t.internal_status})]})]})})}),"enduser"===y&&e.jsx(b,{size:6,children:e.jsx(x,{elevation:2,sx:{p:2,height:"100%"},children:e.jsxs(h,{spacing:2,children:[("placed"===t.internal_status||"released_on_stock"===t.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"contained",color:"primary",onClick:()=>R(!0),children:"Confirm order"}),e.jsx(k,{severity:"warning",children:"Please confirm the order as soon as possible, only upon confirmation this order will be available to the dispatcher"}),e.jsx(T,{open:B,handleClose:()=>R(!1),orderID:t.documentId,currentStatus:t.internal_status,revalidateCallback:p})]}),("placed"===t.internal_status||"ordered"===t.internal_status)&&e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"contained",color:"error",onClick:()=>L(!0),children:"Cancel order"}),e.jsx(U,{open:W,handleClose:()=>L(!1),orderID:t.documentId,revalidateCallback:p})]})]})})}),e.jsx(b,{size:12,children:e.jsx(v,{variant:"h5",children:"Documents"})}),"enduser"===y&&e.jsx(b,{size:6,children:t.minio_order_confirmation?e.jsx(x,{sx:{p:2},children:e.jsxs(h,{spacing:2,children:[e.jsx(v,{variant:"h6",children:"Order Confirmation"}),e.jsx(E.MinioDisplay,{fileSize:t.minio_order_confirmation?.fileSize,mimeType:t.minio_order_confirmation?.mimeType,fileName:t.minio_order_confirmation?.fileName,bucketName:t.minio_order_confirmation?.bucketName,revalidateCallback:p})]})}):e.jsx(x,{sx:{p:2},children:e.jsxs(h,{spacing:2,children:[e.jsx(v,{variant:"h6",children:"Order Confirmation"}),e.jsx(v,{variant:"body2",children:"Upload the order confirmation document for this purchase order"}),e.jsx(s.UploadMinioMediaForm,{reference:"api::logistics.ipo",refID:t.documentId,field:"minio_order_confirmation",bucketName:"umwd",multiple:!1,revalidateCallback:p})]})})}),e.jsx(b,{size:6,children:t.minio_delivery_note?e.jsx(x,{sx:{p:2},children:e.jsxs(h,{spacing:2,children:[e.jsx(v,{variant:"h6",children:"Delivery Note"}),e.jsx(E.MinioDisplay,{fileSize:t.minio_delivery_note?.fileSize,mimeType:t.minio_delivery_note?.mimeType,fileName:t.minio_delivery_note?.fileName,bucketName:t.minio_delivery_note?.bucketName,revalidateCallback:p})]})}):e.jsx(x,{sx:{p:2},children:e.jsxs(h,{spacing:2,children:[e.jsx(v,{variant:"h6",children:"Delivery Note"}),e.jsx(v,{variant:"body2",children:"Upload the delivery note document for this purchase order"}),e.jsx(s.UploadMinioMediaForm,{reference:"api::logistics.ipo",refID:t.documentId,field:"minio_delivery_note",bucketName:"umwd",multiple:!1,revalidateCallback:p})]})})}),t?.notes?.length>0&&e.jsx(b,{size:12,children:e.jsxs(h,{spacing:2,children:[e.jsx(v,{variant:"h5",children:"Notes"}),e.jsx(l.default,{notes:t.notes}),e.jsx(_,{})]})}),e.jsx(b,{size:12,children:e.jsxs(h,{spacing:1,children:[e.jsx(v,{variant:"h5",children:"Items"}),e.jsxs(h,{direction:"row",alignItems:"center",justifyContent:"flex-end",spacing:2,component:x,p:1,sx:{bgcolor:"background.default",border:"1px solid",borderColor:"divider",boxShadow:"none"},children:[e.jsx(v,{variant:"body2",color:"text.secondary",children:"Show:"}),["received","registered","released","reports"].map(r=>e.jsx(S,{control:e.jsx(w,{size:"small",checked:G.includes(r),onChange:e=>{e.target.checked?J([...G,r]):J(G.filter(e=>e!==r))}}),label:e.jsx(v,{variant:"body2",color:"text.secondary",children:r.charAt(0).toUpperCase()+r.slice(1)}),sx:{mr:0}},r))]}),"placed"===t.internal_status&&e.jsx(k,{severity:"warning",children:"Before confirmation you cannot update the items"}),e.jsx(_,{}),e.jsxs("form",{action:C,children:[q&&q.map((r,i)=>e.jsx(x,{sx:{p:2,mb:2},children:"placed"===t.internal_status||"cancelled"===t.internal_status||"done"===t.internal_status?e.jsx(c.default,{item:r,index:i,image:r?.product?.image}):e.jsx(d.default,{item:r,index:i,handleUpdateQuantity:Q,handleAddReport:H,image:r?.product?.image,handleRemoveReportAtIndex:K,revalidateCallback:p,showing:G})},i)),e.jsxs(h,{direction:"row",spacing:2,justifyContent:"space-between",children:[j&&e.jsx(f,{onClick:j,variant:"outlined",children:"Cancel"}),e.jsx(A.SubmitButton,{variant:"contained",text:"Update items",loadingText:"Loading..."})]}),e.jsx("input",{type:"hidden",name:"items",value:JSON.stringify((e=>e.map(e=>({documentId:e.documentId,ordered_quantity:e.ordered_quantity,received_quantity:e.received_quantity,registered_quantity:e.registered_quantity,released_quantity:e.released_quantity,reports:e.reports?.map(e=>({documentId:"documentId"in e?e.documentId:void 0,quantity:e.quantity,content:e.content,type:e.type}))||[]})))(q))})]})]})})]})})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/Divider"),s=require("@mui/material/Paper"),a=require("@mui/material/Box"),n=require("@mui/material/Stack"),r=require("@mui/material/Alert"),t=require("@mui/material/TextField"),l=require("@mui/material/Typography"),o=require("@mui/material/Grid"),c=require("../SubmitButton.js"),d=require("react"),m=require("../StrapiErrors.js"),u=require("../e-commerce/customer/BusinessCredentials.js"),p=require("../common/Address.js"),x=require("../../data/actions/public-information/updatePublicInformationAction.js"),j=require("../common/socials/Socials.js"),h=require("@mui/material/IconButton"),g=require("@mui/icons-material/Add");const f={zodErrors:null,strapiErrors:null,data:null,message:null};exports.PublicInformationForm=function({publicInformation:b,sx:q}){const{documentId:v,title:y,description:S,disclaimer_link:z,privacypolicy_link:I,maxWidth:A,email:_,phone_number:C,business_credentials:N,address:$,socials:k,header_logo:B,footer_logo:E}=b;console.log(k);const[F,R]=d.useActionState((e,i)=>x.updatePublicInformationAction(v,e,i),f),[P,T]=d.useState([]),V=(e,i)=>{P.includes(i)?T(P.filter(e=>e!==i)):T([...P,i])},[D,w]=d.useState(k.reduce((e,i,s)=>(e.push({data:i,componentName:`socials[${s}]`,componentReference:"common.social"}),e),[])),[G,W]=d.useState([]);return e.jsx(a,{sx:[{p:2},...Array.isArray(q)?q:[q]],component:s,children:e.jsx("form",{action:R,children:e.jsxs(o,{container:!0,spacing:2,children:[e.jsx(o,{size:12,children:e.jsx(l,{variant:"h5",children:"Edit Public Information"})}),e.jsx(o,{size:12,children:e.jsxs(n,{spacing:2,children:[e.jsx(t,{id:"title",name:"title",label:"Title",defaultValue:y||""}),e.jsx(t,{id:"description",name:"description",label:"Description",defaultValue:S||""}),e.jsx(t,{id:"email",name:"email",label:"email",defaultValue:_||""}),e.jsx(t,{id:"phone_number",name:"phone_number",label:"phone_number",defaultValue:C||""})]})}),e.jsx(o,{size:{xs:12,lg:6},children:e.jsxs(n,{spacing:2,children:[e.jsx(l,{variant:"h6",children:"Company Address"}),e.jsx(i,{}),e.jsx(p.AddressFields,{componentName:"address",componentReference:"common.address",data:$})]})}),e.jsx(o,{size:{xs:12,lg:6},children:e.jsxs(n,{spacing:2,children:[e.jsx(l,{variant:"h6",children:"Business Credentials"}),e.jsx(i,{}),e.jsx(u.BusinessCredentialsFields,{componentName:"business_credentials",componentReference:"business.credentials",data:N})]})}),e.jsx(o,{sx:{mt:1},size:12,children:e.jsx(l,{variant:"h6",children:"Socials"})}),D.map((i,s)=>i.data?.name?P.includes(i.data.name)?e.jsx(o,{size:{xs:12,md:6,lg:4},children:e.jsx(j.SocialsFields,{data:i.data,componentName:`socials[${s}]`,componentReference:"common.social",deleteCallback:()=>{w(D.filter((e,i)=>i!==s))}})},s):e.jsxs(o,{size:{xs:12,md:6,lg:4},children:[e.jsx("input",{type:"hidden",name:`socials[${s}].documentId`,value:i.data.documentId||""}),e.jsx("input",{type:"hidden",name:`socials[${s}].name`,value:i.data.name||""}),e.jsx("input",{type:"hidden",name:`socials[${s}].url`,value:i.data.url||""}),e.jsx("input",{type:"hidden",name:`socials[${s}].icon`,value:i.data.icon||""}),e.jsx(j.default,{data:{...i.data,onClick:V}})]},s):null),G.map((i,s)=>e.jsx(o,{size:{xs:12,md:6,lg:4},children:e.jsx(j.SocialsFields,{data:i.data,componentName:i.componentName,componentReference:"common.social",deleteCallback:()=>{W(G.filter((e,i)=>i!==s).map((e,i)=>({...e,componentName:`socials[${i+D.length}]`})))}})},i.data?.uuid)),e.jsx(o,{justifyContent:"center",alignItems:"center",size:{xs:12,md:6,lg:4},children:e.jsx(h,{onClick:()=>{W([...G,{componentName:`socials[${D.length+G.length}]`,componentReference:"logistics-elements.social",data:{name:"",url:""}}])},children:e.jsx(g,{})})}),e.jsx(o,{size:12,children:e.jsxs(n,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1},children:[e.jsx(c.SubmitButton,{text:"save changes",loadingText:"loading"}),F?.strapiErrors&&e.jsx(m.StrapiErrors,{error:F?.strapiErrors}),F?.message&&e.jsx(r,{severity:"error",children:F?.message})]})})]})})})};
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),i=require("@mui/material/Divider"),s=require("@mui/material/Paper"),a=require("@mui/material/Box"),n=require("@mui/material/Stack"),r=require("@mui/material/Alert"),t=require("@mui/material/TextField"),l=require("@mui/material/Typography"),o=require("@mui/material/Grid"),c=require("../SubmitButton.js"),d=require("react"),m=require("../StrapiErrors.js"),u=require("../e-commerce/customer/BusinessCredentials.js"),p=require("../common/Address.js"),x=require("../../data/actions/public-information/updatePublicInformationAction.js"),j=require("../common/socials/Socials.js"),h=require("@mui/material/IconButton"),g=require("@mui/icons-material/Add");const f={zodErrors:null,strapiErrors:null,data:null,message:null};exports.PublicInformationForm=function({publicInformation:b,sx:q}){const{documentId:v,title:y,description:S,disclaimer_link:z,privacypolicy_link:I,maxWidth:A,email:_,phone_number:C,business_credentials:N,address:$,socials:k,header_logo:B,footer_logo:E}=b;console.log(k);const[F,R]=d.useActionState((e,i)=>x.updatePublicInformationAction(v,e,i),f),[P,T]=d.useState([]),V=(e,i)=>{P.includes(i)?T(P.filter(e=>e!==i)):T([...P,i])},[D,w]=d.useState(k.reduce((e,i,s)=>(e.push({data:i,componentName:`socials[${s}]`,componentReference:"common.social"}),e),[])),[G,W]=d.useState([]);return e.jsx(a,{sx:[{p:2},...Array.isArray(q)?q:[q]],component:s,children:e.jsx("form",{action:R,children:e.jsxs(o,{container:!0,spacing:2,children:[e.jsx(o,{size:12,children:e.jsx(l,{variant:"h5",children:"Edit Public Information"})}),e.jsx(o,{size:12,children:e.jsxs(n,{spacing:2,children:[e.jsx(t,{id:"title",name:"title",label:"Title",defaultValue:y||""}),e.jsx(t,{id:"description",name:"description",label:"Description",defaultValue:S||""}),e.jsx(t,{id:"email",name:"email",label:"email",defaultValue:_||""}),e.jsx(t,{id:"phone_number",name:"phone_number",label:"phone_number",defaultValue:C||""})]})}),e.jsx(o,{size:{xs:12,lg:6},children:e.jsxs(n,{spacing:2,children:[e.jsx(l,{variant:"h6",children:"Company Address"}),e.jsx(i,{}),e.jsx(p.AddressFields,{componentName:"address",componentReference:"common.address",data:$})]})}),e.jsx(o,{size:{xs:12,lg:6},children:e.jsxs(n,{spacing:2,children:[e.jsx(l,{variant:"h6",children:"Business Credentials"}),e.jsx(i,{}),e.jsx(u.BusinessCredentialsFields,{componentName:"business_credentials",componentReference:"business.credentials",data:N})]})}),e.jsx(o,{sx:{mt:1},size:12,children:e.jsx(l,{variant:"h6",children:"Socials"})}),D.map((i,s)=>i.data?.name?P.includes(i.data.name)?e.jsx(o,{size:{xs:12,md:6,lg:4},children:e.jsx(j.SocialsFields,{data:i.data,componentName:`socials[${s}]`,componentReference:"common.social",deleteCallback:()=>{w(D.filter((e,i)=>i!==s))}})},s):e.jsxs(o,{size:{xs:12,md:6,lg:4},children:[e.jsx("input",{type:"hidden",name:`socials[${s}].documentId`,value:i.data.documentId||""}),e.jsx("input",{type:"hidden",name:`socials[${s}].name`,value:i.data.name||""}),e.jsx("input",{type:"hidden",name:`socials[${s}].url`,value:i.data.url||""}),e.jsx("input",{type:"hidden",name:`socials[${s}].icon`,value:i.data.icon||""}),e.jsx(j.default,{data:{...i.data,onClick:V}})]},s):null),G.map((i,s)=>e.jsx(o,{size:{xs:12,md:6,lg:4},children:e.jsx(j.SocialsFields,{data:i.data,componentName:i.componentName,componentReference:"common.social",deleteCallback:()=>{W(G.filter((e,i)=>i!==s).map((e,i)=>({...e,componentName:`socials[${i+D.length}]`})))}})},i.data?.uuid||s)),e.jsx(o,{justifyContent:"center",alignItems:"center",size:{xs:12,md:6,lg:4},children:e.jsx(h,{onClick:()=>{W([...G,{componentName:`socials[${D.length+G.length}]`,componentReference:"logistics-elements.social",data:{name:"",url:""}}])},children:e.jsx(g,{})})}),e.jsx(o,{size:12,children:e.jsxs(n,{direction:"row-reverse",spacing:2,alignItems:"center",sx:{py:1},children:[e.jsx(c.SubmitButton,{text:"save changes",loadingText:"loading"}),F?.strapiErrors&&e.jsx(m.StrapiErrors,{error:F?.strapiErrors}),F?.message&&e.jsx(r,{severity:"error",children:F?.message})]})})]})})})};
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @copyright Jelle Paulus
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
7
|
-
"use strict";var r=require("../../../services/mutate-data.js"),e=require("../../../../lib/utils.js"),t=require("../../../../lib/parseFormData.js");exports.updateIpoAction=async function(s,a,i){const
|
|
7
|
+
"use strict";var r=require("../../../services/mutate-data.js"),e=require("../../../../lib/utils.js"),t=require("../../../../lib/parseFormData.js");exports.updateIpoAction=async function(s,a,i){const o=t.parseFormData(i);console.log("updateIpoAction",s,o);const u=await r.mutateData("PUT",`/api/ipos/${s}`,o);if(!u)return{...a,severity:"error",strapiErrors:null,message:"Failed to update IPO. Please try again."};if(u.error)return{...a,severity:"error",strapiErrors:u.error,message:"Failed to update IPO."};const n=e.flattenAttributes(u);return{...a,severity:"success",message:"IPO Updated Successfully",data:n,strapiErrors:null}};
|