"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[79669],{24659:(e,n,t)=>{t.d(n,{A:()=>u});t(65043);var i=t(67784),r=t(4701),l=t(17392),a=t(10155),s=t(70579);const o=(0,r.A)({}),d=e=>{let{onClick:n}=e;return(0,s.jsx)(l.A,{onClick:n,children:(0,s.jsx)(a.A,{})})},u=e=>{const n=o();return(0,s.jsx)(i.A,{InputProps:{...n,endAdornment:(0,s.jsxs)(s.Fragment,{children:[" ",e.iscross&&(0,s.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},79669:(e,n,t)=>{t.r(n),t.d(n,{default:()=>y});var i=t(65043),r=t(11906),l=t(68903),a=t(96446),s=t(24659),o=t(63516),d=t(73033),u=t(14556),m=t(73216),c=t(66675),v=t(11852),h=t(10159),x=(t(89543),t(96801)),p=t(70579);const j={unitName:"",remark:""},k=d.Ik().shape({unitName:d.Yj().nullable().required("Enter Stock Name"),remark:d.Yj().nullable().required("Enter Remarks")}),A=(0,x.Gq)("enuseloc"),N=A&&Object.keys(A).length>0?A.user_id:null,f=[];const y=function(e){const[n,t]=(0,i.useState)(j),d=i.useRef(null),x=(0,u.wA)(),A=(0,m.Zp)(),[y,b]=(0,i.useState)([]),g=(0,u.d4)((e=>{var n;return null===(n=e.bd.getFunctionalityPermissionDetail)||void 0===n?void 0:n.data})),S=(0,i.useRef)("NO"),C=(0,i.useRef)("NO");(0,i.useEffect)((()=>{const e={userID:N,functionalityID:246,functionalityItemIDs:f};return x((0,v.P8M)(e)),()=>{x((0,v.qo7)())}}),[]),(0,i.useEffect)((()=>(g&&246===(null===g||void 0===g?void 0:g.functionalityID)&&(b(g),S.current=null===g||void 0===g?void 0:g.permission_report,C.current=null===g||void 0===g?void 0:g.permission_admin),()=>{b([]),S.current="NO",C.current="NO"})),[g]);const z=()=>{A(-1)};return(0,p.jsx)(p.Fragment,{children:(0,p.jsxs)("div",{className:"component-list",style:{marginTop:"20px"},children:[(0,p.jsxs)(r.A,{onClick:z,children:[(0,p.jsx)(c.A,{}),"Add Stock UOM"]}),y&&Object.keys(y).length>0&&246===(null===y||void 0===y?void 0:y.functionalityID)&&("YES"===(null===y||void 0===y?void 0:y.permission_admin)||"YES"===(null===y||void 0===y?void 0:y.AddAPFQuery))?(0,p.jsx)(o.l1,{enableReinitialize:!0,innerRef:d,initialValues:n,validationSchema:k,onSubmit:async(e,n)=>{const t={unitName:null===e||void 0===e?void 0:e.unitName,remark:null===e||void 0===e?void 0:e.remark};console.log("finalpayload",t),n.setSubmitting(!0),await x((0,h.d$N)(t)),n.resetForm({}),z()},children:e=>{let{errors:i,handleSubmit:d,handleChange:u,handleBlur:m,setFieldValue:c,isSubmitting:v,isValid:h,touched:x,values:k}=e;return(0,p.jsx)(o.lV,{onSubmit:d,children:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"reports-list",children:(0,p.jsxs)("div",{className:"component-form",children:[(0,p.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,p.jsx)(s.A,{name:"unitName ",fullWidth:!0,id:"unitName ",type:"text",onBlur:m,value:n.unitName,onChange:(e,i)=>{c("unitName ",i),t({...n,unitName:e.target.value})},error:x.unitName&&Boolean(i.unitName),helperText:x.unitName&&i.unitName,size:"small",label:"Unit Name *",variant:"outlined"})}),(0,p.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,p.jsx)(s.A,{name:"remark ",fullWidth:!0,id:"remark ",type:"text",onBlur:m,value:n.remark,onChange:(e,i)=>{c("remark ",i),t({...n,remark:e.target.value})},error:x.remark&&Boolean(i.remark),helperText:x.remark&&i.remark,size:"small",label:"Remarks *",variant:"outlined"})})]})}),(0,p.jsxs)(l.Ay,{className:"d-flex justify-content-center",p:2,children:[(0,p.jsxs)(a.A,{mx:2,children:[" ",(0,p.jsx)(r.A,{text:"CANCEL",variant:"contained",color:"secondary",size:"medium",type:"reset",onClick:()=>{t({...j})},children:"RESET"})]}),(0,p.jsx)(a.A,{children:(0,p.jsx)(r.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:v,children:"Add"})})]})]})})}}):(0,p.jsx)("div",{className:"common-header-label-bold",children:"You don't have permission to access this page!"})]})})}},10155:(e,n,t)=>{var i=t(24994);n.A=void 0;var r=i(t(40039)),l=t(70579);n.A=(0,r.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,n,t)=>{var i=t(24994);n.A=void 0;var r=i(t(40039)),l=t(70579);n.A=(0,r.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")},89543:()=>{}}]);
//# sourceMappingURL=79669.94555267.chunk.js.map