"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[42316],{24659:(e,a,l)=>{l.d(a,{A:()=>u});l(65043);var t=l(67784),i=l(4701),n=l(17392),s=l(10155),o=l(70579);const d=(0,i.A)({}),r=e=>{let{onClick:a}=e;return(0,o.jsx)(n.A,{onClick:a,children:(0,o.jsx)(s.A,{})})},u=e=>{const a=d();return(0,o.jsx)(t.A,{InputProps:{...a,endAdornment:(0,o.jsxs)(o.Fragment,{children:[" ",e.iscross&&(0,o.jsx)(r,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},42316:(e,a,l)=>{l.r(a),l.d(a,{default:()=>g});var t=l(65043),i=l(11906),n=l(68903),s=l(38624),o=l(96446),d=l(24659),r=l(63516),u=l(14556),h=l(73033),c=l(73216),m=l(66675),y=l(80884),v=l(96801),x=(l(17115),l(70579));const D=(0,v.Gq)("enuseloc"),p=D&&Object.keys(D).length>0?D.user_id:null;console.log("LoginuserId",p);const j={holidayName:"",holidayDate:"",statusID:""},A=h.Ik().shape({holidayName:h.Yj("Enter Holiday Name").required("Holiday Name is required"),statusID:h.Ik().nullable().required("Select Status"),holidayDate:h.p6("Enter Holiday Date").nullable().required("Enter Valid Date ").test("valid-year","Invalid Year",(e=>{if(!e)return!0;const a=new Date(e).getFullYear();return a>=2e3&&a<=(new Date).getFullYear()}))});const g=function(e){const a=(0,c.zy)(),l=null===a||void 0===a?void 0:a.state,h=null===l||void 0===l?void 0:l._original;console.log("milestoneTypeData",h);const[v,D]=(0,t.useState)(!1),p=[{id:"1",name:"Active"},{id:"0",name:"In Active"}],g=t.useRef(null),[I,b]=(0,t.useState)(j),N=(0,u.wA)(),f=(0,c.Zp)();(0,t.useEffect)((()=>{h&&b({...I,holidayName:null===h||void 0===h?void 0:h.hr_holiday_name,holidayDate:null===h||void 0===h?void 0:h.hr_holiday_date,statusID:{id:null===h||void 0===h?void 0:h.hr_holiday_status,name:1==(null===h||void 0===h?void 0:h.hr_holiday_status)?"Active":"InActive"}})}),[h]),console.log("milestoneTypeData",h);const k=()=>{const{holidayName:e,...a}=j;b({...I,...a})};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("div",{className:"common-header-label-bold",children:[(0,x.jsx)(i.A,{onClick:()=>{f(-1)},children:(0,x.jsx)(m.A,{})}),"Update Public Holiday "]}),(0,x.jsx)("div",{className:"component-list",children:(0,x.jsx)(r.l1,{enableReinitialize:!0,innerRef:g,validationSchema:A,initialValues:I,onSubmit:async(e,a)=>{var l,t;const i={holidayID:null===h||void 0===h?void 0:h.hr_holiday_id,holidayName:e.holidayName,holidayDate:e.holidayDate,status:null!==(l=e.statusID)&&void 0!==l&&l.id?null===(t=e.statusID)||void 0===t?void 0:t.id:""};console.log("finalPayload",i),a.setSubmitting(!0),await N((0,y.eTf)(i)),k(),f("/HR/PublicHoliday")},children:e=>{let{errors:a,handleSubmit:l,handleChange:t,handleBlur:u,setFieldValue:h,isSubmitting:c,isValid:m,touched:y,values:v}=e;return(0,x.jsx)(r.lV,{onSubmit:l,children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(n.Ay,{container:!0,className:"component-form",children:(0,x.jsxs)(n.Ay,{container:!0,children:[(0,x.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(d.A,{fullWidth:!0,label:"Holiday Name*",name:"holidayName",onBlur:u,value:v.holidayName,onChange:(e,a)=>{h("holidayName",a),b({...I,holidayName:e.target.value})},variant:"outlined",size:"small",helperText:y.holidayName&&a.holidayName,error:y.holidayName&&Boolean(a.holidayName)})}),(0,x.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(d.A,{fullWidth:!0,label:"Holiday Date*",name:"holidayDate",onBlur:u,InputLabelProps:{shrink:!0},value:v.holidayDate,onChange:(e,a)=>{h("holidayDate",a),b({...I,holidayDate:e.target.value})},variant:"outlined",size:"small",type:"date",helperText:y.holidayDate&&a.holidayDate,error:y.holidayDate&&Boolean(a.holidayDate)})}),(0,x.jsx)(n.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(s.A,{name:"statusID",value:v.statusID,fullWidth:!0,options:p||[],onBlur:u,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,a)=>{h("statusID",a),b({...I,statusID:a})},renderInput:e=>(0,x.jsx)(d.A,{...e,fullWidth:!0,label:"Status *",name:"statusID",variant:"outlined",helperText:a.statusID&&a.statusID,error:a.statusID&&Boolean(a.statusID)})})})]})}),(0,x.jsx)(n.Ay,{className:"d-flex justify-content-center",p:2,children:(0,x.jsx)(o.A,{children:(0,x.jsx)(i.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:c,children:"SAVE"})})})]})})}})})]})}},10155:(e,a,l)=>{var t=l(24994);a.A=void 0;var i=t(l(40039)),n=l(70579);a.A=(0,i.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")}}]);
//# sourceMappingURL=42316.7cae8702.chunk.js.map