From ad9c7595bc59526f2327c032e1c3c7889fdb9d8b Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 19 Jan 2024 15:53:44 +0800 Subject: [PATCH] message details --- src/pages/Message/Details/index.js | 117 ++++++++++++++++++ .../ApplyForm/PublicNoticeApplyForm.js | 2 +- src/pages/dashboard/Public/Message.js | 46 ++++++- src/pages/dashboard/Public/index.js | 13 +- .../iAmSmart/DirectLoginCallback/index.js | 2 + src/routes/PublicUserRoutes.js | 44 ++++--- src/themes/palette.js | 6 + src/translations/en.json | 1 + src/translations/zh-CN.json | 1 + src/translations/zh-HK.json | 1 + src/utils/ApiPathConst.js | 4 + 11 files changed, 207 insertions(+), 30 deletions(-) create mode 100644 src/pages/Message/Details/index.js diff --git a/src/pages/Message/Details/index.js b/src/pages/Message/Details/index.js new file mode 100644 index 0000000..bbdab8f --- /dev/null +++ b/src/pages/Message/Details/index.js @@ -0,0 +1,117 @@ +// material-ui +import { + Grid, + Typography, + Stack, + Button, +} from '@mui/material'; + +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import * as UrlUtils from "utils/ApiPathConst"; +import * as DateUtils from "utils/DateUtils"; +import { useParams, useNavigate } from "react-router-dom"; + +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); + +import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' +import { FormattedMessage } from "react-intl"; +const BackgroundHead = { + backgroundImage: `url(${titleBackgroundImg})`, + width: '100%', + height: '100%', + backgroundSize: 'contain', + backgroundRepeat: 'no-repeat', + backgroundColor: '#0C489E', + backgroundPosition: 'right' +} + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const Index = () => { + const params = useParams(); + const navigate = useNavigate() + + const [record, setRecord] = React.useState(); + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + loadForm(); + }, []); + + React.useEffect(() => { + setOnReady(true); + }, [record]); + + + const loadForm = () => { + if (params.id > 0) { + HttpUtils.get({ + url: UrlUtils.GET_MSG_DETAILS + "/" + params.id, + onSuccess: (responseData) => { + if (!responseData?.sentDate) { + navigate("/"); + } + setRecord(responseData); + } + }); + } + } + + return ( + !onReady ? + + : + ( + + +
+ + + + + +
+
+ {/*row 1*/} + + +
+ + + {record?.subject} + + {DateUtils.datetimeStr(record?.sentDate)} + +
+
+ + + + +
+
+
+
+ {/*row 2*/} +
+ + + ) + + + ); +}; + +export default Index; diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index 4f5f4c5..6366de6 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -139,7 +139,7 @@ const PublicNoticeApplyForm = ({ loadedData, selections }) => { - diff --git a/src/pages/dashboard/Public/Message.js b/src/pages/dashboard/Public/Message.js index 39f5168..f959904 100644 --- a/src/pages/dashboard/Public/Message.js +++ b/src/pages/dashboard/Public/Message.js @@ -1,15 +1,51 @@ // material-ui import { Stack, - Typography + Typography, + Button } from '@mui/material'; import MainCard from "components/MainCard"; import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import * as UrlUtils from "utils/ApiPathConst"; +import * as DateUtils from "utils/DateUtils"; + +import { useNavigate } from "react-router-dom"; // ==============================|| DASHBOARD - DEFAULT ||============================== // const SearchDemandNoteForm = () => { + const navigate = useNavigate() + const [itemList, setItemList] = React.useState([]); + + React.useEffect(() => { + loadData(); + }, []); + + const loadData = () => { + + HttpUtils.get({ + url: UrlUtils.GET_MSG_DESHBOARD, + onSuccess: function (response) { + let list = [] + response.map((item) => { + list.push( + + ) + }); + + setItemList(list); + + } + }); + }; + return ( { content={false} sx={{ backgroundColor: '#fff' }} > - - - - - + + {itemList} ); + }; export default SearchDemandNoteForm; diff --git a/src/pages/dashboard/Public/index.js b/src/pages/dashboard/Public/index.js index 1dcc53d..730d993 100644 --- a/src/pages/dashboard/Public/index.js +++ b/src/pages/dashboard/Public/index.js @@ -10,16 +10,19 @@ import { } from '@mui/material'; import { isORGLoggedIn, } from "utils/Utils"; import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' -import {FormattedMessage} from "react-intl"; +import { FormattedMessage } from "react-intl"; import AdsClickRoundedIcon from '@mui/icons-material/AdsClickRounded'; import * as React from "react"; import Loadable from 'components/Loadable'; const Message = Loadable(React.lazy(() => import('./Message'))); const Notice = Loadable(React.lazy(() => import('./Notice'))); +import { useNavigate } from "react-router-dom"; + // ==============================|| DASHBOARD - DEFAULT ||============================== // const DashboardDefault = () => { + const navigate = useNavigate() const userData = JSON.parse(localStorage.getItem("userData")); const BackgroundHead = { // backgroundColor: '#0d47a1', @@ -37,8 +40,8 @@ const DashboardDefault = () => {
{/* 我的公共啟事 */} - - {isORGLoggedIn() ?userData.fullenName:userData.fullchName}, + + {isORGLoggedIn() ? userData.fullenName : userData.fullchName},
@@ -46,7 +49,7 @@ const DashboardDefault = () => { - + diff --git a/src/pages/iAmSmart/DirectLoginCallback/index.js b/src/pages/iAmSmart/DirectLoginCallback/index.js index 89208b8..e122bfe 100644 --- a/src/pages/iAmSmart/DirectLoginCallback/index.js +++ b/src/pages/iAmSmart/DirectLoginCallback/index.js @@ -58,6 +58,8 @@ const Index = () => { console.log(error); } }); + }else{ + window.location.assign("/iamsmart/loginFail"); } } diff --git a/src/routes/PublicUserRoutes.js b/src/routes/PublicUserRoutes.js index 508991d..9cc82a4 100644 --- a/src/routes/PublicUserRoutes.js +++ b/src/routes/PublicUserRoutes.js @@ -25,7 +25,11 @@ const PaymentDetails_Public = Loadable(lazy(() => import('pages/Payment/Details_ const DemandNote_Public = Loadable(lazy(() => import('pages/DemandNote/Search_Public'))); const UserMaintainPage_Individual = Loadable(lazy(() => import('pages/User/DetailsPage_Individual'))); const UserMaintainPage_Organization = Loadable(lazy(() => import('pages/User/DetailsPage_Organization'))); +<<<<<<< HEAD const OrganizationDetailPage = Loadable(lazy(() => import('pages/Organization/DetailPage'))); +======= +const Msg_Details = Loadable(lazy(() => import('pages/Message/Details'))); +>>>>>>> d1c9a54 (message details) // ==============================|| MAIN ROUTING ||============================== // @@ -46,80 +50,84 @@ const PublicDashboard = { }, { path: 'setting/manageUser', - element: + element: }, { path: 'publicNotice', - element: + element: }, { path: 'publicNotice/apply', - element: + element: }, { path: 'publicNotice/:id', - element: + element: }, { path: 'proof/reply/:id', - element: + element: }, { path: 'proof/search', - element: + element: }, { path: 'proof/pay/:id', - element: + element: }, { path: 'paymentPage', - element: + element: }, { path: 'paymentPage/fps', - element: + element: }, { path: 'paymentPage/card', - element: + element: }, { path: 'paymentPage/callback', - element: + element: }, { path: 'paymentPage/fps/fpscallback', - element: + element: }, { path: 'paymentPage/fps/ackpage', - element: + element: }, { path: 'paymentPage/search', - element: + element: }, { path: 'paymentPage/details/:id', - element: + element: }, { path: 'paymentPage/demandNote', - element: + element: }, { path: '/indUser', element: }, { - path: '/orgUser', - element: + path: '/orgUser', + element: }, { path: '/org', element: }, + { + path: '/msg/details/:id', + element: + }, ] }, ] diff --git a/src/themes/palette.js b/src/themes/palette.js index ea3f267..205947a 100644 --- a/src/themes/palette.js +++ b/src/themes/palette.js @@ -53,6 +53,12 @@ const Palette = (mode) => { paper: paletteColor.grey[0], default: paletteColor.grey.A50 }, + black: { + main: '#000', + light: '#000', + dark: '#000', + contrastText: '#FFF', + }, gray: { main: '#777', light: '#777', diff --git a/src/translations/en.json b/src/translations/en.json index 90f5ac2..68d8f29 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -341,6 +341,7 @@ "viewAllAnnouncement": "Show all announcements", "systemMessage": "System message", "viewAllSystemMessage": "Show all messages", + "msgDetails": "Message Details", "Dashboard": "Dashboard", "event": "Event" diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index 52aa5cd..2f97419 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -340,6 +340,7 @@ "viewAllAnnouncement": "显示所有公告", "systemMessage": "系统消息", "viewAllSystemMessage": "显示所有消息", + "msgDetails": "消息详情", "Dashboard": "仪表板", "event": "活动" diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 7442bc4..4549731 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -340,6 +340,7 @@ "viewAllAnnouncement": "顯示所有公告", "systemMessage": "系統消息", "viewAllSystemMessage": "顯示所有消息", + "msgDetails": "消息詳情", "Dashboard": "儀表板", "event": "活動" diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index a6a03b8..af037af 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -38,6 +38,10 @@ export const GET_ORG_MARK_AS_CREDITOR = apiPath+'/org/mark-as-creditor'; export const GET_ORG_MARK_AS_NON_CREDITOR = apiPath+'/org/mark-as-non-creditor'; export const GET_ORG_EXPORT = apiPath+'/org/export'; +export const GET_MSG_DETAILS = apiPath+'/msg/details'; +export const GET_MSG_LIST = apiPath+'/msg/list'; +export const GET_MSG_DESHBOARD = apiPath+'/msg/list/deshboard'; + //File Up/Download