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