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