diff --git a/src/pages/Announcement/Search_Public/DataGrid.js b/src/pages/Announcement/Search_Public/DataGrid.js new file mode 100644 index 0000000..aa1229d --- /dev/null +++ b/src/pages/Announcement/Search_Public/DataGrid.js @@ -0,0 +1,77 @@ +// material-ui +import * as React from 'react'; +import { + Button, +} from '@mui/material'; +import * as DateUtils from "utils/DateUtils"; +import { useNavigate } from "react-router-dom"; +import { FiDataGrid } from "components/FiDataGrid"; +import { FormattedMessage, useIntl } from "react-intl"; +// ==============================|| EVENT TABLE ||============================== // + +export default function SearchPublicNoticeTable({ recordList }) { + const [rows, setRows] = React.useState(recordList); + const navigate = useNavigate() + const intl = useIntl(); + const { locale } = intl; + + React.useEffect(() => { + setRows(recordList); + }, [recordList]); + + const handleEditClick = (params) => () => { + navigate('/setting/announcement/details/' + params.id); + }; + + + const columns = [ + { + field: 'announceDate', + headerName: , + width: 250, + cellClassName: 'announceDate', + renderCell: (params) => { + return ; + }, + }, + { + id: 'subject', + field: 'subject', + headerName: , + minWidth: 400, + renderCell: (params) => { + return <> + {locale === 'en' ?params.row.subjectEng:locale === 'zh-HK' ?params.row.subjectCht:params.row.subjectChs} + + }, + }, + { + id: 'content', + field: 'content', + headerName: , + flex:1, + minWidth: 400, + renderCell: (params) => { + return <> + {locale === 'en' ?params.row.contentEng:locale === 'zh-HK' ?params.row.contentCht:params.row.contentChs} + + } + }, + ]; + + function handleRowDoubleClick(params) { + navigate('/setting/announcement/details/' + params.id); + } + + return ( +
+ 'auto'} + onRowDoubleClick={handleRowDoubleClick} + /> +
+ ); +} diff --git a/src/pages/Announcement/Search_Public/SearchForm.js b/src/pages/Announcement/Search_Public/SearchForm.js new file mode 100644 index 0000000..f10ad95 --- /dev/null +++ b/src/pages/Announcement/Search_Public/SearchForm.js @@ -0,0 +1,158 @@ +// material-ui +import { + Button, + Grid, TextField, + Typography +} from '@mui/material'; +import MainCard from "components/MainCard"; +import { useForm } from "react-hook-form"; +import * as React from "react"; +import * as DateUtils from "utils/DateUtils"; +import { ThemeProvider } from "@emotion/react"; +import { useNavigate } from "react-router-dom"; +import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst"; +import { FormattedMessage, useIntl } from "react-intl"; +// ==============================|| DASHBOARD - DEFAULT ||============================== // + + +const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { + const navigate = useNavigate() + + const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); + const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); + + const intl = useIntl(); + + const marginBottom = 2.5; + const { reset, register, handleSubmit } = useForm() + const onSubmit = (data) => { + const temp = { + key: data.key, + dateFrom: data.dateFrom, + dateTo: data.dateTo, + }; + applySearch(temp); + }; + + + function resetForm() { + reset(); + } + + + return ( + + +
+ + {/*row 1*/} + + + + + + {/*row 2*/} + + + + + + + + + { + setMinDate(DateUtils.dateStr(newValue)); + }} + InputLabelProps={{ + shrink: true + }} + /> + + + + + + + + { + setMaxDate(DateUtils.dateStr(newValue)); + }} + id="dateTo" + type="date" + //label={"Submit Date(To)"} + defaultValue={searchCriteria.dateTo} + /> + + + + + + + {/*last row*/} + + + + + + + + + + + + + + + +
+
+ ); +}; + +export default SearchPublicNoticeForm; diff --git a/src/pages/Announcement/Search_Public/index.js b/src/pages/Announcement/Search_Public/index.js new file mode 100644 index 0000000..351edb5 --- /dev/null +++ b/src/pages/Announcement/Search_Public/index.js @@ -0,0 +1,104 @@ +// material-ui +import { + Grid, + Typography, + Stack +} from '@mui/material'; +import MainCard from "components/MainCard"; +import * as UrlUtils from "utils/ApiPathConst"; +import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; +import * as DateUtils from "utils/DateUtils"; + +import Loadable from 'components/Loadable'; +const LoadingComponent = Loadable(React.lazy(() => import('pages/extra-pages/LoadingComponent'))); +const SearchForm = Loadable(React.lazy(() => import('./SearchForm'))); +const EventTable = Loadable(React.lazy(() => import('./DataGrid'))); +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 UserSearchPage_Individual = () => { + const [record, setRecord] = React.useState([]); + const [searchCriteria, setSearchCriteria] = React.useState({ + dateTo: DateUtils.dateStr(new Date()), + dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate() - 90)), + }); + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + getDataList(); + }, []); + + React.useEffect(() => { + setOnReady(true); + }, [record]); + + React.useEffect(() => { + getDataList(); + }, [searchCriteria]); + + function getDataList() { + HttpUtils.get({ + url: UrlUtils.GET_ANNOUNCE_LIST, + params: searchCriteria, + onSuccess: function (responseData) { + setRecord(responseData); + } + }); + } + + function applySearch(input) { + setSearchCriteria(input); + } + + return ( + !onReady ? + + + + + + : + + +
+ + + +
+
+ {/*row 1*/} + + + + {/*row 2*/} + + + + + +
+ ); +} +export default UserSearchPage_Individual; diff --git a/src/pages/dashboard/Public/index.js b/src/pages/dashboard/Public/index.js index aaa3d18..7a4320c 100644 --- a/src/pages/dashboard/Public/index.js +++ b/src/pages/dashboard/Public/index.js @@ -10,7 +10,7 @@ import { } from '@mui/material'; import { isORGLoggedIn, } from "utils/Utils"; import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' -import {FormattedMessage, useIntl} from "react-intl"; +import { FormattedMessage, useIntl } from "react-intl"; import AdsClickRoundedIcon from '@mui/icons-material/AdsClickRounded'; import * as React from "react"; import Loadable from 'components/Loadable'; @@ -51,10 +51,10 @@ const DashboardDefault = () => { + + { + + import('pages/User/Det const OrganizationDetailPage = Loadable(lazy(() => import('pages/Organization/DetailPage'))); const Msg_Details = Loadable(lazy(() => import('pages/Message/Details'))); const Msg_Search = Loadable(lazy(() => import('pages/Message/Search'))); +const AnnouncementSearch = Loadable(lazy(() => import('pages/Announcement/Search_Public'))); + // ==============================|| MAIN ROUTING ||============================== // @@ -130,6 +132,10 @@ const PublicDashboard = { path: '/msg/search', element: }, + { + path: '/announcement/search', + element: + }, ] }, ] diff --git a/src/translations/en.json b/src/translations/en.json index 689a55a..f4c6a1e 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -401,6 +401,9 @@ "create": "Create", "confirmTo": "Confirm to ", + "content": "Content", + "subject": "Subject", + "Dashboard": "Dashboard", "event": "Event" } \ No newline at end of file diff --git a/src/translations/zh-CN.json b/src/translations/zh-CN.json index b0eeb96..2c6e178 100644 --- a/src/translations/zh-CN.json +++ b/src/translations/zh-CN.json @@ -397,6 +397,9 @@ "create": "创建", "confirmTo": "确定", + "content": "内容", + "subject": "主题", + "Dashboard": "仪表板", "event": "活动" } \ No newline at end of file diff --git a/src/translations/zh-HK.json b/src/translations/zh-HK.json index 2b2ee40..33bc175 100644 --- a/src/translations/zh-HK.json +++ b/src/translations/zh-HK.json @@ -402,6 +402,9 @@ "create": "創建", "confirmTo": "確定", + "content": "内容", + "subject": "主題", + "Dashboard": "儀表板", "event": "活動" } \ No newline at end of file