Fixed a number of bugs; added a few fields.
This commit is contained in:
@@ -13,6 +13,13 @@
|
||||
|
||||
const assetTypesColumns = [
|
||||
{
|
||||
key: "year",
|
||||
title: "Year",
|
||||
value: v => v.year,
|
||||
minWidth: 100,
|
||||
weight: 1,
|
||||
cls: "year",
|
||||
}, {
|
||||
key: "name",
|
||||
title: "Name",
|
||||
value: v => v.name,
|
||||
@@ -43,17 +50,17 @@
|
||||
}
|
||||
let dirtyAssetType;
|
||||
// Copy the edited value when ever it changes, set some defaults for a new value object (to make the view happy).
|
||||
editedAssetType.subscribe(v => {dirtyAssetType = Object.assign({name: "", description: ""}, v)});
|
||||
editedAssetType.subscribe(v => {dirtyAssetType = Object.assign({name: "", description: "", year: ""}, v)});
|
||||
// Load the sites (reactive).
|
||||
let assetTypes = AssetTypes.find({});
|
||||
let assetTypes = AssetTypes.find({}, {sort: {year: -1}});
|
||||
const deleteAssetType = assetType => {
|
||||
//TODO:
|
||||
};
|
||||
const applyAssetTypeChanges = () => {
|
||||
if(dirtyAssetType._id)
|
||||
Meteor.call("assetTypes.update", dirtyAssetType._id, dirtyAssetType.name, dirtyAssetType.description);
|
||||
Meteor.call("assetTypes.update", dirtyAssetType._id, dirtyAssetType.name, dirtyAssetType.description, dirtyAssetType.year);
|
||||
else
|
||||
Meteor.call("assetTypes.add", dirtyAssetType.name, dirtyAssetType.description);
|
||||
Meteor.call("assetTypes.add", dirtyAssetType.name, dirtyAssetType.description, dirtyAssetType.year);
|
||||
editedAssetType.set(null);
|
||||
dirtyAssetType = null;
|
||||
}
|
||||
@@ -68,6 +75,9 @@
|
||||
{#if dirtyAssetType}
|
||||
<div class="editorContainer">
|
||||
<div style="grid-column: 1/span 1">
|
||||
<TextField type="text" style="width: 100%" bind:value={dirtyAssetType.year} label="Year">
|
||||
<HelperText slot="helper">The manufacture or purchase year. Used for sorting assets so most recent ones appear on top.</HelperText>
|
||||
</TextField>
|
||||
<TextField type="text" style="width: 100%" bind:value={dirtyAssetType.name} label="Name">
|
||||
<HelperText slot="helper">Provide a unique name for the asset type.</HelperText>
|
||||
</TextField>
|
||||
|
||||
Reference in New Issue
Block a user