Fixed Asset list not allowing update or add of assets; Modified conditionDetails to be a text area everywhere but when adding assets (should be only one line then).

This commit is contained in:
2022-08-21 18:41:39 -07:00
parent 23838990d4
commit f3d9b85083
2 changed files with 15 additions and 6 deletions

View File

@@ -17,6 +17,7 @@
});
let assetTypes;
$: assetTypes = AssetTypes.find({}, {sort: {year: -1}});
let assetTypeNameMap;
$: assetTypeNameMap = derived(assetTypes, $assetTypes => $assetTypes.reduce((map, obj) => {
map[obj._id] = obj.name;
return map;
@@ -40,6 +41,13 @@
minWidth: 100,
weight: 1,
cls: "serial",
}, {
key: "condition",
title: "Condition",
value: v => v.condition ? v.condition : "-",
minWidth: 100,
weight: 1,
cls: "condition",
}, {
key: "asset",
title: "Asset Type",
@@ -75,7 +83,7 @@
// Copy the edited site when ever it changes, set some defaults for a new site object (to make the view happy).
editedAsset.subscribe(site => {
if(site) {
dirtyAsset = Object.assign({serial: "", assetId: "", assetTypeId: ""}, site);
dirtyAsset = Object.assign({serial: "", assetId: "", assetTypeId: "", condition: "", conditionDetails: ""}, site);
//document.getElementsByClassName('select').focus();
}
else dirtyAsset = null;
@@ -84,9 +92,9 @@
let assets = Assets.find({});
const applyAssetChanges = () => {
if(dirtyAsset._id)
Meteor.call("assets.update", dirtyAsset._id, dirtyAsset.assetId, dirtyAsset.serial);
Meteor.call("assets.update", dirtyAsset._id, dirtyAsset.assetTypeId, dirtyAsset.assetId, dirtyAsset.serial, dirtyAsset.condition, dirtyAsset.conditionDetails);
else
Meteor.call("assets.add", dirtyAsset.assetTypeId, dirtyAsset.assetId, dirtyAsset.serial);
Meteor.call("assets.add", dirtyAsset.assetTypeId, dirtyAsset.assetId, dirtyAsset.serial, dirtyAsset.condition, dirtyAsset.conditionDetails);
editedAsset.set(null);
}
const rejectAssetChanges = () => {
@@ -135,7 +143,7 @@
{/each}
</Select>
<div style="grid-column: 1/span 1">
<TextField type="text" style="width: 100%" bind:value={dirtyAsset.conditionDetails} label="Condition Details">
<TextField textarea style="width: 100%; height: 20rem; margin-top: 1rem" helperLine$style="width: 100%" bind:value={dirtyAsset.conditionDetails} label="Condition Details">
</TextField>
</div>