選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.js 35 KiB

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