mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-26 15:58:50 +00:00
64 lines
No EOL
2 KiB
JavaScript
64 lines
No EOL
2 KiB
JavaScript
import { M } from '../../../lib/assets/materialize.js';
|
|
import { Lists } from '../../../../imports/api/lists.js';
|
|
import { Menus } from '../../../../imports/api/menu';
|
|
import { TaskItems } from '../../../../imports/api/tasks';
|
|
import { Products } from '../../../../imports/api/products.js';
|
|
import { Stores } from '../../../../imports/api/stores.js';
|
|
|
|
Template.cleanUpModalConfirm.onCreated(function() {
|
|
|
|
});
|
|
|
|
Template.cleanUpModalConfirm.onRendered(function () {
|
|
|
|
});
|
|
|
|
Template.cleanUpModalConfirm.helpers({
|
|
whatItems: function() {
|
|
return Session.get("cleanWhat");
|
|
}
|
|
});
|
|
|
|
Template.cleanUpModalConfirm.events({
|
|
'click #confirmClean' (event) {
|
|
let whatItems = Session.get("cleanWhat");
|
|
|
|
switch(whatItems) {
|
|
case "Lists":
|
|
cleanUp("clean.Lists", whatItems);
|
|
case "Menus":
|
|
cleanUp("clean.Menus", whatItems);
|
|
case "Products":
|
|
// cleanUp("clean.Products", whatItems);
|
|
case "Stores":
|
|
// cleanUp("clean.Stores", whatItems);
|
|
case "Tasks":
|
|
cleanTasks("clean.Tasks", whatItems);
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
|
|
cleanUp = async function(methodName, whatItems) {
|
|
let result = Meteor.callAsync(methodName);
|
|
if (!result) {
|
|
console.log(" ERROR cleaning " + whatItems + ": " + err);
|
|
} else {
|
|
showSnackbar(whatItems + " have been cleaned up!", "green");
|
|
let confirmModal = document.getElementById('cleanUpConfirm');
|
|
M.Modal.getInstance(confirmModal).close();
|
|
}
|
|
}
|
|
|
|
cleanTasks = async function(methodName, whatItems) {
|
|
let timeFrame = Session.get("overdueVal");
|
|
let result = await Meteor.call(methodName, timeFrame);
|
|
if (!result) {
|
|
console.log(" ERROR cleaning " + whatItems + ": " + err);
|
|
} else {
|
|
showSnackbar(whatItems + " have been cleaned up!", "green");
|
|
let confirmModal = document.getElementById('cleanUpConfirm');
|
|
M.Modal.getInstance(confirmModal).close();
|
|
}
|
|
} |