"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[10972],{24659:(e,t,n)=>{n.d(t,{A:()=>d});n(65043);var l=n(67784),s=n(4701),a=n(17392),i=n(10155),o=n(70579);const u=(0,s.A)({}),r=e=>{let{onClick:t}=e;return(0,o.jsx)(a.A,{onClick:t,children:(0,o.jsx)(i.A,{})})},d=e=>{const t=u();return(0,o.jsx)(l.A,{InputProps:{...t,endAdornment:(0,o.jsxs)(o.Fragment,{children:[" ",e.iscross&&(0,o.jsx)(r,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},10972:(e,t,n)=>{n.r(t),n.d(t,{default:()=>S});var l=n(65043),s=n(11906),a=n(68903),i=n(38624),o=n(96446),u=n(24659),r=n(63516),d=n(14556),c=n(73033),p=n(73216),v=n(66675),h=(n(10159),n(96801)),m=n(80884),x=n(74919),A=n.n(x),j=n(70579);const V=(0,h.Gq)("enuseloc"),g=V&&Object.keys(V).length>0?V.user_id:null;console.log("LoginuserId",g);const f={optionValue:"",status:null},b=c.Ik().shape({optionValue:c.Yj().nullable().required("Enter Option Value"),status:c.Ik().nullable().required("Select Status")});const S=function(e){const t=(0,p.zy)(),n=(null===t||void 0===t?void 0:t.state)._original;console.log("optionData",n);const[c,h]=(0,l.useState)(!1),x=[{id:"Active",name:"Active"},{id:"InActive",name:"In Active"}],V=((0,d.d4)((e=>{var t;return null===(t=e.hr.getAppraisalQuestion)||void 0===t?void 0:t.data})),l.useRef(null)),[g,S]=(0,l.useState)(f),y=(0,d.wA)(),k=(0,p.Zp)(),I=()=>{k(-1)},[z,C]=(0,l.useState)((()=>A().createEmptyValue()));(0,l.useEffect)((()=>{y((0,m.xWs)({processID:"",authorityID:"",status:"",departmentID:"",designationID:"",sortOrder:"",generalSearch:"",iDisplayStart:0,iDisplayLength:-1}))}),[]),(0,l.useEffect)((()=>{n&&S({optionValue:null===n||void 0===n?void 0:n.option_value,status:{id:null===n||void 0===n?void 0:n.status,name:null===n||void 0===n?void 0:n.status}})}),[n]);const D=()=>{const{optionValue:e,status:t,...n}=f;S({...g,...n})};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{className:"common-header-label-bold",children:[(0,j.jsx)(s.A,{onClick:I,children:(0,j.jsx)(v.A,{})}),"Update Question Option Value"]}),(0,j.jsx)("div",{className:"component-list",children:(0,j.jsx)(r.l1,{enableReinitialize:!0,innerRef:V,validationSchema:b,initialValues:g,onSubmit:async(e,t)=>{var l,s;const a={optionID:null===n||void 0===n?void 0:n.id,optionValue:null===e||void 0===e?void 0:e.optionValue,status:null!==(l=e.status)&&void 0!==l&&l.id?null===(s=e.status)||void 0===s?void 0:s.id:""};console.log("finalPayload",a),t.setSubmitting(!0),await y((0,m._fg)(a)),D(),I()},children:e=>{let{errors:t,handleSubmit:n,handleChange:l,handleBlur:d,setFieldValue:c,isSubmitting:p,isValid:v,touched:h,values:m}=e;return(0,j.jsx)(r.lV,{onSubmit:n,children:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a.Ay,{container:!0,className:"component-form",children:(0,j.jsxs)(a.Ay,{container:!0,children:[(0,j.jsx)(a.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,j.jsx)(u.A,{name:"optionValue",fullWidth:!0,id:"optionValue",onBlur:d,value:g.optionValue,onChange:(e,t)=>{c("optionValue",t),S({...g,optionValue:e.target.value})},error:h.optionValue&&Boolean(t.optionValue),helperText:h.optionValue&&t.optionValue,size:"small",label:"Option Value",variant:"outlined"})}),(0,j.jsx)(a.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,j.jsx)(i.A,{name:"status",value:m.status,fullWidth:!0,options:x||[],onBlur:d,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,t)=>{c("status",t),S({...g,status:t})},renderInput:e=>(0,j.jsx)(u.A,{...e,fullWidth:!0,label:"Status *",name:"status",variant:"outlined",helperText:t.status&&t.status,error:t.status&&Boolean(t.status)})})})]})}),(0,j.jsx)(a.Ay,{className:"d-flex justify-content-center",p:2,children:(0,j.jsx)(o.A,{children:(0,j.jsx)(s.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:p,children:"SAVE"})})})]})})}})})]})}},10155:(e,t,n)=>{var l=n(24994);t.A=void 0;var s=l(n(40039)),a=n(70579);t.A=(0,s.default)((0,a.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,n)=>{var l=n(24994);t.A=void 0;var s=l(n(40039)),a=n(70579);t.A=(0,s.default)((0,a.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=10972.4acfea8c.chunk.js.map