get_my/client/AdminMgmt/LocationMgmt/locMgmtTbl.js

37 lines
1 KiB
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();
Meteor.call('delete.location', this._id, function(err, result) {
if (err) {
console.log(" ERROR deleting location: " + err);
} else {
console.log(" SUCCESS deleting the location.");
}
});
},
'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);
},
});