2022-08-15 18:07:39 -05:00
|
|
|
import { Locations } from '../../../imports/api/location.js';
|
|
|
|
|
|
|
|
|
|
Template.locMgmtTbl.onCreated(function() {
|
|
|
|
|
this.subscribe("myLocations");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.locMgmtTbl.onRendered(function() {
|
2022-08-23 13:41:21 -05:00
|
|
|
Meteor.setTimeout(function() {
|
|
|
|
|
$('.tooltipped').tooltip();
|
|
|
|
|
}, 150);
|
2022-08-15 18:07:39 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.locMgmtTbl.helpers({
|
|
|
|
|
locs: function() {
|
|
|
|
|
return Locations.find({});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2022-08-23 13:41:21 -05:00
|
|
|
Template.locMgmtTbl.events({
|
|
|
|
|
'click .deleteLocation' (event) {
|
|
|
|
|
event.preventDefault();
|
2022-08-26 11:18:18 -05:00
|
|
|
Session.set("deleteId", this._id);
|
|
|
|
|
Session.set("method", "delete.location");
|
|
|
|
|
Session.set("item", this.locationName);
|
|
|
|
|
Session.set("view", "Locations");
|
|
|
|
|
$('#modalDelete').modal('open');
|
2022-08-23 13:41:21 -05:00
|
|
|
},
|
|
|
|
|
'click .editLocation' (event) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
Session.set("locEditMode", true);
|
|
|
|
|
Session.set("locEditId", this._id);
|
|
|
|
|
let locInfo = Locations.findOne({ _id: this._id });
|
|
|
|
|
$("#locNameInp").val(locInfo.locationName);
|
|
|
|
|
},
|
|
|
|
|
});
|