Initial cut - untested.

This commit is contained in:
2025-09-25 09:31:02 -07:00
parent 7a0666cc6c
commit 3775522265
33 changed files with 351 additions and 346 deletions

View File

@@ -33,12 +33,12 @@ export default () => {
const [searchType, setSearchType] = useState("email")
const [value, setValue] = useState("")
const search = () => {
const search = async () => {
if(searchType === 'email' || searchType === 'firstName' || searchType === 'lastName') {
if (value && value.length > 1) {
let query = searchType === 'email' ? {email: {$regex: value, $options: 'i'}} : searchType === 'firstName' ? {firstName: {$regex: value, $options: 'i'}} : {lastName: {$regex: value, $options: 'i'}}
let students = Students.find(query).fetch()
let staff = Staff.find(query).fetch()
let students = await Students.find(query).fetchAsync()
let staff = await Staff.find(query).fetchAsync()
let all = [...staff, ...students]
if (all.length > 1) {
@@ -50,7 +50,7 @@ export default () => {
}
}
else if(searchType === 'assetId' || searchType === 'serial') {
let asset = Assets.findOne(searchType === 'assetId' ? {assetId: value.toUpperCase()} : {serial : value});
let asset = await Assets.findOneAsync(searchType === 'assetId' ? {assetId: value.toUpperCase()} : {serial : value});
console.log(asset)
if(asset) {
if(searchType === 'assetId')
@@ -102,7 +102,7 @@ export default () => {
</Dialog>
<div style={{display: "flex", flexDirection: "column", marginTop: "1rem"}} sx={{ p: '2px 4px', display: 'flex', alignItems: 'center', width: 400 }}>
{/*<Paper componet='form'>*/}
{/*<Paper component='form'>*/}
{/* <div style={{marginBottom: "1rem", marginTop: "2rem"}}>*/}
{/* <ToggleButtonGroup color="primary" value={resultType} exclusive onChange={(e, type)=>setResultType(type)} aria-label="Result Type">*/}
{/* <ToggleButton value="usage">Usage History</ToggleButton>*/}