Ver código fonte

update app search

master
Anna Ho 1 ano atrás
pai
commit
04e7f551d5
4 arquivos alterados com 94 adições e 14 exclusões
  1. +1
    -0
      src/pages/PublicNotice/ApplyForm/index.js
  2. +76
    -13
      src/pages/PublicNoticeSearch_GLD/SearchForm.js
  3. +15
    -1
      src/pages/PublicNoticeSearch_GLD/index.js
  4. +2
    -0
      src/utils/ApiPathConst.js

+ 1
- 0
src/pages/PublicNotice/ApplyForm/index.js Ver arquivo

@@ -58,6 +58,7 @@ const ApplyForm = () => {
}

function zeroPad(num, places) {
num=num?num:0;
var zero = places - num.toString().length + 1;
return Array(+(zero > 0 && zero)).join("0") + num;
}


+ 76
- 13
src/pages/PublicNoticeSearch_GLD/SearchForm.js Ver arquivo

@@ -13,12 +13,15 @@ import * as DateUtils from "utils/DateUtils";
// ==============================|| DASHBOARD - DEFAULT ||============================== //


const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria }) => {
const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria,issueComboData
}) => {

const [type, setType] = React.useState([]);
const [status, setStatus] = React.useState({ key: 0, label: 'All', type: 'all' });
const [status, setStatus] = React.useState({ key: 0, label: 'All', type: 'all' });
const [orgSelected, setOrgSelected] = React.useState({});
const [orgCombo, setOrgCombo] = React.useState();
const [issueSelected, setIssueSelected] = React.useState({});
const [issueCombo, setIssueCombo] = React.useState([]);

const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom);
const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo);
@@ -38,8 +41,10 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria }) =
dateFrom: data.dateFrom,
dateTo: data.dateTo,
contact: data.contact,
status: (status?.type&&status?.type!= 'all')?status?.type:"",
orgId: (orgSelected?.key&&orgSelected?.key>0)?orgSelected?.key:"",
status: (status?.type && status?.type != 'all') ? status?.type : "",
orgId: (orgSelected?.key && orgSelected?.key > 0) ? orgSelected?.key : "",
issueId: issueSelected?.id,
groupNo: data.groupNo,
};
applySearch(temp);
};
@@ -50,13 +55,34 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria }) =
}
}, [orgComboData]);

React.useEffect(() => {
if (issueComboData && issueComboData.length > 0) {
setIssueCombo(issueComboData);
}
}, [issueComboData]);

function resetForm() {
setType([]);
setStatus({ key: 0, label: 'All', type: 'all' });
setStatus({ key: 0, label: 'All', type: 'all' });
setOrgSelected({});
setIssueSelected({});
reset();
}

function getIssueLabel(data){
if(data=={}) return "";
return data.year
+" Vol. "+zeroPad(data.volume,3)
+", No. "+zeroPad(data.issueNo,2)
+", "+DateUtils.dateFormat(data.issueDate, "D MMM YYYY (ddd)");
}

function zeroPad(num, places) {
num=num?num:0;
var zero = places - num.toString().length + 1;
return Array(+(zero > 0 && zero)).join("0") + num;
}

return (
<MainCard xs={12} md={12} lg={12}
border={false}
@@ -93,8 +119,8 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria }) =
type="date"
label="Submit Date(From)"
defaultValue={searchCriteria.dateFrom}
InputProps={{inputProps: { max: maxDate} }}
onChange={(newValue)=>{
InputProps={{ inputProps: { max: maxDate } }}
onChange={(newValue) => {
setMinDate(DateUtils.dateStr(newValue));
}}
InputLabelProps={{
@@ -110,8 +136,8 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria }) =
shrink: true
}}
{...register("dateTo")}
InputProps={{inputProps: { min: minDate} }}
onChange={(newValue)=>{
InputProps={{ inputProps: { min: minDate } }}
onChange={(newValue) => {
setMaxDate(DateUtils.dateStr(newValue));
}}
id="dateTo"
@@ -132,7 +158,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria }) =
shrink: true
}}
/>
</Grid>

<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
@@ -140,7 +166,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria }) =
{...register("status")}
disablePortal
id="status"
filterOptions={(options)=>options}
filterOptions={(options) => options}
options={ComboData.publicNoticeStaticEng}
value={status}
inputValue={status?.label}
@@ -169,7 +195,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria }) =
id="orgId"
options={orgCombo}
value={orgSelected}
inputValue={(orgSelected?.label)?orgSelected?.label: ""}
inputValue={(orgSelected?.label) ? orgSelected?.label : ""}
onChange={(event, newValue) => {
if (newValue !== null) {
setOrgSelected(newValue);
@@ -183,12 +209,49 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria }) =
}}
/>
)}
/>
</Grid>
: <></>
}

<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
<Autocomplete
{...register("issueId")}
disablePortal
id="issueId"
options={issueCombo}
value={issueSelected}
inputValue={(issueSelected?.id) ? getIssueLabel(issueSelected) : ""}
getOptionLabel={(option)=>getIssueLabel(option)}
onChange={(event, newValue) => {
if (newValue !== null) {
setIssueSelected(newValue);
}
}}
renderInput={(params) => (
<TextField {...params}
label="Gazette Issue"
InputLabelProps={{
shrink: true
}}
/>
)}
/>
</Grid>

<Grid item xs={9} s={6} md={5} lg={3} sx={{ ml: 3, mr: 3, mb: 3 }}>
<TextField
fullWidth
{...register("groupNo")}
id='groupNo'
label="Gazette Code."
defaultValue={searchCriteria.groupNo}
InputLabelProps={{
shrink: true
}}
/>
</Grid>


</Grid>



+ 15
- 1
src/pages/PublicNoticeSearch_GLD/index.js Ver arquivo

@@ -32,6 +32,7 @@ const UserSearchPage_Individual = () => {

const [record,setRecord] = React.useState([]);
const [orgCombo,setOrgCombo] = React.useState([]);
const [issueCombo,setIssueCombo] = React.useState([]);
const [searchCriteria, setSearchCriteria] = React.useState({
dateTo: DateUtils.dateStr(new Date()),
dateFrom: DateUtils.dateStr(new Date().setDate(new Date().getDate()-14)),
@@ -41,11 +42,12 @@ const UserSearchPage_Individual = () => {
React.useEffect(() => {
getUserList();
getOrgCombo();
getIssueCombo();
}, []);

React.useEffect(() => {
setOnReady(true);
}, [orgCombo]);
}, [record]);

React.useEffect(() => {
getUserList();
@@ -71,6 +73,17 @@ const UserSearchPage_Individual = () => {
});
}

function getIssueCombo(){
HttpUtils.get({
url: UrlUtils.GET_ISSUE_COMBO,
onSuccess: function(responseData){
let combo = responseData;
setIssueCombo(combo);
}
});
}

function applySearch(input) {
setSearchCriteria(input);
}
@@ -92,6 +105,7 @@ const UserSearchPage_Individual = () => {
<SearchForm
applySearch={applySearch}
orgComboData={orgCombo}
issueComboData={issueCombo}
searchCriteria={searchCriteria}
/>
</Grid>


+ 2
- 0
src/utils/ApiPathConst.js Ver arquivo

@@ -65,5 +65,7 @@ export const SET_PUBLIC_NOTICE_STATUS_COMPLATED = apiPath+'/application/applicat
export const SET_PUBLIC_NOTICE_STATUS_WITHDRAW = apiPath+'/application/application-detail-status-withdrawn';
export const UPDATE_PUBLIC_NOTICE_APPLY_DETAIL = apiPath+'/application/save';

export const GET_ISSUE_COMBO = apiPath+'/gazette-issue/combo';

//User Group
export const POST_AND_UPDATE_USER_GROUP = apiPath+'/group/save';

Carregando…
Cancelar
Salvar