"use strict";(self.webpackChunkkns_reports=self.webpackChunkkns_reports||[]).push([[75117],{24659:(e,n,a)=>{a.d(n,{A:()=>c});a(65043);var i=a(67784),t=a(4701),s=a(17392),l=a(10155),r=a(70579);const d=(0,t.A)({}),o=e=>{let{onClick:n}=e;return(0,r.jsx)(s.A,{onClick:n,children:(0,r.jsx)(l.A,{})})},c=e=>{const n=d();return(0,r.jsx)(i.A,{InputProps:{...n,endAdornment:(0,r.jsxs)(r.Fragment,{children:[" ",e.iscross&&(0,r.jsx)(o,{onClick:null!==e&&void 0!==e&&e.textclear?e.textclear:""})]})},...e})}},75117:(e,n,a)=>{a.r(n),a.d(n,{default:()=>k});var i=a(65043),t=a(11906),s=a(68903),l=a(96446),r=a(24659),d=a(63516),o=a(73033),c=a(14556),u=a(73216),m=a(66675),v=a(11852),h=a(48376),b=(a(40045),a(96801)),p=a(70579);const x={brandName:""},j=o.Ik().shape({brandName:o.Yj().nullable().required("Enter Brand Name")}),f=(0,b.Gq)("enuseloc"),A=f&&Object.keys(f).length>0?f.user_id:null,N=[];const k=function(e){const[n,a]=(0,i.useState)(x),[o,b]=(0,i.useState)([]),f=i.useRef(null),k=((0,c.d4)((e=>e.bd.liaisonProcessPlanFile.data)),(0,c.wA)()),y=(0,u.Zp)(),[g,S]=((0,c.d4)((e=>e.bd.user)),(0,i.useState)([])),[C,P]=((0,c.d4)((e=>e.bd.projectTaskDocumentType)),(0,i.useState)([])),F=(0,c.d4)((e=>{var n;return null===(n=e.bd.getFunctionalityPermissionDetail)||void 0===n?void 0:n.data})),T=(0,i.useRef)("NO"),z=(0,i.useRef)("NO");(0,i.useEffect)((()=>{const e={userID:A,functionalityID:260,functionalityItemIDs:N};return k((0,v.P8M)(e)),()=>{k((0,v.qo7)())}}),[]),(0,i.useEffect)((()=>(F&&260===(null===F||void 0===F?void 0:F.functionalityID)&&(P(F),T.current=null===F||void 0===F?void 0:F.permission_report,z.current=null===F||void 0===F?void 0:F.permission_admin),()=>{P([]),T.current="NO",z.current="NO"})),[F]),(0,c.d4)((e=>e.civil.getCivilProjects)),(0,c.d4)((e=>e.civil.getCivilProjectPlanningStage)),(0,c.d4)((e=>e.bd.apfTaskPanelFilterList)),(0,c.d4)((e=>e.bd.apfTaskPlanQueryList)),(0,c.d4)((e=>e.bd.apfTaskPlanTaskFilterList)),(0,c.d4)((e=>e.bd.apfTaskPlanList));const E=()=>{y(-1)};return(0,p.jsx)(p.Fragment,{children:(0,p.jsxs)("div",{className:"component-list",style:{marginTop:"20px"},children:[(0,p.jsxs)(t.A,{onClick:E,children:[(0,p.jsx)(m.A,{}),"Add Brand"]}),C&&Object.keys(C).length>0&&260===(null===C||void 0===C?void 0:C.functionalityID)&&("YES"===(null===C||void 0===C?void 0:C.permission_admin)||"YES"===(null===C||void 0===C?void 0:C.AddAPFQuery))?(0,p.jsx)(d.l1,{enableReinitialize:!0,innerRef:f,initialValues:n,validationSchema:j,onSubmit:async(e,n)=>{const a={brandName:null===e||void 0===e?void 0:e.brandName};console.log("finalpayload",a),n.setSubmitting(!0),await k((0,h.J4d)(a)),n.resetForm({}),E()},children:e=>{let{errors:i,handleSubmit:o,handleChange:c,handleBlur:u,setFieldValue:m,isSubmitting:v,isValid:h,touched:b,values:j}=e;return(0,p.jsx)(d.lV,{onSubmit:o,children:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"reports-list",children:(0,p.jsx)("div",{className:"component-form",children:(0,p.jsx)(s.Ay,{item:!0,xs:12,sm:12,md:12,lg:12,p:1,children:(0,p.jsx)(r.A,{name:"brandName",fullWidth:!0,id:"brandName",type:"text",onBlur:u,value:n.brandName,onChange:(e,i)=>{m("brandName",i),a({...n,brandName:e.target.value})},error:b.brandName&&Boolean(i.brandName),helperText:b.brandName&&i.brandName,size:"small",label:"Brand Name *",variant:"outlined"})})})}),(0,p.jsxs)(s.Ay,{className:"d-flex justify-content-center",p:2,children:[(0,p.jsxs)(l.A,{mx:2,children:[" ",(0,p.jsx)(t.A,{text:"CANCEL",variant:"contained",color:"secondary",size:"medium",type:"reset",onClick:()=>{a({...x})},children:"RESET"})]}),(0,p.jsx)(l.A,{children:(0,p.jsx)(t.A,{type:"submit",text:"SAVE",variant:"contained",size:"medium",disabled:v,children:"Add"})})]})]})})}}):(0,p.jsx)("div",{className:"common-header-label-bold",children:"You don't have permission to access this page!"})]})})}},10155:(e,n,a)=>{var i=a(24994);n.A=void 0;var t=i(a(40039)),s=a(70579);n.A=(0,t.default)((0,s.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,n,a)=>{var i=a(24994);n.A=void 0;var t=i(a(40039)),s=a(70579);n.A=(0,t.default)((0,s.jsx)("path",{d:"M3 18h13v-2H3zm0-5h10v-2H3zm0-7v2h13V6zm18 9.59L17.42 12 21 8.41 19.59 7l-5 5 5 5z"}),"MenuOpen")},40045:()=>{}}]);
//# sourceMappingURL=75117.6b69c2e8.chunk.js.map