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