Add option to exclude member dues from transactions
This commit is contained in:
parent
247d224a52
commit
a529004ed0
|
@ -509,6 +509,7 @@ class TransactionViewSet(Base, List, Create, Retrieve, Update):
|
||||||
month = self.request.query_params.get('month', '')
|
month = self.request.query_params.get('month', '')
|
||||||
exclude_paypal = self.request.query_params.get('exclude_paypal', '') == 'true'
|
exclude_paypal = self.request.query_params.get('exclude_paypal', '') == 'true'
|
||||||
exclude_snacks = self.request.query_params.get('exclude_snacks', '') == 'true'
|
exclude_snacks = self.request.query_params.get('exclude_snacks', '') == 'true'
|
||||||
|
exclude_dues = self.request.query_params.get('exclude_dues', '') == 'true'
|
||||||
|
|
||||||
if self.action == 'list':
|
if self.action == 'list':
|
||||||
if month:
|
if month:
|
||||||
|
@ -528,6 +529,9 @@ class TransactionViewSet(Base, List, Create, Retrieve, Update):
|
||||||
|
|
||||||
if exclude_snacks:
|
if exclude_snacks:
|
||||||
queryset = queryset.exclude(category='Snacks')
|
queryset = queryset.exclude(category='Snacks')
|
||||||
|
|
||||||
|
if exclude_dues:
|
||||||
|
queryset = queryset.exclude(category='Membership')
|
||||||
return queryset.order_by('-date', '-id')
|
return queryset.order_by('-date', '-id')
|
||||||
else:
|
else:
|
||||||
return queryset.all()
|
return queryset.all()
|
||||||
|
|
|
@ -51,6 +51,7 @@ export function AdminHistoricalTransactions(props) {
|
||||||
const [summary, setSummary] = useState(summaryCache);
|
const [summary, setSummary] = useState(summaryCache);
|
||||||
const [excludePayPal, setExcludePayPal] = useState(false);
|
const [excludePayPal, setExcludePayPal] = useState(false);
|
||||||
const [excludeSnacks, setExcludeSnacks] = useState(true);
|
const [excludeSnacks, setExcludeSnacks] = useState(true);
|
||||||
|
const [excludeDues, setExcludeDues] = useState(false);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
|
@ -61,7 +62,7 @@ export function AdminHistoricalTransactions(props) {
|
||||||
if (loading) return;
|
if (loading) return;
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
const month = input.month.format('YYYY-MM');
|
const month = input.month.format('YYYY-MM');
|
||||||
requester('/transactions/?month=' + month + '&exclude_paypal=' + excludePayPal + '&exclude_snacks=' + excludeSnacks, 'GET', token)
|
requester('/transactions/?month=' + month + '&exclude_paypal=' + excludePayPal + '&exclude_snacks=' + excludeSnacks + '&exclude_dues=' + excludeDues, 'GET', token)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
setError(false);
|
setError(false);
|
||||||
|
@ -100,9 +101,13 @@ export function AdminHistoricalTransactions(props) {
|
||||||
setExcludeSnacks(v.checked);
|
setExcludeSnacks(v.checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleExcludeDues = (e, v) => {
|
||||||
|
setExcludeDues(v.checked);
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
makeRequest();
|
makeRequest();
|
||||||
}, [excludePayPal, excludeSnacks]);
|
}, [excludePayPal, excludeSnacks, excludeDues]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
@ -175,6 +180,13 @@ export function AdminHistoricalTransactions(props) {
|
||||||
checked={excludeSnacks}
|
checked={excludeSnacks}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Checkbox
|
||||||
|
className='filter-option'
|
||||||
|
label='Exclude Dues'
|
||||||
|
onChange={handleExcludeDues}
|
||||||
|
checked={excludeDues}
|
||||||
|
/>
|
||||||
|
|
||||||
<TransactionList transactions={transactions} />
|
<TransactionList transactions={transactions} />
|
||||||
</div>
|
</div>
|
||||||
:
|
:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user