+
diff --git a/brewman/brewman/static/scripts/angular_filter.js b/brewman/brewman/static/scripts/angular_filter.js
index 70e74277..07452e1c 100644
--- a/brewman/brewman/static/scripts/angular_filter.js
+++ b/brewman/brewman/static/scripts/angular_filter.js
@@ -45,3 +45,59 @@ overlord_filter.filter('journalDebit', function () {
return list;
};
});
+
+overlord_filter.filter('localTime', function () {
+ var months = {
+ Jan: 1,
+ Feb: 2,
+ Mar: 3,
+ Apr: 4,
+ May: 5,
+ Jun: 6,
+ Jul: 7,
+ Aug: 8,
+ Sep: 9,
+ Oct: 10,
+ Nov: 11,
+ Dec: 12
+ }
+ var months_reverse = {
+ 1: 'Jan',
+ 2: 'Feb',
+ 3: 'Mar',
+ 4: 'Apr',
+ 5: 'May',
+ 6: 'Jun',
+ 7: 'Jul',
+ 8: 'Aug',
+ 9: 'Sep',
+ 10: 'Oct',
+ 11: 'Nov',
+ 12: 'Dec'
+ }
+
+ function padNumber(input, length) {
+ if (typeof input == 'number'){
+ input = '' + input;
+ }
+ if (typeof length === 'undefined' || !length) {
+ length = 2;
+ }
+ while (input.length < length) {
+ input = '0' + input;
+ }
+ return input;
+ }
+
+ return function (input) {
+ var d = input.match(/(\w+)/g);
+ if (d.length !== 5) {
+ return input;
+ }
+ var date = new Date(parseInt(d[2]), months[d[1]] - 1, parseInt(d[0]), parseInt(d[3]), parseInt(d[4])).getTime();
+ date = new Date(date - (new Date().getTimezoneOffset() * 60000));
+ var output = padNumber(date.getDate()) + '-' + months_reverse[date.getMonth() + 1] + '-' + date.getFullYear() + ' ' + padNumber(date.getHours()) + ':' + padNumber(date.getMinutes());
+ return output;
+ };
+});
+
diff --git a/brewman/brewman/static/scripts/salary-deduction.js b/brewman/brewman/static/scripts/salary-deduction.js
index 6dd4a241..3c33a016 100644
--- a/brewman/brewman/static/scripts/salary-deduction.js
+++ b/brewman/brewman/static/scripts/salary-deduction.js
@@ -14,18 +14,18 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'voucher', function ($scope, $
function daysInMonthFunction(date) {
var months = {
- Jan:1,
- Feb:2,
- Mar:3,
- Apr:4,
- May:5,
- Jun:6,
- Jul:7,
- Aug:8,
- Sep:9,
- Oct:10,
- Nov:11,
- Dec:12
+ Jan: 1,
+ Feb: 2,
+ Mar: 3,
+ Apr: 4,
+ May: 5,
+ Jun: 6,
+ Jul: 7,
+ Aug: 8,
+ Sep: 9,
+ Oct: 10,
+ Nov: 11,
+ Dec: 12
}
if (!date.match(/^\d{2}-[\w]{3}-[\d]{4}$/g)) {
return;
@@ -40,7 +40,7 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'voucher', function ($scope, $
employer_rate = .0475;
var employee = (grossSalary > limit) ? 0 : Math.ceil(employee_rate * grossSalary * daysWorked / daysInMonth)
var employer = (grossSalary > limit) ? 0 : Math.ceil(employer_rate * grossSalary * daysWorked / daysInMonth)
- return {ee:employee, er:employer, both:employee + employer};
+ return {ee: employee, er: employer, both: employee + employer};
}
function getPf(grossSalary, daysWorked, daysInMonth) {
@@ -49,7 +49,7 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'voucher', function ($scope, $
employer_rate = .12 + .011 + .005 + .0001;
var employee = (grossSalary > limit) ? 0 : Math.ceil(employee_rate * grossSalary * daysWorked / daysInMonth)
var employer = (grossSalary > limit) ? 0 : Math.ceil(employer_rate * grossSalary * daysWorked / daysInMonth)
- return {ee:employee, er:employer, both:employee + employer};
+ return {ee: employee, er: employer, both: employee + employer};
}
$scope.add = function () {
@@ -61,17 +61,17 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'voucher', function ($scope, $
pf = getPf(grossSalary, daysWorked, daysInMonth);
if (typeof oldJournal !== 'undefined') {
- $scope.toasts.push({Type:'Error', Message:'Employee has already been added!'});
+ $scope.toasts.push({Type: 'Error', Message: 'Employee has already been added!'});
} else {
this.voucher.SalaryDeductions.push(
{
- Journal:{Ledger:$scope.employee},
- GrossSalary:grossSalary,
- DaysWorked:daysWorked,
- EsiEmployee:esi.ee,
- PfEmployee:pf.ee,
- EsiEmployer:esi.er,
- PfEmployer:pf.er
+ Journal: {Ledger: $scope.employee},
+ GrossSalary: grossSalary,
+ DaysWorked: daysWorked,
+ EsiEmployee: esi.ee,
+ PfEmployee: pf.ee,
+ EsiEmployer: esi.er,
+ PfEmployer: pf.er
}
)
;
@@ -103,43 +103,43 @@ var SalaryDeductionCtrl = ['$scope', '$location', 'voucher', function ($scope, $
};
$scope.get = function (voucherid) {
- $scope.voucher = Voucher.get({VoucherID:voucherid}, function (u, putResponseHeaders) {
- $scope.toasts.push({Type:'Success', Message:''});
+ $scope.voucher = Voucher.get({VoucherID: voucherid}, function (u, putResponseHeaders) {
+ $scope.toasts.push({Type: 'Success', Message: ''});
}, function (data, status) {
- $scope.toasts.push({Type:'Error', Message:data.data});
+ $scope.toasts.push({Type: 'Error', Message: data.data});
});
};
$scope.save = function () {
- $scope.voucher.$save({type:'Salary Deduction'}, function (u, putResponseHeaders) {
- $scope.toasts.push({Type:'Success', Message:''});
+ $scope.voucher.$save({type: 'Salary Deduction'}, function (u, putResponseHeaders) {
+ $scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/SalaryDeduction/' + u.VoucherID);
}, function (data, status) {
- $scope.toasts.push({Type:'Error', Message:data.data});
+ $scope.toasts.push({Type: 'Error', Message: data.data});
});
};
$scope.delete = function () {
$scope.voucher.$delete(function (u, putResponseHeaders) {
- $scope.toasts.push({Type:'Success', Message:''});
+ $scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/SalaryDeduction').replace();
}, function (data, status) {
- $scope.toasts.push({Type:'Error', Message:data.data});
+ $scope.toasts.push({Type: 'Error', Message: data.data});
});
};
$scope.post = function () {
$scope.voucher.$post(function (u, putResponseHeaders) {
- $scope.toasts.push({Type:'Success', Message:''});
+ $scope.toasts.push({Type: 'Success', Message: ''});
}, function (data, status) {
- $scope.toasts.push({Type:'Error', Message:data.data});
+ $scope.toasts.push({Type: 'Error', Message: data.data});
});
};
}]
SalaryDeductionCtrl.resolve = {
- voucher:['$q', '$route', 'Voucher', function ($q, $route, Voucher) {
+ voucher: ['$q', '$route', 'Voucher', function ($q, $route, Voucher) {
var deferred = $q.defer();
var id = $route.current.params.id;
@@ -149,9 +149,9 @@ SalaryDeductionCtrl.resolve = {
};
if (typeof id === 'undefined') {
- Voucher.get({type:'Salary Deduction'}, successCb);
+ Voucher.get({type: 'Salary Deduction'}, successCb);
} else {
- Voucher.get({id:id}, successCb);
+ Voucher.get({id: id}, successCb);
}
return deferred.promise;
}]
diff --git a/brewman/brewman/views/messaging.py b/brewman/brewman/views/messaging.py
index 38bd629f..c987bdf9 100644
--- a/brewman/brewman/views/messaging.py
+++ b/brewman/brewman/views/messaging.py
@@ -97,8 +97,8 @@ def show_list(request):
threads = []
for item in list:
thread = {'ThreadID': item.id, 'Title': item.title,
- 'CreationDate': item.creation_date.strftime('%d-%b-%Y %H:%M'),
- 'User': item.user.name, 'Priority': item.priority, 'Public': item.public, 'Tags': [], 'Posts': []}
+ 'CreationDate': item.creation_date.strftime('%d-%b-%Y %H:%M'), 'User': item.user.name,
+ 'Priority': item.priority, 'Public': item.public, 'Tags': [], 'Posts': []}
threads.append(thread)
for tag in item.tags:
thread['Tags'].append(tag.name)