"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),r=t(70579);const o=(0,l.A)({}),d=e=>{let{onClick:a}=e;return(0,r.jsx)(i.A,{onClick:a,children:(0,r.jsx)(n.A,{})})},u=e=>{const a=o();return(0,r.jsx)(s.A,{InputProps:{...a,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.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),r=t(96446),o=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),v=(t(17115),t(70579));const x=(0,y.Gq)("enuseloc"),p=x&&Object.keys(x).length>0?x.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,x]=(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)(),C=(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 N=()=>{const{categoryName:e,categoryOrder:a,...t}=j;f({...b,...t})};return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("div",{className:"common-header-label-bold",children:[(0,v.jsx)(l.A,{onClick:()=>{C(-1)},children:(0,v.jsx)(g.A,{})}),"Update Documentation Category"]}),(0,v.jsx)("div",{className:"component-list",children:(0,v.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)),N(),C("/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,v.jsx)(d.lV,{onSubmit:t,children:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(i.Ay,{container:!0,className:"component-form",children:(0,v.jsxs)(i.Ay,{container:!0,children:[(0,v.jsxs)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:["                                            ",(0,v.jsx)(o.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,v.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,v.jsx)(o.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,v.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,v.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,v.jsx)(o.A,{...e,fullWidth:!0,label:"Status *",name:"status",variant:"outlined",helperText:a.status&&a.status,error:a.status&&Boolean(a.status)})})})]})}),(0,v.jsx)(i.Ay,{className:"d-flex justify-content-center",p:2,children:(0,v.jsx)(r.A,{children:(0,v.jsx)(l.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:m,children:"SAVE"})})})]})})}})})]})}},10155:(e,a,t)=>{var s=t(24994);a.A=void 0;var l=s(t(40039)),i=t(70579);a.A=(0,l.default)((0,i.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear")}}]);
//# sourceMappingURL=67790.3f39ebe1.chunk.js.map