"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[6428],{24659:(e,s,i)=>{i.d(s,{A:()=>u});i(65043);var n=i(67784),a=i(4701),l=i(17392),r=i(10155),d=i(70579);const t=(0,a.A)({}),o=e=>{let{onClick:s}=e;return(0,d.jsx)(l.A,{onClick:s,children:(0,d.jsx)(r.A,{})})},u=e=>{const s=t();return(0,d.jsx)(n.A,{InputProps:{...s,endAdornment:(0,d.jsxs)(d.Fragment,{children:[" ",e.iscross&&(0,d.jsx)(o,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},6428:(e,s,i)=>{i.r(s),i.d(s,{default:()=>f});var n=i(65043),a=i(68903),l=i(11906),r=i(96446),d=i(63516),t=i(24659),o=i(73216),u=i(66675),c=i(14556),m=i(96801),h=i(73033),p=i(11852),v=i(70579);const y={phaseName:"",displayOrder:""},x=h.Ik().shape({phaseName:h.Yj("Enter Phase Name").required("Phase Name is required"),displayOrder:h.ai("Enter Display Order").required("Display Order is required").positive("Display Order Must be Positive Number")}),j=[],A=(0,m.Gq)("enuseloc"),N=A&&Object.keys(A).length>0?A.user_id:null;const f=function(e){const s=(0,c.wA)(),i=n.useRef(null),[m,h]=(0,n.useState)(y),A=(0,o.Zp)(),f=()=>{A(-1)},[b,O]=(0,n.useState)([]),g=(0,c.d4)((e=>{var s;return null===(s=e.bd.getFunctionalityPermissionDetail)||void 0===s?void 0:s.data})),k=n.useRef("No"),C=n.useRef("No");return(0,n.useEffect)((()=>{const e={userID:N,functionalityID:177,functionalityItemIDs:j};return s((0,p.P8M)(e)),()=>{s((0,p.qo7)())}}),[]),(0,n.useEffect)((()=>(g&&177===(null===g||void 0===g?void 0:g.functionalityID)&&(O(g),k.current=null===g||void 0===g?void 0:g.permission_report,C.current=null===g||void 0===g?void 0:g.permission_admin),()=>{O([]),k.current="NO",C.current="NO"})),[g]),(0,v.jsxs)("div",{className:"component-list",children:[(0,v.jsx)(a.Ay,{container:!0,className:"d-flex justify-content-between align-items-center",py:1,children:(0,v.jsxs)(a.Ay,{item:!0,className:"common-header-label",children:[(0,v.jsx)(l.A,{onClick:f,children:(0,v.jsx)(u.A,{})}),"Add Project Phase"]})}),b&&Object.keys(b).length>0&&177===(null===b||void 0===b?void 0:b.functionalityID)&&("YES"===(null===b||void 0===b?void 0:b.permission_admin)||"YES"===(null===b||void 0===b?void 0:b.AddLegalTask))?(0,v.jsx)(d.l1,{enableReinitialize:!0,innerRef:i,initialValues:m,validationSchema:x,onSubmit:async(e,i)=>{const n={phaseName:null!==e&&void 0!==e&&e.phaseName?null===e||void 0===e?void 0:e.phaseName:"",displayOrder:null!==e&&void 0!==e&&e.displayOrder?null===e||void 0===e?void 0:e.displayOrder:""};console.log("finalPayload",n),i.setSubmitting(!0),await s((0,p.yJQ)(n)),i.resetForm({}),f()},children:e=>{let{errors:s,handleSubmit:i,handleChange:n,setFieldValue:o,handleBlur:u,isSubmitting:c,isValid:m,touched:p,values:x}=e;return(0,v.jsx)(d.lV,{onSubmit:i,children:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(a.Ay,{container:!0,className:"component-form",children:(0,v.jsxs)(a.Ay,{container:!0,children:[(0,v.jsx)(a.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,v.jsx)(t.A,{name:"phaseName",fullWidth:!0,onBlur:u,onChange:n,value:x.phaseName,error:p.phaseName&&Boolean(s.phaseName),helperText:s.phaseName&&s.phaseName,id:"phaseName",size:"small",label:"Phase Name *",variant:"outlined"})}),(0,v.jsx)(a.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,v.jsx)(t.A,{name:"displayOrder",fullWidth:!0,onBlur:u,onChange:n,value:x.displayOrder,error:s.displayOrder&&Boolean(s.displayOrder),helperText:s.displayOrder&&s.displayOrder,type:"number",id:"displayOrder",size:"small",label:"Display Order*",variant:"outlined"})})]})}),(0,v.jsxs)(a.Ay,{className:"d-flex justify-content-end",p:2,children:[(0,v.jsxs)(r.A,{mx:2,children:[" ",(0,v.jsx)(l.A,{text:"CANCEL",size:"medium",type:"reset",variant:"contained",color:"secondary",onClick:()=>{h({...y})},children:"RESET"})]}),(0,v.jsx)(r.A,{children:(0,v.jsx)(l.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:c,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 a=n(i(40039)),l=i(70579);s.A=(0,a.default)((0,l.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 a=n(i(40039)),l=i(70579);s.A=(0,a.default)((0,l.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=6428.36676a28.chunk.js.map