38 lines
No EOL
1 KiB
JavaScript
38 lines
No EOL
1 KiB
JavaScript
import { Roles } from 'meteor/roles';
|
|
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
|
import { LocationTypes } from '../../imports/api/locationTypes.js';
|
|
|
|
Template.locationTypes.onCreated(function() {
|
|
this.subscribe("LocationTypes");
|
|
});
|
|
|
|
Template.locationTypes.onRendered(function() {
|
|
|
|
});
|
|
|
|
Template.locationTypes.helpers({
|
|
|
|
});
|
|
|
|
Template.locationTypes.events({
|
|
'click #saveLocationType' (event) {
|
|
event.preventDefault();
|
|
|
|
let typeName = $("#typeName").val();
|
|
let typeDesc = $("#typeDesc").val();
|
|
|
|
if (typeName == null || typeName == "") {
|
|
return;
|
|
} else {
|
|
const addLocation = async() => {
|
|
const result = await Meteor.callAsync("add.locationType", typeName, typeDesc);
|
|
if (!result) {
|
|
showSnackbar("Location Type Failed!", "red");
|
|
} else {
|
|
showSnackbar("Location Type Added!", "green");
|
|
}
|
|
}
|
|
addLocation();
|
|
}
|
|
}
|
|
}); |