Updated meteor; Fixed AssetTypes add/update/remove.

This commit is contained in:
2023-04-22 13:20:14 -07:00
parent 8196c02b4e
commit 5514cd8d9d
9 changed files with 103 additions and 64 deletions

View File

@@ -42,9 +42,9 @@ const AssetTypeEditor = ({value, close}) => {
close()
//TODO Should invert this and only close if there was success on the server.
if(value._id)
Meteor.call("assetType.update", value._id, name, description, year);
Meteor.call("assetTypes.update", value._id, name, description, year);
else
Meteor.call("assetType.add", name, description, year);
Meteor.call("assetTypes.add", name, description, year);
}
const rejectChanges = () => {
close()
@@ -59,7 +59,7 @@ const AssetTypeEditor = ({value, close}) => {
<div style={cssFieldColumnContainer}>
<h1>Asset Type Editor</h1>
<div style={cssGridFieldContainer}>
<TextField variant="standard" style={cssEditorField} label="Year" value={year} onChange={(e) => change}/>
<TextField variant="standard" style={cssEditorField} label="Year" value={year} onChange={(e) => change(e)}/>
<TextField variant="standard" style={cssEditorField} label="Name" value={name} onChange={(e) => {setName(e.target.value)}}/>
<TextField variant="outlined" style={{gridColumn: '1 / span 2',...cssEditorField}} multiline rows={4} label="Description" value={description} onChange={(e) => {setDescription(e.target.value)}}/>
</div>
@@ -102,7 +102,7 @@ export default () => {
maxHeight: '40rem',
keyHandler: (e, selected) => {
if(selected && selected._id && e.key === "Delete") {
Meteor.call("assetType.remove", selected._id);
Meteor.call("assetTypes.remove", selected._id);
}
}
}

View File

@@ -62,6 +62,7 @@ const AddAssets = ({assetTypes}) => {
return (
<>
<div>1: Select Asset Types To Add</div>
<Box style={cssContainer}>
<FormControl style={cssComponent}>
<InputLabel id="selectAssetTypesLabel">Available Asset Types</InputLabel>
@@ -81,6 +82,7 @@ const AddAssets = ({assetTypes}) => {
</Select>
</FormControl>
</Box>
<div>2: Select Asset Type and Enter Asset Data</div>
<Box style={cssContainer}>
<div style={{maxHeight: '26rem', overflowY:'auto', minWidth: '10rem', minHeight: '10rem'}}>
<List>

View File

@@ -65,13 +65,13 @@ const AssetEditor = ({value, close}) => {
return <MenuItem key={i} value={assetType._id}>{assetType.name}</MenuItem>
})}
</TextField>
<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)}}/>
<TextField style={cssEditorField} select variant="standard" label="Condition" value={condition} onChange={(e)=>{setCondition(e.target.value)}}>
{conditions.map((condition, i) => {
return <MenuItem key={i} value={condition}>{condition}</MenuItem>
})}
</TextField>
<TextField style={cssEditorField} variant="standard" label="Serial" value={serial} onChange={(e) => {setSerial(e.target.value)}}/>
<TextField style={{gridColumn: '1 / span 2',...cssEditorField}} multiline variant="outlined" rows={4} label="Condition Details" value={conditionDetails} onChange={(e) => {setConditionDetails(e.target.value)}}/>
</div>
<div style={cssButtonContainer}>