Redesigned the querying for the sale duplicates screen to use aggregation; Finished the styling of the sale duplicate screen; Tested the functionality of sale duplicates; Added a way to show hidden (ignored) duplicates.
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
|
||||
import './Pricing.html';
|
||||
|
||||
/**
|
||||
* Notes:
|
||||
* The Product object has a prices field which is an object whose fields names are Measure ID's. Each field value (for each Measure ID) is an object that has a 'price', 'effectiveDate', and 'previousPrice'.
|
||||
* The effectiveDate field stores the date as a number in the format YYYYMMDD. Converting this number into a local date is done with moment(sale.date.toString(), "YYYYMMDD").toDate(), and converting it to a number from a date can be accomplished with ~~(moment(date).format("YYYYMMDD")), where the ~~ is a bitwise not and converts a string to a number quickly and reliably.
|
||||
* Because the structure of the Product object is so complicated, the normal checking that is done by the framework cannot be used.
|
||||
*/
|
||||
|
||||
let QUERY_LIMIT = 20;
|
||||
let PREFIX = "Pricing.";
|
||||
|
||||
@@ -70,7 +77,7 @@ Template.Pricing.events({
|
||||
Meteor.call("clearProductPrice", productIds, measureId)
|
||||
}
|
||||
else {
|
||||
date = moment(date ? date : new Date().toDateInputValue(), "YYYY-MM-DD").toDate();
|
||||
date = ~~(moment(date ? date : new Date().toDateInputValue(), "YYYY-MM-DD").format("YYYYMMDD")); // The ~~ is a bitwise not which converts the string into a number in the format of YYYYMMDD for storage in the database; to avoid timezone issues.
|
||||
setPrevious = setPrevious == true || setPrevious == 'on' || setPrevious == "true" || setPrevious == "yes";
|
||||
|
||||
if(setPrevious == true && !date) {
|
||||
@@ -117,9 +124,8 @@ Template.PricingForProduct.helpers({
|
||||
},
|
||||
priceChangeDate: function() {
|
||||
let measureId = Session.get(PREFIX + "selectedMeasure");
|
||||
let date = this.prices && measureId && this.prices[measureId] && this.prices[measureId].effectiveDate ? this.prices[measureId].effectiveDate : undefined;
|
||||
|
||||
return date ? moment(date).format("MM/DD/YYYY (w)") : "-";
|
||||
return this.prices && measureId && this.prices[measureId] && this.prices[measureId].effectiveDate ? moment(this.prices[measureId].effectiveDate.toString(), "YYYYMMDD").format("MM/DD/YYYY (w)") : "-";
|
||||
},
|
||||
rowClass: function() {
|
||||
return this.deactivated ? "deactivated" : "";
|
||||
|
||||
Reference in New Issue
Block a user