"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[25248],{24659:(e,s,a)=>{a.d(s,{A:()=>u});a(65043);var l=a(67784),i=a(4701),t=a(17392),r=a(10155),n=a(70579);const d=(0,i.A)({}),o=e=>{let{onClick:s}=e;return(0,n.jsx)(t.A,{onClick:s,children:(0,n.jsx)(r.A,{})})},u=e=>{const s=d();return(0,n.jsx)(l.A,{InputProps:{...s,endAdornment:(0,n.jsxs)(n.Fragment,{children:[" ",e.iscross&&(0,n.jsx)(o,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},25248:(e,s,a)=>{a.r(s),a.d(s,{default:()=>j});var l=a(65043),i=a(68903),t=a(11906),r=a(38624),n=a(96446),d=a(24659),o=a(63516),u=a(73033),p=a(14556),m=a(73216),h=a(66675),c=(a(37785),a(11852)),v=a(70579);const x={phaseName:"",displayOrder:"",status:""},y=u.Ik().shape({phaseName:u.Yj("Enter Phase Name").required("Phase Name is required"),displayOrder:u.ai("Enter Display Order").required("Display Order is required").positive("Display Order Must be Positive Number"),status:u.Ik().nullable().required("Select status")}),A={per_page:10,page_index:0,order_by:"ticket_number",sort_by:"asc"};const j=function(e){const[s,a]=(0,l.useState)(x),[u,j]=(0,l.useState)(A),b=(0,p.wA)(),N=l.useRef(null),f=(0,m.zy)(),O=null===f||void 0===f?void 0:f.state,g=null===O||void 0===O?void 0:O._original,k=(0,m.Zp)(),S=()=>{k(-1)};return(0,l.useEffect)((()=>{g&&a({phaseName:null===g||void 0===g?void 0:g.phase_name,displayOrder:null===g||void 0===g?void 0:g.display_order,status:{id:null===g||void 0===g?void 0:g.status,name:null===g||void 0===g?void 0:g.status}})}),[g]),console.log("phaseIDInfoData",g),(0,v.jsx)(v.Fragment,{children:(0,v.jsx)("div",{className:"component-list",children:(0,v.jsx)(o.l1,{enableReinitialize:!0,innerRef:N,validationSchema:y,initialValues:s,onSubmit:async(e,s)=>{var a;const l={phaseID:g.id,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:"",status:null===(a=e.status)||void 0===a?void 0:a.id};console.log("finalPayload",l),s.setSubmitting(!0),await b((0,c.B2l)(l)),s.resetForm({}),S()},children:e=>{let{errors:l,handleSubmit:u,handleChange:p,setFieldValue:m,handleBlur:c,isSubmitting:x,isValid:y,touched:A,values:j}=e;return(0,v.jsx)(o.lV,{onSubmit:u,children:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(i.Ay,{container:!0,className:"component-form",children:[(0,v.jsxs)(t.A,{onClick:S,children:[" ",(0,v.jsx)(h.A,{}),"Update Project Phase"]}),(0,v.jsxs)(i.Ay,{container:!0,children:[(0,v.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,v.jsx)(d.A,{name:"phaseName",fullWidth:!0,onBlur:c,onChange:p,value:j.phaseName,error:A.phaseName&&Boolean(l.phaseName),helperText:l.phaseName&&l.phaseName,id:"phaseName",size:"small",label:"Phase Name *",variant:"outlined"})}),(0,v.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,v.jsx)(d.A,{name:"displayOrder",fullWidth:!0,onBlur:c,onChange:p,value:j.displayOrder,error:l.displayOrder&&Boolean(l.displayOrder),helperText:l.displayOrder&&l.displayOrder,type:"number",id:"displayOrder",size:"small",label:"Display Order*",variant:"outlined"})}),(0,v.jsx)(i.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,v.jsx)(r.A,{name:"status",value:j.status,fullWidth:!0,options:[{id:"Active",name:"Active"},{id:"InActive",name:"In Active"}],onBlur:c,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,l)=>{m("status",l),a({...s,status:l})},renderInput:e=>(0,v.jsx)(d.A,{...e,fullWidth:!0,label:"Status *",name:"status",variant:"outlined",helperText:l.status&&l.status,error:l.status&&Boolean(l.status)})})})]})]}),(0,v.jsx)(i.Ay,{className:"d-flex justify-content-center",p:2,children:(0,v.jsx)(n.A,{children:(0,v.jsx)(t.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:x,children:"SAVE"})})})]})})}})})})}},10155:(e,s,a)=>{var l=a(24994);s.A=void 0;var i=l(a(40039)),t=a(70579);s.A=(0,i.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,a)=>{var l=a(24994);s.A=void 0;var i=l(a(40039)),t=a(70579);s.A=(0,i.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")},37785:()=>{}}]);
//# sourceMappingURL=25248.3bdb3dd4.chunk.js.map