diff --git a/src/layout/MainLayout/Header/index.js b/src/layout/MainLayout/Header/index.js index 7a62b2e..99a2024 100644 --- a/src/layout/MainLayout/Header/index.js +++ b/src/layout/MainLayout/Header/index.js @@ -1,13 +1,13 @@ import PropTypes from 'prop-types'; import React -,{useState} - from 'react'; -import {useDispatch} from "react-redux"; -import {useNavigate} from "react-router-dom"; +, { useState } + from 'react'; +import { useDispatch } from "react-redux"; +import { useNavigate } from "react-router-dom"; // material-ui // import { useTheme } from '@mui/material/styles'; -import { +import { AppBar, // Container, Typography, @@ -29,7 +29,7 @@ import { IconButton, Drawer, // useMediaQuery - } from '@mui/material'; +} from '@mui/material'; import MenuIcon from '@mui/icons-material/Menu'; import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; @@ -41,7 +41,7 @@ import AdminLogo from 'components/AdminLogo'; import MobileLogo from 'components/MobileLogo'; import Profile from './HeaderContent/Profile'; import "assets/style/navbarStyles.css"; -import {isUserLoggedIn,isGLDLoggedIn, isPrimaryLoggedIn} from "utils/Utils"; +import { isUserLoggedIn, isGLDLoggedIn, isPrimaryLoggedIn } from "utils/Utils"; import { handleLogoutFunction } from 'auth/index'; // assets @@ -69,77 +69,83 @@ function Header(props) { //await handleLogoutFunction(); navigate('/login'); }; - + const loginContent = ( isGLDLoggedIn() ? -
-
  • - Dashboard -
  • -
  • - Application -
  • -
  • - Proof -
  • -
  • - Payment -
  • -
  • - Client -
      -
    • - Users (GLD) -
    • -
    • - Users (Individual) -
    • -
    • - Users (Organization) -
    • -
    • - Organization -
    • -
    • - User Group -
    • -
    -
  • -
  • - Logout -
  • -
    - : -
    -
  • - 主頁 -
  • -
  • - 我的公共啟事 -
  • -
  • - 校對記錄 -
  • -
  • - 付款記錄 -
  • -
  • - 設定 -
      - { isPrimaryLoggedIn()? -
    • - 公司/機構用戶記錄 -
    • - : - <> - } - -
    -
  • -
  • - 登出 -
  • -
    +
    +
  • + Dashboard +
  • +
  • + Application + +
  • +
  • + Proof +
  • +
  • + Payment +
  • +
  • + Client +
      +
    • + Users (GLD) +
    • +
    • + Users (Individual) +
    • +
    • + Users (Organization) +
    • +
    • + Organization +
    • +
    • + User Group +
    • +
    +
  • +
  • + Logout +
  • +
    + : +
    +
  • + 主頁 +
  • +
  • + 我的公共啟事 +
  • +
  • + 校對記錄 +
  • +
  • + 付款記錄 +
  • +
  • + 設定 +
      + {isPrimaryLoggedIn() ? +
    • + 公司/機構用戶記錄 +
    • + : + <> + } + +
    +
  • +
  • + 登出 +
  • +
    ); const logoutContent = ( @@ -154,7 +160,7 @@ function Header(props) { ); const drawer = ( - isUserLoggedIn()? + isUserLoggedIn() ? PNSPS @@ -170,7 +176,7 @@ function Header(props) { - : + : PNSPS @@ -185,165 +191,165 @@ function Header(props) { const container = window !== undefined ? () => window().document.body : undefined; return ( - isUserLoggedIn() ? - // User Login success - - - - {isGLDLoggedIn() - ? - - - - + + + {isGLDLoggedIn() + ? + + + + - - - - - PNSPS - - : - - - - - - 公共啟事提交 - 及繳費系統 + + + + + PNSPS + + : + + + + + + 公共啟事提交 + 及繳費系統 + - - - + - - - - - - 公共啟事提交及繳費系統 - - - - } - - + + + + + + 公共啟事提交及繳費系統 + + + + } + + + + + + + + + + + + {drawer} + + + : + + + - - - - - - - - - {drawer} - - - : - - - - - + - - + + 公共啟事提交及繳費系統 - - - - - - 公共啟事提交及繳費系統 - - - - - - {/* */} + + + + + 公共啟事提交及繳費系統 + - - - - - - {drawer} - + + + + {/* */} + + + + + + + {drawer} + + - ); } Header.propTypes = { diff --git a/src/pages/PublicNotice/ListPanel/PublicNoteStatusUtils.js b/src/pages/PublicNotice/ListPanel/PublicNoteStatusUtils.js index 6111c8d..134e37d 100644 --- a/src/pages/PublicNotice/ListPanel/PublicNoteStatusUtils.js +++ b/src/pages/PublicNotice/ListPanel/PublicNoteStatusUtils.js @@ -21,8 +21,29 @@ export function getStatus(params) { default: return getStatusTag({ text: params.row.status }) } +} - +export function getStatusEng(params) { + switch (params.row.status) { + case "submitted": + return getStatusTag({ color: "#f5a83d", text: "Submitted" }) + case "rejected": + return getStatusTag({ color: "#d9372b", text: "Rejected" }) + case "cancelled": + return getStatusTag({ color: "#757373", text: "Cancelled" }) + case "accepted": + return getStatusTag({ color: "#22a13f", text: "Accepted" }) + case "confirmed": + return getStatusTag({ color: "#22a13f", text: "Confirmed" }) + case "paid": + return getStatusTag({ color: "#22a13f", text: "Paid" }) + case "published": + return getStatusTag({ color: "#f5a83d", text: "Published" }) + case "withdrawn": + return getStatusTag({ color: "#8a8784", text: "Withdrawn" }) + default: + return getStatusTag({ text: params.row.status }) + } } export function getStatusTag({ color = "#000", textColor = "#FFF", text = "" }) { diff --git a/src/pages/PublicNoticeSearch_GLD/DataGrid.js b/src/pages/PublicNoticeSearch_GLD/DataGrid.js new file mode 100644 index 0000000..b1ccdd3 --- /dev/null +++ b/src/pages/PublicNoticeSearch_GLD/DataGrid.js @@ -0,0 +1,117 @@ +// material-ui +import * as React from 'react'; +import { + DataGrid, +} from "@mui/x-data-grid"; +import { + Button +} from '@mui/material'; +import * as DateUtils from "utils/DateUtils"; +import * as StatusUtils from "pages/PublicNotice/ListPanel/PublicNoteStatusUtils"; +// ==============================|| EVENT TABLE ||============================== // + +export default function SearchPublicNoticeTable({ recordList }) { + const [rows, setRows] = React.useState(recordList); + const [rowModesModel] = React.useState({}); + + React.useEffect(() => { + setRows(recordList); + }, [recordList]); + + const columns = [ + { + id: 'appNo', + field: 'appNo', + headerName: 'App No.', + flex: 1, + }, + { + id: 'created', + field: 'created', + headerName: 'Submit Date', + flex: 1, + valueGetter: (params) => { + return DateUtils.datetimeStr(params?.value); + } + }, + { + id: 'contactPerson', + field: 'contactPerson', + headerName: 'Contact Person', + flex: 2, + renderCell: (params) => { + let phone = JSON.parse(params.row.contactTelNo); + let faxNo = JSON.parse(params.row.contactFaxNo); + + let contact = ""; + if (phone) { + contact = "Phone No.: " + phone?.countryCode + " " + phone?.phoneNumber + } + + if (faxNo) { + if (contact != "") + contact = contact + ", " + contact = contact + "Fax No.:" + faxNo?.countryCode + " " + faxNo?.faxNumber + } + + return (<> + {params?.value}
    + {contact} + ); + } + }, + { + id: 'remarks', + field: 'remarks', + headerName: 'Remarks', + flex: 3, + }, + { + id: 'status', + field: 'status', + headerName: 'Status', + width: 100, + renderCell: (params) => { + return [StatusUtils.getStatusEng(params)] + }, + }, + { + field: 'actions', + type: 'actions', + headerName: '', + width: 100, + cellClassName: 'actions', + renderCell: () => { + return ; + }, + } + ]; + + + return ( +
    + + +
    + ); +} diff --git a/src/pages/PublicNoticeSearch_GLD/SearchForm.js b/src/pages/PublicNoticeSearch_GLD/SearchForm.js new file mode 100644 index 0000000..0986703 --- /dev/null +++ b/src/pages/PublicNoticeSearch_GLD/SearchForm.js @@ -0,0 +1,193 @@ +// material-ui +import { + Button, + CardContent, + Grid, TextField, + Autocomplete +} from '@mui/material'; +import MainCard from "components/MainCard"; +import { useForm } from "react-hook-form"; +import * as React from "react"; +import * as ComboData from "utils/ComboData"; +// ==============================|| DASHBOARD - DEFAULT ||============================== // + + +const SearchPublicNoticeForm = ({ applySearch, orgComboData }) => { + + const [type, setType] = React.useState([]); + const [status, setStatus] = React.useState(); + const [orgId, setOrgId] = React.useState(); + const [orgCombo, setOrgCombo] = React.useState(); + + + const { reset, register, handleSubmit } = useForm() + const onSubmit = (data) => { + + let typeArray = []; + + for (let i = 0; i < type.length; i++) { + typeArray.push(type[i].label); + } + + const temp = { + appNo: data.appNo, + dateFrom: data.dateFrom, + dateTo: data.dateTo, + contact: data.contact, + status: status?.type, + orgId:orgId?.key, + }; + applySearch(temp); + }; + + React.useEffect(()=>{ + if(orgComboData && orgComboData.length>0){ + setOrgCombo(orgComboData); + } + },[orgComboData]); + + function resetForm() { + setType([]); + setStatus(); + setOrgId(); + reset(); + } + + return ( + + +
    + {/*row 1*/} + + + Search Form + + + + {/*row 2*/} + + + + + + + + + + + + + + + + + + + { + if (newValue !== null) { + setStatus(newValue); + } + }} + renderInput={(params) => ( + + )} + /> + + + + option.label || ""} + onChange={(event, newValue) => { + if (newValue !== null) { + setOrgId(newValue); + } + }} + renderInput={(params) => ( + + )} + /> + + + + + + {/*last row*/} + + + + + + + + + + +
    +
    + ); +}; + +export default SearchPublicNoticeForm; diff --git a/src/pages/PublicNoticeSearch_GLD/index.js b/src/pages/PublicNoticeSearch_GLD/index.js new file mode 100644 index 0000000..cc7673b --- /dev/null +++ b/src/pages/PublicNoticeSearch_GLD/index.js @@ -0,0 +1,90 @@ +// material-ui +import { + Grid +} 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 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'))); + +// ==============================|| DASHBOARD - DEFAULT ||============================== // + +const UserSearchPage_Individual = () => { + + const [record,setRecord] = React.useState([]); + const [orgCombo,setOrgCombo] = React.useState([]); + const [searchCriteria, setSearchCriteria] = React.useState({}); + const [onReady, setOnReady] = React.useState(false); + + React.useEffect(() => { + getUserList(); + getOrgCombo(); + }, []); + + React.useEffect(() => { + setOnReady(true); + }, [orgCombo]); + + React.useEffect(() => { + getUserList(); + }, [searchCriteria]); + + function getUserList(){ + HttpUtils.get({ + url: UrlUtils.GET_PUBLIC_NOTICE_LIST, + params: searchCriteria, + onSuccess: function(responseData){ + setRecord(responseData); + } + }); + } + + function getOrgCombo(){ + HttpUtils.get({ + url: UrlUtils.GET_ORG_COMBO, + onSuccess: function(responseData){ + let combo = responseData; + setOrgCombo(combo); + } + }); + } + + function applySearch(input) { + setSearchCriteria(input); + } + + return ( + !onReady ? + + : + + {/*row 1*/} + + + + {/*row 2*/} + + + + + + + + + ); +}; + +export default UserSearchPage_Individual; diff --git a/src/routes/GLDUserRoutes.js b/src/routes/GLDUserRoutes.js index cf9392b..91d3bb9 100644 --- a/src/routes/GLDUserRoutes.js +++ b/src/routes/GLDUserRoutes.js @@ -8,6 +8,7 @@ const MainLayout = Loadable(lazy(() => import('layout/MainLayout'))); // render - dashboard const DashboardDefault = Loadable(lazy(() => import('pages/gldDashboard'))); const ApplicationDetail = Loadable(lazy(() => import('pages/gldApplicationDetailPage'))); +const ApplicationSearch = Loadable(lazy(() => import('pages/PublicNoticeSearch_GLD'))); // ==============================|| MAIN ROUTING ||============================== // const GLDUserRoutes = { @@ -28,6 +29,10 @@ const GLDUserRoutes = { { path: '/application/:id', element: + }, + { + path: '/application/search', + element: } ] }, diff --git a/src/utils/ApiPathConst.js b/src/utils/ApiPathConst.js index 0b5ce85..bdeadd5 100644 --- a/src/utils/ApiPathConst.js +++ b/src/utils/ApiPathConst.js @@ -24,6 +24,8 @@ export const GET_ORG_USER_PATH = apiPath+'/user/org'; export const GET_ORG_PATH = apiPath+'/org'; export const GET_ORG_FROM_USER_PATH = apiPath+'/org/from-user'; export const POST_ORG_SAVE_PATH = apiPath+'/org/save'; +export const GET_ORG_COMBO = apiPath+'/org/combo'; + //File Up/Download diff --git a/src/utils/ComboData.js b/src/utils/ComboData.js index 4956a71..9794148 100644 --- a/src/utils/ComboData.js +++ b/src/utils/ComboData.js @@ -22,6 +22,17 @@ export const publicNoticeStatic = [ { key: 8, label: '已撤銷', type: 'withdrawn' }, ]; +export const publicNoticeStaticEng = [ + { key: 1, label: 'Submitted', type: 'submitted' }, + { key: 2, label: 'Rejected', type: 'rejected' }, + { key: 3, label: 'Cancelled', type: 'cancelled' }, + { key: 4, label: 'Accepted', type: 'accepted' }, + { key: 5, label: 'Confirmed', type: 'confirmed' }, + { key: 6, label: 'Paid', type: 'paid' }, + { key: 7, label: 'Published', type: 'published' }, + { key: 8, label: 'Withdrawn', type: 'withdrawn' }, +]; + export const groupTitle = [ { key: 1, label: 'Private Bill', type: 'A' }, { key: 2, label: 'Companies Ordinance', type: 'B' },