"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[12737],{24659:(e,t,n)=>{n.d(t,{A:()=>c});n(65043);var i=n(67784),s=n(4701),l=n(17392),a=n(10155),r=n(70579);const o=(0,s.A)({}),d=e=>{let{onClick:t}=e;return(0,r.jsx)(l.A,{onClick:t,children:(0,r.jsx)(a.A,{})})},c=e=>{const t=o();return(0,r.jsx)(i.A,{InputProps:{...t,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},12737:(e,t,n)=>{n.r(t),n.d(t,{default:()=>f});var i=n(65043),s=n(11906),l=n(68903),a=n(96446),r=n(24659),o=n(63516),d=n(73033),c=n(14556),u=n(73216),m=n(66675),v=n(11852),h=n(10159),g=(n(23356),n(96801)),x=n(70579);(new Date).toISOString().substring(0,10);const S={SettingName:""},j=d.Ik().shape({SettingName:d.Yj().nullable().required("Enter Civil Setting Name")}),p=(0,g.Gq)("enuseloc"),A=p&&Object.keys(p).length>0?p.user_id:null,N=[];const f=function(e){const[t,n]=(0,i.useState)(!1),[d,g]=(0,i.useState)(S),p=i.useRef(null),f=(0,c.wA)(),b=(0,u.Zp)(),[y,k]=(0,i.useState)([]),C=(0,c.d4)((e=>{var t;return null===(t=e.bd.getFunctionalityPermissionDetail)||void 0===t?void 0:t.data})),E=(0,c.d4)((e=>e.civil.getCivilProjectTaskUOM.data));console.log("ProjectTaskUOMList",E);const O=(0,i.useRef)("NO"),z=(0,i.useRef)("NO");return(0,i.useEffect)((()=>{const e={userID:A,functionalityID:318,functionalityItemIDs:N};return f((0,v.P8M)(e)),()=>{f((0,v.qo7)())}}),[]),(0,i.useEffect)((()=>(C&&318===(null===C||void 0===C?void 0:C.functionalityID)&&(k(C),O.current=null===C||void 0===C?void 0:C.permission_report,z.current=null===C||void 0===C?void 0:C.permission_admin),()=>{k([]),O.current="NO",z.current="NO"})),[C]),(0,x.jsx)(x.Fragment,{children:(0,x.jsxs)("div",{className:"component-list",style:{marginTop:"20px"},children:[(0,x.jsxs)(s.A,{onClick:()=>{b(-1)},children:[(0,x.jsx)(m.A,{})," Add Civil Setting"]}),y&&Object.keys(y).length>0&&318===(null===y||void 0===y?void 0:y.functionalityID)&&("YES"===(null===y||void 0===y?void 0:y.permission_admin)||"YES"===(null===y||void 0===y?void 0:y.AddAPFQuery))?(0,x.jsx)(o.l1,{enableReinitialize:!0,innerRef:p,initialValues:d,validationSchema:j,onSubmit:async(e,i)=>{const s={settingName:null!==e&&void 0!==e&&e.SettingName?null===e||void 0===e?void 0:e.SettingName:""};console.log("finalpayload",s),i.setSubmitting(!0),await f((0,h.TEG)(s)),i.resetForm({}),n(!0!==t),g({...d,SettingName:""}),b(-1)},children:e=>{let{errors:t,handleSubmit:n,handleChange:i,handleBlur:d,setFieldValue:c,isSubmitting:u,isValid:m,touched:v,values:h}=e;return(0,x.jsx)(o.lV,{onSubmit:n,children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)("div",{className:"reports-list",children:(0,x.jsx)("div",{className:"component-form",children:(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(r.A,{name:"SettingName",fullWidth:!0,onBlur:d,onChange:i,value:h.SettingName,error:t.SettingName&&Boolean(t.SettingName),helperText:t.SettingName&&t.SettingName,id:"SettingName",size:"small",label:"Setting Name*",variant:"outlined"})})})}),(0,x.jsxs)(l.Ay,{className:"d-flex justify-content-end",p:2,children:[(0,x.jsxs)(a.A,{mx:2,children:[" ",(0,x.jsx)(s.A,{text:"CANCEL",variant:"contained",color:"secondary",size:"medium",type:"reset",onClick:()=>{g({...S})},children:"RESET"})]}),(0,x.jsx)(a.A,{children:(0,x.jsx)(s.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:u,children:"Submit"})})]})]})})}}):(0,x.jsx)("div",{className:"common-header-label-bold",children:"You don't have permission to access this page!"})]})})}},10155:(e,t,n)=>{var i=n(24994);t.A=void 0;var s=i(n(40039)),l=n(70579);t.A=(0,s.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,t,n)=>{var i=n(24994);t.A=void 0;var s=i(n(40039)),l=n(70579);t.A=(0,s.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")},23356:()=>{}}]);
//# sourceMappingURL=12737.1a3f752b.chunk.js.map