"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[94284],{24659:(e,a,n)=>{n.d(a,{A:()=>c});n(65043);var t=n(67784),l=n(4701),s=n(17392),i=n(10155),r=n(70579);const o=(0,l.A)({}),d=e=>{let{onClick:a}=e;return(0,r.jsx)(s.A,{onClick:a,children:(0,r.jsx)(i.A,{})})},c=e=>{const a=o();return(0,r.jsx)(t.A,{InputProps:{...a,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},94284:(e,a,n)=>{n.r(a),n.d(a,{default:()=>D});var t=n(65043),l=n(68903),s=n(11906),i=n(96446),r=n(63516),o=n(24659),d=n(73216),c=n(66675),u=n(14556),m=n(96801),y=n(11852),v=n(8611),h=n(6994),x=n(73033),g=n(70579);(new Date).toISOString().substring(0,10);const j={toDate:"",fromDate:"",description:"",categoryName:"",leadDays:"",projectID:""},p=x.Ik().shape({categoryName:x.Yj().required("Category name is required"),leadDays:x.Yj().required("Lead days is required")}),A=(0,m.Gq)("enuseloc"),f=A&&Object.keys(A).length>0?A.user_id:null,N=[];const D=function(e){const a=(0,u.wA)(),n=(0,d.Zp)(),m=t.useRef(null),[x,A]=(0,t.useState)(j),D=()=>{n(-1)},[b,C]=((0,u.d4)((e=>{var a,n;return null===e||void 0===e||null===(a=e.reports)||void 0===a||null===(n=a.getCrmProjects)||void 0===n?void 0:n.projects})),(0,t.useState)([])),k=(0,u.d4)((e=>{var a;return null===(a=e.bd.getFunctionalityPermissionDetail)||void 0===a?void 0:a.data})),S=(0,t.useRef)("NO"),z=(0,t.useRef)("NO");return(0,t.useEffect)((()=>{const e={userID:f,functionalityID:555,functionalityItemIDs:N};return a((0,y.P8M)(e)),()=>{a((0,y.qo7)())}}),[]),(0,t.useEffect)((()=>(k&&555===(null===k||void 0===k?void 0:k.functionalityID)&&(C(k),S.current=null===k||void 0===k?void 0:k.permission_report,z.current=null===k||void 0===k?void 0:k.permission_admin),()=>{C([]),S.current="NO",z.current="NO"})),[k]),(0,t.useEffect)((()=>{a((0,v.wak)({}))}),[]),(0,g.jsxs)("div",{className:"component-list",children:[(0,g.jsx)(l.Ay,{container:!0,className:"d-flex justify-content-between align-items-center",py:1,children:(0,g.jsxs)(l.Ay,{item:!0,className:"common-header-label",children:[(0,g.jsx)(s.A,{onClick:D,children:(0,g.jsx)(c.A,{})}),"Add Customer Ticket Category"]})}),b&&Object.keys(b).length>0&&555===(null===b||void 0===b?void 0:b.functionalityID)&&"YES"===(null===b||void 0===b?void 0:b.permission_admin)?(0,g.jsx)(r.l1,{enableReinitialize:!0,innerRef:m,initialValues:x,validationSchema:p,onSubmit:async(e,n)=>{const t={categoryName:null!==e&&void 0!==e&&e.categoryName?null===e||void 0===e?void 0:e.categoryName:"",leadDays:null!==e&&void 0!==e&&e.leadDays?null===e||void 0===e?void 0:e.leadDays:""};console.log("finalPayload",t),n.setSubmitting(!0),await a((0,h.maV)(t)),n.resetForm({}),D()},children:e=>{let{errors:a,handleSubmit:n,handleChange:t,setFieldValue:d,handleBlur:c,isSubmitting:u,isValid:m,touched:y,values:v}=e;return(0,g.jsx)(r.lV,{onSubmit:n,children:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(l.Ay,{container:!0,className:"component-form",children:(0,g.jsxs)(l.Ay,{container:!0,children:[(0,g.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,g.jsx)(o.A,{fullWidth:!0,name:"categoryName",onBlur:c,onChange:e=>{const a=e.target.value;d("categoryName",a),A({...x,categoryName:a})},value:v.categoryName,error:y.categoryName&&Boolean(a.categoryName),helperText:y.categoryName&&a.categoryName,id:"categoryName",size:"small",label:"Category Name *",variant:"outlined"})}),(0,g.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,g.jsx)(o.A,{fullWidth:!0,name:"leadDays",onBlur:c,onChange:e=>{const a=e.target.value;d("leadDays",a),A({...x,leadDays:a})},value:v.leadDays,error:y.leadDays&&Boolean(a.leadDays),helperText:y.leadDays&&a.leadDays,id:"leadDays",type:"number",size:"small",label:"Lead Days *",variant:"outlined"})})]})}),(0,g.jsxs)(l.Ay,{className:"d-flex justify-content-end",p:2,children:[(0,g.jsxs)(i.A,{mx:2,children:[" ",(0,g.jsx)(s.A,{text:"CANCEL",variant:"contained",size:"medium",type:"reset",color:"secondary",onClick:()=>{A({...j})},children:"RESET"})]}),(0,g.jsx)(i.A,{children:(0,g.jsx)(s.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:u,children:"SAVE"})})]})]})})}}):(0,g.jsx)("div",{className:"common-header-label-bold",children:"You don't have permission to access this page!"})]})}},10155:(e,a,n)=>{var t=n(24994);a.A=void 0;var l=t(n(40039)),s=n(70579);a.A=(0,l.default)((0,s.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,a,n)=>{var t=n(24994);a.A=void 0;var l=t(n(40039)),s=n(70579);a.A=(0,l.default)((0,s.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=94284.e66fa9c5.chunk.js.map