diff --git a/webclient/src/Cards.js b/webclient/src/Cards.js index 872e5ad..b750f72 100644 --- a/webclient/src/Cards.js +++ b/webclient/src/Cards.js @@ -36,7 +36,7 @@ export function Cards(props) { Number Notes - Last Seen + Last Scan Active diff --git a/webclient/src/Home.js b/webclient/src/Home.js index cc6609d..215114a 100644 --- a/webclient/src/Home.js +++ b/webclient/src/Home.js @@ -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 (
@@ -47,7 +48,7 @@ function MemberInfo(props) { Expiry: - {member.expire_date} + {moment(member.expire_date).format('ll')} @@ -82,29 +83,75 @@ function MemberInfo(props) { Latest Training + + + {lastTrain.length ? + lastTrain.map(x => + + + {moment(x.session.datetime).tz('America/Edmonton').format('ll')} + + {x.session.course_data.name} + + ) + : + None, please sign up for an Orientation + } + {user.training.length > 3 && [more]} + + + +
Latest Transactions
+ + + {lastTrans.length ? + lastTrans.map(x => + + + {moment(x.date).format('ll')} + + {x.account_type} + ${x.amount} + + ) + : + None + } + {user.transactions.length > 3 && [more]} + + +
Details
Application: - {member.application_date || 'Unknown'} + {moment(member.application_date).format('ll') || 'Unknown'} Start: - {member.current_start_date || 'Unknown'} + {moment(member.current_start_date).format('ll') || 'Unknown'} Vetted: - {member.vetted_date || 'Not vetted'} + {moment(member.vetted_date).format('ll') || 'Not vetted'} - Monthly: - ${member.monthly_fees || 'Unknown'} + Monthly dues: + ${member.monthly_fees || 'Unknown'}.00 - Card Number: + Last scan: - {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 && [more]} @@ -116,25 +163,6 @@ function MemberInfo(props) { View application forms

} - -
Latest Transactions
- - - {lastTrans.length ? - lastTrans.map(x => - - - {x.date} - - {x.account_type} - ${x.amount} - - ) - : - None - } - -
); }; diff --git a/webclient/src/Training.js b/webclient/src/Training.js index 82e975e..c90fb4a 100644 --- a/webclient/src/Training.js +++ b/webclient/src/Training.js @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom'; import './light.css'; import { Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Popup, Segment, Table } from 'semantic-ui-react'; -import moment from 'moment'; +import moment from 'moment-timezone'; import { requester, getInstructor } from './utils.js'; import { NotFound, PleaseLogin } from './Misc.js'; @@ -96,7 +96,7 @@ export function TrainingList(props) { {x.session.course_data.name} - {moment(x.session.datetime).format('MMMM Do YYYY')} + {moment(x.session.datetime).tz('America/Edmonton').format('ll')} {x.attendance_status} {getInstructor(x.session)} @@ -113,12 +113,6 @@ export function Training(props) { return ( -
Your Certifications
- - - -

Certifications are based on the courses you've taken. If there's any errors, please email directors@protospace.ca.

-
Your Training
{user.training.length ? @@ -127,6 +121,11 @@ export function Training(props) {

No training yet! Sign up for a course to take a class.

} +
Your Certifications
+ + + +

Certifications are based on the courses you've taken. If there's any errors, please email directors@protospace.ca.

); }; diff --git a/webclient/src/Transactions.js b/webclient/src/Transactions.js index e4c87ae..5abf67f 100644 --- a/webclient/src/Transactions.js +++ b/webclient/src/Transactions.js @@ -1,5 +1,6 @@ import React, { useState, useEffect, useRef } from 'react'; import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom'; +import moment from 'moment-timezone'; import ReactToPrint from 'react-to-print'; import './light.css'; import { Button, Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; @@ -279,8 +280,8 @@ export function TransactionList(props) { {transactions.length ? transactions.slice().sort((a, b) => a.date < b.date ? 1 : -1).map(x => - - {x.date} + + {moment(x.date).format('ll')} {!noMember && {x.member_id ?