get_my/client/AdminMgmt/StoreMgmt/storeMgmtTbl.js
2022-08-23 13:41:21 -05:00

37 lines
No EOL
1 KiB
JavaScript

import { Stores } from '../../../imports/api/stores';
Template.storeMgmtTbl.onCreated(function() {
this.subscribe("storeInfo");
});
Template.storeMgmtTbl.onRendered(function() {
Meteor.setTimeout(function() {
$('.tooltipped').tooltip();
}, 150);
});
Template.storeMgmtTbl.helpers({
mgmtStoreInfo: function() {
return Stores.find({});
},
});
Template.storeMgmtTbl.events({
'click .deleteStore' (event) {
event.preventDefault();
Meteor.call('delete.store', this._id, function(err, result) {
if (err) {
console.log(" ERROR deleting store: " + err);
} else {
console.log(" SUCCESS deleting the store.");
}
});
},
'click .editStore' (event) {
event.preventDefault();
Session.set("storeIdEdit", this._id);
let storeInfo = Stores.findOne({ _id: this._id });
$("#storeName").val(storeInfo.storeName);
Session.set("editModeStore", true);
},
});