| @@ -23,6 +23,7 @@ const LoadingComponent = Loadable(lazy(() => import('../extra-pages/LoadingCompo | |||||
| import ContentPasteSearchIcon from '@mui/icons-material/ContentPasteSearch'; | import ContentPasteSearchIcon from '@mui/icons-material/ContentPasteSearch'; | ||||
| import CheckCircleOutline from '@mui/icons-material/CheckCircleOutline'; | import CheckCircleOutline from '@mui/icons-material/CheckCircleOutline'; | ||||
| import HighlightOff from '@mui/icons-material/HighlightOff'; | import HighlightOff from '@mui/icons-material/HighlightOff'; | ||||
| import {useNavigate} from "react-router-dom"; | |||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
| const ClientDetailCard = ( | const ClientDetailCard = ( | ||||
| @@ -39,6 +40,7 @@ const ClientDetailCard = ( | |||||
| const {register, | const {register, | ||||
| // getValues | // getValues | ||||
| } = useForm() | } = useForm() | ||||
| const navigate = useNavigate() | |||||
| useEffect(() => { | useEffect(() => { | ||||
| //if user data from parent are not null | //if user data from parent are not null | ||||
| @@ -56,6 +58,13 @@ const ClientDetailCard = ( | |||||
| } | } | ||||
| }, [currentApplicationDetailData]); | }, [currentApplicationDetailData]); | ||||
| const handleViewClick = () => () => { | |||||
| console.log(currentApplicationDetailData) | |||||
| currentApplicationDetailData.type == "ORG"? | |||||
| navigate('/orgUser/'+ currentApplicationDetailData.id): | |||||
| navigate('/indUser/'+ currentApplicationDetailData.id); | |||||
| }; | |||||
| // useEffect(() => { | // useEffect(() => { | ||||
| // //upload latest data to parent | // //upload latest data to parent | ||||
| // const values = getValues(); | // const values = getValues(); | ||||
| @@ -86,7 +95,7 @@ const ClientDetailCard = ( | |||||
| <Button | <Button | ||||
| // size="large" | // size="large" | ||||
| variant="contained" | variant="contained" | ||||
| // onClick={handleNewUserClick} | |||||
| onClick={handleViewClick()} | |||||
| sx={{ | sx={{ | ||||
| textTransform: 'capitalize', | textTransform: 'capitalize', | ||||
| alignItems: 'end', | alignItems: 'end', | ||||
| @@ -102,7 +102,7 @@ const DashboardDefault = () => { | |||||
| </Grid> | </Grid> | ||||
| <Grid item xs={12}> | <Grid item xs={12}> | ||||
| <Box xs={12} ml={4} mt={3}> | <Box xs={12} ml={4} mt={3}> | ||||
| <TabTableDetail /> | |||||
| <TabTableDetail applicationDetailData={applicationDetailData}/> | |||||
| </Box> | </Box> | ||||
| </Grid> | </Grid> | ||||
| </Grid> | </Grid> | ||||
| @@ -17,13 +17,13 @@ export default function BaseGrid({rows}) { | |||||
| { | { | ||||
| id: 'appNo', | id: 'appNo', | ||||
| field: 'appNo', | field: 'appNo', | ||||
| headerName: '申請編號', | |||||
| headerName: 'Application No.', | |||||
| flex: 1, | flex: 1, | ||||
| }, | }, | ||||
| { | { | ||||
| id: 'created', | id: 'created', | ||||
| field: 'created', | field: 'created', | ||||
| headerName: '提交日期', | |||||
| headerName: 'Created', | |||||
| flex: 1, | flex: 1, | ||||
| valueGetter:(params)=>{ | valueGetter:(params)=>{ | ||||
| return DateUtils.datetimeStr(params?.value); | return DateUtils.datetimeStr(params?.value); | ||||
| @@ -32,7 +32,7 @@ export default function BaseGrid({rows}) { | |||||
| { | { | ||||
| id: 'contactPerson', | id: 'contactPerson', | ||||
| field: 'contactPerson', | field: 'contactPerson', | ||||
| headerName: '聯絡人', | |||||
| headerName: 'Contact Person', | |||||
| flex: 2, | flex: 2, | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| let phone = JSON.parse(params.row.contactTelNo); | let phone = JSON.parse(params.row.contactTelNo); | ||||
| @@ -58,7 +58,7 @@ export default function BaseGrid({rows}) { | |||||
| { | { | ||||
| id: 'remarks', | id: 'remarks', | ||||
| field: 'remarks', | field: 'remarks', | ||||
| headerName: '我的備註', | |||||
| headerName: 'remarks', | |||||
| flex: 3, | flex: 3, | ||||
| }, | }, | ||||
| { | { | ||||
| @@ -0,0 +1,76 @@ | |||||
| // 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 "./PublicNoteStatusUtils"; | |||||
| // ==============================|| EVENT TABLE ||============================== // | |||||
| export default function ProofTab({rows}) { | |||||
| const [rowModesModel] = React.useState({}); | |||||
| const columns = [ | |||||
| { | |||||
| id: 'proofRef', | |||||
| field: 'proofRef', | |||||
| headerName: 'Proof Ref.', | |||||
| flex: 1, | |||||
| }, | |||||
| { | |||||
| id: 'proofSent', | |||||
| field: 'proofSent', | |||||
| headerName: 'Proof Return', | |||||
| flex: 1, | |||||
| }, | |||||
| { | |||||
| id: 'proofReturn', | |||||
| field: 'proofReturn', | |||||
| headerName: 'Proof Return', | |||||
| flex: 1, | |||||
| }, | |||||
| { | |||||
| id: 'status', | |||||
| field: 'status', | |||||
| headerName: 'Status', | |||||
| flex: 1, | |||||
| }, | |||||
| { | |||||
| id: 'fee', | |||||
| field: 'fee', | |||||
| headerName: 'Fee (HKD)', | |||||
| flex: 2, | |||||
| }, | |||||
| { | |||||
| field: 'detail', | |||||
| type: 'actions', | |||||
| headerName: '', | |||||
| width: 50, | |||||
| cellClassName: 'actions', | |||||
| renderCell: () => { | |||||
| return <Button onClick={()=>{}}>查看詳細</Button>; | |||||
| }, | |||||
| } | |||||
| ]; | |||||
| return ( | |||||
| <div style={{height:'20%', width: '100%'}}> | |||||
| <DataGrid | |||||
| rows={rows} | |||||
| columns={columns} | |||||
| editMode="row" | |||||
| rowModesModel={rowModesModel} | |||||
| initialState={{ | |||||
| pagination: { | |||||
| paginationModel: {page: 0, pageSize: 5}, | |||||
| }, | |||||
| }} | |||||
| pageSizeOptions={[5, 10]} | |||||
| autoHeight = {true} | |||||
| /> | |||||
| </div> | |||||
| ); | |||||
| } | |||||
| @@ -0,0 +1,64 @@ | |||||
| // material-ui | |||||
| import * as React from 'react'; | |||||
| import { | |||||
| DataGrid, | |||||
| } from "@mui/x-data-grid"; | |||||
| // import dayjs from "dayjs"; | |||||
| // import { | |||||
| // Button | |||||
| // } from '@mui/material'; | |||||
| // import * as DateUtils from "utils/DateUtils" | |||||
| import * as StatusUtils from "../../PublicNotice/ListPanel/PublicNoteStatusUtils"; | |||||
| // ==============================|| EVENT TABLE ||============================== // | |||||
| export default function StatusHistoryTab({rows}) { | |||||
| const [rowModesModel] = React.useState({}); | |||||
| const columns = [ | |||||
| { | |||||
| id: 'created', | |||||
| field: 'created', | |||||
| headerName: 'Date', | |||||
| valueGetter: (params) => { | |||||
| const value = params.value | |||||
| return value[0]+"/"+value[1]+"/"+value[2]+" "+value[3]+":"+value[4]+":"+value[5] | |||||
| }, | |||||
| // valueFormatter: (params) => dayjs(params.value).format('DD/MM/YYYY'), | |||||
| flex: 1, | |||||
| }, | |||||
| { | |||||
| id: 'createdBy', | |||||
| field: 'createdBy', | |||||
| headerName: 'Changed By', | |||||
| flex: 1, | |||||
| }, | |||||
| { | |||||
| id: 'status', | |||||
| field: 'status', | |||||
| headerName: 'Status', | |||||
| flex: 1, | |||||
| renderCell: (params) => { | |||||
| return [StatusUtils.getStatusEng(params)] | |||||
| }, | |||||
| }, | |||||
| ]; | |||||
| return ( | |||||
| <div style={{height:'20%', width: '100%'}}> | |||||
| <DataGrid | |||||
| rows={rows} | |||||
| columns={columns} | |||||
| editMode="row" | |||||
| rowModesModel={rowModesModel} | |||||
| initialState={{ | |||||
| pagination: { | |||||
| paginationModel: {page: 0, pageSize: 5}, | |||||
| }, | |||||
| }} | |||||
| pageSizeOptions={[5, 10]} | |||||
| autoHeight = {true} | |||||
| /> | |||||
| </div> | |||||
| ); | |||||
| } | |||||
| @@ -9,7 +9,7 @@ import { | |||||
| import { TabPanel, TabContext, TabList } from '@mui/lab'; | import { TabPanel, TabContext, TabList } from '@mui/lab'; | ||||
| import { | import { | ||||
| // useEffect, | |||||
| useEffect, | |||||
| useState } from "react"; | useState } from "react"; | ||||
| // import { useNavigate } from "react-router-dom"; | // import { useNavigate } from "react-router-dom"; | ||||
| import * as React from "react"; | import * as React from "react"; | ||||
| @@ -19,20 +19,20 @@ import * as React from "react"; | |||||
| import Loadable from 'components/Loadable'; | import Loadable from 'components/Loadable'; | ||||
| import { lazy } from 'react'; | import { lazy } from 'react'; | ||||
| const BaseGrid = Loadable(lazy(() => import('./BaseGrid'))); | const BaseGrid = Loadable(lazy(() => import('./BaseGrid'))); | ||||
| const PendingPaymentTab = Loadable(lazy(() => import('./PendingPaymentTab'))); | |||||
| const StatusHistoryTab = Loadable(lazy(() => import('./StatusHistoryTab'))); | |||||
| const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | const LoadingComponent = Loadable(lazy(() => import('../../extra-pages/LoadingComponent'))); | ||||
| // const SearchTab = Loadable(lazy(() => import('./SearchPublicNoticeTab'))); | |||||
| const ProofTab = Loadable(lazy(() => import('./ProofTab'))); | |||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
| const PublicNotice = () => { | |||||
| const PublicNotice = ({applicationDetailData}) => { | |||||
| const [submittedList, ] = useState([]); | const [submittedList, ] = useState([]); | ||||
| const [inProgressList, ] = useState([]); | const [inProgressList, ] = useState([]); | ||||
| const [pendingPaymentList, ] = useState([]); | |||||
| const [isLoading,] = useState(false); | |||||
| const [onReady,setOnReady] = useState(false); | |||||
| const [selectedTab, setSelectedTab] = useState("1"); | const [selectedTab, setSelectedTab] = useState("1"); | ||||
| // const navigate = useNavigate(); | // const navigate = useNavigate(); | ||||
| const [statusHistoryList, setStatusHistoryList] = useState([]); | |||||
| // useEffect(() => { | // useEffect(() => { | ||||
| @@ -43,18 +43,20 @@ const PublicNotice = () => { | |||||
| window.location.reload(false); | window.location.reload(false); | ||||
| } | } | ||||
| // const loadData = () => { | |||||
| // setLoding(true); | |||||
| // HttpUtils.get({ | |||||
| // url: `${UrlUtils.GET_PUBLIC_NOTICE_LIST_ListByStatus}`, | |||||
| // onSuccess: function (response) { | |||||
| // setSubmittedList(response["submitted"]); | |||||
| // setInProgressList(response["inProgress"]); | |||||
| // setPendingPaymentList(response["pendingPayment"]); | |||||
| // setPendingPublishList(response["pendingPublish"]); | |||||
| // } | |||||
| // }); | |||||
| // }; | |||||
| useEffect(() => { | |||||
| //if user data from parent are not null | |||||
| // console.log(applicationDetailData) | |||||
| if (Object.keys(applicationDetailData).length > 0) { | |||||
| setStatusHistoryList(applicationDetailData.statusHistoryList); | |||||
| } | |||||
| }, [applicationDetailData]); | |||||
| useEffect(() => { | |||||
| //if state data are ready and assign to different field | |||||
| if (statusHistoryList.length > 0) { | |||||
| setOnReady(true); | |||||
| } | |||||
| }, [statusHistoryList]); | |||||
| // useEffect(() => { | // useEffect(() => { | ||||
| // setLoding(false); | // setLoding(false); | ||||
| @@ -69,7 +71,7 @@ const PublicNotice = () => { | |||||
| // } | // } | ||||
| return ( | return ( | ||||
| isLoading ? | |||||
| !onReady ? | |||||
| <LoadingComponent /> | <LoadingComponent /> | ||||
| : | : | ||||
| <Grid container sx={{minHeight: '40vh'}}> | <Grid container sx={{minHeight: '40vh'}}> | ||||
| @@ -78,13 +80,13 @@ const PublicNotice = () => { | |||||
| <TabContext value={selectedTab}> | <TabContext value={selectedTab}> | ||||
| <Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | <Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | ||||
| <TabList onChange={handleChange} aria-label="lab API tabs example"> | <TabList onChange={handleChange} aria-label="lab API tabs example"> | ||||
| <Tab label={"已提交(" + submittedList.length + ")"} value="1" /> | |||||
| <Tab label={"處理中(" + inProgressList.length + ")"} value="2" /> | |||||
| <Tab label={"待付款(" + pendingPaymentList.length + ")"} value="3" /> | |||||
| <Tab label={"Proof(" + submittedList.length + ")"} value="1" /> | |||||
| <Tab label={"Payment(" + inProgressList.length + ")"} value="2" /> | |||||
| <Tab label={"Status History(" + statusHistoryList.length + ")"} value="3" /> | |||||
| </TabList> | </TabList> | ||||
| </Box> | </Box> | ||||
| <TabPanel value="1"> | <TabPanel value="1"> | ||||
| <BaseGrid | |||||
| <ProofTab | |||||
| rows={submittedList} | rows={submittedList} | ||||
| reloadFunction={reloadPage} | reloadFunction={reloadPage} | ||||
| /> | /> | ||||
| @@ -96,8 +98,8 @@ const PublicNotice = () => { | |||||
| /> | /> | ||||
| </TabPanel> | </TabPanel> | ||||
| <TabPanel value="3"> | <TabPanel value="3"> | ||||
| <PendingPaymentTab | |||||
| rows={pendingPaymentList} | |||||
| <StatusHistoryTab | |||||
| rows={statusHistoryList} | |||||
| reloadFunction={reloadPage} | reloadFunction={reloadPage} | ||||
| /> | /> | ||||
| </TabPanel> | </TabPanel> | ||||