"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[4377],{24659:(e,t,a)=>{a.d(t,{A:()=>c});a(65043);var i=a(67784),r=a(4701),n=a(17392),l=a(10155),s=a(70579);const o=(0,r.A)({}),d=e=>{let{onClick:t}=e;return(0,s.jsx)(n.A,{onClick:t,children:(0,s.jsx)(l.A,{})})},c=e=>{const t=o();return(0,s.jsx)(i.A,{InputProps:{...t,endAdornment:(0,s.jsxs)(s.Fragment,{children:[" ",e.iscross&&(0,s.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},4377:(e,t,a)=>{a.r(t),a.d(t,{default:()=>A});var i=a(65043),r=a(11906),n=a(68903),l=a(96446),s=a(24659),o=a(63516),d=a(73033),c=a(14556),u=a(73216),m=a(66675),v=a(11852),g=a(6994),h=(a(32737),a(96801)),p=a(70579);(new Date).toISOString().substring(0,10);const y={categoryName:"",groupID:null},x=d.Ik().shape({categoryName:d.Yj().nullable().required("Enter Category Name")}),j=(0,h.Gq)("enuseloc"),f=j&&Object.keys(j).length>0?j.user_id:null,b=[];const A=function(e){const[t,a]=(0,i.useState)(y),[d,h]=(0,i.useState)([]),j=i.useRef(null),A=((0,c.d4)((e=>e.bd.liaisonProcessPlanFile.data)),(0,c.wA)()),N=(0,u.Zp)(),[k,C]=((0,c.d4)((e=>e.bd.user)),(0,i.useState)([])),[S,P]=((0,c.d4)((e=>e.bd.projectTaskDocumentType)),(0,i.useState)([])),O=(0,c.d4)((e=>{var t;return null===(t=e.bd.getFunctionalityPermissionDetail)||void 0===t?void 0:t.data})),D=(0,i.useRef)("NO"),F=(0,i.useRef)("NO");(0,i.useEffect)((()=>{const e={userID:f,functionalityID:283,functionalityItemIDs:b};return A((0,v.P8M)(e)),()=>{A((0,v.qo7)())}}),[]),(0,i.useEffect)((()=>(O&&283===(null===O||void 0===O?void 0:O.functionalityID)&&(P(O),D.current=null===O||void 0===O?void 0:O.permission_report,F.current=null===O||void 0===O?void 0:O.permission_admin),()=>{P([]),D.current="NO",F.current="NO"})),[O]),(0,c.d4)((e=>e.civil.getCivilProjects)),(0,c.d4)((e=>e.civil.getCivilProjectPlanningStage)),(0,c.d4)((e=>e.bd.apfTaskPanelFilterList)),(0,c.d4)((e=>e.bd.apfTaskPlanQueryList)),(0,c.d4)((e=>e.bd.apfTaskPlanTaskFilterList)),(0,c.d4)((e=>e.bd.apfTaskPlanList)),(0,c.d4)((e=>e.bd.projectOwners)),(0,c.d4)((e=>{var t;return null===(t=e.civil.getCivilWorkOrderProcess)||void 0===t?void 0:t.data})),(0,c.d4)((e=>{var t;return null===(t=e.crm.getCrmSourceGroup)||void 0===t?void 0:t.data})),(0,c.d4)((e=>{var t;return null===(t=e.civil.getCivilWorkOrderCategory)||void 0===t?void 0:t.data})),(0,i.useEffect)((()=>{A((0,g.sKF)({status:"1",sortOrder:"",generalSearch:"",iDisplayStart:1,iDisplayLength:-1}))}),[]);const E=()=>{N(-1)};return(0,p.jsx)(p.Fragment,{children:(0,p.jsxs)("div",{className:"component-list",style:{marginTop:"20px"},children:[(0,p.jsxs)(r.A,{onClick:E,children:[(0,p.jsx)(m.A,{}),"Add Source Category"]}),S&&Object.keys(S).length>0&&283===(null===S||void 0===S?void 0:S.functionalityID)&&("YES"===(null===S||void 0===S?void 0:S.permission_admin)||"YES"===(null===S||void 0===S?void 0:S.AddAPFQuery))?(0,p.jsx)(o.l1,{enableReinitialize:!0,innerRef:j,initialValues:t,validationSchema:x,onSubmit:async(e,t)=>{const a={categoryName:null===e||void 0===e?void 0:e.categoryName};console.log("finalpayload",a),t.setSubmitting(!0),await A((0,g.fRK)(a)),t.resetForm({}),E()},children:e=>{let{errors:i,handleSubmit:d,handleChange:c,handleBlur:u,setFieldValue:m,isSubmitting:v,isValid:g,touched:h,values:x}=e;return(0,p.jsx)(o.lV,{onSubmit:d,children:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"reports-list",children:(0,p.jsx)("div",{className:"component-form",children:(0,p.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,p.jsx)(s.A,{name:"categoryName",fullWidth:!0,id:"categoryName",type:"text",onBlur:u,value:t.categoryName,onChange:(e,i)=>{m("categoryName",i),a({...t,categoryName:e.target.value})},error:h.categoryName&&Boolean(i.categoryName),helperText:h.categoryName&&i.categoryName,size:"small",label:"Category Name *",variant:"outlined"})})})}),(0,p.jsxs)(n.Ay,{className:"d-flex justify-content-center",p:2,children:[(0,p.jsxs)(l.A,{mx:2,children:[" ",(0,p.jsx)(r.A,{text:"CANCEL",variant:"contained",color:"secondary",size:"medium",type:"reset",onClick:()=>{a({...y})},children:"RESET"})]}),(0,p.jsx)(l.A,{children:(0,p.jsx)(r.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:v,children:"Add"})})]})]})})}}):(0,p.jsx)("div",{className:"common-header-label-bold",children:"You don't have permission to access this page!"})]})})}},10155:(e,t,a)=>{var i=a(24994);t.A=void 0;var r=i(a(40039)),n=a(70579);t.A=(0,r.default)((0,n.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,t,a)=>{var i=a(24994);t.A=void 0;var r=i(a(40039)),n=a(70579);t.A=(0,r.default)((0,n.jsx)("path",{d:"M3 18h13v-2H3zm0-5h10v-2H3zm0-7v2h13V6zm18 9.59L17.42 12 21 8.41 19.59 7l-5 5 5 5z"}),"MenuOpen")},32737:()=>{}}]);
//# sourceMappingURL=4377.5a2a5392.chunk.js.map