"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[84538],{24659:(e,i,n)=>{n.d(i,{A:()=>d});n(65043);var a=n(67784),l=n(4701),t=n(17392),s=n(10155),o=n(70579);const r=(0,l.A)({}),c=e=>{let{onClick:i}=e;return(0,o.jsx)(t.A,{onClick:i,children:(0,o.jsx)(s.A,{})})},d=e=>{const i=r();return(0,o.jsx)(a.A,{InputProps:{...i,endAdornment:(0,o.jsxs)(o.Fragment,{children:[" ",e.iscross&&(0,o.jsx)(c,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},84538:(e,i,n)=>{n.r(i),n.d(i,{default:()=>S});var a=n(65043),l=n(68903),t=n(11906),s=n(38624),o=n(96446),r=n(63516),c=n(24659),d=n(73216),u=n(66675),m=n(14556),p=n(96801),v=n(11852),h=n(67954),f=n(73033),x=n(70579);const y={specificationName:"",valueType:""},j=f.Ik().shape({specificationName:f.Yj().required("Specification Name is Required"),valueType:f.Ik().nullable().required("Select Value Type Name ")}),A=(0,p.Gq)("enuseloc"),N=A&&Object.keys(A).length>0?A.user_id:null,b=[];const S=function(e){const i=(0,m.wA)(),n=((0,m.d4)((e=>{var i;return null===(i=e.bd.getAssetGroupMaster)||void 0===i?void 0:i.data})),a.useRef(null)),[p,f]=(0,a.useState)(y),[A,S]=(0,a.useState)(""),T=(0,d.Zp)(),g=()=>{T(-1)},[k,C]=(0,a.useState)([]),z=(0,m.d4)((e=>{var i;return null===(i=e.bd.getFunctionalityPermissionDetail)||void 0===i?void 0:i.data})),I=(0,a.useRef)("NO"),E=(0,a.useRef)("NO");return(0,a.useEffect)((()=>{const e={userID:N,functionalityID:430,functionalityItemIDs:b};return i((0,v.P8M)(e)),()=>{i((0,v.qo7)())}}),[]),(0,a.useEffect)((()=>(z&&430===(null===z||void 0===z?void 0:z.functionalityID)&&(C(z),I.current=null===z||void 0===z?void 0:z.permission_report,E.current=null===z||void 0===z?void 0:z.permission_admin),()=>{C([]),I.current="NO",E.current="NO"})),[z]),(0,a.useEffect)((()=>{i((0,v.Xtw)({isActive:"1"}))}),[]),(0,x.jsxs)("div",{className:"component-list",children:[(0,x.jsx)(l.Ay,{container:!0,className:"d-flex justify-content-between align-items-center",py:1,children:(0,x.jsxs)(l.Ay,{item:!0,className:"common-header-label",children:[(0,x.jsx)(t.A,{onClick:g,children:(0,x.jsx)(u.A,{})}),"Add Specification"]})}),k&&Object.keys(k).length>0&&430===(null===k||void 0===k?void 0:k.functionalityID)&&"YES"===(null===k||void 0===k?void 0:k.permission_admin)?(0,x.jsx)(r.l1,{enableReinitialize:!0,innerRef:n,initialValues:p,validationSchema:j,onSubmit:async(e,n)=>{var a,l;const t={specificationName:null!==e&&void 0!==e&&e.specificationName?null===e||void 0===e?void 0:e.specificationName:"",valueType:null!==e&&void 0!==e&&null!==(a=e.valueType)&&void 0!==a&&a.name?null===e||void 0===e||null===(l=e.valueType)||void 0===l?void 0:l.name:""};console.log("finalPayload",t),n.setSubmitting(!0),await i((0,h.ZQ)(t)),n.resetForm({}),g()},children:e=>{let{errors:i,handleSubmit:n,handleChange:a,setFieldValue:d,handleBlur:u,isSubmitting:m,isValid:p,touched:v,values:h}=e;return(0,x.jsx)(r.lV,{onSubmit:n,children:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(l.Ay,{container:!0,children:[(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(c.A,{fullWidth:!0,name:"specificationName",onBlur:u,onChange:a,value:h.specificationName,error:v.specificationName&&Boolean(i.specificationName),helperText:v.specificationName&&i.specificationName,type:"text",id:"specificationName",size:"small",label:"Specification Name*",variant:"outlined"})}),(0,x.jsx)(l.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,x.jsx)(s.A,{name:"valueType",value:h.valueType,fullWidth:!0,options:[{id:1,name:"Standard"},{id:2,name:"NotStandard "}],onBlur:u,size:"small",getOptionLabel:e=>e.name||"",onChange:(e,i)=>{d("valueType",i)},renderInput:e=>(0,x.jsx)(c.A,{...e,fullWidth:!0,label:"Value Type*",name:"valueType",variant:"outlined",helperText:v.valueType&&i.valueType,error:v.valueType&&Boolean(i.valueType)})})})]}),(0,x.jsxs)(l.Ay,{className:"d-flex justify-content-end",p:2,children:[(0,x.jsxs)(o.A,{mx:2,children:[" ",(0,x.jsx)(t.A,{text:"CANCEL",variant:"contained",size:"medium",type:"reset",color:"secondary",onClick:()=>{f({...y})},children:"RESET"})]}),(0,x.jsx)(o.A,{children:(0,x.jsx)(t.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:m,children:"SAVE"})})]})]})})}}):(0,x.jsx)("div",{className:"common-header-label-bold",children:"You don't have permission to access this page!"})]})}},10155:(e,i,n)=>{var a=n(24994);i.A=void 0;var l=a(n(40039)),t=n(70579);i.A=(0,l.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,i,n)=>{var a=n(24994);i.A=void 0;var l=a(n(40039)),t=n(70579);i.A=(0,l.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")}}]);
//# sourceMappingURL=84538.e7dc3dc8.chunk.js.map