get_my/client/AdminMgmt/LocationMgmt/locMgmtTbl.js

35 lines
984 B
JavaScript
Raw Normal View History

import { Locations } from '../../../imports/api/location.js';
Template.locMgmtTbl.onCreated(function() {
this.subscribe("myLocations");
});
Template.locMgmtTbl.onRendered(function() {
Meteor.setTimeout(function() {
$('.tooltipped').tooltip();
}, 150);
});
Template.locMgmtTbl.helpers({
locs: function() {
return Locations.find({});
}
});
Template.locMgmtTbl.events({
'click .deleteLocation' (event) {
event.preventDefault();
Session.set("deleteId", this._id);
Session.set("method", "delete.location");
Session.set("item", this.locationName);
Session.set("view", "Locations");
$('#modalDelete').modal('open');
},
'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);
},
});