|
@@ -12,37 +12,37 @@ import * as React from "react"; |
|
|
import * as ComboData from "utils/ComboData"; |
|
|
import * as ComboData from "utils/ComboData"; |
|
|
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 {FormattedMessage, useIntl} from "react-intl"; |
|
|
|
|
|
import {PNSPS_BUTTON_THEME} from "../../../themes/buttonConst"; |
|
|
|
|
|
import {ThemeProvider} from "@emotion/react"; |
|
|
|
|
|
|
|
|
import { FormattedMessage, useIntl } from "react-intl"; |
|
|
|
|
|
import { PNSPS_BUTTON_THEME } from "../../../themes/buttonConst"; |
|
|
|
|
|
import { ThemeProvider } from "@emotion/react"; |
|
|
import { makeStyles } from '@mui/styles'; |
|
|
import { makeStyles } from '@mui/styles'; |
|
|
|
|
|
|
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
// ==============================|| DASHBOARD - DEFAULT ||============================== // |
|
|
const useStyles = makeStyles(() => ({ |
|
|
const useStyles = makeStyles(() => ({ |
|
|
root: { |
|
|
root: { |
|
|
position: "relative" |
|
|
|
|
|
|
|
|
position: "relative" |
|
|
}, |
|
|
}, |
|
|
display: { |
|
|
display: { |
|
|
position: "absolute", |
|
|
|
|
|
top: 2, |
|
|
|
|
|
left: 12, |
|
|
|
|
|
bottom: 2, |
|
|
|
|
|
background: "white", |
|
|
|
|
|
pointerEvents: "none", |
|
|
|
|
|
right: 50, |
|
|
|
|
|
display: "flex", |
|
|
|
|
|
alignItems: "center" |
|
|
|
|
|
|
|
|
position: "absolute", |
|
|
|
|
|
top: 2, |
|
|
|
|
|
left: 12, |
|
|
|
|
|
bottom: 2, |
|
|
|
|
|
background: "white", |
|
|
|
|
|
pointerEvents: "none", |
|
|
|
|
|
right: 50, |
|
|
|
|
|
display: "flex", |
|
|
|
|
|
alignItems: "center" |
|
|
}, |
|
|
}, |
|
|
})); |
|
|
|
|
|
|
|
|
})); |
|
|
|
|
|
|
|
|
const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
}) => { |
|
|
}) => { |
|
|
|
|
|
|
|
|
const intl = useIntl(); |
|
|
const intl = useIntl(); |
|
|
const { locale } = intl; |
|
|
const { locale } = intl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [type, setType] = React.useState([]); |
|
|
const [type, setType] = React.useState([]); |
|
|
const [issueSelected, setIssueSelected] = React.useState({ key: 0, i18nLabel: 'all', labelCht: '全部', label: 'All', type: 'all' }); |
|
|
|
|
|
|
|
|
const [issueSelected, setIssueSelected] = React.useState({ key: 0, i18nLabel: 'all', labelCht: '全部', label: 'All', type: 'all' }); |
|
|
const [issueCombo, setIssueCombo] = React.useState([]); |
|
|
const [issueCombo, setIssueCombo] = React.useState([]); |
|
|
const [selectedStatus, setSelectedStatus] = React.useState(ComboData.denmandNoteStatus_Public[0]); |
|
|
const [selectedStatus, setSelectedStatus] = React.useState(ComboData.denmandNoteStatus_Public[0]); |
|
|
|
|
|
|
|
@@ -53,58 +53,58 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
React.useEffect(() => { |
|
|
console.log(minDate) |
|
|
console.log(minDate) |
|
|
if (minDate != searchCriteria.dateFrom){ |
|
|
|
|
|
|
|
|
if (minDate != searchCriteria.dateFrom) { |
|
|
setFromDateValue(minDate); |
|
|
setFromDateValue(minDate); |
|
|
} |
|
|
} |
|
|
}, [minDate]); |
|
|
}, [minDate]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
React.useEffect(() => { |
|
|
console.log(maxDate) |
|
|
console.log(maxDate) |
|
|
if (maxDate != searchCriteria.dateTo){ |
|
|
|
|
|
|
|
|
if (maxDate != searchCriteria.dateTo) { |
|
|
setToDateValue(maxDate); |
|
|
setToDateValue(maxDate); |
|
|
} |
|
|
} |
|
|
}, [maxDate]); |
|
|
}, [maxDate]); |
|
|
|
|
|
|
|
|
function FormDateInputComponent({inputRef, ...props }) { |
|
|
|
|
|
|
|
|
function FormDateInputComponent({ inputRef, ...props }) { |
|
|
const classes = useStyles(); |
|
|
const classes = useStyles(); |
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<div className={classes.display}> |
|
|
|
|
|
{DateUtils.dateStr(fromDateValue)=="Invalid Date"? |
|
|
|
|
|
fromDateValue |
|
|
|
|
|
: |
|
|
|
|
|
DateUtils.dateStr(fromDateValue)} |
|
|
|
|
|
</div> |
|
|
|
|
|
<input |
|
|
|
|
|
// className={classes.input} |
|
|
|
|
|
ref={inputRef} |
|
|
|
|
|
{...props} |
|
|
|
|
|
// onChange={handleChange} |
|
|
|
|
|
value={fromDateValue} |
|
|
|
|
|
max= {maxDate} |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<div className={classes.display}> |
|
|
|
|
|
{DateUtils.dateStr(fromDateValue) == "Invalid Date" ? |
|
|
|
|
|
fromDateValue |
|
|
|
|
|
: |
|
|
|
|
|
DateUtils.dateStr(fromDateValue)} |
|
|
|
|
|
</div> |
|
|
|
|
|
<input |
|
|
|
|
|
// className={classes.input} |
|
|
|
|
|
ref={inputRef} |
|
|
|
|
|
{...props} |
|
|
|
|
|
// onChange={handleChange} |
|
|
|
|
|
value={fromDateValue} |
|
|
|
|
|
max={maxDate} |
|
|
|
|
|
/> |
|
|
</> |
|
|
</> |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function ToDateInputComponent({inputRef, ...props }) { |
|
|
|
|
|
|
|
|
function ToDateInputComponent({ inputRef, ...props }) { |
|
|
const classes = useStyles(); |
|
|
const classes = useStyles(); |
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<div className={classes.display}> |
|
|
|
|
|
{DateUtils.dateStr(toDateValue)=="Invalid Date"? |
|
|
|
|
|
toDateValue |
|
|
|
|
|
: |
|
|
|
|
|
DateUtils.dateStr(toDateValue)} |
|
|
|
|
|
</div> |
|
|
|
|
|
<input |
|
|
|
|
|
// className={classes.input} |
|
|
|
|
|
ref={inputRef} |
|
|
|
|
|
{...props} |
|
|
|
|
|
// onChange={handleChange} |
|
|
|
|
|
value={toDateValue} |
|
|
|
|
|
min = {minDate} |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<div className={classes.display}> |
|
|
|
|
|
{DateUtils.dateStr(toDateValue) == "Invalid Date" ? |
|
|
|
|
|
toDateValue |
|
|
|
|
|
: |
|
|
|
|
|
DateUtils.dateStr(toDateValue)} |
|
|
|
|
|
</div> |
|
|
|
|
|
<input |
|
|
|
|
|
// className={classes.input} |
|
|
|
|
|
ref={inputRef} |
|
|
|
|
|
{...props} |
|
|
|
|
|
// onChange={handleChange} |
|
|
|
|
|
value={toDateValue} |
|
|
|
|
|
min={minDate} |
|
|
|
|
|
/> |
|
|
</> |
|
|
</> |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
@@ -119,7 +119,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
typeArray.push(type[i].label); |
|
|
typeArray.push(type[i].label); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if( fromDateValue!="dd / mm / yyyy"&&toDateValue!="dd / mm / yyyy"){ |
|
|
|
|
|
|
|
|
if (fromDateValue != "dd / mm / yyyy" && toDateValue != "dd / mm / yyyy") { |
|
|
sentDateFrom = DateUtils.dateValue(fromDateValue) |
|
|
sentDateFrom = DateUtils.dateValue(fromDateValue) |
|
|
sentDateTo = DateUtils.dateValue(toDateValue) |
|
|
sentDateTo = DateUtils.dateValue(toDateValue) |
|
|
} |
|
|
} |
|
@@ -188,7 +188,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
<CardContent sx={{ px: 2.5, pt: 3 }}> |
|
|
<CardContent sx={{ px: 2.5, pt: 3 }}> |
|
|
<Grid item justifyContent="space-between" alignItems="center" > |
|
|
<Grid item justifyContent="space-between" alignItems="center" > |
|
|
<Typography variant="pnspsFormHeader"> |
|
|
<Typography variant="pnspsFormHeader"> |
|
|
<FormattedMessage id="searchForm"/> |
|
|
|
|
|
|
|
|
<FormattedMessage id="searchForm" /> |
|
|
</Typography> |
|
|
</Typography> |
|
|
</Grid> |
|
|
</Grid> |
|
|
</CardContent> |
|
|
</CardContent> |
|
@@ -212,7 +212,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
}} |
|
|
}} |
|
|
renderInput={(params) => ( |
|
|
renderInput={(params) => ( |
|
|
<TextField {...params} |
|
|
<TextField {...params} |
|
|
label={intl.formatMessage({id: 'gazetteCount'})} |
|
|
|
|
|
|
|
|
label={intl.formatMessage({ id: 'gazetteCount' })} |
|
|
InputLabelProps={{ |
|
|
InputLabelProps={{ |
|
|
shrink: true |
|
|
shrink: true |
|
|
}} |
|
|
}} |
|
@@ -224,9 +224,9 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> |
|
|
<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}> |
|
|
<TextField |
|
|
<TextField |
|
|
fullWidth |
|
|
fullWidth |
|
|
{...register("appNo")} |
|
|
|
|
|
|
|
|
{...register("appNo")} |
|
|
id='appNo' |
|
|
id='appNo' |
|
|
label={intl.formatMessage({id: 'applicationId'})} |
|
|
|
|
|
|
|
|
label={intl.formatMessage({ id: 'applicationId' })} |
|
|
defaultValue={searchCriteria.appNo} |
|
|
defaultValue={searchCriteria.appNo} |
|
|
InputLabelProps={{ |
|
|
InputLabelProps={{ |
|
|
shrink: true |
|
|
shrink: true |
|
@@ -239,7 +239,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
fullWidth |
|
|
fullWidth |
|
|
{...register("dnNo")} |
|
|
{...register("dnNo")} |
|
|
id='dnNo' |
|
|
id='dnNo' |
|
|
label={intl.formatMessage({id: 'paymentRecordId'})} |
|
|
|
|
|
|
|
|
label={intl.formatMessage({ id: 'paymentRecordId' })} |
|
|
defaultValue={searchCriteria.dnNo} |
|
|
defaultValue={searchCriteria.dnNo} |
|
|
InputLabelProps={{ |
|
|
InputLabelProps={{ |
|
|
shrink: true |
|
|
shrink: true |
|
@@ -253,7 +253,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
{...register("dateFrom")} |
|
|
{...register("dateFrom")} |
|
|
id="dateFrom" |
|
|
id="dateFrom" |
|
|
type="date" |
|
|
type="date" |
|
|
label={intl.formatMessage({id: 'sendDateFrom'})} |
|
|
|
|
|
|
|
|
label={intl.formatMessage({ id: 'sendDateFrom' })} |
|
|
defaultValue={searchCriteria.dateFrom} |
|
|
defaultValue={searchCriteria.dateFrom} |
|
|
// InputProps={{ inputProps: { max: maxDate } }} |
|
|
// InputProps={{ inputProps: { max: maxDate } }} |
|
|
InputProps={{ |
|
|
InputProps={{ |
|
@@ -276,7 +276,8 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
shrink: true |
|
|
shrink: true |
|
|
}} |
|
|
}} |
|
|
{...register("dateTo")} |
|
|
{...register("dateTo")} |
|
|
InputProps={{ inputComponent: ToDateInputComponent, |
|
|
|
|
|
|
|
|
InputProps={{ |
|
|
|
|
|
inputComponent: ToDateInputComponent, |
|
|
inputProps: { min: minDate } |
|
|
inputProps: { min: minDate } |
|
|
}} |
|
|
}} |
|
|
onChange={(newValue) => { |
|
|
onChange={(newValue) => { |
|
@@ -284,7 +285,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
}} |
|
|
}} |
|
|
id="dateTo" |
|
|
id="dateTo" |
|
|
type="date" |
|
|
type="date" |
|
|
label={intl.formatMessage({id: 'sendDateTo'})} |
|
|
|
|
|
|
|
|
label={intl.formatMessage({ id: 'sendDateTo' })} |
|
|
defaultValue={searchCriteria.dateTo} |
|
|
defaultValue={searchCriteria.dateTo} |
|
|
/> |
|
|
/> |
|
|
</Grid> |
|
|
</Grid> |
|
@@ -296,8 +297,8 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
id="status" |
|
|
id="status" |
|
|
size="small" |
|
|
size="small" |
|
|
options={ComboData.denmandNoteStatus_Public} |
|
|
options={ComboData.denmandNoteStatus_Public} |
|
|
getOptionLabel={(option) => option?.i18nLabel? intl.formatMessage({ id: option.i18nLabel }) : ""} |
|
|
|
|
|
inputValue={selectedStatus?.i18nLabel? intl.formatMessage({ id: selectedStatus.i18nLabel }) : ""} |
|
|
|
|
|
|
|
|
getOptionLabel={(option) => option?.i18nLabel ? intl.formatMessage({ id: option.i18nLabel }) : ""} |
|
|
|
|
|
inputValue={selectedStatus?.i18nLabel ? intl.formatMessage({ id: selectedStatus.i18nLabel }) : ""} |
|
|
value={selectedStatus} |
|
|
value={selectedStatus} |
|
|
onChange={(event, newValue) => { |
|
|
onChange={(event, newValue) => { |
|
|
if (newValue !== null) { |
|
|
if (newValue !== null) { |
|
@@ -307,7 +308,7 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
renderInput={(params) => ( |
|
|
renderInput={(params) => ( |
|
|
<TextField |
|
|
<TextField |
|
|
{...params} |
|
|
{...params} |
|
|
label={intl.formatMessage({id: 'status'})} |
|
|
|
|
|
|
|
|
label={intl.formatMessage({ id: 'status' })} |
|
|
/> |
|
|
/> |
|
|
)} |
|
|
)} |
|
|
InputLabelProps={{ |
|
|
InputLabelProps={{ |
|
@@ -323,13 +324,13 @@ const SearchDemandNoteForm = ({ applySearch, searchCriteria, issueComboData |
|
|
{/*last row*/} |
|
|
{/*last row*/} |
|
|
<Grid container maxWidth justifyContent="flex-end"> |
|
|
<Grid container maxWidth justifyContent="flex-end"> |
|
|
<ThemeProvider theme={PNSPS_BUTTON_THEME}> |
|
|
<ThemeProvider theme={PNSPS_BUTTON_THEME}> |
|
|
<Grid item sx={{mr: 3, mb: 3}}> |
|
|
|
|
|
|
|
|
<Grid item sx={{ mr: 3, mb: 3 }}> |
|
|
<Button |
|
|
<Button |
|
|
color="cancel" |
|
|
color="cancel" |
|
|
variant="contained" |
|
|
variant="contained" |
|
|
onClick={resetForm} |
|
|
onClick={resetForm} |
|
|
> |
|
|
> |
|
|
<FormattedMessage id="reset"/> |
|
|
|
|
|
|
|
|
<FormattedMessage id="reset" /> |
|
|
</Button> |
|
|
</Button> |
|
|
</Grid> |
|
|
</Grid> |
|
|
|
|
|
|
|
|