Filter signup helper search by active members
This commit is contained in:
parent
3dc450437b
commit
4173f00459
|
@ -309,6 +309,7 @@ export function AccountForm(props) {
|
|||
onChange={handleValues}
|
||||
initial={''}
|
||||
autofocus={''}
|
||||
filterActive={true}
|
||||
/>
|
||||
</Form.Field>}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ const memberSorts = {
|
|||
};
|
||||
|
||||
export function MembersDropdown(props) {
|
||||
const { token, name, onChange, value, initial, autofocus } = props;
|
||||
const { token, name, onChange, value, initial, autofocus, filterActive } = props;
|
||||
const [response, setResponse] = useState({ results: [] });
|
||||
const searchDefault = {seq: 0, q: initial || '', sort: 'newest_active'};
|
||||
const [search, setSearch] = useState(searchDefault);
|
||||
|
@ -36,7 +36,11 @@ export function MembersDropdown(props) {
|
|||
requester('/search/', 'POST', token, search)
|
||||
.then(res => {
|
||||
if (!search.seq || res.seq > response.seq) {
|
||||
setResponse(res);
|
||||
if (filterActive) {
|
||||
setResponse({...res, results: res.results.filter(x => ['Prepaid', 'Current', 'Due', 'Overdue'].includes(x.member.status))});
|
||||
} else {
|
||||
setResponse(res);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user