"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[68028],{69875:(e,t,a)=>{a.d(t,{A:()=>r});a(65043);const r=a.p+"static/media/Upload.4216d61323e67ba8fcaf839d79ad9d80.svg"},24659:(e,t,a)=>{a.d(t,{A:()=>d});a(65043);var r=a(67784),o=a(4701),s=a(17392),l=a(10155),n=a(70579);const i=(0,o.A)({}),c=e=>{let{onClick:t}=e;return(0,n.jsx)(s.A,{onClick:t,children:(0,n.jsx)(l.A,{})})},d=e=>{const t=i();return(0,n.jsx)(r.A,{InputProps:{...t,endAdornment:(0,n.jsxs)(n.Fragment,{children:[" ",e.iscross&&(0,n.jsx)(c,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},68028:(e,t,a)=>{a.r(t),a.d(t,{default:()=>A});var r=a(65043),o=a(11906),s=a(68903),l=a(38624),n=a(96446),i=a(24659),c=(a(69875),a(63516)),d=a(14556),g=a(73033),u=a(73216),y=a(66675),m=a(11852),v=a(96801),h=(a(17115),a(70579));const x=(0,v.Gq)("enuseloc"),j=x&&Object.keys(x).length>0?x.user_id:null;console.log("LoginuserId",j);const S={categoryName:"",categoryOrder:"",categoryStatus:""},p=g.Ik().shape({categoryName:g.Yj("Enter Category Name").required("Category Name is required"),categoryOrder:g.ai("Enter Category Order").required("Category Order is required").positive("Order must be a positive number"),categoryStatus:g.Ik().nullable().required("Select Status")});const A=function(e){const t=(0,u.zy)().state,a=t._original;console.log("taskCategoryData",a);const[g,v]=(0,r.useState)(!1),x=r.useRef(null),j=(r.useRef(null),r.useRef(null),(0,d.d4)((e=>e.bd.getBdProjectTaskCategory)));console.log("getBdProjectTaskCategory",j);const[A,C]=(0,r.useState)(S),b=(0,d.wA)(),f=(0,u.Zp)();(0,r.useEffect)((()=>{if(t){const e={taskCategoryID:null===a||void 0===a?void 0:a.id,categoryName:null===j||void 0===j?void 0:j.category_name,categoryOrder:"",categoryStatus:"",generalSearch:"",sortOrder:"",iDisplayStart:0,iDisplayLength:-1};b((0,m.sK9)(e))}}),[t,g]),(0,r.useEffect)((()=>{a&&C({...A,categoryName:null===a||void 0===a?void 0:a.category_name,categoryOrder:null===a||void 0===a?void 0:a.category_order,categoryStatus:{id:null===a||void 0===a?void 0:a.category_status,name:null===a||void 0===a?void 0:a.category_status}})}),[a]),console.log("getBdProjectTaskCategory",j);const N=()=>{const{categoryName:e,categoryOrder:t,...a}=S;C({...A,...a})};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:"common-header-label-bold",children:[(0,h.jsx)(o.A,{onClick:()=>{f(-1)},children:(0,h.jsx)(y.A,{})}),"Update Project Task Category"]}),(0,h.jsx)("div",{className:"component-list",children:(0,h.jsx)(c.l1,{enableReinitialize:!0,innerRef:x,validationSchema:p,initialValues:A,onSubmit:async(e,t)=>{var r,o;const s={taskCategoryID:null===a||void 0===a?void 0:a.id,categoryName:null===e||void 0===e?void 0:e.categoryName,categoryOrder:null===e||void 0===e?void 0:e.categoryOrder,categoryStatus:null!==(r=e.categoryStatus)&&void 0!==r&&r.id?null===(o=e.categoryStatus)||void 0===o?void 0:o.id:""};console.log("finalPayload",s),t.setSubmitting(!0),await b((0,m.xjd)(s)),N(),f("/bd-masters/ProjectTaskCategory")},children:e=>{let{errors:t,handleSubmit:a,handleChange:r,handleBlur:d,setFieldValue:g,isSubmitting:u,isValid:y,touched:m,values:v}=e;return(0,h.jsx)(c.lV,{onSubmit:a,children:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s.Ay,{container:!0,className:"component-form",children:(0,h.jsxs)(s.Ay,{container:!0,children:[(0,h.jsx)(s.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,h.jsx)(i.A,{fullWidth:!0,label:"Category Name*",name:"categoryName",onBlur:d,value:v.categoryName,onChange:(e,t)=>{g("categoryName",t),C({...A,categoryName:e.target.value})},variant:"outlined",size:"small",helperText:m.categoryName&&t.categoryName,error:m.categoryName&&Boolean(t.categoryName)})}),(0,h.jsx)(s.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,h.jsx)(i.A,{fullWidth:!0,label:"Category Order*",name:"categoryOrder",onBlur:d,value:v.categoryOrder,onChange:(e,t)=>{g("categoryOrder",t),C({...A,categoryOrder:e.target.value})},variant:"outlined",size:"small",type:"number",helperText:m.categoryOrder&&t.categoryOrder,error:m.categoryOrder&&Boolean(t.categoryOrder)})}),(0,h.jsx)(s.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,h.jsx)(l.A,{name:"categoryStatus",value:v.categoryStatus,fullWidth:!0,options:[{id:"Active",name:"Active"},{id:"InActive",name:"In Active"}],onBlur:d,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,t)=>{g("categoryStatus",t),C({...A,categoryStatus:t})},renderInput:e=>(0,h.jsx)(i.A,{...e,fullWidth:!0,label:"Category Status *",name:"categoryStatus",variant:"outlined",helperText:t.categoryStatus&&t.categoryStatus,error:t.categoryStatus&&Boolean(t.categoryStatus)})})})]})}),(0,h.jsx)(s.Ay,{className:"d-flex justify-content-center",p:2,children:(0,h.jsx)(n.A,{children:(0,h.jsx)(o.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:u,children:"SAVE"})})})]})})}})})]})}}}]);
//# sourceMappingURL=68028.b830ac59.chunk.js.map