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