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