Added a delete confirmation modal to all views.

This commit is contained in:
Brian McGonagill 2022-08-26 11:18:18 -05:00
parent 4d9d2acff6
commit 29ddc544e5
27 changed files with 117 additions and 127 deletions

View file

@ -1,16 +1,11 @@
<template name="catMgmtForm">
<form action="submit" id="catInputForm">
<div class="row">
<div class="col s12 m6 l6 input-field">
<div class="col s8 m10 l10 input-field">
<input type="text" class="catNameInp" id="catNameInp" style="{{#if $eq catNameErr true}}border: 2px solid red;{{/if}}" />
<label for="catNameInp">Name*</label>
</div>
</div>
<div class="row">
<div class="col s6 m6 l6">
<a class="waves-effect waves-light btn cancelCatMgmt orange">Cancel</a>
</div>
<div class="col s6 m6 l6">
<div class="col s4 m2 l2 input-field">
{{#if $eq catEditMode false}}
<a class="waves-effect waves-light btn saveCatMgmt green right">Add</a>
{{else}}

View file

@ -12,4 +12,5 @@
</ul>
</div>
</div>
{{> deleteConfirmationModal}}
</template>

View file

@ -19,13 +19,11 @@ Template.catMgmtTbl.helpers({
Template.catMgmtTbl.events({
'click .deleteCategory' (event) {
event.preventDefault();
Meteor.call('delete.category', this._id, function(err, result) {
if (err) {
console.log(" ERROR deleting category: " + err);
} else {
console.log(" SUCCESS deleting the category.");
}
});
Session.set("deleteId", this._id);
Session.set("method", "delete.category");
Session.set("item", this.categoryName);
Session.set("view", "Categories");
$('#modalDelete').modal('open');
},
'click .editCategory' (event) {
event.preventDefault();

View file

@ -30,9 +30,9 @@ Template.listMgmtForm.events({
} else {
Meteor.call('add.list', listName, shared, function(err, result) {
if (err) {
console.log(" ERROR adding list name: " + err);
// console.log(" ERROR adding list name: " + err);
} else {
console.log(" SUCCESS adding list name.");
// console.log(" SUCCESS adding list name.");
$("#listNameInp").val("");
$("#isShared").prop("checked", false);
}
@ -51,9 +51,9 @@ Template.listMgmtForm.events({
} else {
Meteor.call('edit.list', listId, listName, shared, function(err, result) {
if (err) {
console.log(" ERROR editing list name: " + err);
// console.log(" ERROR editing list name: " + err);
} else {
console.log(" SUCCESS editing list name.");
// console.log(" SUCCESS editing list name.");
$("#listNameInp").val("");
$("#isShared").prop("checked", false);
Session.set("listNameEditMode", false);
@ -75,9 +75,9 @@ Template.listMgmtForm.events({
if (editMode == false) {
Meteor.call('add.list', listName, shared, function(err, result) {
if (err) {
console.log(" ERROR adding list name: " + err);
// console.log(" ERROR adding list name: " + err);
} else {
console.log(" SUCCESS adding list name.");
// console.log(" SUCCESS adding list name.");
$("#listNameInp").val("");
$("#isShared").prop("checked", false);
}
@ -85,9 +85,9 @@ Template.listMgmtForm.events({
} else {
Meteor.call('edit.list', listId, listName, shared, function(err, result) {
if (err) {
console.log(" ERROR editing list name: " + err);
// console.log(" ERROR editing list name: " + err);
} else {
console.log(" SUCCESS editing list name.");
// console.log(" SUCCESS editing list name.");
$("#listNameInp").val("");
$("#isShared").prop("checked", false);
Session.set("listNameEditMode", false);

View file

@ -13,4 +13,5 @@
</ul>
</div>
</div>
{{> deleteConfirmationModal}}
</template>

View file

@ -19,14 +19,12 @@ Template.listMgmtTbl.helpers({
Template.listMgmtTbl.events({
'click .deleteListName' (event) {
event.preventDefault();
Session.set("deleteId", this._id);
Session.set("method", "delete.list");
Session.set("item", this.listName);
Session.set("view", "Lists");
$('#modalDelete').modal('open');
let listId = this._id;
Meteor.call('delete.list', listId, function(err, result) {
if (err) {
console.log(" ERROR deleting list: " + err);
} else {
console.log(" SUCCESS deleting list.");
}
});
},
'click .editListName' (event) {
event.preventDefault();
@ -47,9 +45,9 @@ Template.listMgmtTbl.events({
let listId = this._id;
Meteor.call('mark.complete', listId, function(err, result) {
if (err) {
console.log(" ERROR marking complete: " + err);
// console.log(" ERROR marking complete: " + err);
} else {
console.log(" SUCCESS marking complete.");
// console.log(" SUCCESS marking complete.");
}
});
}

View file

@ -1,16 +1,11 @@
<template name="locMgmtForm">
<form action="" id="locInputForm">
<div class="row">
<div class="col s12 m6 l6 input-field">
<div class="col s8 m10 l10 input-field">
<input type="text" class="locNameInp" id="locNameInp" style="{{#if $eq locNameErr true}}border: 2px solid red;{{/if}}" />
<label for="locNameInp">Name*</label>
</div>
</div>
<div class="row">
<div class="col s6 m6 l6">
<a class="waves-effect waves-light btn cancelLocMgmt orange">Cancel</a>
</div>
<div class="col s6 m6 l6">
<div class="col s4 m2 l2 input-field">
{{#if $eq locEditMode false}}
<a class="waves-effect waves-light btn saveLocMgmt green right">Add</a>
{{else}}

View file

@ -12,4 +12,5 @@
</ul>
</div>
</div>
{{> deleteConfirmationModal}}
</template>

View file

@ -19,13 +19,11 @@ Template.locMgmtTbl.helpers({
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.");
}
});
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();

View file

@ -36,4 +36,5 @@
</table>
</div>
</div>
{{> deleteConfirmationModal}}
</template>

View file

@ -28,13 +28,11 @@ Template.prodMgmtTbl.helpers({
Template.prodMgmtTbl.events({
'click .deleteProduct' (event) {
event.preventDefault();
Meteor.call('delete.product', this._id, function(err, result) {
if (err) {
console.log(" ERROR deleting product: " + err);
} else {
console.log(" SUCCESS deleting the product.");
}
});
Session.set("deleteId", this._id);
Session.set("method", "delete.product");
Session.set("item", this.prodName);
Session.set("view", "Products");;
$('#modalDelete').modal('open');
},
'click .editProduct' (event) {
event.preventDefault();

View file

@ -1,16 +1,11 @@
<template name="storeMgmtForm">
<form id="storeForm" action="submit">
<div class="row">
<div class="col s12 input-field">
<div class="col s8 m10 l10 input-field">
<input type="text" class="storeName" id="storeName" />
<label for="storeName">Name</label>
</div>
</div>
<div class="row">
<div class="col s6 m6 l6">
<a class="waves-effect waves-light btn cancelStoreMgmt orange">Cancel</a>
</div>
<div class="col s6 m6 l6">
<div class="col s4 m2 l2 input-field">
{{#if $eq editModeStore false}}
<a class="waves-effect waves-light btn saveStoreMgmt green right">Add</a>
{{else}}

View file

@ -12,4 +12,5 @@
</ul>
</div>
</div>
{{> deleteConfirmationModal}}
</template>

View file

@ -19,13 +19,11 @@ Template.storeMgmtTbl.helpers({
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.");
}
});
Session.set("deleteId", this._id);
Session.set("method", "delete.store");
Session.set("item", this.storeName);
Session.set("view", "Stores");
$('#modalDelete').modal('open');
},
'click .editStore' (event) {
event.preventDefault();