"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[22966],{24659:(e,i,a)=>{a.d(i,{A:()=>c});a(65043);var n=a(67784),t=a(4701),l=a(17392),s=a(10155),r=a(70579);const o=(0,t.A)({}),d=e=>{let{onClick:i}=e;return(0,r.jsx)(l.A,{onClick:i,children:(0,r.jsx)(s.A,{})})},c=e=>{const i=o();return(0,r.jsx)(n.A,{InputProps:{...i,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(d,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},22966:(e,i,a)=>{a.r(i),a.d(i,{default:()=>N});var n=a(65043),t=a(68903),l=a(11906),s=a(96446),r=a(63516),o=a(24659),d=a(73216),c=a(66675),m=a(11852),u=a(14556),v=a(96801),h=a(73033),y=a(70579);const x=(0,v.Gq)("enuseloc"),g=x&&Object.keys(x).length>0?x.user_id:null,j={categoryName:"",leadTime:""},p=h.Ik().shape({categoryName:h.Yj("Enter the Category Name").required("Category Name is required"),leadTime:h.ai("Enter Lead Time").required("Lead Time is required").positive("Time must be Positive Number")}),A=[];const N=function(e){const i=n.useRef(null),[a,v]=(0,n.useState)(j),h=(0,d.Zp)(),x=(0,u.wA)(),[N,f]=(0,n.useState)([]),b=(0,u.d4)((e=>{var i;return null===(i=e.bd.getFunctionalityPermissionDetail)||void 0===i?void 0:i.data})),T=n.useRef("No"),C=n.useRef("No");return(0,n.useEffect)((()=>{const e={userID:g,functionalityID:107,functionalityItemIDs:A};return x((0,m.P8M)(e)),()=>{x((0,m.qo7)())}}),[]),(0,n.useEffect)((()=>(b&&107===(null===b||void 0===b?void 0:b.functionalityID)&&(f(b),T.current=null===b||void 0===b?void 0:b.permission_report,C.current=null===b||void 0===b?void 0:b.permission_admin),()=>{f([]),T.current="NO",C.current="NO"})),[b]),(0,y.jsxs)("div",{className:"component-list",children:[(0,y.jsx)(t.Ay,{container:!0,className:"d-flex justify-content-between align-items-center",py:1,children:(0,y.jsxs)(t.Ay,{item:!0,className:"common-header-label",children:[(0,y.jsx)(l.A,{onClick:()=>{h(-1)},children:(0,y.jsx)(c.A,{})}),"Add Documentation Category"]})}),N&&Object.keys(N).length>0&&107===(null===N||void 0===N?void 0:N.functionalityID)&&("YES"===(null===N||void 0===N?void 0:N.permission_admin)||"YES"===(null===N||void 0===N?void 0:N.AddLegalTask))?(0,y.jsx)(r.l1,{enableReinitialize:!0,innerRef:i,initialValues:a,validationSchema:p,onSubmit:async(e,i)=>{console.log(e,"values");const a={taskCategoryName:null!==e&&void 0!==e&&e.categoryName?null===e||void 0===e?void 0:e.categoryName:"",taskLeadTime:null!==e&&void 0!==e&&e.leadTime?null===e||void 0===e?void 0:e.leadTime:""};console.log("finalpayload:: ",a),i.setSubmitting(!0),await x((0,m.Qow)(a)),i.resetForm({}),h("/bd-masters/LiaisonTaskCategory")},children:e=>{let{errors:i,handleSubmit:a,handleChange:n,setFieldvalue:d,handleBlur:c,isSubmitting:m,isValid:u,touched:h,values:x}=e;return(0,y.jsx)(r.lV,{onSubmit:a,children:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(t.Ay,{container:!0,className:"component-form",children:(0,y.jsxs)(t.Ay,{container:!0,children:[(0,y.jsxs)(t.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:[" ",(0,y.jsx)(o.A,{fullWidth:!0,name:"categoryName",onBlur:c,onChange:n,value:x.categoryName,error:i.categoryName&&Boolean(i.categoryName),helperText:i.categoryName&&i.categoryName,id:"categoryName",size:"small",label:"Category Name*",variant:"outlined"})]}),(0,y.jsx)(t.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,y.jsx)(o.A,{fullWidth:!0,name:"leadTime",onBlur:c,onChange:n,value:x.leadTime,error:i.leadTime&&Boolean(i.leadTime),helperText:i.leadTime&&i.leadTime,type:"number",id:"categoryOrder",size:"small",label:"Lead Time*",variant:"outlined"})})]})}),(0,y.jsxs)(t.Ay,{className:"d-flex justify-content-end",p:2,children:[(0,y.jsxs)(s.A,{mx:2,children:[" ",(0,y.jsx)(l.A,{text:"CANCEL",variant:"contained",color:"secondary",size:"medium",type:"reset",onClick:()=>{v(j)},children:"RESET"})]}),(0,y.jsx)(s.A,{children:(0,y.jsx)(l.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:m,children:"SAVE"})})]})]})})}}):(0,y.jsx)("div",{className:"common-header-label-bold",children:"You don't have permission to access this page!"})]})}},10155:(e,i,a)=>{var n=a(24994);i.A=void 0;var t=n(a(40039)),l=a(70579);i.A=(0,t.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,i,a)=>{var n=a(24994);i.A=void 0;var t=n(a(40039)),l=a(70579);i.A=(0,t.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")}}]);
//# sourceMappingURL=22966.0dbed9bf.chunk.js.map