Cleaned up the L&F; Added table sorting; Cleaned up the table styling.

This commit is contained in:
2022-09-10 17:42:38 -07:00
parent 4ec6d502aa
commit bbff674b62
13 changed files with 237 additions and 3972 deletions

View File

@@ -113,6 +113,15 @@ export default () => {
{
name: "ID",
value: (row) => row.id,
descendingComparator: (a, b) => {
if(a.id === b.id) return 0
else if(!a.id) return -1
else if(!b.id) return 1
else if(a.id.length < b.id.length) return 1
else if(a.id.length > b.id.length) return -1
else if(b.id < a.id) return -1
else return 1
}
},
{
name: "Email",

View File

@@ -114,6 +114,15 @@ export default () => {
{
name: "ID",
value: (row) => row.id,
descendingComparator: (a, b) => {
if(a.id === b.id) return 0
else if(!a.id) return -1
else if(!b.id) return 1
else if(a.id.length < b.id.length) return 1
else if(a.id.length > b.id.length) return -1
else if(b.id < a.id) return -1
else return 1
}
},
{
name: "Email",
@@ -130,6 +139,15 @@ export default () => {
{
name: "GRD",
value: (row) => row.grade,
descendingComparator: (a, b) => {
if(a.grade === b.grade) return 0
else if(!a.grade) return -1
else if(!b.grade) return 1
else if(a.grade.length < b.grade.length) return 1
else if(a.grade.length > b.grade.length) return -1
else if(b.grade < a.grade) return -1
else return 1
}
},
]

View File

@@ -95,7 +95,7 @@ const AddAssets = ({assetTypes}) => {
</div>
<div style={{marginLeft: '1rem', display: 'flex', flexDirection: 'column'}}>
<div style={{display: 'flex', flexDirection: 'row'}}>
<TextField style={cssEditorField} variant="standard" label="Asset ID" value={assetId} onChange={(e) => {setAssetId(e.target.value)}}/>
<TextField style={cssEditorField} variant="standard" label="Asset ID" value={assetId} onChange={(e) => {setAssetId(e.target.value.toUpperCase())}}/>
<TextField style={cssEditorField} variant="standard" label="Serial" value={serial} onChange={(e) => {setSerial(e.target.value)}}/>
</div>
<div style={{display: 'flex', flexDirection: 'row'}}>

View File

@@ -105,18 +105,45 @@ export default () => {
{
name: "Asset ID",
value: (row) => row.assetId,
descendingComparator: (a, b) => {
if(a.assetId === b.assetId) return 0
else if(!a.assetId) return -1
else if(!b.assetId) return 1
else if(a.assetId.length < b.assetId.length) return 1
else if(a.assetId.length > b.assetId.length) return -1
else if(b.assetId < a.assetId) return -1
else return 1
}
},
{
name: "Serial",
value: (row) => row.serial,
descendingComparator: (a, b) => {
if(a.serial === b.serial) return 0
else if(!a.serial) return -1
else if(!b.serial) return 1
else if(a.serial.length < b.serial.length) return 1
else if(a.serial.length > b.serial.length) return -1
else if(b.serial < a.serial) return -1
else return 1
}
},
{
name: "Condition",
value: (row) => row.condition,
descendingComparator: (a, b) => {
if(b.condition === a.condition) return 0 //Most common case
// Find the first matching condition in order.
for(let condition of conditions) {
if(b.condition === condition) return -1
else if(a.condition === condition) return 1
}
return 0
}
},
{
name: "AssetType",
value: (row) => row.assetType.name,
value: (row) => row.assetType ? row.assetType.name : "",
},
]

View File

@@ -107,7 +107,7 @@ const AssignmentsByAsset = () => {
</Dialog>
<Box style={{marginTop: '1rem',...cssTwoColumnContainer}}>
<TextField style={cssEditorField} variant="standard" label="Asset ID" inputRef={input=>setAssetIdInput(input)} value={assetId} onChange={(e) => {setAssetId(e.target.value)}}/>
<TextField style={cssEditorField} variant="standard" label="Asset ID" inputRef={input=>setAssetIdInput(input)} value={assetId} onChange={(e) => {setAssetId(e.target.value.toUpperCase())}}/>
</Box>
{foundAsset && (
<div>