Add checkbox to exclude PayPal transactions from list
This commit is contained in:
parent
05642c01a3
commit
38500b3c94
|
@ -43,16 +43,23 @@ export function AdminReportedTransactions(props) {
|
||||||
};
|
};
|
||||||
|
|
||||||
let transactionsCache = false;
|
let transactionsCache = false;
|
||||||
|
let excludePayPalCache = false;
|
||||||
|
|
||||||
export function AdminHistoricalTransactions(props) {
|
export function AdminHistoricalTransactions(props) {
|
||||||
const { token, user } = props;
|
const { token, user } = props;
|
||||||
const [input, setInput] = useState({ month: moment() });
|
const [input, setInput] = useState({ month: moment() });
|
||||||
const [transactions, setTransactions] = useState(transactionsCache);
|
const [transactions, setTransactions] = useState(transactionsCache);
|
||||||
|
const [excludePayPal, setExcludePayPal] = useState(excludePayPalCache);
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
|
|
||||||
const handleDatetime = (v) => setInput({ ...input, month: v });
|
const handleDatetime = (v) => setInput({ ...input, month: v });
|
||||||
|
|
||||||
|
const handleExcludePayPal = (e, v) => {
|
||||||
|
setExcludePayPal(v.checked);
|
||||||
|
excludePayPalCache = v.checked;
|
||||||
|
};
|
||||||
|
|
||||||
const handleSubmit = (e) => {
|
const handleSubmit = (e) => {
|
||||||
if (loading) return;
|
if (loading) return;
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
@ -97,7 +104,14 @@ export function AdminHistoricalTransactions(props) {
|
||||||
{!!transactions.length &&
|
{!!transactions.length &&
|
||||||
<Header size='small'>{moment(transactions[0].date, 'YYYY-MM-DD').format('MMMM YYYY')} Transactions</Header>
|
<Header size='small'>{moment(transactions[0].date, 'YYYY-MM-DD').format('MMMM YYYY')} Transactions</Header>
|
||||||
}
|
}
|
||||||
<TransactionList transactions={transactions} />
|
|
||||||
|
<Checkbox
|
||||||
|
label='Exclude PayPal'
|
||||||
|
onChange={handleExcludePayPal}
|
||||||
|
checked={excludePayPal}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TransactionList transactions={transactions.filter(x => !excludePayPal || x.account_type !== 'PayPal')} />
|
||||||
</div>
|
</div>
|
||||||
:
|
:
|
||||||
<p>Error loading transactions.</p>
|
<p>Error loading transactions.</p>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user