@ -14,8 +14,9 @@ function MemberInfo(props) {
const user = props . user ;
const member = user . member ;
const lastTrans = user . transactions && user . transactions . slice ( 0 , 3 ) ;
const lastCard = user . cards && user . cards . sort ( ( a , b ) => a . last _seen < b . last _seen ) [ 0 ] ;
const lastTrans = user . transactions ? . slice ( 0 , 3 ) ;
const lastTrain = user . training ? . sort ( ( a , b ) => a . session . datetime < b . session . datetime ? 1 : - 1 ) . slice ( 0 , 3 ) ;
const lastCard = user . cards ? . sort ( ( a , b ) => a . last _seen < b . last _seen ) [ 0 ] ;
return (
< div >
@ -47,7 +48,7 @@ function MemberInfo(props) {
< / T a b l e . R o w >
< Table . Row >
< Table . Cell > Expiry : < / T a b l e . C e l l >
< Table . Cell > { member . expire _date } < / T a b l e . C e l l >
< Table . Cell > { moment ( m ember . expire _date ) . format ( 'll' ) } < / T a b l e . C e l l >
< / T a b l e . R o w >
< / T a b l e . B o d y >
< / B a s i c T a b l e >
@ -82,29 +83,75 @@ function MemberInfo(props) {
< QRCode value = { siteUrl + '/subscribe?monthly_fees=' + user . member . monthly _fees + '&id=' + user . member . id } / >
< / R e a c t . F r a g m e n t > }
< Header size = 'medium' > Latest Training < / H e a d e r >
< BasicTable >
< Table . Body >
{ lastTrain . length ?
lastTrain . map ( x =>
< Table . Row key = { x . id } >
< Table . Cell style = { { minWidth : '8rem' } } >
< Link to = { '/classes/' + x . session . id } > { moment ( x . session . datetime ) . tz ( 'America/Edmonton' ) . format ( 'll' ) } < / L i n k >
< / T a b l e . C e l l >
< Table . Cell > { x . session . course _data . name } < / T a b l e . C e l l >
< / T a b l e . R o w >
)
:
< Table . Row > < Table . Cell > None , please sign up for an < Link to = { '/courses/249/' } > Orientation < / L i n k > < / T a b l e . C e l l > < / T a b l e . R o w >
}
{ user . training . length > 3 && < Link to = '/training' > [ more ] < / L i n k > }
< / T a b l e . B o d y >
< / B a s i c T a b l e >
< Header size = 'medium' > Latest Transactions < / H e a d e r >
< BasicTable >
< Table . Body >
{ lastTrans . length ?
lastTrans . map ( x =>
< Table . Row key = { x . id } >
< Table . Cell style = { { minWidth : '8rem' } } >
< Link to = { '/transactions/' + x . id } > { moment ( x . date ) . format ( 'll' ) } < / L i n k >
< / T a b l e . C e l l >
< Table . Cell > { x . account _type } < / T a b l e . C e l l >
< Table . Cell > $ { x . amount } < / T a b l e . C e l l >
< / T a b l e . R o w >
)
:
< Table . Row > < Table . Cell > None < / T a b l e . C e l l > < / T a b l e . R o w >
}
{ user . transactions . length > 3 && < Link to = '/transactions' > [ more ] < / L i n k > }
< / T a b l e . B o d y >
< / B a s i c T a b l e >
< Header size = 'medium' > Details < / H e a d e r >
< BasicTable >
< Table . Body >
< Table . Row >
< Table . Cell > Application : < / T a b l e . C e l l >
< Table . Cell > { member . application _date || 'Unknown' } < / T a b l e . C e l l >
< Table . Cell > { moment ( m ember . application _date ) . format ( 'll' ) || 'Unknown' } < / T a b l e . C e l l >
< / T a b l e . R o w >
< Table . Row >
< Table . Cell > Start : < / T a b l e . C e l l >
< Table . Cell > { member . current _start _date || 'Unknown' } < / T a b l e . C e l l >
< Table . Cell > { moment ( m ember . current _start _date ) . format ( 'll' ) || 'Unknown' } < / T a b l e . C e l l >
< / T a b l e . R o w >
< Table . Row >
< Table . Cell > Vetted : < / T a b l e . C e l l >
< Table . Cell > { member . vetted _date || 'Not vetted' } < / T a b l e . C e l l >
< Table . Cell > { moment ( m ember . vetted _date ) . format ( 'll' ) || 'Not vetted' } < / T a b l e . C e l l >
< / T a b l e . R o w >
< Table . Row >
< Table . Cell > Monthly : < / T a b l e . C e l l >
< Table . Cell > $ { member . monthly _fees || 'Unknown' } < / T a b l e . C e l l >
< Table . Cell > Monthly dues : < / T a b l e . C e l l >
< Table . Cell > $ { member . monthly _fees || 'Unknown' } . 00 < / T a b l e . C e l l >
< / T a b l e . R o w >
< Table . Row >
< Table . Cell > Card Number : < / T a b l e . C e l l >
< Table . Cell > Last scan : < / T a b l e . C e l l >
< Table . Cell >
{ lastCard && lastCard . card _number || 'None' }
{ lastCard && lastCard . last _seen ?
lastCard . last _seen > '2021-11-14T02:01:35.415685Z' ?
moment . utc ( lastCard . last _seen ) . tz ( 'America/Edmonton' ) . format ( 'lll' )
:
moment . utc ( lastCard . last _seen ) . tz ( 'America/Edmonton' ) . format ( 'll' )
:
'Unknown'
}
{ user . cards . length > 1 && < Link to = '/cards' > [ more ] < / L i n k > }
< / T a b l e . C e l l >
< / T a b l e . R o w >
@ -116,25 +163,6 @@ function MemberInfo(props) {
View application forms
< / a >
< / p > }
< Header size = 'medium' > Latest Transactions < / H e a d e r >
< BasicTable >
< Table . Body >
{ lastTrans . length ?
lastTrans . map ( x =>
< Table . Row key = { x . id } >
< Table . Cell >
< Link to = { '/transactions/' + x . id } > { x . date } < / L i n k >
< / T a b l e . C e l l >
< Table . Cell > { x . account _type } < / T a b l e . C e l l >
< Table . Cell > $ { x . amount } < / T a b l e . C e l l >
< / T a b l e . R o w >
)
:
< Table . Row > < Table . Cell > None < / T a b l e . C e l l > < / T a b l e . R o w >
}
< / T a b l e . B o d y >
< / B a s i c T a b l e >
< / d i v >
) ;
} ;