"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[94543],{24659:(e,t,a)=>{a.d(t,{A:()=>d});a(65043);var n=a(67784),s=a(4701),l=a(17392),i=a(10155),r=a(70579);const u=(0,s.A)({}),o=e=>{let{onClick:t}=e;return(0,r.jsx)(l.A,{onClick:t,children:(0,r.jsx)(i.A,{})})},d=e=>{const t=u();return(0,r.jsx)(n.A,{InputProps:{...t,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(o,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},94543:(e,t,a)=>{a.r(t),a.d(t,{default:()=>b});var n=a(65043),s=a(11906),l=a(68903),i=a(38624),r=a(96446),u=a(24659),o=a(63516),d=a(14556),m=a(73033),c=a(73216),v=a(66675),h=a(10159),k=a(96801),x=a(70579);const j=(0,k.Gq)("enuseloc"),A=(j&&Object.keys(j).length>0&&j.user_id,{unitName:"",status:"",remark:""}),p=m.Ik().shape({unitName:m.Yj().nullable().required("Enter Stock Name"),remark:m.Yj().nullable().required("Enter Remark"),status:m.Ik().nullable().required("Select Status")});const b=function(e){const t=(0,c.zy)(),a=(null===t||void 0===t?void 0:t.state)._original,[m,k]=(0,n.useState)(!1),j=[{id:"1",name:"Active"},{id:"0",name:"In Active"}],b=n.useRef(null),[N,g]=(0,n.useState)(A),f=(0,d.wA)(),S=(0,c.Zp)(),_=()=>{S(-1)};(0,n.useEffect)((()=>{a&&g({...N,unitName:null===a||void 0===a?void 0:a.stock_unit_name,remark:null===a||void 0===a?void 0:a.stock_remarks,status:{id:null===a||void 0===a?void 0:a.stock_unit_active,name:1==(null===a||void 0===a?void 0:a.stock_unit_active)?"Active":"InActive"}})}),[a]),console.log("stockUOMData",a);const y=()=>{const{unitName:e,status:t,...a}=A;g({...N,...a})};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"common-header-label-bold",children:[(0,x.jsx)(s.A,{onClick:_,children:(0,x.jsx)(v.A,{})}),"Update Stock UOM"]}),(0,x.jsx)("div",{className:"component-list",children:(0,x.jsx)(o.l1,{enableReinitialize:!0,innerRef:b,validationSchema:p,initialValues:N,onSubmit:async(e,t)=>{var n,s;const l={stockUnitID:null===a||void 0===a?void 0:a.stock_unit_id,unitName:e.unitName,remark:e.remark,status:null!==(n=e.status)&&void 0!==n&&n.id?null===(s=e.status)||void 0===s?void 0:s.id:""};console.log("finalPayload",l),t.setSubmitting(!0),await f((0,h.iW9)(l)),y(),_()},children:e=>{let{errors:t,handleSubmit:a,handleChange:n,handleBlur:d,setFieldValue:m,isSubmitting:c,isValid:v,touched:h,values:k}=e;return(0,x.jsx)(o.lV,{onSubmit:a,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)(u.A,{fullWidth:!0,label:"Unit Name*",name:"unitName",onBlur:d,value:k.unitName,onChange:(e,t)=>{m("unitName",t),g({...N,unitName:e.target.value})},variant:"outlined",size:"small",helperText:h.unitName&&t.unitName,error:h.unitName&&Boolean(t.unitName)})}),(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(u.A,{fullWidth:!0,label:"Remark*",name:"remark",onBlur:d,value:k.remark,onChange:(e,t)=>{m("remark",t),g({...N,remark:e.target.value})},variant:"outlined",size:"small",helperText:h.remark&&t.remark,error:h.remark&&Boolean(t.remark)})}),(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(i.A,{name:"status",value:k.status,fullWidth:!0,options:j||[],onBlur:d,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,t)=>{m("status",t),g({...N,status:t})},renderInput:e=>(0,x.jsx)(u.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)(s.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:c,children:"SAVE"})})})]})})}})})]})}},10155:(e,t,a)=>{var n=a(24994);t.A=void 0;var s=n(a(40039)),l=a(70579);t.A=(0,s.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,a)=>{var n=a(24994);t.A=void 0;var s=n(a(40039)),l=a(70579);t.A=(0,s.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=94543.77246b4b.chunk.js.map