"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[81243],{24659:(e,i,l)=>{l.d(i,{A:()=>u});l(65043);var t=l(67784),a=l(4701),n=l(17392),s=l(10155),o=l(70579);const r=(0,a.A)({}),c=e=>{let{onClick:i}=e;return(0,o.jsx)(n.A,{onClick:i,children:(0,o.jsx)(s.A,{})})},u=e=>{const i=r();return(0,o.jsx)(t.A,{InputProps:{...i,endAdornment:(0,o.jsxs)(o.Fragment,{children:[" ",e.iscross&&(0,o.jsx)(c,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},81243:(e,i,l)=>{l.r(i),l.d(i,{default:()=>N});var t=l(65043),a=l(11906),n=l(68903),s=l(38624),o=l(96446),r=l(24659),c=l(63516),u=l(14556),d=l(73033),v=l(73216),m=l(66675),A=l(36883),h=l(10159),x=l(96801),j=l(70579);const g=(0,x.Gq)("enuseloc"),p=g&&Object.keys(g).length>0?g.user_id:null;console.log("LoginuserId",p);const f={valueName:"",fromUomID:"",toUomID:"",conversionFactor:"",categoryID:"",isActive:""},b=d.Ik().shape({valueName:d.Yj().nullable().required("Enter value "),isActive:d.Ik().nullable().required("Select status")});const N=function(e){const i=(0,v.zy)(),l=null===i||void 0===i?void 0:i.state,d=((0,u.d4)((e=>{var i;return null===(i=e.civil.getCivilResourceCategory)||void 0===i?void 0:i.data})),(0,u.d4)((e=>e.civil.getStockUom.data)),l._original);console.log("ResourceData",d);const[x,g]=(0,t.useState)(!1),p=[{id:"1",name:"Active"},{id:"0",name:"InActive"}],N=t.useRef(null),[y,k]=(0,t.useState)(f),I=(0,u.wA)(),S=(0,v.Zp)(),C=()=>{S(-1)};(0,t.useEffect)((()=>{d&&k({...y,valueName:null===d||void 0===d?void 0:d.value_name,isActive:{id:null===d||void 0===d?void 0:d.is_active,name:1==(null===d||void 0===d?void 0:d.is_active)?"Active":"InActive"}})}),[d]),console.log("ResourceData",d),(0,t.useEffect)((()=>{I((0,h.rVf)({status:"1"}))}),[]);const D=()=>{const{valueName:e,conversionFactor:i,categoryID:l,fromUomID:t,toUomID:a,isActive:n,...s}=f;k({...y,...s})};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"common-header-label-bold",children:[(0,j.jsx)(a.A,{onClick:C,children:(0,j.jsx)(m.A,{})}),"Update Setting Value"]}),(0,j.jsx)("div",{className:"component-list",children:(0,j.jsx)(c.l1,{enableReinitialize:!0,innerRef:N,validationSchema:b,initialValues:y,onSubmit:async(e,i)=>{var l,t;const a={valueID:null===d||void 0===d?void 0:d.id,valueName:e.valueName,isActive:null!==(l=e.isActive)&&void 0!==l&&l.id?null===(t=e.isActive)||void 0===t?void 0:t.id:""};console.log("finalPayload",a),i.setSubmitting(!0),await I((0,A.Oyy)(a)),D(),C()},children:e=>{let{errors:i,handleSubmit:l,handleChange:t,handleBlur:u,setFieldValue:d,isSubmitting:v,isValid:m,touched:A,values:h}=e;return(0,j.jsx)(c.lV,{onSubmit:l,children:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(n.Ay,{container:!0,className:"component-form",children:(0,j.jsxs)(n.Ay,{container:!0,children:[(0,j.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,j.jsx)(r.A,{fullWidth:!0,label:"Value*",name:"valueName ",type:"text",onBlur:u,value:h.valueName,onChange:(e,i)=>{d("valueName ",i),k({...y,valueName:e.target.value})},variant:"outlined",size:"small",helperText:A.valueName&&i.valueName,error:A.valueName&&Boolean(i.valueName)})}),(0,j.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,j.jsx)(s.A,{name:"isActive ",value:h.isActive,fullWidth:!0,options:p||[],onBlur:u,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,i)=>{d("isActive ",i),k({...y,isActive:i})},renderInput:e=>(0,j.jsx)(r.A,{...e,fullWidth:!0,label:"Status *",name:"isActive ",variant:"outlined",helperText:i.isActive&&i.isActive,error:i.isActive&&Boolean(i.isActive)})})})]})}),(0,j.jsx)(n.Ay,{className:"d-flex justify-content-center",p:2,children:(0,j.jsx)(o.A,{children:(0,j.jsx)(a.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:v,children:"ADD"})})})]})})}})})]})}},10155:(e,i,l)=>{var t=l(24994);i.A=void 0;var a=t(l(40039)),n=l(70579);i.A=(0,a.default)((0,n.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,i,l)=>{var t=l(24994);i.A=void 0;var a=t(l(40039)),n=l(70579);i.A=(0,a.default)((0,n.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=81243.6d5589ae.chunk.js.map