| @@ -1,6 +1,6 @@ | |||||
| // material-ui | // material-ui | ||||
| import { | import { | ||||
| Typography, | |||||
| Typography, useMediaQuery, | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import { | import { | ||||
| isORGLoggedIn, | isORGLoggedIn, | ||||
| @@ -9,12 +9,15 @@ import * as React from 'react'; | |||||
| import * as FormatUtils from "utils/FormatUtils" | import * as FormatUtils from "utils/FormatUtils" | ||||
| import { FiDataGrid } from "components/FiDataGrid"; | import { FiDataGrid } from "components/FiDataGrid"; | ||||
| import * as DateUtils from "utils/DateUtils" | import * as DateUtils from "utils/DateUtils" | ||||
| import {useTheme} from "@emotion/react"; | |||||
| // import * as Utils from "utils/Utils" | // import * as Utils from "utils/Utils" | ||||
| // ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
| export default function SearchPublicNoticeTable({ recordList }) { | export default function SearchPublicNoticeTable({ recordList }) { | ||||
| const [rows, setRows] = React.useState(recordList); | const [rows, setRows] = React.useState(recordList); | ||||
| const [total, setTotal] = React.useState(0); | const [total, setTotal] = React.useState(0); | ||||
| const theme = useTheme(); | |||||
| const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | |||||
| React.useEffect(() => { | React.useEffect(() => { | ||||
| const indexedData = recordList.map((obj, index) => ({ index_number: index + 1, ...obj })); | const indexedData = recordList.map((obj, index) => ({ index_number: index + 1, ...obj })); | ||||
| @@ -41,7 +44,8 @@ export default function SearchPublicNoticeTable({ recordList }) { | |||||
| id: 'appNo', | id: 'appNo', | ||||
| field: 'appNo', | field: 'appNo', | ||||
| headerName:'項目', | headerName:'項目', | ||||
| flex: 1, | |||||
| width: isMdOrLg ? 'auto' : 300, | |||||
| flex: isMdOrLg ? 1 : undefined, | |||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| let appNo = params.row.appNo; | let appNo = params.row.appNo; | ||||
| // console.log(params) | // console.log(params) | ||||
| @@ -76,8 +80,12 @@ export default function SearchPublicNoticeTable({ recordList }) { | |||||
| }, | }, | ||||
| }} | }} | ||||
| /> | /> | ||||
| <Typography align="right" variant= "h3">付款總額: <span style={{ color: "blue", fontWeight: "bold", }}> (HK$) {FormatUtils.currencyFormat(total)}</span></Typography> | |||||
| <Typography align="right" variant="h4" sx={{mr:2}}> | |||||
| 付款總額: | |||||
| <span style={{ color: "blue", fontWeight: "bold", }}> | |||||
| (HK$) {FormatUtils.currencyFormat(total)} | |||||
| </span> | |||||
| </Typography> | |||||
| </div> | </div> | ||||
| ); | ); | ||||
| } | } | ||||
| @@ -1,18 +1,21 @@ | |||||
| // material-ui | // material-ui | ||||
| import * as React from 'react'; | import * as React from 'react'; | ||||
| import { | import { | ||||
| Button | |||||
| Button, useMediaQuery | |||||
| } from '@mui/material'; | } from '@mui/material'; | ||||
| import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
| import * as FormatUtils from "utils/FormatUtils" | import * as FormatUtils from "utils/FormatUtils" | ||||
| import * as PaymentStatus from "utils/statusUtils/PaymentStatus" | import * as PaymentStatus from "utils/statusUtils/PaymentStatus" | ||||
| import { useNavigate } from "react-router-dom"; | import { useNavigate } from "react-router-dom"; | ||||
| import { FiDataGrid } from "components/FiDataGrid"; | import { FiDataGrid } from "components/FiDataGrid"; | ||||
| import {useTheme} from "@emotion/react"; | |||||
| // ==============================|| EVENT TABLE ||============================== // | // ==============================|| EVENT TABLE ||============================== // | ||||
| export default function SearchPublicNoticeTable({ recordList }) { | export default function SearchPublicNoticeTable({ recordList }) { | ||||
| const [rows, setRows] = React.useState(recordList); | const [rows, setRows] = React.useState(recordList); | ||||
| const navigate = useNavigate() | const navigate = useNavigate() | ||||
| const theme = useTheme(); | |||||
| const isMdOrLg = useMediaQuery(theme.breakpoints.up('md')); | |||||
| const _sx = { | const _sx = { | ||||
| padding: "4 2 4 2", | padding: "4 2 4 2", | ||||
| @@ -42,7 +45,8 @@ export default function SearchPublicNoticeTable({ recordList }) { | |||||
| { | { | ||||
| field: 'actions', | field: 'actions', | ||||
| headerName: '付款編號', | headerName: '付款編號', | ||||
| flex: 1, | |||||
| width: isMdOrLg ? 'auto' : 160, | |||||
| flex: isMdOrLg ? 1 : undefined, | |||||
| cellClassName: 'actions', | cellClassName: 'actions', | ||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| return <Button onClick={handleEditClick(params)}><u>{params.row.transNo}</u></Button>; | return <Button onClick={handleEditClick(params)}><u>{params.row.transNo}</u></Button>; | ||||
| @@ -52,7 +56,8 @@ export default function SearchPublicNoticeTable({ recordList }) { | |||||
| id: 'appNos', | id: 'appNos', | ||||
| field: 'appNos', | field: 'appNos', | ||||
| headerName: '申請編號', | headerName: '申請編號', | ||||
| flex: 1, | |||||
| width: isMdOrLg ? 'auto' : 160, | |||||
| flex: isMdOrLg ? 1 : undefined, | |||||
| renderCell: (params) => { | renderCell: (params) => { | ||||
| let appNo = params.row.appNos; | let appNo = params.row.appNos; | ||||
| return <div style={{ margin: 4 }}>{appNo}</div> | return <div style={{ margin: 4 }}>{appNo}</div> | ||||
| @@ -62,7 +67,8 @@ export default function SearchPublicNoticeTable({ recordList }) { | |||||
| id: 'transDateTime', | id: 'transDateTime', | ||||
| field: 'transDateTime', | field: 'transDateTime', | ||||
| headerName: '付款日期', | headerName: '付款日期', | ||||
| flex: 1, | |||||
| width: isMdOrLg ? 'auto' : 160, | |||||
| flex: isMdOrLg ? 1 : undefined, | |||||
| valueGetter: (params) => { | valueGetter: (params) => { | ||||
| return DateUtils.datetimeStr(params?.value); | return DateUtils.datetimeStr(params?.value); | ||||
| } | } | ||||
| @@ -11,6 +11,8 @@ import { useForm } from "react-hook-form"; | |||||
| import * as React from "react"; | import * as React from "react"; | ||||
| import * as DateUtils from "utils/DateUtils"; | import * as DateUtils from "utils/DateUtils"; | ||||
| import * as ComboData from "utils/ComboData"; | import * as ComboData from "utils/ComboData"; | ||||
| import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; | |||||
| import {ThemeProvider} from "@emotion/react"; | |||||
| // ==============================|| DASHBOARD - DEFAULT ||============================== // | // ==============================|| DASHBOARD - DEFAULT ||============================== // | ||||
| @@ -72,7 +74,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||||
| {/*row 2*/} | {/*row 2*/} | ||||
| <Grid container alignItems={"center"}> | <Grid container alignItems={"center"}> | ||||
| <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
| <Grid item xs={12} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
| <TextField | <TextField | ||||
| fullWidth | fullWidth | ||||
| {...register("code")} | {...register("code")} | ||||
| @@ -85,43 +87,51 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||||
| /> | /> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
| <TextField | |||||
| fullWidth | |||||
| {...register("dateFrom")} | |||||
| id="dateFrom" | |||||
| type="date" | |||||
| label="付款日期(從)" | |||||
| defaultValue={searchCriteria.dateFrom} | |||||
| InputProps={{ inputProps: { max: maxDate } }} | |||||
| onChange={(newValue) => { | |||||
| setMinDate(DateUtils.dateStr(newValue)); | |||||
| }} | |||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| /> | |||||
| </Grid> | |||||
| <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
| <TextField | |||||
| fullWidth | |||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| {...register("dateTo")} | |||||
| InputProps={{ inputProps: { min: minDate } }} | |||||
| onChange={(newValue) => { | |||||
| setMaxDate(DateUtils.dateStr(newValue)); | |||||
| }} | |||||
| id="dateTo" | |||||
| type="date" | |||||
| label="付款日期(到)" | |||||
| defaultValue={searchCriteria.dateTo} | |||||
| /> | |||||
| <Grid item xs={12} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
| <Grid container> | |||||
| <Grid item xs={5.25} s={5.25} md={5.25} lg={5.5}> | |||||
| <TextField | |||||
| fullWidth | |||||
| {...register("dateFrom")} | |||||
| id="dateFrom" | |||||
| type="date" | |||||
| label="付款日期(從)" | |||||
| defaultValue={searchCriteria.dateFrom} | |||||
| InputProps={{ inputProps: { max: maxDate } }} | |||||
| onChange={(newValue) => { | |||||
| setMinDate(DateUtils.dateStr(newValue)); | |||||
| }} | |||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| /> | |||||
| </Grid> | |||||
| <Grid item xs={1.5} s={1.5} md={1.5} lg={1} sx={{mt:1.3, display: 'flex', justifyContent:"center", alignItems: 'flex-start'}}> | |||||
| 到 | |||||
| </Grid> | |||||
| <Grid item xs={5.25} s={5.25} md={5.25} lg={5.5}> | |||||
| <TextField | |||||
| fullWidth | |||||
| InputLabelProps={{ | |||||
| shrink: true | |||||
| }} | |||||
| {...register("dateTo")} | |||||
| InputProps={{ inputProps: { min: minDate } }} | |||||
| onChange={(newValue) => { | |||||
| setMaxDate(DateUtils.dateStr(newValue)); | |||||
| }} | |||||
| id="dateTo" | |||||
| type="date" | |||||
| //label="付款日期(到)" | |||||
| defaultValue={searchCriteria.dateTo} | |||||
| /> | |||||
| </Grid> | |||||
| </Grid> | |||||
| </Grid> | </Grid> | ||||
| <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
| <Grid item xs={12} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
| <TextField | <TextField | ||||
| fullWidth | fullWidth | ||||
| {...register("tarnsNo")} | {...register("tarnsNo")} | ||||
| @@ -134,11 +144,12 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||||
| /> | /> | ||||
| </Grid> | </Grid> | ||||
| <Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
| <Grid item xs={12} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
| <Autocomplete | <Autocomplete | ||||
| {...register("status")} | {...register("status")} | ||||
| disablePortal={false} | disablePortal={false} | ||||
| id="status" | id="status" | ||||
| size="small" | |||||
| filterOptions={(options) => options} | filterOptions={(options) => options} | ||||
| options={ComboData.paymentStatus} | options={ComboData.paymentStatus} | ||||
| value={status} | value={status} | ||||
| @@ -165,32 +176,25 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { | |||||
| {/*last row*/} | {/*last row*/} | ||||
| <Grid container maxWidth justifyContent="flex-end"> | <Grid container maxWidth justifyContent="flex-end"> | ||||
| <Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}> | |||||
| <ThemeProvider theme={PNSPS_BUTTON_THEME}> | |||||
| <Grid item sx={{mr: 3, mb: 3 }}> | |||||
| <Button | <Button | ||||
| size="large" | |||||
| variant="contained" | variant="contained" | ||||
| onClick={resetForm} | onClick={resetForm} | ||||
| sx={{ | |||||
| textTransform: 'capitalize', | |||||
| alignItems: 'end' | |||||
| }}> | |||||
| <Typography variant="h5">重置</Typography> | |||||
| > | |||||
| 重置 | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| <Grid item sx={{ ml: 3, mr: 3, mb: 3, mt: 3 }}> | |||||
| <Grid item sx={{ ml: 3, mr: 3, mb: 3 }}> | |||||
| <Button | <Button | ||||
| size="large" | |||||
| variant="contained" | variant="contained" | ||||
| type="submit" | type="submit" | ||||
| sx={{ | |||||
| textTransform: 'capitalize', | |||||
| alignItems: 'end' | |||||
| }}> | |||||
| <Typography variant="h5">提交</Typography> | |||||
| > | |||||
| 提交 | |||||
| </Button> | </Button> | ||||
| </Grid> | </Grid> | ||||
| </ThemeProvider> | |||||
| </Grid> | </Grid> | ||||
| </form> | </form> | ||||
| </MainCard> | </MainCard> | ||||