1"use strict";(self.webpackChunkifundicreate=self.webpackChunkifundicreate||[]).push([[395],{42395:(e,t,a)=>{a.r(t),a.d(t,{default:()=>f});var r=a(9950),s=a(95028),l=a(42424),i=a(26473),o=a(29714),d=a(9449),n=a(10300),m=a(28429),x=a(53256),c=a(6297),p=a(36491),g=a(29466),u=a(46906),h=a(36527),b=a(44414);const f=()=>{const e=(0,n.wA)(),t=(0,m.Zp)(),{categoryId:a,app:f}=(0,m.g)(),y=JSON.parse(localStorage.getItem("user")),{userList:w,categoryList:N,buttonText:j}=(0,n.d4)(e=>({...e.user,...e.category,...e.masterPrompt}));(0,r.useEffect)(()=>{e(g.BP)},[]),(0,r.useEffect)(()=>{"new"!==a&&e((0,h.p7)({categoryId:a})).then(e=>{"You are not authorized to access this route"==e.payload&&t("/dashboard"),"Program not found"==e.payload&&t("/programs")})},[a]),(0,r.useEffect)(()=>{e((0,g.T1)())},[]),(0,r.useEffect)(()=>{"new"!==a&&N.length&&E({categoryName:N[0].categoryName,description:N[0].description,_id:N[0]._id?N[0]._id:null})},[N]);const C=o.Ik().shape({categoryName:o.Yj().required("Category Name is required").trim().max(255,"Category Name must be under 255 characters"),description:o.Yj().required("Description is required").trim().max(1e3,"Description must be under 1000 characters")}),v=(0,d.mN)({resolver:(0,i.t)(C),defaultValues:{categoryName:"",description:""}}),{handleSubmit:A,setValue:k,formState:{errors:_},reset:E}=v;(0,r.useEffect)(()=>{y&&"SuperUser"==y.role&&k("owner",y._id)},[k,y]);return(0,b.jsx)(b.Fragment,{children:(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"mb-6 flex flex-wrap gap items-start justify-between",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"!font-[Poppins] xl:text-3xl xl:leading-3xl text-2xl leading-2xl text-blue-500 font-semibold",children:"new"!==a?"Edit Category":"Add New Category"}),(0,b.jsx)("p",{className:"!font-[Poppins] lg:text-sm lg:leading-sm text-xs leading-xs font-medium text-grey-700 mt-1",children:"Fill the following details to add or edit the details of the categories."})]}),"new"!==a?(0,b.jsx)(u.A,{links:[{name:"Master Prompt",href:`/admin/master-prompts/${f}`},{name:"Category List",href:"/admin/master-prompts/tutor/category-list"},{name:"new"!==a?"Edit Category":"Create Category",href:""}]}):(0,b.jsx)(u.A,{links:[{name:"Master Prompt",href:`/admin/master-prompts/${f}`},{name:"Create Category",href:""}]})]}),(0,b.jsx)("div",{className:"card-box overflow-hidden bg-white border border-solid border-blue-200 rounded-2xl relative p-6 pb-24 min-h-[calc(100vh-234px)]",children:(0,b.jsxs)(l.A,{methods:v,onSubmit:A(async r=>{if("new"!==a){r.categoryName,r.description;e((0,h.uQ)(r)).then(e=>{e.payload.status&&t(`/admin/master-prompts/${f}`)})}else{const a={categoryName:r.categoryName,description:r.description,app:f};e((0,h.uQ)(a)).then(e=>{e.payload.status&&t(`/admin/master-prompts/${f}`)})}}),children:[(0,b.jsxs)("div",{className:"grid lg:grid-cols-1 grid-cols-1 gap-x-5 2xl:max-w-[33%] lg:max-w-[50%] w-full relative z-1",children:[(0,b.jsx)(s.A,{name:"categoryName",placeholder:"Category Name",label:"Category Name:",className:"lg:!mt-2"}),(0,b.jsx)(s.A,{label:"Description:",multiline:!0,name:"description",placeholder:"Description",className:"!mt-4"})]}),(0,b.jsxs)("div",{className:"absolute bottom-6 left-6 flex gap-4",children:[(0,b.jsx)(p.A,{type:"submit",text:"Save",leftIcon:a?(0,b.jsx)(c.h,{className:"mr-2 fill-white 2xl:w-[18px] w-[16px]"}):(0,b.jsx)(x.A,{className:"2xl:!text-3xl 2xl:!leading-3xl !text-2xl !leading-2xl mr-1"}),className:"shadow-[0px_10px_40px_0px_#0C71C326] !bg-blue-500 !text-white 2xl:!text-base 2xl:leading-base lg:!text-sm lg:!leading-sm !text-xs !leading-xs !rounded-lg !font-medium !p-3 !2xl:!min-w-[150px] !min-w-[120px] !border-solid !border-blue-500 !border hover:!bg-blue-700 hover:!border-blue-700"}),(0,b.jsx)(p.A,{onClick:()=>{t(`/admin/master-prompts/${f}/category-list`)},text:"Cancel",className:"!bg-white !text-blue-500 2xl:!text-base 2xl:!leading-base lg:!text-sm lg:!leading-xs !text-xs !leading-xs !rounded-lg !font-medium !p-3 2xl:!min-w-[150px] !min-w-[120px] !border-solid !border-blue-500 !border hover:!bg-blue-500 hover:!text-white"})]})]})})]})})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.