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