Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.145.92.96
"use strict";(self.webpackChunkcollege_portal_app=self.webpackChunkcollege_portal_app||[]).push([[387],{18286:(e,s,t)=>{t.d(s,{A:()=>o});t(65043);var n=t(40164),u=t(91686),r=t(70579);const a=()=>(0,r.jsx)(u.A,{indicator:(0,r.jsx)(n.A,{style:{fontSize:30,color:"white"},spin:!0})}),o=e=>{let{text:s,onClick:t,isLoading:n}=e;return(0,r.jsx)("div",{children:n?(0,r.jsx)("div",{className:"button",style:{paddingTop:10},children:(0,r.jsx)(a,{})}):(0,r.jsx)("div",{children:(0,r.jsx)("input",{type:"submit",className:"button",value:s,onClick:t})})})}},39387:(e,s,t)=>{t.r(s),t.d(s,{default:()=>E});var n=t(65043),u=t(53722),r=t(18286),a=t(83003),o=t(73216),l=t(6051),c=t(37490),d=t(82245),i=t(48677),m=t(70579);const p=e=>{let{submenus:s,dropdown:t,depthLevel:n}=e;n+=1;const u=n>1?"dropdown-submenu":"";return(0,m.jsx)("ul",{className:"dropdown ".concat(u," ").concat(t?"show":""),children:s.map(((e,s)=>(0,m.jsx)(v,{items:e,depthLevel:n},s)))})};var h=t(95893),x=t(59266),j=t(35475);const v=e=>{let{items:s,depthLevel:t}=e;const[u,r]=(0,n.useState)(!1);let a=(0,n.useRef)();(0,n.useEffect)((()=>{const e=e=>{u&&a.current&&!a.current.contains(e.target)&&r(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[u]);return(0,m.jsx)("li",{className:"menu-items",ref:a,onMouseEnter:()=>{r(!0)},onMouseLeave:()=>{r(!1)},onClick:()=>{u&&r(!1)},children:s.url&&s.submenu?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("button",{type:"button","aria-haspopup":"menu","aria-expanded":u?"true":"false",onClick:()=>{r((e=>!e))},children:[(0,m.jsx)(j.k2,{children:s.title}),t>0?(0,m.jsx)(h.A,{}):(0,m.jsx)(x.A,{})]}),(0,m.jsx)(p,{depthLevel:t,submenus:s.submenu,dropdown:u})]}):!s.url&&s.submenu?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("button",{type:"button","aria-haspopup":"menu","aria-expanded":u?"true":"false",children:[s.title,t>0?(0,m.jsx)(h.A,{}):(0,m.jsx)(x.A,{})]}),(0,m.jsx)(p,{depthLevel:t,submenus:s.submenu,dropdown:u})]}):(0,m.jsx)(j.k2,{to:s.url,children:s.title})})};var b=t(86213),w=t(150),f=t(15355);const y=async(e,s)=>{try{await(0,b.A)({method:"GET",url:w.A+"getCmenus&usertype="+s}).then((s=>{if(0===s.data.error_code){let t=[];s.data.data.menu.map(((e,s)=>{let n={};n.title=e.title,n.url=e.url,e.submenu.length>0&&(n.submenu=e.submenu,e.submenu.map(((e,s)=>{0===e.submenu.length&&delete e.submenu}))),t.push(n)})),e({type:"MENUS",payload:t})}else e({type:"CLEAR_MENUS",payload:[]})}))}catch(t){(0,f.F)(t)}},L=()=>{const e=(0,a.wA)(),s=(0,a.d4)((e=>e.AuthReducer)),t=(0,a.d4)((e=>e.MenuReducer.menus));(0,n.useEffect)((()=>{u()}),[]);const u=async()=>{await y(e,s.userData.fusertype)};return(0,m.jsx)("nav",{className:"desktop-nav",children:(0,m.jsx)("ul",{className:"menus",children:t.map(((e,s)=>(0,m.jsx)(v,{items:e,depthLevel:0},s)))})})},g=e=>{let{submenus:s,dropdown:t,depthLevel:n}=e;n+=1;const u=n>1?"dropdown-submenu":"";return(0,m.jsx)("ul",{className:"dropdown ".concat(u," ").concat(t?"show":""),children:s.map(((e,s)=>(0,m.jsx)(A,{items:e,depthLevel:n},s)))})},A=e=>{let{items:s,depthLevel:t,showMenu:u,setShowMenu:r}=e;const[a,o]=(0,n.useState)(!1),l=()=>{a&&o(!1),u&&r(!1)},c=e=>{e.stopPropagation(),o((e=>!e))};return(0,m.jsx)("li",{className:"menu-items",onClick:l,children:s.url&&s.submenu?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("button",{type:"button","aria-haspopup":"menu","aria-expanded":a?"true":"false",children:[(0,m.jsx)(j.N_,{onClick:l,children:s.title}),(0,m.jsx)("div",{onClick:e=>c(e),children:a?(0,m.jsx)("span",{className:"arrow-close"}):(0,m.jsx)("span",{className:"arrow"})})]}),(0,m.jsx)(g,{depthLevel:t,submenus:s.submenu,dropdown:a})]}):!s.url&&s.submenu?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("button",{type:"button","aria-haspopup":"menu","aria-expanded":a?"true":"false",children:[s.title," ",(0,m.jsx)("div",{onClick:e=>c(e),children:a?(0,m.jsx)("span",{className:"arrow-close"}):(0,m.jsx)("span",{className:"arrow"})})]}),(0,m.jsx)(g,{depthLevel:t,submenus:s.submenu,dropdown:a})]}):(0,m.jsx)(j.N_,{to:s.url,children:s.title})})},N=()=>{const e=(0,a.wA)(),s=(0,a.d4)((e=>e.MenuReducer.menus)),t=(0,a.d4)((e=>e.AuthReducer)),[u,r]=(0,n.useState)(!1);let o=(0,n.useRef)();(0,n.useEffect)((()=>{l();const e=e=>{u&&o.current&&!o.current.contains(e.target)&&r(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[u]);const l=async()=>{await y(e,t.userData.fusertype)};return(0,m.jsxs)("nav",{className:"mobile-nav",children:[(0,m.jsx)("button",{className:"mobile-nav__menu-button",type:"button",onClick:()=>r((e=>!e)),children:"Menu"}),u&&(0,m.jsx)("ul",{className:"menus",ref:o,children:s.map(((e,s)=>(0,m.jsx)(A,{items:e,depthLevel:0,showMenu:u,setShowMenu:r},s)))})]})};var k=t(8579);const C={display:"flex",justifyContent:"space-between",alignItems:"center"},E=()=>{const e=(0,a.wA)(),s=(0,o.Zp)(),[t,p]=(0,n.useState)(!1),[h,x]=(0,n.useState)(localStorage.getItem("logo")),v=(0,a.d4)((e=>e.AuthReducer.userData));return(0,m.jsx)("header",{children:(0,m.jsxs)("div",{className:"nav-area",children:[(0,m.jsxs)("div",{style:C,children:[(0,m.jsx)(j.k2,{to:"/",className:"logo",children:(0,m.jsx)("img",{src:h,width:50,height:50,style:{borderRadius:"8px"}})}),(0,m.jsx)("div",{})]}),(0,m.jsx)(L,{}),(0,m.jsx)(N,{}),(0,m.jsx)("div",{style:C,children:(0,m.jsx)(l.A,{wrap:!0,size:16,children:(0,m.jsxs)(c.A,{children:[(0,m.jsx)(d.A,{size:50,icon:(0,m.jsx)(u.A,{}),onClick:()=>p(!0)}),(0,m.jsx)("p",{style:{fontSize:"10px",color:"#fff",textAlign:"center"},children:v.fuser})]})})}),(0,m.jsx)(i.A,{title:"Profile",open:t,onClose:()=>p(!1),children:(0,m.jsx)(r.A,{text:"Logout",onClick:()=>{e((0,k.y)(s))}})})]})})}}}]);
//# sourceMappingURL=387.c629b557.chunk.js.map
|