mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 08:18:50 +00:00
Fixed Editing products
This commit is contained in:
parent
2b1022f513
commit
909030ea0f
1 changed files with 4 additions and 22 deletions
|
|
@ -4,8 +4,6 @@ import { Stores } from '../../../imports/api/stores.js';
|
|||
Template.prodMgmtForm.onCreated(function() {
|
||||
this.subscribe("myProducts");
|
||||
this.subscribe("storeInfo");
|
||||
this.subscribe("myCategories");
|
||||
this.subscribe("myLocations");
|
||||
});
|
||||
|
||||
Template.prodMgmtForm.onRendered(function() {
|
||||
|
|
@ -58,17 +56,8 @@ Template.prodMgmtForm.events({
|
|||
'click .editProdMgmt' (event) {
|
||||
event.preventDefault();
|
||||
let name = $("#prodName").val();
|
||||
|
||||
let location = $("#prodLocation").val();
|
||||
let prodId = Session.get("prodEditId");
|
||||
|
||||
if (cat == null) {
|
||||
cat = "";
|
||||
}
|
||||
|
||||
if (location == null) {
|
||||
location = "";
|
||||
}
|
||||
let store = $("#prodStore").val();
|
||||
|
||||
if (store == null) {
|
||||
store = "";
|
||||
|
|
@ -78,7 +67,7 @@ Template.prodMgmtForm.events({
|
|||
Session.set("prodNameRed", true);
|
||||
return;
|
||||
} else {
|
||||
Meteor.call('edit.product', prodId, name, cat, store, location, function(err, result) {
|
||||
Meteor.call('edit.product', prodId, name, store, function(err, result) {
|
||||
if (err) {
|
||||
// console.log(" ERROR: can't add product: " + err);
|
||||
} else {
|
||||
|
|
@ -99,13 +88,6 @@ Template.prodMgmtForm.events({
|
|||
let prodId = Session.get("prodEditId");
|
||||
let prodEditMode = Session.get("prodEditMode");
|
||||
console.log(" ---- got the submit event for products.");
|
||||
if (cat == null) {
|
||||
cat = "";
|
||||
}
|
||||
|
||||
if (location == null) {
|
||||
location = "";
|
||||
}
|
||||
|
||||
if (store == null) {
|
||||
store = "";
|
||||
|
|
@ -116,7 +98,7 @@ Template.prodMgmtForm.events({
|
|||
return;
|
||||
} else {
|
||||
if (prodEditMode == true) {
|
||||
Meteor.call('edit.product', prodId, name, cat, store, location, function(err, result) {
|
||||
Meteor.call('edit.product', prodId, name, store, function(err, result) {
|
||||
if (err) {
|
||||
// console.log(" ERROR: can't add product: " + err);
|
||||
} else {
|
||||
|
|
@ -127,7 +109,7 @@ Template.prodMgmtForm.events({
|
|||
}
|
||||
});
|
||||
} else {
|
||||
Meteor.call('add.product', name, cat, store, location, function(err, result) {
|
||||
Meteor.call('add.product', name, store, function(err, result) {
|
||||
if (err) {
|
||||
// console.log(" ERROR: can't add product: " + err);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue