Display most recent transactions in member info
This commit is contained in:
parent
e1ad30e481
commit
aa6c81c48c
|
@ -25,7 +25,7 @@ class Transaction(models.Model):
|
||||||
recorder = models.ForeignKey(User, related_name='+', blank=True, null=True, on_delete=models.PROTECT)
|
recorder = models.ForeignKey(User, related_name='+', blank=True, null=True, on_delete=models.PROTECT)
|
||||||
|
|
||||||
member_id = models.IntegerField(blank=True, null=True)
|
member_id = models.IntegerField(blank=True, null=True)
|
||||||
date = models.DateTimeField(default=now)
|
date = models.DateField(default=date.today)
|
||||||
amount = models.DecimalField(max_digits=7, decimal_places=2)
|
amount = models.DecimalField(max_digits=7, decimal_places=2)
|
||||||
reference_number = models.CharField(max_length=32, blank=True, null=True)
|
reference_number = models.CharField(max_length=32, blank=True, null=True)
|
||||||
memo = models.TextField(blank=True, null=True)
|
memo = models.TextField(blank=True, null=True)
|
||||||
|
|
|
@ -239,8 +239,16 @@ function MemberInfo(props) {
|
||||||
const user = props.user;
|
const user = props.user;
|
||||||
const member = user.member;
|
const member = user.member;
|
||||||
|
|
||||||
|
const lastTrans = user.transactions.slice(-3);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<Grid stackable>
|
||||||
|
<Grid.Column width={6}>
|
||||||
|
<Image src='https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png' size='small' />
|
||||||
|
</Grid.Column>
|
||||||
|
|
||||||
|
<Grid.Column width={10}>
|
||||||
<Header size='large'>
|
<Header size='large'>
|
||||||
<Icon.Group size='small'>
|
<Icon.Group size='small'>
|
||||||
<Icon name='circle' color='green' />
|
<Icon name='circle' color='green' />
|
||||||
|
@ -250,23 +258,17 @@ function MemberInfo(props) {
|
||||||
|
|
||||||
<p>Preferred Name: {member.preferred_name || '???'}</p>
|
<p>Preferred Name: {member.preferred_name || '???'}</p>
|
||||||
<p>Email: {user.email}</p>
|
<p>Email: {user.email}</p>
|
||||||
|
<p>Status: Current</p>
|
||||||
<Grid stackable>
|
|
||||||
<Grid.Column width={6}>
|
|
||||||
<Image src='https://upload.wikimedia.org/wikipedia/commons/8/89/Portrait_Placeholder.png' size='small' />
|
|
||||||
</Grid.Column>
|
</Grid.Column>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid.Column width={10}>
|
<Header size='medium'>Details</Header>
|
||||||
<Table unstackable basic='very'>
|
<Table unstackable basic='very'>
|
||||||
<Table.Body>
|
<Table.Body>
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.Cell>Expiry:</Table.Cell>
|
<Table.Cell>Expiry:</Table.Cell>
|
||||||
<Table.Cell>2099-01-01</Table.Cell>
|
<Table.Cell>2099-01-01</Table.Cell>
|
||||||
</Table.Row>
|
</Table.Row>
|
||||||
<Table.Row>
|
|
||||||
<Table.Cell>Status:</Table.Cell>
|
|
||||||
<Table.Cell>Current</Table.Cell>
|
|
||||||
</Table.Row>
|
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.Cell>Application:</Table.Cell>
|
<Table.Cell>Application:</Table.Cell>
|
||||||
<Table.Cell>{member.application_date || '???'}</Table.Cell>
|
<Table.Cell>{member.application_date || '???'}</Table.Cell>
|
||||||
|
@ -285,8 +287,23 @@ function MemberInfo(props) {
|
||||||
</Table.Row>
|
</Table.Row>
|
||||||
</Table.Body>
|
</Table.Body>
|
||||||
</Table>
|
</Table>
|
||||||
</Grid.Column>
|
|
||||||
</Grid>
|
<Header size='medium'>Latest Transactions</Header>
|
||||||
|
<Table unstackable basic='very'>
|
||||||
|
<Table.Body>
|
||||||
|
{lastTrans.length ?
|
||||||
|
lastTrans.map((x, i) =>
|
||||||
|
<Table.Row key={i}>
|
||||||
|
<Table.Cell>{x.date}</Table.Cell>
|
||||||
|
<Table.Cell>{x.account_type}</Table.Cell>
|
||||||
|
<Table.Cell>${x.amount}</Table.Cell>
|
||||||
|
</Table.Row>
|
||||||
|
)
|
||||||
|
:
|
||||||
|
<p>None</p>
|
||||||
|
}
|
||||||
|
</Table.Body>
|
||||||
|
</Table>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -322,7 +339,7 @@ function App() {
|
||||||
setUserCache(false);
|
setUserCache(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
const menuName = user.member && user.member.preferred_name || 'Me';
|
const menuName = user && user.member && user.member.preferred_name || 'Me';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user