Added custom scroll bars and separated the table header from the tables for Sales and the Graphs tables.
This commit is contained in:
@@ -16,6 +16,16 @@ let SalesSchema = new SimpleSchema({
|
||||
optional: false,
|
||||
index: 1
|
||||
},
|
||||
timestamp: {
|
||||
type: Date,
|
||||
label: "Timestamp",
|
||||
optional: true
|
||||
},
|
||||
weekOfYear: {
|
||||
type: Number,
|
||||
label: "Week Of Year",
|
||||
optional: true
|
||||
},
|
||||
amount: {
|
||||
type: Number,
|
||||
label: "Amount",
|
||||
@@ -189,7 +199,8 @@ if(Meteor.isServer) {
|
||||
let group = {
|
||||
$group: {
|
||||
_id: {
|
||||
year: {$dateToString: {format: '%Y', date: '$date'}}//{$year: '$date'}
|
||||
//year: {$dateToString: {format: '%Y', date: '$date'}}//{$year: '$date'}
|
||||
year: {$substr: ['$date', 0, 4]}
|
||||
},
|
||||
'total': {
|
||||
$sum: {
|
||||
@@ -212,13 +223,13 @@ if(Meteor.isServer) {
|
||||
|
||||
//Annual is assumed if not week or month.
|
||||
if(time === 'weekly') {
|
||||
group.$group._id.week = {$dateToString: {format: '%U', date: '$date'}}; //{$week: '$date'};
|
||||
group.$group._id.week = '$weekOfYear'; //{$dateToString: {format: '%U', date: new Date({$concat: [{$substr: ['$date', 0, 4]}, '-', {$substr: ['$date', 4, 2]}, '-', {$substr: ['$date', 6, 2]}]}) }}; //{$week: '$date'};
|
||||
project.$project.week = '$_id.week';
|
||||
project.$project.date = {$concat: ['$_id.week', '-', '$_id.year']};
|
||||
project.$project._id.$concat.push('$_id.week');
|
||||
project.$project.date = {$concat: [{$substr: ['$_id.week', 0, 2]}, '-', '$_id.year']};
|
||||
project.$project._id.$concat.push({$substr: ['$_id.week', 0, 2]});
|
||||
}
|
||||
else if(time === 'monthly') {
|
||||
group.$group._id.month = {$dateToString: {format: '%m', date: '$date'}}; //{$month: '$date'};
|
||||
group.$group._id.month = {$substr: ['$date', 4, 6]}; //{$dateToString: {format: '%m', date: new Date({$concat: [{$substr: ['$date', 0, 4]}, '-', {$substr: ['$date', 4, 2]}, '-', {$substr: ['$date', 6, 2]}]}) }}; //{$month: '$date'};
|
||||
project.$project.month = '$_id.month';
|
||||
project.$project.date = {$concat: ['$_id.month', '-', '$_id.year']};
|
||||
project.$project._id.$concat.push('$_id.month');
|
||||
@@ -285,7 +296,11 @@ if(Meteor.isServer) {
|
||||
comment: Match.Optional(String)
|
||||
});
|
||||
|
||||
let dateString = date.toString();
|
||||
|
||||
sale.createdAt = new Date();
|
||||
sale.timestamp = new Date(dateString.substring(0, 4) + "-" + dateString.substring(4, 6) + "-" + dateString.substring(6, 8) + "T00:00:00Z");
|
||||
sale.weekOfYear = sale.timestamp.getWeek().toString();
|
||||
|
||||
if(Roles.userIsInRole(this.userId, [Meteor.UserRoles.ROLE_UPDATE])) {
|
||||
Sales.insert(sale, function(err, id) {
|
||||
@@ -332,8 +347,12 @@ if(Meteor.isServer) {
|
||||
check(price, Number);
|
||||
check(amount, Number);
|
||||
|
||||
let dateString = date.toString();
|
||||
let timestamp = new Date(dateString.substring(0, 4) + "-" + dateString.substring(4, 6) + "-" + dateString.substring(6, 8) + "T00:00:00Z");
|
||||
let weekOfYear = sale.timestamp.getWeek().toString();
|
||||
|
||||
if(Roles.userIsInRole(this.userId, [Meteor.UserRoles.ROLE_UPDATE])) {
|
||||
Sales.update(id, {$set: {date, venueId, price, amount}}, function(err, id) {
|
||||
Sales.update(id, {$set: {date, venueId, price, amount, timestamp, weekOfYear}}, function(err, id) {
|
||||
if(err) console.log(err);
|
||||
}, {bypassCollection2: true});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user