Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -114,8 +114,9 @@ Meteor.methods({
|
||||
}
|
||||
else throw new Meteor.Error("User Permission Error");
|
||||
},
|
||||
'assets.update'(_id, assetId, serial, condition, conditionDetails) {
|
||||
'assets.update'(_id, assetTypeId, assetId, serial, condition, conditionDetails) {
|
||||
check(_id, String);
|
||||
check(assetTypeId, String);
|
||||
check(assetId, String);
|
||||
if(serial) check(serial, String);
|
||||
check(condition, String);
|
||||
@@ -129,7 +130,7 @@ Meteor.methods({
|
||||
|
||||
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
//TODO: Need to first verify there are no checked out assets to the staff member.
|
||||
Assets.update({_id}, {$set: {assetId, serial, condition, conditionDetail}});
|
||||
Assets.update({_id}, {$set: {assetTypeId, assetId, serial, condition, conditionDetails}});
|
||||
}
|
||||
else throw new Meteor.Error("User Permission Error");
|
||||
},
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user