Fixed all known bugs; Modified the menu to hide; Fixed the tables to scroll with a fixed header.
This commit is contained in:
@@ -29,19 +29,28 @@ Template.SalesSheetForm.onCreated(function() {
|
||||
// Place the sales sheet in a reactive var and put the setting of the reactive var in an autorun.
|
||||
// The autorun is needed apparently to ensure changes to the data force a change in the reactive var.
|
||||
Tracker.autorun(function() {
|
||||
let data = Blaze.getData(template.view);
|
||||
//****
|
||||
// Note: I have commented the code below out because I was unable to get Meteor to properly (according to their docs on Template.currentData() being reactive) call my code when the template's input data changes.
|
||||
// Because of this I have instead used the parent template's session variable "selectedSheet" to detect and handle the template data changing.
|
||||
// To avoid session variable conflicts, I have been using a session variable name prefix that is the template's name followed by a '.' as a convention.
|
||||
//****
|
||||
|
||||
//Force this to be reactive on the current data.
|
||||
try {
|
||||
Template.currentData();
|
||||
} catch(err) {
|
||||
// Ignore it. This always has an error accessing the currentData as the template is destroyed.
|
||||
}
|
||||
//try {
|
||||
// Template.currentData();
|
||||
//} catch(err) {
|
||||
// // Ignore it. This always has an error accessing the currentData as the template is destroyed.
|
||||
//}
|
||||
|
||||
//For some reason the current data is not always set, and does not always equal the template.data. We will use the template.data to get the actual ID of the sales sheet for the query.
|
||||
template.salesSheet.set(Meteor.collections.SalesSheets.findOne(template.data));
|
||||
//template.salesSheet.set(Template.instance() ? Meteor.collections.SalesSheets.findOne(Template.currentData()) : null);
|
||||
//template.salesSheet.set(Session.get("SalesSheets." + "selectedSheet"));
|
||||
template.salesSheet.set(Meteor.collections.SalesSheets.findOne(data));
|
||||
});
|
||||
|
||||
Tracker.autorun(function() {
|
||||
let products = template.salesSheet.get().products;
|
||||
let products = template.salesSheet.get() ? template.salesSheet.get().products : [];
|
||||
let index = 1;
|
||||
|
||||
// Note: We will ignore orphaned data in the dictionary so we don't have to clear the dictionary, or identify the orphans. The orphans are just a few extra product id's mapped to booleans, and should be fairly rare anyway.
|
||||
@@ -103,7 +112,7 @@ Template.SalesSheetForm.events({
|
||||
event.preventDefault();
|
||||
template.$('.sheetHeader').data('bs.validator').validate(function(isValid) {
|
||||
if(isValid) {
|
||||
let date = template.selectedDate.get();
|
||||
let date = ~~(moment(template.selectedDate.get()).format("YYYYMMDD"));
|
||||
let venueId = template.selectedVenue.get()._id;
|
||||
// Track the inserts and errors, display output to the user and log when everything is done.
|
||||
let insertMetadata = {
|
||||
|
||||
Reference in New Issue
Block a user