Fixed all known bugs; Modified the menu to hide; Fixed the tables to scroll with a fixed header.

This commit is contained in:
Wynne Crisman
2017-10-20 14:54:58 -07:00
parent 83e8268375
commit f848ea9a8f
34 changed files with 1019 additions and 821 deletions

View File

@@ -38,18 +38,12 @@ Template.Sales.onCreated(function() {
});
});
Template.Sales.onRendered(function() {
//$('.tableContainer').mCustomScrollbar();
$(".tableContainer").mCustomScrollbar({
scrollButtons:{enable:true},
theme:"light-thick",
scrollbarPosition:"outside"
scrollButtons: {enable:true},
theme: "light-thick",
scrollbarPosition: "outside",
scrollEasing: "linear"
});
//(function($){
// $(window).on("load",function(){
// $(".tableContainer").mCustomScrollbar();
// });
//})(jQuery);
//$('#test').mCustomScrollbar();
});
Template.Sales.onDestroyed(function() {
if(Template.Sales.salesSubscription) {
@@ -85,6 +79,11 @@ Template.Sales.events({
else {
Session.set(PREFIX + 'displayNewSale', true);
Session.set(PREFIX + "editedSale", undefined); //Clear the edited sale so that only one editor is open at a time.
//Set the focus to the date field of the form. Put this in a timeout so that it is queued for processing after the form is added to the DOM.
setTimeout(function() {
$("form[name='insertSaleForm'] input[name='date']").focus();
}, 10);
}
template.$('.newSaleButton').toggleClass('active');
},
@@ -123,8 +122,8 @@ Template.Sale.helpers({
productName: function(id) {
return Meteor.collections.Products.findOne({_id: id}, {fields: {name: 1}}).name;
},
formatDateAndWeek: function(date) {
return moment.utc(date.toString(), "YYYYMMDD").utc().format("MM/DD/YYYY (w)");
formatDateAndWeek: function(date, weekOfYear) {
return moment.utc(date.toString(), "YYYYMMDD").utc().format("MM/DD/YYYY") + "(" + weekOfYear + ")";
},
formatDateTime: function(date) {
return moment.utc(date).format("MM/DD/YYYY");
@@ -146,7 +145,7 @@ Template.Sale.events({
"click .actionEdit": function(event, template) {
Session.set(PREFIX + "editedSale", this._id);
Session.set(PREFIX + 'displayNewSale', false); //Ensure the new sale editor is closed.
template.$('.newSaleButton').removeClass('active');
template.parentTemplate().$('.newSaleButton').removeClass('active');
},
"click .saleRemove": function(event, template) {
let _this = this;
@@ -441,7 +440,6 @@ Template.InsertSale.events({
if(error) sAlert.error("Failed to insert the sale!\n" + error);
else {
sAlert.success("Sale Created");
nextMeasure.find(".amount").val(0);
//Clear the measure quantity fields so the user can enter another sale without the quantities already set.
for(let next = 0; next < insertSaleMeasures.length; next++) {
@@ -449,6 +447,11 @@ Template.InsertSale.events({
nextMeasure.find(".amount").val(0);
}
//Set the focus to the product field of the form.
$("form[name='insertSaleForm'] input[name='product']").focus();
//Clear the product since it is highly unlikely the same product will be added twice for the same date and market.
$("form[name='insertSaleForm'] input[name='product']").val("");
}
});
}