Added a data entry page with initial content.

This commit is contained in:
2022-07-12 11:26:36 -07:00
parent 117bd8cd1a
commit c762581608
9 changed files with 440 additions and 183 deletions

View File

@@ -51,32 +51,37 @@ Meteor.methods({
check(assetTypeId, String);
check(assetId, String);
check(serial, String);
// Convert the asset ID's to uppercase for storage to make searching easier.
assetId = assetId.toUpperCase();
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
let assetType = AssetTypes.findOne({assetTypeId});
if(assetType.hasSerial && serial || !assetType.hasSerial && !serial) {
if(serial) {
Assets.insert({assetTypeId, assetId, serial});
}
else {
Assets.insert({assetTypeId, assetId});
}
if(serial) {
Assets.insert({assetTypeId, assetId, serial});
}
else {
//Should never get here due to client side validation.
console.log("Error: Must provide a serial for asset types marked as having one, and may not provide one for asset types not marked as having one.")
Assets.insert({assetTypeId, assetId});
}
}
},
'assets.update'(_id, assetId, serial) {
//TODO:
check(_id, String);
check(assetId, String);
if(serial) check(serial, String);
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}});
}
},
'assets.remove'(_id) {
check(_id, String);
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
//TODO: Need to first verify there are no checked out assets to the staff member.
Assets.remove({_id});
}
},
});