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");
|
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(_id, String);
|
||||||
|
check(assetTypeId, String);
|
||||||
check(assetId, String);
|
check(assetId, String);
|
||||||
if(serial) check(serial, String);
|
if(serial) check(serial, String);
|
||||||
check(condition, String);
|
check(condition, String);
|
||||||
@@ -129,7 +130,7 @@ Meteor.methods({
|
|||||||
|
|
||||||
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||||
//TODO: Need to first verify there are no checked out assets to the staff member.
|
//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");
|
else throw new Meteor.Error("User Permission Error");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
});
|
});
|
||||||
let assetTypes;
|
let assetTypes;
|
||||||
$: assetTypes = AssetTypes.find({}, {sort: {year: -1}});
|
$: assetTypes = AssetTypes.find({}, {sort: {year: -1}});
|
||||||
|
let assetTypeNameMap;
|
||||||
$: assetTypeNameMap = derived(assetTypes, $assetTypes => $assetTypes.reduce((map, obj) => {
|
$: assetTypeNameMap = derived(assetTypes, $assetTypes => $assetTypes.reduce((map, obj) => {
|
||||||
map[obj._id] = obj.name;
|
map[obj._id] = obj.name;
|
||||||
return map;
|
return map;
|
||||||
@@ -40,6 +41,13 @@
|
|||||||
minWidth: 100,
|
minWidth: 100,
|
||||||
weight: 1,
|
weight: 1,
|
||||||
cls: "serial",
|
cls: "serial",
|
||||||
|
}, {
|
||||||
|
key: "condition",
|
||||||
|
title: "Condition",
|
||||||
|
value: v => v.condition ? v.condition : "-",
|
||||||
|
minWidth: 100,
|
||||||
|
weight: 1,
|
||||||
|
cls: "condition",
|
||||||
}, {
|
}, {
|
||||||
key: "asset",
|
key: "asset",
|
||||||
title: "Asset Type",
|
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).
|
// Copy the edited site when ever it changes, set some defaults for a new site object (to make the view happy).
|
||||||
editedAsset.subscribe(site => {
|
editedAsset.subscribe(site => {
|
||||||
if(site) {
|
if(site) {
|
||||||
dirtyAsset = Object.assign({serial: "", assetId: "", assetTypeId: ""}, site);
|
dirtyAsset = Object.assign({serial: "", assetId: "", assetTypeId: "", condition: "", conditionDetails: ""}, site);
|
||||||
//document.getElementsByClassName('select').focus();
|
//document.getElementsByClassName('select').focus();
|
||||||
}
|
}
|
||||||
else dirtyAsset = null;
|
else dirtyAsset = null;
|
||||||
@@ -84,9 +92,9 @@
|
|||||||
let assets = Assets.find({});
|
let assets = Assets.find({});
|
||||||
const applyAssetChanges = () => {
|
const applyAssetChanges = () => {
|
||||||
if(dirtyAsset._id)
|
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
|
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);
|
editedAsset.set(null);
|
||||||
}
|
}
|
||||||
const rejectAssetChanges = () => {
|
const rejectAssetChanges = () => {
|
||||||
@@ -135,7 +143,7 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</Select>
|
||||||
<div style="grid-column: 1/span 1">
|
<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>
|
</TextField>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user