umwd-components 0.1.748 → 0.1.749
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/categories/EditCategoryForm.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/src/components/e-commerce/categories/EditCategoryForm.js +2 -2
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/types/types/e-commerce/category/types.d.ts +1 -3
- 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("@mui/material/Box"),t=require("@mui/material/Stack"),
|
|
7
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material/Box"),t=require("@mui/material/Stack"),i=require("@mui/material/TextField"),a=require("@mui/material/Typography"),s=require("../../SubmitButton.js"),n=require("react"),o=require("../../../data/actions/e-commerce/categories/updateCategoryAction.js"),c=require("@mui/material/Grid"),u=require("../products/ProductSelector.js"),d=require("../../common/markdown/MarkdownEditor.js"),l=require("../../../context/common/SnackbarContext.js"),m=require("@mui/material");const x={zodErrors:null,strapiErrors:null,data:null,message:null,severity:null};exports.EditCategoryForm=function({data:p,revalidateCallback:g,handleClose:j,productNamesArray:h,sx:y}){const{documentId:v,title:q,description:f,slug:E,is_archive:b,products:C}=p,k=C||[],[A,S]=n.useActionState(o.updateCategoryAction.bind(null,v),x),{handleAddMessage:z}=l.useSnackbar();return n.useEffect(()=>{A?.message&&(z({message:A.message,severity:A.severity||"error"}),"success"===A.severity&&(g&&g(),j&&j()))},[A?.message]),n.useEffect(()=>{A?.strapiErrors&&z({message:A.strapiErrors.message||"Error updating category",severity:A.severity||"error"})},[A?.strapiErrors]),e.jsx(r,{sx:[...Array.isArray(y)?y:[y]],children:e.jsx("form",{action:S,children:e.jsxs(c,{container:!0,spacing:2,children:[e.jsx(c,{size:12,children:e.jsxs(t,{spacing:2,children:[e.jsx(a,{variant:"h3",component:"h1",children:"Edit Category"}),e.jsx(a,{variant:"body2",children:"Edit the category for your products. You can add products to this category later."})]})}),e.jsx(c,{size:12,children:e.jsxs(t,{spacing:2,children:[e.jsx(i,{id:"title",name:"title",label:"Title",defaultValue:q}),e.jsx(d.default,{name:"description",label:"Description",defaultValue:f})]})}),e.jsxs(c,{size:12,children:[e.jsx(a,{variant:"h6",children:"Products"}),e.jsx(u.default,{productNames:h,currentValue:[...k.map(e=>e.documentId)]})]}),e.jsx(c,{size:12,children:e.jsxs(t,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{pt:2},children:[j&&e.jsx(m.Button,{onClick:j,variant:"outlined",children:"Cancel"}),e.jsx(s.SubmitButton,{text:"Update category",loadingText:"Loading...",variant:"contained"})]})})]})})})};
|