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