Reorganized assignment UI. Added searching by person.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
import {Students} from "/imports/api/students";
|
||||
import {Staff} from "/imports/api/staff";
|
||||
import {AssetTypes} from "/imports/api/asset-types";
|
||||
import {Assets} from "/imports/api/assets";
|
||||
|
||||
let serialInput = null;
|
||||
let emailInput = null;
|
||||
@@ -104,7 +105,7 @@
|
||||
});
|
||||
let chromebookData = null;
|
||||
$: {
|
||||
if(deviceId || serial || email || date) {
|
||||
if(deviceId || assetId || serial || email || date) {
|
||||
let params = {};
|
||||
|
||||
if(deviceId) params.deviceId = deviceId;
|
||||
@@ -121,25 +122,6 @@
|
||||
if (error) {
|
||||
console.error(error);
|
||||
} else {
|
||||
for(let next of result) {
|
||||
if(next.assetId) {
|
||||
next.asset = Assets.findOne({assetId: next.assetId});
|
||||
}
|
||||
if(next.email) {
|
||||
next.person = Students.findOne({email: next.email});
|
||||
|
||||
if(!next.person) next.person = Staff.findOne({email: next.email});
|
||||
}
|
||||
|
||||
if(next.asset) {
|
||||
next.assetType = AssetTypes.findOne({_id: next.asset.assetType})
|
||||
|
||||
if(next.asset.assigneeId) {
|
||||
next.assignedTo = next.asset.assigneeType === "Student" ? Students.findOne({_id: next.asset.assigneeId}) : Staff.findOne({_id: next.asset.assigneeId})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chromebookData = result;
|
||||
}
|
||||
});
|
||||
@@ -148,6 +130,8 @@
|
||||
chromebookData = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<Route path="/" let:meta>
|
||||
@@ -158,18 +142,19 @@
|
||||
{#each chromebookData as data}
|
||||
<li>
|
||||
{#if data.person}
|
||||
{data.person.firstName} {data.person.lastName} (<a href="/chromebooks?email={encodeURIComponent(data.email)}">{data.email}</a>)<br/>
|
||||
User: {data.person.firstName} {data.person.lastName} {#if data.person.grade} ~ {data.person.grade}{/if} (<a href="/chromebooks?email={encodeURIComponent(data.email)}">{data.email}</a>)<br/>
|
||||
{:else}
|
||||
<a href="/chromebooks?email={encodeURIComponent(data.email)}">{data.email}</a><br/>
|
||||
User: <a href="/chromebooks?email={encodeURIComponent(data.email)}">{data.email}</a><br/>
|
||||
{/if}
|
||||
<a href="/chromebooks?deviceId={encodeURIComponent(data.deviceId)}">{data.deviceId}</a><br/>
|
||||
<a href="/chromebooks?serial={encodeURIComponent(data.serial)}">{data.serial}</a><br/>
|
||||
Device ID: <a href="/chromebooks?deviceId={encodeURIComponent(data.deviceId)}">{data.deviceId}</a><br/>
|
||||
Serial: <a href="/chromebooks?serial={encodeURIComponent(data.serial)}">{data.serial}</a><br/>
|
||||
{#if data.asset}Asset ID: <a href="/chromebooks?assetId={encodeURIComponent(data.assetId)}">{data.asset.assetId}</a><br/>{/if}
|
||||
{new Date(data.startTime).toLocaleDateString("en-US") + "-" + new Date(data.endTime).toLocaleDateString("en-US")}
|
||||
{#if data.assetType}
|
||||
<br/>Asset Type: {data.assetType.name}
|
||||
{/if}
|
||||
{#if data.assignedTo}
|
||||
<br/>Currently assigned to: {next.assignedTo.firstName} {next.assignedTo.lastName} ({next.assignedTo.email})
|
||||
<br/>Currently assigned to: {data.assignedTo.firstName} {data.assignedTo.lastName} {#if data.assignedTo.grade} ~ {data.assignedTo.grade}{/if} ({data.assignedTo.email})
|
||||
{/if}
|
||||
</li>
|
||||
{/each}
|
||||
|
||||
Reference in New Issue
Block a user