"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[30261],{24659:(e,t,i)=>{i.d(t,{A:()=>p});i(65043);var n=i(67784),o=i(4701),l=i(17392),s=i(10155),r=i(70579);const a=(0,o.A)({}),d=e=>{let{onClick:t}=e;return(0,r.jsx)(l.A,{onClick:t,children:(0,r.jsx)(s.A,{})})},p=e=>{const t=a();return(0,r.jsx)(n.A,{InputProps:{...t,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},30261:(e,t,i)=>{i.r(t),i.d(t,{default:()=>g});var n=i(65043),o=i(11906),l=i(68903),s=i(38624),r=i(96446),a=i(24659),d=i(63516),p=i(14556),u=i(73033),c=i(73216),m=i(66675),v=i(48376),h=i(96801),x=i(70579);const j=(0,h.Gq)("enuseloc"),A=(j&&Object.keys(j).length>0&&j.user_id,{pointName:"",pointDescription:"",pointOrder:"",status:""}),b=u.Ik().shape({pointName:u.Yj().nullable().required("Enter Point Name"),pointOrder:u.ai().nullable().required("Enter Point Order"),pointDescription:u.Yj().nullable().required("Enter Point Description"),status:u.Ik().nullable().required("Select Status")});const g=function(e){const t=(0,c.zy)(),i=(null===t||void 0===t?void 0:t.state)._original,[u,h]=(0,n.useState)(!1),j=[{id:"1",name:"Active"},{id:"0",name:"In Active"}],g=n.useRef(null),[N,f]=(0,n.useState)(A),O=(0,p.wA)(),D=(0,c.Zp)(),y=()=>{D(-1)};(0,n.useEffect)((()=>{i&&f({...N,pointName:null===i||void 0===i?void 0:i.point_name,pointDescription:null===i||void 0===i?void 0:i.point_description,pointOrder:null===i||void 0===i?void 0:i.point_order,status:{id:null===i||void 0===i?void 0:i.is_active,name:1==(null===i||void 0===i?void 0:i.is_active)?"Active":"In Active"}})}),[i]),console.log("civilitemCategoryData",i);const k=()=>{const{pointName:e,status:t,...i}=A;f({...N,...i})};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"common-header-label-bold",children:[(0,x.jsx)(o.A,{onClick:y,children:(0,x.jsx)(m.A,{})}),"Update Check Point"]}),(0,x.jsx)("div",{className:"component-list",children:(0,x.jsx)(d.l1,{enableReinitialize:!0,innerRef:g,validationSchema:b,initialValues:N,onSubmit:async(e,t)=>{var n,o;const l={checkPointID:null===i||void 0===i?void 0:i.id,pointName:e.pointName,pointOrder:e.pointOrder,pointDescription:e.pointDescription,status:null!==(n=e.status)&&void 0!==n&&n.id?null===(o=e.status)||void 0===o?void 0:o.id:""};console.log("finalPayload",l),t.setSubmitting(!0),await O((0,v.JMb)(l)),k(),y()},children:e=>{let{errors:t,handleSubmit:i,handleChange:n,handleBlur:p,setFieldValue:u,isSubmitting:c,isValid:m,touched:v,values:h}=e;return(0,x.jsx)(d.lV,{onSubmit:i,children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(l.Ay,{container:!0,className:"component-form",children:(0,x.jsxs)(l.Ay,{container:!0,children:[(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(a.A,{name:"pointName",fullWidth:!0,id:"pointName",type:"text",onBlur:p,value:N.pointName,onChange:(e,t)=>{u("pointName",t),f({...N,pointName:e.target.value})},error:v.pointName&&Boolean(t.pointName),helperText:v.pointName&&t.pointName,size:"small",label:"Point Name *",variant:"outlined"})}),(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(a.A,{name:"pointOrder",fullWidth:!0,id:"pointOrder",type:"number",onBlur:p,value:N.pointOrder,onChange:(e,t)=>{u("pointOrder",t),f({...N,pointOrder:e.target.value})},error:v.pointOrder&&Boolean(t.pointOrder),helperText:v.pointOrder&&t.pointOrder,size:"small",label:"Point Order *",variant:"outlined"})}),(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(a.A,{name:"pointDescription",fullWidth:!0,id:"pointDescription",type:"text",onBlur:p,value:N.pointDescription,onChange:(e,t)=>{u("pointDescription",t),f({...N,pointDescription:e.target.value})},error:v.pointDescription&&Boolean(t.pointDescription),helperText:v.pointDescription&&t.pointDescription,size:"small",label:"Point Description *",variant:"outlined"})}),(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(s.A,{name:"status",value:h.status,fullWidth:!0,options:j||[],onBlur:p,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,t)=>{u("status",t),f({...N,status:t})},renderInput:e=>(0,x.jsx)(a.A,{...e,fullWidth:!0,label:"Status*",name:"status",variant:"outlined",helperText:t.status&&t.status,error:t.status&&Boolean(t.status)})})})]})}),(0,x.jsx)(l.Ay,{className:"d-flex justify-content-center",p:2,children:(0,x.jsx)(r.A,{children:(0,x.jsx)(o.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:c,children:"SAVE"})})})]})})}})})]})}},10155:(e,t,i)=>{var n=i(24994);t.A=void 0;var o=n(i(40039)),l=i(70579);t.A=(0,o.default)((0,l.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")},66675:(e,t,i)=>{var n=i(24994);t.A=void 0;var o=n(i(40039)),l=i(70579);t.A=(0,o.default)((0,l.jsx)("path",{d:"M3 18h13v-2H3zm0-5h10v-2H3zm0-7v2h13V6zm18 9.59L17.42 12 21 8.41 19.59 7l-5 5 5 5z"}),"MenuOpen")}}]);
//# sourceMappingURL=30261.c59cb586.chunk.js.map