Updated meteor; Modified the assignments byPerson page considerably to improve the workflow; Added an external id to sites; Added an import for students; Improved the students page.

This commit is contained in:
2023-06-16 11:52:48 -07:00
parent 9444cac85d
commit 3c76d5e6a0
15 changed files with 664 additions and 180 deletions

View File

@@ -15,7 +15,7 @@ import DialogActions from '@mui/material/DialogActions';
import DialogContent from '@mui/material/DialogContent';
import DialogContentText from '@mui/material/DialogContentText';
import DialogTitle from '@mui/material/DialogTitle';
import {Assets, conditions} from "/imports/api/assets";
import {Assets, conditions, functionalConditions} from "/imports/api/assets";
import {AssetTypes} from "/imports/api/asset-types";
import {Students} from "/imports/api/students";
import {Staff} from "/imports/api/staff";
@@ -34,6 +34,21 @@ const cssEditorField = {
const Statistics = () => {
const [selectedMissingAsset, setSelectedMissingAsset] = useState("")
const {assetStatistics} = useTracker(() => {
let assetStatistics = []
const assetTypes = AssetTypes.find({}, {year: 1}).fetch()
for(let type of assetTypes) {
let count = Assets.find({assetTypeId: type._id, condition: {$in: functionalConditions}}).count()
if(count > 0) {
assetStatistics.push({name: type.name, count})
}
}
return {assetStatistics}
})
const {missingAssets} = useTracker(() => {
let missingAssets = [];
@@ -54,16 +69,32 @@ const Statistics = () => {
return (
<>
<h1>Missing Equipment</h1>
<List>
{missingAssets.map((next, i) => {
return (
<ListItemButton key={next._id} style={getListItemStyle(next)} selected={selectedMissingAsset === next} onClick={(e) => {setSelectedMissingAsset(next)}}>
<ListItemText primary={next.assetId} secondary={next.assetType.name}/>
</ListItemButton>
)
})}
</List>
<div style={{display: 'flex', flexFlow: 'row wrap', justifyContent: 'center', alignItems: 'flex-start', columnGap: '1rem'}}>
<div>
<h1>Equipment Counts</h1>
<List sx={{overflow: "auto", maxHeight: "30rem", position: "relative", width: "30rem", border: "1px solid #999", marginBottom: "2rem"}}>
{assetStatistics.map((next, i) => {
return (
<ListItem key={next.name} style={getListItemStyle(next)}>
<ListItemText primary={next.name} secondary={next.count}/>
</ListItem>
)
})}
</List>
</div>
<div>
<h1>Missing Equipment</h1>
<List sx={{overflow: "auto", maxHeight: "30rem", position: "relative", width: "30rem", border: "1px solid #999", marginBottom: "2rem"}}>
{missingAssets.map((next, i) => {
return (
<ListItemButton key={next._id} style={getListItemStyle(next)} selected={selectedMissingAsset === next} onClick={(e) => {setSelectedMissingAsset(next)}}>
<ListItemText primary={next.assetId} secondary={next.assetType.name}/>
</ListItemButton>
)
})}
</List>
</div>
</div>
</>
)
}