diff --git a/brewman/brewman/__init__.py b/brewman/brewman/__init__.py index 0c6ff811..bdf757ec 100644 --- a/brewman/brewman/__init__.py +++ b/brewman/brewman/__init__.py @@ -78,8 +78,8 @@ def main(global_config, **settings): config.add_route('journal', '/Journal') config.add_route('purchase_id', '/Purchase/{id}') config.add_route('purchase', '/Purchase') - config.add_route('purchase_return_id', '/PurchaseReturn/{id}') - config.add_route('purchase_return', '/PurchaseReturn') + config.add_route('purchase_return_id', '/Return/{id}') + config.add_route('purchase_return', '/Return') config.add_route('payment_id', '/Payment/{id}') config.add_route('payment', '/Payment') config.add_route('receipt_id', '/Receipt/{id}') diff --git a/brewman/brewman/models/auth.py b/brewman/brewman/models/auth.py index dff7ec1c..096b68e0 100644 --- a/brewman/brewman/models/auth.py +++ b/brewman/brewman/models/auth.py @@ -1,9 +1,11 @@ +import random +import string import uuid from sqlalchemy.schema import ForeignKey, Table from brewman.models.guidtype import GUID from hashlib import md5 -from sqlalchemy import Column, Boolean, Unicode +from sqlalchemy import Column, Boolean, Unicode, Integer from sqlalchemy.orm import synonym, relationship @@ -14,12 +16,50 @@ def encrypt(val): return md5(val.encode('utf-8') + "Salt".encode('utf-8')).hexdigest() -#class UserGroup(Base): -# __tablename__ = 'auth_usergroups' -# -# id = Column('UserGroupID', GUID(), primary_key=True) -# user_id = Column('UserID', GUID(), ForeignKey('auth_users.UserID')) -# group_id = Column('GroupID', GUID(), ForeignKey('auth_groups.GroupID')) +class Client(Base): + __tablename__ = 'auth_clients' + + id = Column('ClientID', GUID(), primary_key=True, default=uuid.uuid4) + code = Column('Code', Integer, unique=True, nullable=False) + name = Column('Name', Unicode(255), unique=True, nullable=False) + enabled = Column('Enabled', Boolean, nullable=False) + otp = Column('OTP', Integer) + + def __init__(self, code=None, name=None, enabled=False, otp=None): + self.code = code + self.name = name + self.enabled = enabled + self.otp = otp + + @classmethod + def by_id(cls, id): + if not isinstance(id, uuid.UUID): + id = uuid.UUID(id) + return DBSession.query(cls).filter(cls.id == id).first() + + @classmethod + def by_code(cls, code): + if not isinstance(code, int): + code = int(code) + return DBSession.query(cls).filter(cls.code == code).first() + + @classmethod + def list(cls): + return DBSession.query(cls).order_by(cls.name).all() + + @classmethod + def enabled_list(cls): + return DBSession.query(cls).filter(cls.enabled == True).order_by(cls.name).all() + + @classmethod + def create(cls): + client_code = random.randint(1000, 9999) + otp = random.randint(1000, 9999) + name = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(6)) +# name = str(client_code) + client = Client(client_code, name, False, otp) + DBSession.add(client) + return client user_group = Table( @@ -27,7 +67,7 @@ user_group = Table( Column('UserGroupID', GUID(), primary_key=True, default=uuid.uuid4), Column('UserID', GUID(), ForeignKey('auth_users.UserID')), Column('GroupID', GUID(), ForeignKey('auth_groups.GroupID')) - ) +) #class RoleGroup(Base): # __tablename__ = 'auth_rolegroups' @@ -37,12 +77,12 @@ user_group = Table( # group_id = Column('GroupID', GUID(), ForeignKey('auth_groups.GroupID')) -role_group = Table ( +role_group = Table( 'auth_rolegroups', Base.metadata, Column('RoleGroupID', GUID(), primary_key=True, default=uuid.uuid4), Column('RoleID', GUID(), ForeignKey('auth_roles.RoleID')), Column('GroupID', GUID(), ForeignKey('auth_groups.GroupID')) - ) +) class User(Base): diff --git a/brewman/brewman/models/master.py b/brewman/brewman/models/master.py index 62761b43..b03b10e8 100644 --- a/brewman/brewman/models/master.py +++ b/brewman/brewman/models/master.py @@ -160,6 +160,7 @@ class LedgerBase(Base): type = Column('Type', Integer, nullable=False) ledger_type = Column('ledger_type', Unicode(50), nullable=False) is_active = Column('IsActive', Boolean) + is_reconcilable = Column('IsReconcilable', Boolean) costcenter_id = Column('CostCenterID', GUID(), ForeignKey('entities_costcenters.CostCenterID')) __mapper_args__ = {'polymorphic_on': ledger_type} @@ -174,11 +175,12 @@ class LedgerBase(Base): def type_object(self): return LedgerType.by_id(self.type) - def __init__(self, code=None, name=None, type=None, is_active=None, costcenter_id=None): + def __init__(self, code=None, name=None, type=None, is_active=None, is_reconcilable=False, costcenter_id=None): self.code = code self.name = name self.type = type self.is_active = is_active + self.is_reconcilable = is_reconcilable self.costcenter_id = costcenter_id @classmethod @@ -253,7 +255,8 @@ class Employee(LedgerBase): self.service_points = service_points self.joining_date = joining_date self.leaving_date = leaving_date - super().__init__(code, name, 10, is_active, costcenter_id) + super().__init__(code=code, name=name, type=10, is_active=is_active, is_reconcilable=False, + costcenter_id=costcenter_id) def create(self): code = DBSession.query(func.max(LedgerBase.code)).filter(LedgerBase.type == self.type).one()[0] @@ -341,14 +344,14 @@ class LedgerType: list.append(LedgerType(5, 'Capital', True, False, False, 70, True)) list.append(LedgerType(6, 'Debtors', True, True, True, 30, True)) list.append(LedgerType(7, 'Expenses', False, True, True, 40, True)) -# list.append(LedgerType(8, 'Discount', False, False, True, 30, True)) + # list.append(LedgerType(8, 'Discount', False, False, True, 30, True)) list.append(LedgerType(9, 'Creditors', True, False, True, 60, True)) list.append(LedgerType(10, 'Salary', True, True, True, 40, False)) list.append(LedgerType(11, 'Liabilities', True, False, True, 50, True)) list.append(LedgerType(12, 'Revenue', False, False, True, 30, True)) -# list.append(LedgerType(13, 'Tax', True, False, True, 80, True)) -# list.append(LedgerType(14, 'Total', False, False, False, 900, False)) -# list.append(LedgerType(15, 'Net', False, False, False, 1000, False)) + # list.append(LedgerType(13, 'Tax', True, False, True, 80, True)) + # list.append(LedgerType(14, 'Total', False, False, False, 900, False)) + # list.append(LedgerType(15, 'Net', False, False, False, 1000, False)) return list diff --git a/brewman/brewman/static/partial/account-detail.html b/brewman/brewman/static/partial/account-detail.html index 28848762..2fe0698a 100644 --- a/brewman/brewman/static/partial/account-detail.html +++ b/brewman/brewman/static/partial/account-detail.html @@ -30,6 +30,9 @@ + diff --git a/brewman/brewman/static/partial/account-list.html b/brewman/brewman/static/partial/account-list.html index aab1086e..9daa1fd8 100644 --- a/brewman/brewman/static/partial/account-list.html +++ b/brewman/brewman/static/partial/account-list.html @@ -5,6 +5,7 @@ Name Type Is Active? + Is Reconcilable? Cost Center @@ -13,6 +14,7 @@ {{item.Name}} {{item.Type}} {{item.IsActive}} + {{item.IsReconcilable}} {{item.CostCenter}} diff --git a/brewman/brewman/static/partial/issue.html b/brewman/brewman/static/partial/issue.html index 8fa0a5cf..6b80873d 100644 --- a/brewman/brewman/static/partial/issue.html +++ b/brewman/brewman/static/partial/issue.html @@ -67,14 +67,14 @@
- +
-
diff --git a/brewman/brewman/static/partial/journal.html b/brewman/brewman/static/partial/journal.html index 68a27fe2..36622f08 100644 --- a/brewman/brewman/static/partial/journal.html +++ b/brewman/brewman/static/partial/journal.html @@ -15,7 +15,7 @@
- +
- +
@@ -38,18 +38,18 @@ - - - - + + + + - - - - + + + diff --git a/brewman/brewman/static/partial/purchase-return.html b/brewman/brewman/static/partial/purchase-return.html new file mode 100644 index 00000000..c74eaea6 --- /dev/null +++ b/brewman/brewman/static/partial/purchase-return.html @@ -0,0 +1,104 @@ + + Purchase Return Edit / New +
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + + +
+ + +
+ ₹ +
+
+
+
+ + +
+ + + +
+
+ +
+ + +
+
DebitNameAmountDeleteDebitNameAmountDelete
{{journal.Debit | debit}}{{journal.Ledger.Name}}{{journal.Amount}} + {{journal.Debit | debit}}{{journal.Ledger.Name}}{{journal.Amount}}
Delete diff --git a/brewman/brewman/static/partial/payment-modal.html b/brewman/brewman/static/partial/payment-modal.html new file mode 100644 index 00000000..fcc0b12f --- /dev/null +++ b/brewman/brewman/static/partial/payment-modal.html @@ -0,0 +1,23 @@ +
+ + + +
diff --git a/brewman/brewman/static/partial/payment.html b/brewman/brewman/static/partial/payment.html index 1843a8f8..a2daaf14 100644 --- a/brewman/brewman/static/partial/payment.html +++ b/brewman/brewman/static/partial/payment.html @@ -27,18 +27,17 @@
- +
- +
₹
- +
@@ -59,7 +58,17 @@
{{journal.Ledger.Name}} {{journal.Amount}} - +
+ Delete + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
ProductQuantityRateTaxDiscountAmountDelete
{{inventory.Product.Name}}{{inventory.Quantity}}{{inventory.Rate}}{{inventory.Tax}}{{inventory.Discount}}{{inventory.Amount}} + +
+
+ +
+ + +
+ +
+
+
+ + + +
+
+ Created on {{voucher.CreationDate}} and Last Edited on {{voucher.LastEditDate}} by {{voucher.User.Name}}. + Posted + by {{voucher.Poster}} +
+ \ No newline at end of file diff --git a/brewman/brewman/static/partial/purchase.html b/brewman/brewman/static/partial/purchase.html index 8dc60227..ddb9250c 100644 --- a/brewman/brewman/static/partial/purchase.html +++ b/brewman/brewman/static/partial/purchase.html @@ -44,7 +44,7 @@ placeholder="Tax" ng-model="tax"/> - diff --git a/brewman/brewman/static/partial/receipt-modal.html b/brewman/brewman/static/partial/receipt-modal.html new file mode 100644 index 00000000..d9d27651 --- /dev/null +++ b/brewman/brewman/static/partial/receipt-modal.html @@ -0,0 +1,23 @@ +
+ + + +
diff --git a/brewman/brewman/static/partial/receipt.html b/brewman/brewman/static/partial/receipt.html index 30633e5e..d2a46eee 100644 --- a/brewman/brewman/static/partial/receipt.html +++ b/brewman/brewman/static/partial/receipt.html @@ -27,7 +27,7 @@
- +
-
@@ -59,7 +59,17 @@ {{journal.Ledger.Name}} {{journal.Amount}} - +
+ Delete + + +
diff --git a/brewman/brewman/static/scripts/account.js b/brewman/brewman/static/scripts/account.js index ecc043c3..8c026629 100644 --- a/brewman/brewman/static/scripts/account.js +++ b/brewman/brewman/static/scripts/account.js @@ -1,4 +1,6 @@ -function AccountListCtrl($scope, accounts) { +'use strict'; + +function AccountListCtrl($scope, accounts) { $scope.info = accounts; } AccountListCtrl.resolve = { @@ -12,10 +14,10 @@ AccountListCtrl.resolve = { Account.query({}, successCb); return deferred.promise; } -} +}; function AccountCtrl($scope, $location, account, account_types, cost_centers) { - $scope.account = account + $scope.account = account; $scope.account_types = account_types; $scope.cost_centers = cost_centers; @@ -73,4 +75,4 @@ AccountCtrl.resolve = { CostCenter.query({}, successCb); return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/angular_directive.js b/brewman/brewman/static/scripts/angular_directive.js index 39832d03..0e44502b 100644 --- a/brewman/brewman/static/scripts/angular_directive.js +++ b/brewman/brewman/static/scripts/angular_directive.js @@ -1,6 +1,8 @@ +'use strict'; + var overlord_directive = angular.module('overlord.directive', []); overlord_directive.directive('autocomplete', function () { - var directiveDefinitionObject = { + return { restrict:'E', replace:true, transclude:true, @@ -41,11 +43,10 @@ overlord_directive.directive('autocomplete', function () { }); } }; - return directiveDefinitionObject; }); overlord_directive.directive('autobatch', function () { - var directiveDefinitionObject = { + return { restrict:'E', replace:true, transclude:true, @@ -81,11 +82,10 @@ overlord_directive.directive('autobatch', function () { }); } }; - return directiveDefinitionObject; }); overlord_directive.directive('datepicker', function () { - var directiveDefinitionObject = { + return { restrict:'E', replace:true, transclude:true, @@ -102,17 +102,16 @@ overlord_directive.directive('datepicker', function () { }); } }; - return directiveDefinitionObject; }); overlord_directive.directive('fadey', function () { - var directiveDefinitionObject = { + return { restrict:'A', link:function (scope, element, attrs) { var duration = 500; element = jQuery(element); element.hide(); - element.fadeIn(duration) + element.fadeIn(duration); scope.destroy = function (complete) { element.fadeOut(duration, function () { @@ -124,7 +123,6 @@ overlord_directive.directive('fadey', function () { } }; - return directiveDefinitionObject; }); overlord_directive.directive('ngConfirm', function (modal, $parse) { @@ -197,7 +195,7 @@ overlord_directive.directive('ngConfirm', function (modal, $parse) { overlord_directive.directive('journal-edit', function () { - var directiveDefinitionObject = { + return { restrict:'A', replace:true, transclude:true, @@ -210,5 +208,42 @@ overlord_directive.directive('journal-edit', function () { }); } }; - return directiveDefinitionObject; }); + +overlord_directive.directive('ngEditRepeat', function (modal, $parse) { + return { + restrict:'E', + template:'' + + '
' + + ' Delete' + + ' ' + + ' ' + + '
', + + link:function postLink(scope, element, attrs) { + // Could have custom or boostrap modal options here + var options = {}; + if (typeof attrs.url !== 'undefined') { + element.bind("click", function () { + if (typeof attrs.before !== 'undefined') { + var fn = $parse(attrs.before); + scope.$apply(function () { + fn(scope); + }); + } + modal.template(attrs.url, attrs.onAction, attrs.onCancel, scope, options); + }); + } else { + element.bind("click", function () { + var actionButton = {text:attrs["actionButtonText"], click:attrs["actionFunction"], class:attrs['class']}; + var cancelButton = {text:attrs["cancelButtonText"], click:attrs["cancelFunction"]}; + modal.confirm(attrs["title"], attrs["actionText"], actionButton, cancelButton, scope, options); + }); + } + } + }; + +}); + diff --git a/brewman/brewman/static/scripts/angular_filter.js b/brewman/brewman/static/scripts/angular_filter.js index 7e58833a..b2e66372 100644 --- a/brewman/brewman/static/scripts/angular_filter.js +++ b/brewman/brewman/static/scripts/angular_filter.js @@ -1,3 +1,5 @@ +'use strict'; + var overlord_filter = angular.module('overlord.filter', []); overlord_filter.filter('debit', function () { return function (input) { @@ -8,7 +10,6 @@ overlord_filter.filter('debit', function () { } else { return ''; } - ; }; }); diff --git a/brewman/brewman/static/scripts/angular_service.js b/brewman/brewman/static/scripts/angular_service.js index 730ca0f3..65baa6c8 100644 --- a/brewman/brewman/static/scripts/angular_service.js +++ b/brewman/brewman/static/scripts/angular_service.js @@ -1,3 +1,5 @@ +'use strict'; + var overlord_service = angular.module('overlord.service', ['ngResource']); // TODO: Replace hardcoded url with route_url diff --git a/brewman/brewman/static/scripts/attendance.js b/brewman/brewman/static/scripts/attendance.js index ae1e7ce9..2fdb98f4 100644 --- a/brewman/brewman/static/scripts/attendance.js +++ b/brewman/brewman/static/scripts/attendance.js @@ -1,4 +1,6 @@ -function AttendanceCtrl($scope, $location, Attendance, attendance_types, info) { +'use strict'; + +function AttendanceCtrl($scope, $location, Attendance, attendance_types, info) { $scope.attendance_types = attendance_types; $scope.info = info; $scope.show = function () { @@ -36,4 +38,4 @@ AttendanceCtrl.resolve = { AttendanceTypes.query({}, successCb); return deferred.promise; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/cash-flow.js b/brewman/brewman/static/scripts/cash-flow.js index 9cfa39ba..bb2139b1 100644 --- a/brewman/brewman/static/scripts/cash-flow.js +++ b/brewman/brewman/static/scripts/cash-flow.js @@ -1,4 +1,6 @@ -function CashFlowCtrl($scope, $routeParams, $location, cash_flow) { +'use strict'; + +function CashFlowCtrl($scope, $routeParams, $location, cash_flow) { $scope.info = cash_flow; $scope.show = function () { $location.path('/CashFlow').search({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate}); @@ -26,4 +28,4 @@ CashFlowCtrl.resolve = { } return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/closing-stock.js b/brewman/brewman/static/scripts/closing-stock.js index 3aeaf597..24bb0c64 100644 --- a/brewman/brewman/static/scripts/closing-stock.js +++ b/brewman/brewman/static/scripts/closing-stock.js @@ -1,4 +1,6 @@ -function ClosingStockCtrl($scope, $location, info) { +'use strict'; + +function ClosingStockCtrl($scope, $location, info) { $scope.info = info; $scope.show = function () { $location.path('/ClosingStock/' + $scope.info.Date); @@ -22,4 +24,4 @@ ClosingStockCtrl.resolve = { } return deferred.promise; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/cost-center.js b/brewman/brewman/static/scripts/cost-center.js index a13d0327..b326b6ef 100644 --- a/brewman/brewman/static/scripts/cost-center.js +++ b/brewman/brewman/static/scripts/cost-center.js @@ -1,4 +1,6 @@ -function CostCenterListCtrl($scope, cost_centers) { +'use strict'; + +function CostCenterListCtrl($scope, cost_centers) { $scope.info = cost_centers; } @@ -13,7 +15,7 @@ CostCenterListCtrl.resolve = { CostCenter.query({}, successCb); return deferred.promise; } -} +}; function CostCenterCtrl($scope, $routeParams, $location, cost_center) { $scope.cost_center = cost_center; @@ -51,4 +53,4 @@ CostCenterCtrl.resolve = { CostCenter.get({id:id}, successCb); return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/daybook.js b/brewman/brewman/static/scripts/daybook.js index c77f9a5f..61c5dc46 100644 --- a/brewman/brewman/static/scripts/daybook.js +++ b/brewman/brewman/static/scripts/daybook.js @@ -1,4 +1,6 @@ -function DaybookCtrl($scope, $location, info) { +'use strict'; + +function DaybookCtrl($scope, $location, info) { $scope.info = info; $scope.show = function () { $location.path('/Daybook').search({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate}); @@ -23,4 +25,4 @@ DaybookCtrl.resolve = { } return deferred.promise; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/delete-button-service.js b/brewman/brewman/static/scripts/delete-button-service.js index 394fd271..22627da4 100644 --- a/brewman/brewman/static/scripts/delete-button-service.js +++ b/brewman/brewman/static/scripts/delete-button-service.js @@ -1,4 +1,6 @@ -overlord_service.factory('modal', function ($http, $compile) { +'use strict'; + +overlord_service.factory('delete-button', function ($http, $compile) { var modal = {}; modal.get = function (create) { @@ -7,12 +9,12 @@ overlord_service.factory('modal', function ($http, $compile) { modal.dialog.appendTo('BODY'); } return modal.dialog; - } + }; modal.compileAndRun = function (dialog, scope, options) { $compile(dialog)(scope); dialog.modal(options); - } + }; modal.alert = function (title, text, button, scope, options) { text = (text) ? text : "Alert"; @@ -35,7 +37,7 @@ overlord_service.factory('modal', function ($http, $compile) { modal.close(); }); modal.compileAndRun(dialog, scope, options); - } + }; modal.confirm = function (title, actionText, actionButton, cancelButton, scope, options) { actionText = (actionText) ? actionText : "Are you sure?"; @@ -68,14 +70,14 @@ overlord_service.factory('modal', function ($http, $compile) { }); modal.compileAndRun(dialog, scope, options); - } + }; modal.close = function () { - var dialog = modal.get() + var dialog = modal.get(); if (dialog) { dialog.modal('hide'); } - } + }; return modal; diff --git a/brewman/brewman/static/scripts/employee-attendance.js b/brewman/brewman/static/scripts/employee-attendance.js index 0d7010a0..0ca71f95 100644 --- a/brewman/brewman/static/scripts/employee-attendance.js +++ b/brewman/brewman/static/scripts/employee-attendance.js @@ -1,4 +1,6 @@ -function EmployeeAttendanceCtrl($scope, $location, EmployeeAttendance, attendance_types, info) { +'use strict'; + +function EmployeeAttendanceCtrl($scope, $location, EmployeeAttendance, attendance_types, info) { $scope.attendance_types = attendance_types; $scope.info = info; $scope.show = function () { @@ -39,4 +41,4 @@ EmployeeAttendanceCtrl.resolve = { AttendanceTypes.query({}, successCb); return deferred.promise; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/employee-functions.js b/brewman/brewman/static/scripts/employee-functions.js index dba2b056..e5f4fb4b 100644 --- a/brewman/brewman/static/scripts/employee-functions.js +++ b/brewman/brewman/static/scripts/employee-functions.js @@ -1,4 +1,6 @@ -function EmployeeFunctionsCtrl($scope) { +'use strict'; + +function EmployeeFunctionsCtrl($scope) { $scope.creditSalary = function () { $scope.toasts.push({Type:'Error', Message:'Not Implemented Yet'}); }; diff --git a/brewman/brewman/static/scripts/employee.js b/brewman/brewman/static/scripts/employee.js index 9bde1390..5f02374a 100644 --- a/brewman/brewman/static/scripts/employee.js +++ b/brewman/brewman/static/scripts/employee.js @@ -1,4 +1,6 @@ -function EmployeeListCtrl($scope, employees) { +'use strict'; + +function EmployeeListCtrl($scope, employees) { $scope.info = employees; } EmployeeListCtrl.resolve = { @@ -12,12 +14,12 @@ EmployeeListCtrl.resolve = { Employee.query({}, successCb); return deferred.promise; } -} +}; function EmployeeCtrl($scope, $routeParams, $location, employee, cost_centers) { $scope.employee = employee; - $scope.cost_centers = cost_centers + $scope.cost_centers = cost_centers; $scope.save = function () { $scope.employee.$save(function (u, putResponseHeaders) { @@ -62,4 +64,4 @@ EmployeeCtrl.resolve = { CostCenter.query({}, successCb); return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/group.js b/brewman/brewman/static/scripts/group.js index e8ad85cf..6758adce 100644 --- a/brewman/brewman/static/scripts/group.js +++ b/brewman/brewman/static/scripts/group.js @@ -1,4 +1,6 @@ -function GroupListCtrl($scope, groups) { +'use strict'; + +function GroupListCtrl($scope, groups) { $scope.info = groups; } @@ -13,7 +15,7 @@ GroupListCtrl.resolve = { Group.query({}, successCb); return deferred.promise; } -} +}; function GroupCtrl($scope, $location, group) { $scope.group = group; @@ -51,4 +53,4 @@ GroupCtrl.resolve = { Group.get({id:id}, successCb); return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/issue.js b/brewman/brewman/static/scripts/issue.js index fce77750..2d2c2ed0 100644 --- a/brewman/brewman/static/scripts/issue.js +++ b/brewman/brewman/static/scripts/issue.js @@ -1,4 +1,6 @@ -function IssueCtrl($scope, $routeParams, $location, voucher, cost_centers, issue_grid, IssueGrid, Voucher) { +'use strict'; + +function IssueCtrl($scope, $routeParams, $location, voucher, cost_centers, issue_grid, IssueGrid, Voucher) { $scope.voucher = voucher; $scope.cost_centers = cost_centers; $scope.smallGrid = issue_grid; @@ -32,8 +34,8 @@ delete $scope.name; delete $scope.quantity; $('#txtBatch').val(''); + $('#txtBatch').focus(); } - $('#txtBatch').focus(); }; $scope.removeInventory = function (inventory) { var index = this.voucher.Inventories.indexOf(inventory); @@ -79,7 +81,7 @@ if (typeof newInventories === 'undefined' || typeof oldInventories === 'undefined') { return; } - var amount = 0 + var amount = 0; for (var i = 0, l = newInventories.length; i < l; i++) { amount += newInventories[i].Amount; } @@ -200,4 +202,5 @@ IssueCtrl.resolve = { CostCenter.query({}, successCb); return deferred.promise; - }} \ No newline at end of file + } +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/journal.js b/brewman/brewman/static/scripts/journal.js index 66450ff9..5897071b 100644 --- a/brewman/brewman/static/scripts/journal.js +++ b/brewman/brewman/static/scripts/journal.js @@ -1,4 +1,6 @@ -function JournalCtrl($scope, $location, voucher) { +'use strict'; + +function JournalCtrl($scope, $location, voucher) { $scope.voucher = voucher; $scope.name = ''; $scope.debit = 1; @@ -97,7 +99,7 @@ $scope.toggleDebit = function () { $("#editDebit").button('toggle'); $scope.edit.Debit = ($scope.edit.Debit === 1) ? -1 : 1; - } + }; $scope.toggleEdit = function (journal, update) { if (typeof update === 'undefined') { $scope.edit = {}; @@ -137,5 +139,4 @@ JournalCtrl.resolve = { } return deferred.promise; } - -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/ledger.js b/brewman/brewman/static/scripts/ledger.js index 14d97f2c..aaed6290 100644 --- a/brewman/brewman/static/scripts/ledger.js +++ b/brewman/brewman/static/scripts/ledger.js @@ -1,4 +1,6 @@ -function LedgerCtrl($scope, $routeParams, $location, ledger) { +'use strict'; + +function LedgerCtrl($scope, $routeParams, $location, ledger) { $scope.info = ledger; $scope.show = function () { $location.path('/Ledger/' + $scope.info.Ledger.LedgerID).search('StartDate', $scope.info.StartDate).search('FinishDate', $scope.info.FinishDate); @@ -25,6 +27,6 @@ LedgerCtrl.resolve = { } return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/login.js b/brewman/brewman/static/scripts/login.js index fed0561b..5843b79b 100644 --- a/brewman/brewman/static/scripts/login.js +++ b/brewman/brewman/static/scripts/login.js @@ -1,4 +1,6 @@ -function LoginCtrl($scope, $http, $location, $route, $routeParams) { +'use strict'; + +function LoginCtrl($scope, $http, $location, $route, $routeParams) { $scope.submit = function () { $http. post('/login', {username:$scope.username, password:$scope.password}). @@ -12,7 +14,7 @@ error(function (errorMessage) { $scope.toasts.push({Type:'Error', Message:errorMessage}); }); - } + }; $('#username').focus(); } diff --git a/brewman/brewman/static/scripts/modal-service.js b/brewman/brewman/static/scripts/modal-service.js index 9858cf2a..83450ed2 100644 --- a/brewman/brewman/static/scripts/modal-service.js +++ b/brewman/brewman/static/scripts/modal-service.js @@ -1,3 +1,5 @@ +'use strict'; + overlord_service.factory('modal', function ($http, $compile) { var modal = {}; @@ -7,12 +9,12 @@ overlord_service.factory('modal', function ($http, $compile) { modal.dialog.appendTo('BODY'); } return modal.dialog; - } + }; modal.compileAndRun = function (dialog, scope, options) { $compile(dialog)(scope); dialog.modal(options); - } + }; modal.alert = function (title, text, button, scope, options) { text = (text) ? text : "Alert"; @@ -35,7 +37,7 @@ overlord_service.factory('modal', function ($http, $compile) { modal.close(); }); modal.compileAndRun(dialog, scope, options); - } + }; modal.confirm = function (title, actionText, actionButton, cancelButton, scope, options) { actionText = (actionText) ? actionText : "Are you sure?"; @@ -68,7 +70,7 @@ overlord_service.factory('modal', function ($http, $compile) { }); modal.compileAndRun(dialog, scope, options); - } + }; modal.template = function (url, onSuccess, onCancel, scope, options) { $http.get(url).success(function (data) { @@ -85,20 +87,20 @@ overlord_service.factory('modal', function ($http, $compile) { if (onCancel) { scope.$eval(onCancel); } - }) + }); dialog.find("#cancel").click(function () { modal.close(); }); modal.compileAndRun(dialog, scope, options); }); - } + }; modal.close = function () { - var dialog = modal.get() + var dialog = modal.get(); if (dialog) { dialog.modal('hide'); } - } + }; return modal; diff --git a/brewman/brewman/static/scripts/overlord.js b/brewman/brewman/static/scripts/overlord.js index c71fc04e..810bfc76 100644 --- a/brewman/brewman/static/scripts/overlord.js +++ b/brewman/brewman/static/scripts/overlord.js @@ -19,6 +19,9 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte when('/Purchase', {templateUrl:'/partial/purchase.html', controller:PurchaseCtrl, resolve:PurchaseCtrl.resolve}). when('/Purchase/:id', {templateUrl:'/partial/purchase.html', controller:PurchaseCtrl, resolve:PurchaseCtrl.resolve}). + when('/Return', {templateUrl:'/partial/purchase-return.html', controller:PurchaseReturnCtrl, resolve:PurchaseReturnCtrl.resolve}). + when('/Return/:id', {templateUrl:'/partial/purchase-return.html', controller:PurchaseReturnCtrl, resolve:PurchaseReturnCtrl.resolve}). + when('/Issue', {templateUrl:'/partial/issue.html', controller:IssueCtrl, resolve:IssueCtrl.resolve}). when('/Issue/:id', {templateUrl:'/partial/issue.html', controller:IssueCtrl, resolve:IssueCtrl.resolve}). @@ -123,13 +126,16 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte }; }]); -function BaseCtrl($rootScope, $scope, Auth, $location) { +function BaseCtrl($rootScope, $scope, Auth, $location, $routeParams) { $rootScope.spinner = {http:0, route:false}; $rootScope.$on('event:loginRequired', function () { if ($rootScope.auth.isAuthenticated) { $location.path('/'); } else { - var came_from = $location.path(); + var came_from = $routeParams.came_from; + if (typeof came_from === 'undefined' && $location.path() === '/login') { + came_from = $location.path(); + } $location.path('/login').search({came_from:came_from}); } }); diff --git a/brewman/brewman/static/scripts/payment.js b/brewman/brewman/static/scripts/payment.js index a51fc7e9..ebe56b5b 100644 --- a/brewman/brewman/static/scripts/payment.js +++ b/brewman/brewman/static/scripts/payment.js @@ -1,27 +1,33 @@ -function PaymentCtrl($scope, $location, voucher, ledgers) { - $scope.voucher = voucher - $scope.ledgers = ledgers; +'use strict'; - $scope.addJournal = function () { - for (var i = 0, l = this.voucher.Journals.length; i < l; i++) { - if (this.voucher.Journals[i].Ledger.LedgerID === $scope.id) { - var amount = (this.voucher.Journals[i].Debit * this.voucher.Journals[i].Amount) + (parseInt($scope.debit) * Number($scope.amount)); - if (amount < 0) { - this.voucher.Journals[i].Debit = -1; - this.voucher.Journals[i].Amount = amount * -1; - } else { - this.voucher.Journals[i].Debit = 1; - this.voucher.Journals[i].Amount = amount; - } - break; +function PaymentCtrl($scope, $location, voucher, ledgers) { + $scope.voucher = voucher; + $scope.ledgers = ledgers; + function getOldJournal(ledgerID, journals) { + for (var i = 0, l = journals.length; i < l; i++) { + if (journals[i].Ledger.LedgerID === ledgerID) { + return journals[i]; } } - if (i >= l) { - this.voucher.Journals.push({Debit:1, Amount:Number($scope.amount), Ledger:{LedgerID:$scope.id, Name:$scope.name}}); + + } + + $scope.addJournal = function () { + var oldJournal = getOldJournal($scope.ledger.LedgerID, this.voucher.Journals); + if (typeof oldJournal !== 'undefined') { + var amount = (oldJournal.Debit * oldJournal.Amount) + (parseInt($scope.debit) * Number($scope.amount)); + if (amount < 0) { + oldJournal.Debit = -1; + oldJournal.Amount = amount * -1; + } else { + oldJournal.Debit = 1; + oldJournal.Amount = amount; + } + } else { + this.voucher.Journals.push({Debit:1, Amount:Number($scope.amount), Ledger:$scope.ledger}); } + delete $scope.ledger; delete $scope.amount; - delete $scope.id; - delete $scope.name; $('#txtLedger').focus(); }; @@ -93,6 +99,27 @@ $scope.toasts.push({Type:'Error', Message:data.data}); }); }; + + $scope.toggleEdit = function (journal, update) { + if (typeof update === 'undefined') { + $scope.edit = {}; + angular.copy(journal, $scope.edit); + } else { + if (update === true && typeof $scope.edit !== 'undefined') { + if (journal.Ledger.LedgerID !== $scope.edit.Ledger.LedgerID) { + var oldJournal = getOldJournal($scope.edit.Ledger.LedgerID, $scope.voucher.Journals); + if (typeof oldJournal !== 'undefined') { + return false; + } + } + angular.copy($scope.edit, journal); + $scope.$apply(); + return true; + } else if (update === false) { + delete $scope.edit; + } + } + } } PaymentCtrl.resolve = { @@ -117,9 +144,9 @@ PaymentCtrl.resolve = { var successCb = function (result) { deferred.resolve(result); - } + }; LedgerService.query({type:1}, successCb); return deferred.promise; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/product-group.js b/brewman/brewman/static/scripts/product-group.js index dbbd1111..7ca257b3 100644 --- a/brewman/brewman/static/scripts/product-group.js +++ b/brewman/brewman/static/scripts/product-group.js @@ -1,4 +1,6 @@ -function ProductGroupListCtrl($scope, product_groups) { +'use strict'; + +function ProductGroupListCtrl($scope, product_groups) { $scope.info = product_groups } @@ -13,7 +15,7 @@ ProductGroupListCtrl.resolve = { ProductGroup.query({}, successCb); return deferred.promise; } -} +}; function ProductGroupCtrl($scope, $location, product_group) { $scope.product_group = product_group; @@ -51,4 +53,4 @@ ProductGroupCtrl.resolve = { ProductGroup.get({id:id}, successCb); return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/product-ledger.js b/brewman/brewman/static/scripts/product-ledger.js index 7c135706..795565b4 100644 --- a/brewman/brewman/static/scripts/product-ledger.js +++ b/brewman/brewman/static/scripts/product-ledger.js @@ -1,4 +1,6 @@ -function ProductLedgerCtrl($scope, $routeParams, $location, product_ledger) { +'use strict'; + +function ProductLedgerCtrl($scope, $routeParams, $location, product_ledger) { $scope.info = product_ledger; $scope.show = function () { $location.path('/ProductLedger/' + $scope.info.Product.ProductID).search('StartDate', $scope.info.StartDate).search('FinishDate', $scope.info.FinishDate); @@ -24,4 +26,4 @@ ProductLedgerCtrl.resolve = { } return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/product.js b/brewman/brewman/static/scripts/product.js index aadc5659..d68e557a 100644 --- a/brewman/brewman/static/scripts/product.js +++ b/brewman/brewman/static/scripts/product.js @@ -1,4 +1,6 @@ -function ProductListCtrl($scope, products) { +'use strict'; + +function ProductListCtrl($scope, products) { $scope.info = products; } @@ -13,10 +15,10 @@ ProductListCtrl.resolve = { Product.query({}, successCb); return deferred.promise; } -} +}; function ProductCtrl($scope, $location, product, product_groups) { - $scope.product = product + $scope.product = product; $scope.product_groups = product_groups; $scope.save = function () { @@ -62,4 +64,4 @@ ProductCtrl.resolve = { ProductGroup.query({}, successCb); return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/profit-loss.js b/brewman/brewman/static/scripts/profit-loss.js index c768df71..926936c8 100644 --- a/brewman/brewman/static/scripts/profit-loss.js +++ b/brewman/brewman/static/scripts/profit-loss.js @@ -1,4 +1,6 @@ -function ProfitLossCtrl($scope, $location, profit_loss) { +'use strict'; + +function ProfitLossCtrl($scope, $location, profit_loss) { $scope.info = profit_loss; $scope.show = function () { $location.path('/ProfitLoss').search({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate}); @@ -24,4 +26,4 @@ ProfitLossCtrl.resolve = { } return deferred.promise; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/purchase-entries.js b/brewman/brewman/static/scripts/purchase-entries.js index 1d439921..61ee0f25 100644 --- a/brewman/brewman/static/scripts/purchase-entries.js +++ b/brewman/brewman/static/scripts/purchase-entries.js @@ -1,4 +1,6 @@ -function PurchaseEntriesCtrl($scope, $location, purchase_entries) { +'use strict'; + +function PurchaseEntriesCtrl($scope, $location, purchase_entries) { $scope.info = purchase_entries; $scope.show = function () { @@ -25,6 +27,6 @@ PurchaseEntriesCtrl.resolve = { } return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/purchase-return.js b/brewman/brewman/static/scripts/purchase-return.js new file mode 100644 index 00000000..819ae45a --- /dev/null +++ b/brewman/brewman/static/scripts/purchase-return.js @@ -0,0 +1,120 @@ +'use strict'; + +function PurchaseReturnCtrl($scope, $location, voucher) { + $scope.voucher = voucher; + + $scope.rate = 0; + $scope.addInventory = function () { + for (var i = 0, l = this.voucher.Inventories.length; i < l; i++) { + if (this.voucher.Inventories[i].Product.ProductID === $scope.batch.Product.ProductID) { + break; + } + } + if (i >= l && Number($scope.quantity) <= $scope.batch.QuantityRemaining) { + var amount = Number($scope.quantity) * $scope.batch.Rate * (1 + $scope.batch.Tax) * (1 - $scope.batch.Discount); + this.voucher.Inventories.push( + { + Product:$scope.batch.Product, + Quantity:Number($scope.quantity), + Rate:Number($scope.batch.Rate), + Tax:Number($scope.batch.Tax), + Discount:Number($scope.batch.Discount), + Amount:amount, + Batch:$scope.batch + }); + delete $scope.batch; + delete $scope.name; + delete $scope.quantity; + $('#txtBatch').val(''); + $('#txtBatch').focus(); + } + }; + $scope.removeInventory = function (inventory) { + var index = this.voucher.Inventories.indexOf(inventory); + this.voucher.Inventories.splice(index, 1); + }; + + $scope.$watch('voucher.Inventories', function (inventories, oldValue) { + var amount = 0; + if (typeof inventories !== 'undefined') { + for (var i = 0, l = inventories.length; i < l; i++) { + amount += Number(inventories[i].Amount); + } + } + if (typeof $scope.voucher.Journals !== 'undefined') { + for (var i = 0, l = $scope.voucher.Journals.length; i < l; i++) { + if ($scope.voucher.Journals[i].Debit === 1) { + $scope.voucher.Journals[i].Amount = amount; + break; + } + } + } + }, true); + + $scope.preventAlteration = function (voucher) { + if (typeof $scope.perms === 'undefined') { + return false; + } else if (typeof voucher.VoucherID === 'undefined') { + return !$scope.perms['Purchase Return']; + } else if (voucher.Posted && !$scope.perms['Edit Posted Vouchers']) { + return true; + } else if (voucher.User.UserID != $scope.auth.UserID && !$scope.perms["Edit Other User's Vouchers"]) { + return true; + } else { + return false; + } + }; + + $scope.get = function (voucherid) { + $scope.voucher = Voucher.get({VoucherID:voucherid}, function (u, putResponseHeaders) { + $scope.toasts.push({Type:'Success', Message:u.Code}); + }, function (data, status) { + $scope.toasts.push({Type:'Error', Message:data.data}); + }); + }; + + $scope.save = function () { + $scope.voucher.$save({type:'Purchase Return'}, function (u, putResponseHeaders) { + $scope.toasts.push({Type:'Success', Message:u.Code}); + $location.path('/Return/' + u.VoucherID); + }, function (data, status) { + $scope.toasts.push({Type:'Error', Message:data.data}); + }); + }; + + $scope.delete = function () { + $scope.voucher.$delete(function (u, putResponseHeaders) { + $scope.toasts.push({Type:'Success', Message:''}); + $location.path('/Return').replace(); + }, function (data, status) { + $scope.toasts.push({Type:'Error', Message:data.data}); + }); + }; + + $scope.post = function () { + $scope.voucher.$post(function (u, putResponseHeaders) { + $scope.toasts.push({Type:'Success', Message:u.code}); + }, function (data, status) { + $scope.toasts.push({Type:'Error', Message:data.data}); + }); + }; +} + +PurchaseReturnCtrl.resolve = { + voucher:function ($q, $route, Voucher) { + var deferred = $q.defer(); + + var id = $route.current.params.id; + + var successCb = function (result) { + deferred.resolve(result); + }; + + if (typeof id === 'undefined') { + Voucher.get({type:'Purchase Return'}, successCb); + } else { + Voucher.get({id:id}, successCb); + } + return deferred.promise; + } +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/purchase.js b/brewman/brewman/static/scripts/purchase.js index 969b3d9b..29f369ec 100644 --- a/brewman/brewman/static/scripts/purchase.js +++ b/brewman/brewman/static/scripts/purchase.js @@ -1,5 +1,7 @@ -function PurchaseCtrl($scope, $location, voucher) { - $scope.voucher = voucher +'use strict'; + +function PurchaseCtrl($scope, $location, voucher) { + $scope.voucher = voucher; $scope.rate = 0; $scope.addInventory = function () { @@ -37,10 +39,6 @@ this.voucher.Inventories.splice(index, 1); }; - $scope.ledgerName = function (journal) { - return journal.Ledger.Name; - }; - $scope.$watch('voucher.Inventories', function (inventories, oldValue) { var amount = 0; if (typeof inventories !== 'undefined') { @@ -124,4 +122,4 @@ PurchaseCtrl.resolve = { } return deferred.promise; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/raw-material-cost.js b/brewman/brewman/static/scripts/raw-material-cost.js index 90b21f44..547c138a 100644 --- a/brewman/brewman/static/scripts/raw-material-cost.js +++ b/brewman/brewman/static/scripts/raw-material-cost.js @@ -1,4 +1,6 @@ -function RawMaterialCostCtrl($scope, $routeParams, $location, raw_material_cost) { +'use strict'; + +function RawMaterialCostCtrl($scope, $routeParams, $location, raw_material_cost) { $scope.info = raw_material_cost; $scope.show = function () { $location.path('/RawMaterialCost').search({StartDate:$scope.info.StartDate, FinishDate:$scope.info.FinishDate}); @@ -26,4 +28,4 @@ RawMaterialCostCtrl.resolve = { } return deferred.promise; } -} +}; diff --git a/brewman/brewman/static/scripts/receipt.js b/brewman/brewman/static/scripts/receipt.js index 92048edb..bcdd3b25 100644 --- a/brewman/brewman/static/scripts/receipt.js +++ b/brewman/brewman/static/scripts/receipt.js @@ -1,27 +1,33 @@ -function ReceiptCtrl($scope, $routeParams, $location, voucher, ledgers, Voucher) { - $scope.voucher = voucher - $scope.ledgers = ledgers; +'use strict'; - $scope.addJournal = function () { - for (var i = 0, l = this.voucher.Journals.length; i < l; i++) { - if (this.voucher.Journals[i].Ledger.LedgerID === $scope.id) { - var amount = (this.voucher.Journals[i].Debit * this.voucher.Journals[i].Amount) + (parseInt($scope.debit) * Number($scope.amount)); - if (amount < 0) { - this.voucher.Journals[i].Debit = -1; - this.voucher.Journals[i].Amount = amount * -1; - } else { - this.voucher.Journals[i].Debit = 1; - this.voucher.Journals[i].Amount = amount; - } - break; +function ReceiptCtrl($scope, $routeParams, $location, voucher, ledgers, Voucher) { + $scope.voucher = voucher; + $scope.ledgers = ledgers; + function getOldJournal(ledgerID, journals) { + for (var i = 0, l = journals.length; i < l; i++) { + if (journals[i].Ledger.LedgerID === ledgerID) { + return journals[i]; } } - if (i >= l) { - this.voucher.Journals.push({Debit:-1, Amount:Number($scope.amount), Ledger:{LedgerID:$scope.id, Name:$scope.name}}); + + } + + $scope.addJournal = function () { + var oldJournal = getOldJournal($scope.ledger.LedgerID, this.voucher.Journals); + if (typeof oldJournal !== 'undefined') { + var amount = (oldJournal.Debit * oldJournal.Amount) + (parseInt($scope.debit) * Number($scope.amount)); + if (amount < 0) { + oldJournal.Debit = -1; + oldJournal.Amount = amount * -1; + } else { + oldJournal.Debit = 1; + oldJournal.Amount = amount; + } + } else { + this.voucher.Journals.push({Debit:-1, Amount:Number($scope.amount), Ledger:$scope.ledger}); } + delete $scope.ledger; delete $scope.amount; - delete $scope.id; - delete $scope.name; $('#txtLedger').focus(); }; @@ -93,6 +99,27 @@ $scope.toasts.push({Type:'Error', Message:data.data}); }); }; + + $scope.toggleEdit = function (journal, update) { + if (typeof update === 'undefined') { + $scope.edit = {}; + angular.copy(journal, $scope.edit); + } else { + if (update === true && typeof $scope.edit !== 'undefined') { + if (journal.Ledger.LedgerID !== $scope.edit.Ledger.LedgerID) { + var oldJournal = getOldJournal($scope.edit.Ledger.LedgerID, $scope.voucher.Journals); + if (typeof oldJournal !== 'undefined') { + return false; + } + } + angular.copy($scope.edit, journal); + $scope.$apply(); + return true; + } else if (update === false) { + delete $scope.edit; + } + } + } } ReceiptCtrl.resolve = { @@ -117,9 +144,9 @@ ReceiptCtrl.resolve = { var successCb = function (result) { deferred.resolve(result); - } + }; LedgerService.query({type:1}, successCb); return deferred.promise; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/trial-balance.js b/brewman/brewman/static/scripts/trial-balance.js index 82d172d5..93ae39bd 100644 --- a/brewman/brewman/static/scripts/trial-balance.js +++ b/brewman/brewman/static/scripts/trial-balance.js @@ -1,4 +1,6 @@ -function TrialBalanceCtrl($scope, $routeParams, $location, trial_balance) { +'use strict'; + +function TrialBalanceCtrl($scope, $routeParams, $location, trial_balance) { $scope.info = trial_balance; $scope.show = function () { @@ -23,4 +25,4 @@ TrialBalanceCtrl.resolve = { } return deferred.promise; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/unposted.js b/brewman/brewman/static/scripts/unposted.js index e74d3d49..2bb03329 100644 --- a/brewman/brewman/static/scripts/unposted.js +++ b/brewman/brewman/static/scripts/unposted.js @@ -1,4 +1,6 @@ -function UnpostedCtrl($scope, info) { +'use strict'; + +function UnpostedCtrl($scope, info) { $scope.info = info; } UnpostedCtrl.resolve = { @@ -12,4 +14,4 @@ UnpostedCtrl.resolve = { Unposted.query({}, successCb); return deferred.promise; } -} \ No newline at end of file +}; \ No newline at end of file diff --git a/brewman/brewman/static/scripts/user.js b/brewman/brewman/static/scripts/user.js index ed34b4d0..367fdd4c 100644 --- a/brewman/brewman/static/scripts/user.js +++ b/brewman/brewman/static/scripts/user.js @@ -1,4 +1,6 @@ -function UserListCtrl($scope, users) { +'use strict'; + +function UserListCtrl($scope, users) { $scope.info = users; } @@ -13,7 +15,7 @@ UserListCtrl.resolve = { User.query({}, successCb); return deferred.promise; } -} +}; function UserCtrl($scope, $location, user) { $scope.user = user; @@ -51,4 +53,4 @@ UserCtrl.resolve = { User.get({id:id}, successCb); return deferred.promise; } -} +}; diff --git a/brewman/brewman/templates/angular_base.mako b/brewman/brewman/templates/angular_base.mako index 478f808f..e7aed612 100644 --- a/brewman/brewman/templates/angular_base.mako +++ b/brewman/brewman/templates/angular_base.mako @@ -37,6 +37,7 @@ + @@ -90,7 +91,7 @@