You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

674 lines
26 KiB

  1. import PropTypes from 'prop-types';
  2. import React
  3. , { useState }
  4. from 'react';
  5. import { useDispatch } from "react-redux";
  6. import { useNavigate } from "react-router-dom";
  7. // material-ui
  8. // import { useTheme } from '@mui/material/styles';
  9. import {
  10. AppBar,
  11. // Container,
  12. Typography,
  13. Box,
  14. Stack,
  15. // IconButton,
  16. // Menu,
  17. // MenuItem,
  18. // Button,
  19. // Tooltip,
  20. // Avatar,
  21. // Stack,
  22. Toolbar,
  23. Divider,
  24. // List,
  25. // ListItem,
  26. // ListItemButton,
  27. // ListItemText,
  28. IconButton,
  29. Drawer, Grid,
  30. // useMediaQuery
  31. } from '@mui/material';
  32. import MenuIcon from '@mui/icons-material/Menu';
  33. import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
  34. // project import
  35. // import AppBarStyled from './AppBarStyled';
  36. // import HeaderContent from './HeaderContent';
  37. import Logo from 'components/Logo';
  38. import AdminLogo from 'components/AdminLogo';
  39. import MobileLogo from 'components/MobileLogo';
  40. //import Profile from './HeaderContent/Profile';
  41. import "assets/style/navbarStyles.css";
  42. import {
  43. isUserLoggedIn,
  44. isGLDLoggedIn,
  45. isPrimaryLoggedIn,
  46. isCreditorLoggedIn,
  47. isINDLoggedIn,
  48. // isORGLoggedIn,
  49. // getUserId
  50. } from "utils/Utils";
  51. import { handleLogoutFunction } from 'auth/index';
  52. import { isGranted, isGrantedAny } from "auth/utils";
  53. // assets
  54. // import { MenuFoldOutlined,MenuOutlined } from '@ant-design/icons';
  55. // import { AppBar } from '../../../../node_modules/@mui/material/index';
  56. import { Link } from "react-router-dom";
  57. import LocaleSelector from "./HeaderContent/LocaleSelector";
  58. import { FormattedMessage } from "react-intl";
  59. const drawerWidth = 300;
  60. // const navItems = ['Home', 'About', 'Contact'];
  61. // ==============================|| MAIN LAYOUT - HEADER ||============================== //
  62. function Header(props) {
  63. const { window } = props;
  64. const [mobileOpen, setMobileOpen] = useState(false);
  65. const dispatch = useDispatch()
  66. const navigate = useNavigate()
  67. const handleDrawerToggle = () => {
  68. setMobileOpen((prevState) => !prevState);
  69. };
  70. const handleLogout = async () => {
  71. dispatch(handleLogoutFunction());
  72. //await handleLogoutFunction();
  73. navigate('/login');
  74. };
  75. const loginContent = (
  76. isGLDLoggedIn() ?
  77. <div id="adminContent">
  78. <li>
  79. <Link className="dashboard" to='/dashboard'>
  80. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }} >
  81. Dashboard
  82. </Typography>
  83. </Link>
  84. </li>
  85. <li>
  86. <Link className="application" to='/application/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Application</Typography></Link>
  87. </li>
  88. {
  89. isGrantedAny(["VIEW_PROOF", "MAINTAIN_PROOF"]) ?
  90. <li>
  91. <Link className="proof" to='/proof/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Proof</Typography></Link>
  92. </li>
  93. : <></>
  94. }
  95. {
  96. isGrantedAny(["MAINTAIN_PAYMENT", "MAINTAIN_RECON", "VIEW_DEMANDNOTE", "MAINTAIN_DEMANDNOTE"]) ?
  97. <li>
  98. <Link className="paymentTop" ><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Payment</Typography><KeyboardArrowDownIcon sx={{ fontSize: '1vw' }} /></Link>
  99. <ul className='dropdown'>
  100. {
  101. isGranted("MAINTAIN_PAYMENT") ?
  102. <li>
  103. <Link className="payment" to='/paymentPage/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Online Payment Record</Typography></Link>
  104. </li>
  105. :
  106. <></>
  107. }
  108. {
  109. isGranted("MAINTAIN_RECON") ?
  110. <>
  111. <li>
  112. <Link className="downloadXML" to='/gfmis/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>GFMIS Generate XML</Typography></Link>
  113. </li>
  114. <li>
  115. <Link className="reconReport" to='/paymentPage/reconReport'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Recon Report</Typography></Link>
  116. </li>
  117. </>
  118. :
  119. <></>
  120. }
  121. {
  122. isGranted("MAINTAIN_DEMANDNOTE") ?
  123. <li>
  124. <Link className="createDemandNote" to='/paymentPage/createDemandNote' ><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Create Demand Note</Typography></Link>
  125. </li>
  126. :
  127. <></>
  128. }
  129. {
  130. isGrantedAny(["VIEW_DEMANDNOTE", "MAINTAIN_DEMANDNOTE"]) ?
  131. <li>
  132. <Link className="demandNote" to='/paymentPage/demandNote' ><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Demand Note</Typography></Link>
  133. </li>
  134. :
  135. <></>
  136. }
  137. </ul>
  138. </li>
  139. :
  140. <></>
  141. }
  142. {
  143. isGrantedAny(["VIEW_USER", "MAINTAIN_USER", "VIEW_ORG", "MAINTAIN_ORG", "VIEW_GROUP", "MAINTAIN_GROUP"]) ?
  144. <li>
  145. <Link className="client" ><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Client</Typography><KeyboardArrowDownIcon sx={{ fontSize: '1vw' }} /></Link>
  146. <ul className='dropdown'>
  147. {
  148. isGrantedAny(["VIEW_USER", "MAINTAIN_USER"]) ?
  149. <>
  150. <li>
  151. <Link className="userSearchview" to='/userSearchview'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Users (GLD)</Typography></Link>
  152. </li>
  153. <li>
  154. <Link className="indUser" to='/indUser'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Users (Individual)</Typography></Link>
  155. </li>
  156. <li>
  157. <Link className="orgUser" to='/orgUser'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Users (Organisation)</Typography></Link>
  158. </li>
  159. </>
  160. :
  161. <></>
  162. }
  163. {
  164. isGrantedAny(["VIEW_ORG", "MAINTAIN_ORG"]) ?
  165. <li>
  166. <Link className="org" to='/org'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Organisation</Typography></Link>
  167. </li>
  168. :
  169. <></>
  170. }
  171. {
  172. isGrantedAny(["VIEW_GROUP", "MAINTAIN_GROUP"]) ?
  173. <li>
  174. <Link className="usergroupSearchview" to='/usergroupSearchview'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>User Group</Typography></Link>
  175. </li>
  176. :
  177. <></>
  178. }
  179. </ul>
  180. </li>
  181. :
  182. <></>
  183. }
  184. <li>
  185. <Link className="setting" ><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>Settings</Typography><KeyboardArrowDownIcon sx={{ fontSize: '1vw' }} /></Link>
  186. <ul className='dropdown'>
  187. <li>
  188. <Link className="userProfileGld" to='/user/profile'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>My Profile</Typography></Link>
  189. </li>
  190. {
  191. isGranted("MAINTAIN_GAZETTE_ISSUE") ?
  192. <>
  193. <li>
  194. <Link className="holidaySetting" to='/setting/holiday'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Holiday Settings</Typography></Link>
  195. </li>
  196. <li>
  197. <Link className="gazetteissueSetting" to='/setting/gazetteissuepage'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Gazette Issues</Typography></Link>
  198. </li>
  199. </>
  200. :
  201. <></>
  202. }
  203. {
  204. isGranted("MAINTAIN_ANNOUNCEMENT") ?
  205. <li>
  206. <Link className="announcement" to='/setting/announcement'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Announcement</Typography></Link>
  207. </li>
  208. :
  209. <></>
  210. }
  211. {isGranted("MAINTAIN_EMAIL") ?
  212. <li>
  213. <Link className="emailTemplate" to='/setting/emailTemplate'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Email Template</Typography></Link>
  214. </li>
  215. :
  216. <></>
  217. }
  218. {
  219. isGranted("MAINTAIN_DR") ?
  220. <li>
  221. <Link className="drImport" to='/setting/drImport'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>DR Import</Typography></Link>
  222. </li>
  223. :
  224. <></>
  225. }
  226. {
  227. isGranted("MAINTAIN_SETTING") ?
  228. <li>
  229. <Link className="systemSetting" to='/setting/sys'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>System Settings</Typography></Link>
  230. </li>
  231. :
  232. <></>
  233. }
  234. <li>
  235. <Link className="auditLogSetting" to='/setting/auditLog'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2, mt: 1, mb: 1 }}>Audit Log</Typography></Link>
  236. </li>
  237. </ul>
  238. </li>
  239. <Box sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}>
  240. <li>
  241. <Link className="logout" onClick={handleLogout}><Typography variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>Logout</Typography></Link>
  242. </li>
  243. </Box>
  244. </div>
  245. :
  246. <div id="individualUserContent">
  247. <li>
  248. <Link className="dashboard" to='/dashboard'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  249. <FormattedMessage id="mainPage" />
  250. </Typography></Link>
  251. </li>
  252. <li>
  253. <Link className="myDocumet" to='/publicNotice'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  254. <FormattedMessage id="myPublicNotice" />
  255. </Typography></Link>
  256. </li>
  257. <li>
  258. <Link className="documentRecord" to='/proof/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  259. <FormattedMessage id="proofRecord" />
  260. </Typography></Link>
  261. </li>
  262. <li>
  263. {isCreditorLoggedIn() ?
  264. <>
  265. <Link className="paymentRecord">
  266. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  267. <FormattedMessage id="paymentHistory" />
  268. </Typography>
  269. <KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} />
  270. </Link>
  271. <ul className='dropdown'>
  272. <li>
  273. <Link className="manageOrgUser" to='/paymentPage/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  274. <FormattedMessage id="onlinePaymentHistory" />
  275. </Typography></Link>
  276. </li>
  277. <li>
  278. <Link className="manageOrgUser" to='/paymentPage/demandNote'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  279. <FormattedMessage id="paymentInfoRecord" />
  280. </Typography></Link>
  281. </li>
  282. </ul>
  283. </>
  284. :
  285. <Link className="manageOrgUser" to='/paymentPage/search'><Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }}>
  286. <FormattedMessage id="onlinePaymentHistory" />
  287. </Typography></Link>
  288. }
  289. </li>
  290. <li>
  291. {isPrimaryLoggedIn() ?
  292. <>
  293. <Link className="userSetting" >
  294. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }} onClick={(event) => console.log(event)}>
  295. <FormattedMessage id="setting" />
  296. </Typography>
  297. <KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} />
  298. </Link>
  299. <ul className='dropdown' style={{ width: "max-content" }}>
  300. <li>
  301. <Link className="manageOrgUser" to='setting/manageUser'>
  302. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  303. <FormattedMessage id="companyOrUserRecord" />
  304. </Typography>
  305. </Link>
  306. </li>
  307. <li>
  308. <Link className="manageUser" to={'/orgUser'}>
  309. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  310. {/* <FormattedMessage id="companyOrUserRecord" /> */}
  311. <FormattedMessage id="userProfile" />
  312. </Typography>
  313. </Link>
  314. </li>
  315. <li>
  316. <Link className="manageUser" to={'/org'}>
  317. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  318. {/* <FormattedMessage id="companyOrUserRecord" /> */}
  319. <FormattedMessage id="organizationProfile" />
  320. </Typography>
  321. </Link>
  322. </li>
  323. </ul>
  324. </>
  325. :
  326. isINDLoggedIn() ?
  327. <>
  328. <Link className="userSetting" >
  329. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }} onClick={(event) => console.log(event)}>
  330. <FormattedMessage id="setting" />
  331. </Typography>
  332. <KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} />
  333. </Link>
  334. <ul className='dropdown' style={{ width: "max-content" }}>
  335. <li>
  336. <Link className="manageUser" to={'/indUser'}>
  337. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  338. {/* <FormattedMessage id="companyOrUserRecord" /> */}
  339. <FormattedMessage id="userProfile" />
  340. </Typography>
  341. </Link>
  342. </li>
  343. </ul>
  344. </>
  345. :
  346. <>
  347. <Link className="userSetting" >
  348. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 1 }} onClick={(event) => console.log(event)}>
  349. <FormattedMessage id="setting" />
  350. </Typography>
  351. <KeyboardArrowDownIcon sx={{ fontSize: '1.0rem' }} />
  352. </Link>
  353. <ul className='dropdown' style={{ width: "max-content" }}>
  354. <li>
  355. <Link className="manageUser" to={'/orgUser'}>
  356. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  357. <FormattedMessage id="userProfile" />
  358. </Typography>
  359. </Link>
  360. </li>
  361. </ul>
  362. </>
  363. }
  364. </li>
  365. <Box sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}>
  366. <li>
  367. <Link className="logout" onClick={handleLogout}><Typography variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  368. <FormattedMessage id="logout" />
  369. </Typography></Link>
  370. </li>
  371. </Box>
  372. </div>
  373. );
  374. const logoutContent = (
  375. <div>
  376. <li>
  377. <Link className="login" to='/login'>
  378. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  379. <FormattedMessage id="login" />
  380. </Typography>
  381. </Link>
  382. </li>
  383. <li>
  384. <Link className="register" to='/register'>
  385. <Typography style={{ opacity: 0.9 }} variant={"pnspsHeaderTitle"} sx={{ ml: 2 }}>
  386. <FormattedMessage id="register" />
  387. </Typography>
  388. </Link>
  389. </li>
  390. </div>
  391. );
  392. const drawer = (
  393. isUserLoggedIn() ?
  394. <Stack id="sidebar" direction="column" justifyContent="center" alignItems="center" /*onClick={handleDrawerToggle}*/ sx={{ textAlign: 'center', width: '300px' }}>
  395. {/* <Typography variant="h6" sx={{ my: 2 }}>
  396. PNSPS
  397. </Typography> */}
  398. <Box sx={{ mr: 2, mt: 1, display: { md: 'none' } }}>
  399. <MobileLogo />
  400. <span id="mobileTitle" >PNSPS</span>
  401. </Box>
  402. <Divider />
  403. <ul id="sidebartop">
  404. {loginContent}
  405. </ul>
  406. <Divider />
  407. <ul id="sidebarbottom">
  408. <li>
  409. <Link className="logout" onClick={handleLogout}>
  410. <FormattedMessage id="logout" />
  411. </Link>
  412. </li>
  413. </ul>
  414. </Stack>
  415. :
  416. <Stack id="sidebar" direction="column" justifyContent="center" alignItems="center" onClick={handleDrawerToggle} sx={{ textAlign: 'center' }}>
  417. <Box sx={{ mr: 2, mt: 1, display: { md: 'none' } }}>
  418. <MobileLogo />
  419. <span id="mobileTitle" >PNSPS</span>
  420. </Box>
  421. <Divider />
  422. <ul id="logoutContent">
  423. {logoutContent}
  424. </ul>
  425. <Divider />
  426. </Stack>
  427. );
  428. const container = window !== undefined ? () => window().document.body : undefined;
  429. return (
  430. isUserLoggedIn() ?
  431. // User Login success
  432. <Box>
  433. <AppBar component="nav">
  434. <Toolbar id="nav" width="100%">
  435. {isGLDLoggedIn()
  436. ? <Stack
  437. direction="row"
  438. justifyContent="flex-start"
  439. alignItems="center"
  440. spacing={0}
  441. >
  442. <Box mt={0.5} sx={{ display: { xs: 'none', sm: 'none', md: 'block' } }}>
  443. <AdminLogo />
  444. </Box>
  445. <IconButton
  446. color="inherit"
  447. aria-label="open drawer"
  448. edge="start"
  449. onClick={handleDrawerToggle}
  450. sx={{ mr: 2, display: { md: 'none' } }}
  451. >
  452. <MenuIcon style={{ color: '#0C489E' }} />
  453. </IconButton>
  454. <Box sx={{ mr: 2, display: { md: 'none' } }}>
  455. <MobileLogo />
  456. <span id="mobileTitle" >PNSPS</span>
  457. </Box>
  458. </Stack> :
  459. <Stack
  460. direction="row"
  461. justifyContent="flex-start"
  462. alignItems="center"
  463. spacing={0}
  464. sx={{ width: { xs: '100%', md: '25%' } }}
  465. >
  466. <Box sx={{ width: '260px', flexGrow: 1, display: { xs: 'none', sm: 'none', md: 'block' } }}>
  467. <Stack direction="row" justifyContent="flex-start" alignItems="center">
  468. <Logo />
  469. <Stack justifyContent="flex-start" alignItems="center">
  470. {/*<span id="systemTitle">公共啟事提交</span>*/}
  471. {/*<span id="systemTitle">及繳費系統</span>*/}
  472. <span id="systemTitle">
  473. <FormattedMessage id="PNSPS" />
  474. </span>
  475. </Stack>
  476. </Stack>
  477. </Box>
  478. <IconButton
  479. color="inherit"
  480. aria-label="open drawer"
  481. edge="start"
  482. onClick={handleDrawerToggle}
  483. sx={{ mr: 2, display: { md: 'none' } }}
  484. >
  485. <MenuIcon style={{ color: '#0C489E' }} />
  486. </IconButton>
  487. <Box sx={{ flexGrow: 1, mr: 2, display: { sm: 'block', md: 'none' } }}>
  488. <Stack direction="row" justifyContent="space-between" alignItems="center" width="100%">
  489. <MobileLogo />
  490. <Stack justifyContent="flex-start" alignItems="flex-start" width="100%" ml={2}>
  491. <span id="mobileTitle">
  492. <FormattedMessage id="PNSPS" />
  493. </span>
  494. </Stack>
  495. <Stack justifyContent="flex-end" alignItems="center">
  496. <LocaleSelector />
  497. </Stack>
  498. </Stack>
  499. </Box>
  500. </Stack>
  501. }
  502. <Box sx={{ display: { xs: 'none', sm: 'none', md: 'block' }, width: "100%" }}>
  503. <Stack
  504. direction="row"
  505. justifyContent="space-between"
  506. alignItems="center"
  507. spacing={1}
  508. >
  509. <ul id="navbar" width="100%" >
  510. {loginContent}
  511. </ul>
  512. <Grid item>
  513. <Grid container direction="column"
  514. justifyContent="flex-end"
  515. alignItems="center"
  516. >
  517. {
  518. isGLDLoggedIn() ?
  519. <Grid item />
  520. :
  521. <Grid item>
  522. <LocaleSelector />
  523. </Grid>
  524. }
  525. {/*<Profile />*/}
  526. </Grid>
  527. </Grid>
  528. </Stack>
  529. </Box>
  530. </Toolbar>
  531. </AppBar>
  532. <Box component="nav">
  533. <Drawer
  534. container={container}
  535. variant="temporary"
  536. open={mobileOpen}
  537. onClose={handleDrawerToggle}
  538. ModalProps={{
  539. keepMounted: true, // Better open performance on mobile.
  540. }}
  541. sx={{
  542. display: { sm: 'block', md: 'none' },
  543. '& .MuiDrawer-paper': { boxSizing: 'border-box', width: drawerWidth },
  544. }}
  545. >
  546. {drawer}
  547. </Drawer>
  548. </Box>
  549. </Box> :
  550. <Box>
  551. <AppBar component="nav">
  552. <Toolbar id="nav" width="100%">
  553. <Stack
  554. direction="row"
  555. justifyContent="flex-start"
  556. alignItems="center"
  557. spacing={0}
  558. // width="100%"
  559. sx={{ width: { xs: '100%', md: '25%' } }}
  560. >
  561. <Box sx={{ flexGrow: 1, display: { xs: 'none', sm: 'none', md: 'block' } }}>
  562. <Stack direction="row" justifyContent="flex-start" alignItems="center" >
  563. <Logo />
  564. <Stack justifyContent="flex-start" alignItems="center">
  565. <span id="systemTitle">
  566. <FormattedMessage id="PNSPS" />
  567. </span>
  568. </Stack>
  569. </Stack>
  570. </Box>
  571. <IconButton
  572. color="inherit"
  573. aria-label="open drawer"
  574. edge="start"
  575. onClick={handleDrawerToggle}
  576. sx={{ mr: 2, display: { md: 'none' } }}
  577. >
  578. <MenuIcon style={{ color: '#0C489E' }} />
  579. </IconButton>
  580. <Box sx={{ flexGrow: 1, mr: 2, display: { sm: 'block', md: 'none' } }}>
  581. <Stack direction="row" justifyContent="space-between" alignItems="center" width="100%">
  582. <MobileLogo />
  583. <Stack justifyContent="flex-start" alignItems="flex-start" width="100%" ml={2}>
  584. <span id="mobileTitle">
  585. <FormattedMessage id="PNSPS" />
  586. </span>
  587. </Stack>
  588. <Stack justifyContent="flex-end" alignItems="center">
  589. <LocaleSelector />
  590. </Stack>
  591. </Stack>
  592. </Box>
  593. </Stack>
  594. <Box sx={{ display: { xs: 'none', sm: 'none', md: 'block' }, width: "75%" }}>
  595. <Stack
  596. direction="row"
  597. justifyContent="space-between"
  598. alignItems="center"
  599. spacing={1}
  600. >
  601. <ul id="navbar" width="100%" >
  602. {logoutContent}
  603. </ul>
  604. <LocaleSelector />
  605. {/*<Profile />*/}
  606. </Stack>
  607. </Box>
  608. </Toolbar>
  609. </AppBar>
  610. <Box component="nav">
  611. <Drawer
  612. container={container}
  613. variant="temporary"
  614. open={mobileOpen}
  615. onClose={handleDrawerToggle}
  616. ModalProps={{
  617. keepMounted: true, // Better open performance on mobile.
  618. }}
  619. sx={{
  620. display: { sm: 'block', md: 'none' },
  621. '& .MuiDrawer-paper': { boxSizing: 'border-box', width: drawerWidth },
  622. }}
  623. >
  624. {drawer}
  625. </Drawer>
  626. </Box>
  627. </Box>
  628. );
  629. }
  630. Header.propTypes = {
  631. /**
  632. * Injected by the documentation to work in an iframe.
  633. * You won't need it on your project.
  634. */
  635. window: PropTypes.func,
  636. };
  637. export default Header;