Browse Source

fix bugs

master
Anna Ho 1 year ago
parent
commit
bdfb746c98
2 changed files with 25 additions and 13 deletions
  1. +18
    -1
      src/pages/ProofSearch_Public/DataGrid.js
  2. +7
    -12
      src/pages/ProofSearch_Public/SearchForm.js

+ 18
- 1
src/pages/ProofSearch_Public/DataGrid.js View File

@@ -20,6 +20,23 @@ export default function SearchPublicNoticeTable({ recordList }) {
navigate('/proof/reply/' + params.row.id); navigate('/proof/reply/' + params.row.id);
}; };


const getGroupTitle = (title) => {
switch (title) {
case 'Private Bill':
return "私人帳單";
case 'Companies Ordinance':
return "公司條例";
case 'High Court':
return "高等法院";
case 'Notices':
return "通知";
case 'Miscellaneous (Companies)':
return "其他";
default:
return title;
}
}



const columns = [ const columns = [
{ {
@@ -82,7 +99,7 @@ export default function SearchPublicNoticeTable({ recordList }) {
headerName: '憲報類型', headerName: '憲報類型',
flex: 1, flex: 1,
valueGetter: (params) => { valueGetter: (params) => {
return (params?.value) ? (params?.value) : "";
return getGroupTitle(params?.value);
} }
}, },
{ {


+ 7
- 12
src/pages/ProofSearch_Public/SearchForm.js View File

@@ -17,7 +17,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData
}) => { }) => {


const [type, setType] = React.useState([]); const [type, setType] = React.useState([]);
const [status, setStatus] = React.useState({ key: 0, label: 'All', type: 'all' });
const [status, setStatus] = React.useState(ComboData.proofStatus[0]);
const [issueSelected, setIssueSelected] = React.useState({}); const [issueSelected, setIssueSelected] = React.useState({});
const [issueCombo, setIssueCombo] = React.useState([]); const [issueCombo, setIssueCombo] = React.useState([]);
const [groupSelected, setGroupSelected] = React.useState({}); const [groupSelected, setGroupSelected] = React.useState({});
@@ -42,7 +42,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData
gazettGroup: groupSelected?.type, gazettGroup: groupSelected?.type,
dateFrom: data.dateFrom, dateFrom: data.dateFrom,
dateTo: data.dateTo, dateTo: data.dateTo,
contact: data.contact,
//contact: data.contact,
replyed: (status?.type && status?.type != 'all') ? status?.type : "", replyed: (status?.type && status?.type != 'all') ? status?.type : "",
}; };
applySearch(temp); applySearch(temp);
@@ -57,8 +57,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData


function resetForm() { function resetForm() {
setType([]); setType([]);
setStatus({ key: 0, label: 'All', type: 'all' });
setOrgSelected({});
setStatus(ComboData.proofStatus[0]);
setIssueSelected({}); setIssueSelected({});
setGroupSelected({}); setGroupSelected({});
reset(); reset();
@@ -129,9 +128,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData
inputValue={(issueSelected?.id) ? getIssueLabel(issueSelected) : ""} inputValue={(issueSelected?.id) ? getIssueLabel(issueSelected) : ""}
getOptionLabel={(option)=>getIssueLabel(option)} getOptionLabel={(option)=>getIssueLabel(option)}
onChange={(event, newValue) => { onChange={(event, newValue) => {
if (newValue !== null) {
setIssueSelected(newValue);
}
setIssueSelected(newValue);
}} }}
renderInput={(params) => ( renderInput={(params) => (
<TextField {...params} <TextField {...params}
@@ -154,9 +151,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData
inputValue={(groupSelected?.labelCht)?groupSelected?.labelCht:""} inputValue={(groupSelected?.labelCht)?groupSelected?.labelCht:""}
getOptionLabel={(option)=>option.labelCht} getOptionLabel={(option)=>option.labelCht}
onChange={(event, newValue) => { onChange={(event, newValue) => {
if (newValue !== null) {
setGroupSelected(newValue);
}
setGroupSelected(newValue);
}} }}
renderInput={(params) => ( renderInput={(params) => (
<TextField {...params} <TextField {...params}
@@ -205,7 +200,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData
/> />
</Grid> </Grid>


<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("contact")} {...register("contact")}
@@ -217,7 +212,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria,issueComboData
}} }}
/> />


</Grid>
</Grid> */}


<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 }}>
<Autocomplete <Autocomplete


Loading…
Cancel
Save