diff --git a/.gitignore b/.gitignore index bc9f961c..d088e83e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,8 @@ env .pydevproject */__pycache__/ .idea/ -*.egg-info/ \ No newline at end of file +*.egg-info/ +brewman/static/node_modules +brewman/static/app/**/*.js +brewman/static/app/**/*.map +brewman/static/package-lock.json diff --git a/brewman/routes.py b/brewman/routes.py index 70a67abb..3911cdc8 100644 --- a/brewman/routes.py +++ b/brewman/routes.py @@ -13,6 +13,7 @@ def includeme(config): config.add_static_view('partial', 'brewman:static/partial', cache_max_age=get_age(10)) config.add_static_view('template', 'brewman:static/template', cache_max_age=get_age(10)) config.add_static_view('app', 'brewman:static/app', cache_max_age=get_age(10)) + config.add_static_view('node_modules', 'brewman:static/node_modules', cache_max_age=get_age(10)) config.add_route('api_dashboard', '/api/Dashboard') config.add_route('dashboard', '/Dashboard') @@ -23,6 +24,8 @@ def includeme(config): config.add_route('logout', '/logout') config.add_route('home', '/') + config.add_route('tsconfig', '/tsconfig.json') + config.add_route('systemjs', '/systemjs.config.js') config.add_route('api_account_type_list', '/api/AccountTypes') diff --git a/brewman/static/app/account/account-detail.html b/brewman/static/app/account/account-detail.html index f4712eeb..d310f408 100644 --- a/brewman/static/app/account/account-detail.html +++ b/brewman/static/app/account/account-detail.html @@ -5,34 +5,34 @@
| Name | @@ -22,8 +22,8 @@||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| {{item.Name}} | {{item.Type}} | {{item.IsActive}} | diff --git a/brewman/static/app/account/account-list.resolver.ts b/brewman/static/app/account/account-list.resolver.ts new file mode 100644 index 00000000..b17bda36 --- /dev/null +++ b/brewman/static/app/account/account-list.resolver.ts @@ -0,0 +1,3 @@ +export function AccountListResolver(Account) { + return Account.query({}).$promise; +} diff --git a/brewman/static/app/account/account-type.service.ts b/brewman/static/app/account/account-type.service.ts new file mode 100644 index 00000000..6a3f37b8 --- /dev/null +++ b/brewman/static/app/account/account-type.service.ts @@ -0,0 +1,3 @@ +export function AccountType($resource) { + return $resource('/api/AccountTypes'); +} diff --git a/brewman/static/app/account/account-types.resolver.ts b/brewman/static/app/account/account-types.resolver.ts new file mode 100644 index 00000000..b3829ac7 --- /dev/null +++ b/brewman/static/app/account/account-types.resolver.ts @@ -0,0 +1,4 @@ +export function AccountTypesResolver(AccountType) { + return AccountType.query({}).$promise; +} + diff --git a/brewman/static/app/account/account.component.ts b/brewman/static/app/account/account.component.ts new file mode 100644 index 00000000..9356eb6a --- /dev/null +++ b/brewman/static/app/account/account.component.ts @@ -0,0 +1,7 @@ +import {AccountController} from './account.controller'; + +export const AccountComponent = { + templateUrl: '/app/account/account-detail.html', + controller: AccountController, + controllerAs: 'vm' +}; \ No newline at end of file diff --git a/brewman/static/app/account/account.controller.js b/brewman/static/app/account/account.controller.js deleted file mode 100644 index 80c94c64..00000000 --- a/brewman/static/app/account/account.controller.js +++ /dev/null @@ -1,64 +0,0 @@ -angular - .module('overlord') - .controller('AccountController', AccountController); - -AccountController.$inject = ['$scope', '$location', '$uibModal', 'account', 'accountTypes', 'costCentres']; -function AccountController($scope, $location, $modal, account, accountTypes, costCentres) { - $scope.account = account; - - $scope.accountTypes = accountTypes; - $scope.costCentres = costCentres; - - $scope.save = function () { - $scope.account.$save(function () { - $scope.toasts.push({Type: 'Success', Message: ''}); - $location.path('/Accounts'); - }, function (data) { - $scope.toasts.push({Type: 'Danger', Message: data.data}); - }); - }; - - $scope.delete = function () { - $scope.account.$delete(function () { - $scope.toasts.push({Type: 'Success', Message: ''}); - $location.path('/Accounts'); - }, function (data) { - $scope.toasts.push({Type: 'Danger', Message: data.data}); - }); - }; - - $scope.confirm = function () { - var modalInstance = $modal.open({ - backdrop: true, - templateUrl: '/template/modal/confirm.html', - controller: ['$scope', '$uibModalInstance', function ($scope, $modalInstance) { - $scope.title = "Delete Account"; - $scope.body = "Are you sure? This cannot be undone."; - $scope.isDelete = true; - $scope.ok = function () { - $modalInstance.close(); - }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - }] - }); - modalInstance.result.then(function () { - $scope.delete(); - }); - }; - $scope.foName = true; -}; - -AccountController.resolve = { - account: ['$route', 'Account', function ($route, Account) { - var id = $route.current.params.id; - return Account.get({id: id}).$promise; - }], - accountTypes: ['AccountType', function (AccountType) { - return AccountType.query({}).$promise; - }], - costCentres: ['CostCentre', function (CostCentre) { - return CostCentre.query({}).$promise; - }] -}; diff --git a/brewman/static/app/account/account.controller.ts b/brewman/static/app/account/account.controller.ts new file mode 100644 index 00000000..64fd5145 --- /dev/null +++ b/brewman/static/app/account/account.controller.ts @@ -0,0 +1,61 @@ +export class AccountController { + static $inject = ['$scope', '$location', '$uibModal', 'Messages']; + foName: any; + account: any; + accountTypes: any; + costCentres: any; + + constructor(public $scope, public $location, public $modal, public Messages) { + this.account = $scope.$parent.res.account; + this.accountTypes = $scope.$parent.res.accountTypes; + this.costCentres = $scope.$parent.res.costCentres; + this.foName = true; + } + + save() { + this.account.$save(() => { + this.Messages.push({Type: 'Success', Message: ''}); + this.$location.path('/Accounts'); + }, (data) => { + this.Messages.push({Type: 'Danger', Message: data.data}); + }); + } + + delete() { + this.account.$delete(() => { + this.Messages.push({Type: 'Success', Message: ''}); + this.$location.path('/Accounts'); + }, (data) => { + this.Messages.push({Type: 'Danger', Message: data.data}); + }); + } + + confirm() { + let modalInstance = this.$modal.open({ + backdrop: true, + templateUrl: '/template/modal/confirm.html', + controller: ['$uibModalInstance', class { + title: any; + body: any; + isDelete: boolean; + + constructor(public $modalInstance) { + this.title = "Delete Account"; + this.body = "Are you sure? This cannot be undone."; + this.isDelete = true; + } + + ok() { + this.$modalInstance.close(); + } + + cancel() { + this.$modalInstance.dismiss('cancel'); + } + }] + }); + modalInstance.result.then(() => { + this.delete(); + }); + } +} diff --git a/brewman/static/app/account/account.resolver.ts b/brewman/static/app/account/account.resolver.ts new file mode 100644 index 00000000..3e486d81 --- /dev/null +++ b/brewman/static/app/account/account.resolver.ts @@ -0,0 +1,4 @@ +export function AccountResolver($route, Account) { + const id = $route.current.params.id; + return Account.get({id: id}).$promise; +} diff --git a/brewman/static/app/account/account.service.ts b/brewman/static/app/account/account.service.ts new file mode 100644 index 00000000..655835e1 --- /dev/null +++ b/brewman/static/app/account/account.service.ts @@ -0,0 +1,8 @@ +export function Account($resource) { + return $resource('/api/Account/:id', + {id: '@LedgerID'}, { + query: {method: 'GET', params: {list: true}, isArray: true}, + autocomplete: {method: 'GET', params: {term: ''}, isArray: true}, + balance: {method: 'GET', params: {b: true, d: ''}} + }); +} diff --git a/brewman/static/app/account/payment-accounts.resolver.ts b/brewman/static/app/account/payment-accounts.resolver.ts new file mode 100644 index 00000000..0927b23a --- /dev/null +++ b/brewman/static/app/account/payment-accounts.resolver.ts @@ -0,0 +1,3 @@ +export function PaymentAccountsResolver(Account) { + return Account.autocomplete({term: '', type: 1}).$promise; +} diff --git a/brewman/static/app/account/receipt-accounts.resolver.ts b/brewman/static/app/account/receipt-accounts.resolver.ts new file mode 100644 index 00000000..27e21657 --- /dev/null +++ b/brewman/static/app/account/receipt-accounts.resolver.ts @@ -0,0 +1,3 @@ +export function ReceiptAccountsResolver(Account) { + return Account.autocomplete({term: '', type: 1}).$promise; +} diff --git a/brewman/static/app/attendance/attendance-info.resolver.ts b/brewman/static/app/attendance/attendance-info.resolver.ts new file mode 100644 index 00000000..0df0d09a --- /dev/null +++ b/brewman/static/app/attendance/attendance-info.resolver.ts @@ -0,0 +1,10 @@ +import * as angular from 'angular'; + +export function AttendanceInfoResolver($route, Attendance) { + const date = $route.current.params.date; + if (angular.isUndefined(date)) { + return Attendance.get({}).$promise; + } else { + return Attendance.get({date: date}).$promise; + } +} diff --git a/brewman/static/app/attendance/attendance-sub.controller.js b/brewman/static/app/attendance/attendance-sub.controller.js deleted file mode 100644 index e7e19981..00000000 --- a/brewman/static/app/attendance/attendance-sub.controller.js +++ /dev/null @@ -1,29 +0,0 @@ -angular - .module('overlord') - .controller('AttendanceSubController', AttendanceSubController); - -AttendanceSubController.$inject = ['$scope']; -function AttendanceSubController($scope) { - $scope.original = {}; - angular.copy($scope.item, $scope.original); - - $scope.isLabel = function () { - return true; - }; - - $scope.isError = function () { - return $scope.item.Worked === 'Error'; - }; - - $scope.isGood = function () { - return $scope.item.Worked === true; - }; - - $scope.isBad = function () { - return $scope.item.Worked === false; - }; - - $scope.isDirty = function () { - return !angular.equals($scope.original, $scope.item); - }; -} diff --git a/brewman/static/app/attendance/attendance-sub.controller.ts b/brewman/static/app/attendance/attendance-sub.controller.ts new file mode 100644 index 00000000..f3aec9a9 --- /dev/null +++ b/brewman/static/app/attendance/attendance-sub.controller.ts @@ -0,0 +1,35 @@ +import * as angular from 'angular'; + +export class AttendanceSubController { + static $inject = ['$scope']; + item: any; + original: any; + attendanceTypes: any; + + constructor(public $scope) { + this.attendanceTypes = $scope.attendanceTypes; + this.item = $scope.item; + this.original = {}; + angular.copy(this.item, this.original); + } + + isLabel() { + return true; + } + + isError() { + return this.item.Worked === 'Error'; + } + + isGood() { + return this.item.Worked === true; + } + + isBad() { + return this.item.Worked === false; + } + + isDirty() { + return !angular.equals(this.original, this.item); + } +} diff --git a/brewman/static/app/attendance/attendance-sub.directive.ts b/brewman/static/app/attendance/attendance-sub.directive.ts new file mode 100644 index 00000000..a0b01bc8 --- /dev/null +++ b/brewman/static/app/attendance/attendance-sub.directive.ts @@ -0,0 +1,14 @@ +import {AttendanceSubController} from './attendance-sub.controller'; + +export function AttendanceSubDirective() { + return { + scope: { + item: '=attendanceSub', + attendanceTypes: '=attendanceTypes' + }, + restrict: 'A', + templateUrl: '/app/attendance/attendance-sub.html', + controller: AttendanceSubController, + controllerAs: 'vmSub', + }; +} diff --git a/brewman/static/app/attendance/attendance-sub.html b/brewman/static/app/attendance/attendance-sub.html new file mode 100644 index 00000000..fda3d8aa --- /dev/null +++ b/brewman/static/app/attendance/attendance-sub.html @@ -0,0 +1,12 @@ +{{item.Code}} | +{{item.Name}} | +{{item.Designation}} | +{{item.Department}} | ++ + | +{{item.Prints}} + {{item.Hours}} + | diff --git a/brewman/static/app/attendance/attendance-types.resolver.ts b/brewman/static/app/attendance/attendance-types.resolver.ts new file mode 100644 index 00000000..3dd4c02d --- /dev/null +++ b/brewman/static/app/attendance/attendance-types.resolver.ts @@ -0,0 +1,3 @@ +export function AttendanceTypesResolver(AttendanceTypes) { + return AttendanceTypes.query({}).$promise; +} diff --git a/brewman/static/app/attendance/attendance-types.service.ts b/brewman/static/app/attendance/attendance-types.service.ts new file mode 100644 index 00000000..f19542fa --- /dev/null +++ b/brewman/static/app/attendance/attendance-types.service.ts @@ -0,0 +1,3 @@ +export function AttendanceTypes($resource) { + return $resource('/api/AttendanceTypes'); +} diff --git a/brewman/static/app/attendance/attendance.component.ts b/brewman/static/app/attendance/attendance.component.ts new file mode 100644 index 00000000..38763032 --- /dev/null +++ b/brewman/static/app/attendance/attendance.component.ts @@ -0,0 +1,7 @@ +import {AttendanceController} from './attendance.controller'; + +export const AttendanceComponent = { + templateUrl: '/app/attendance/attendance.html', + controller: AttendanceController, + controllerAs: 'vm', +}; \ No newline at end of file diff --git a/brewman/static/app/attendance/attendance.controller.js b/brewman/static/app/attendance/attendance.controller.js deleted file mode 100644 index 0c85f383..00000000 --- a/brewman/static/app/attendance/attendance.controller.js +++ /dev/null @@ -1,42 +0,0 @@ -angular - .module('overlord') - .controller('AttendanceController', AttendanceController); - -AttendanceController.$inject = ['$scope', '$location', 'asDateFilter', 'Attendance', 'attendanceTypes', 'info', 'uibDateParser']; -function AttendanceController($scope, $location, asDate, Attendance, attendanceTypes, info, dateParser) { - var _info_Date = dateParser.parse(info.Date, "dd-MMM-yyyy"); - $scope.info_Date = function (value) { - if (arguments.length) { - $scope.info.Date = asDate(value); - _info_Date = value; - } - return _info_Date; - }; - $scope.attendanceTypes = attendanceTypes; - $scope.info = info; - $scope.show = function () { - $location.path('/Attendance/' + $scope.info.Date); - }; - $scope.save = function () { - return $scope.info.$save(function (u) { - $scope.toasts.push({Type: 'Success', Message: u.Code}); - }, function (data) { - $scope.toasts.push({Type: 'Danger', Message: data.data}); - }); - }; - $scope.foDate = true; -} - -tendanceController.resolve = { - info: ['$route', 'Attendance', function ($route, Attendance) { - var date = $route.current.params.date; - if (angular.isUndefined(date)) { - return Attendance.get({}).$promise; - } else { - return Attendance.get({date: date}).$promise; - } - }], - attendanceTypes: ['AttendanceTypes', function (AttendanceTypes) { - return AttendanceTypes.query({}).$promise; - }] -}; \ No newline at end of file diff --git a/brewman/static/app/attendance/attendance.controller.ts b/brewman/static/app/attendance/attendance.controller.ts new file mode 100644 index 00000000..a8ad6525 --- /dev/null +++ b/brewman/static/app/attendance/attendance.controller.ts @@ -0,0 +1,34 @@ +export class AttendanceController { + static $inject = ['$scope', '$location', 'asDateFilter', 'Attendance', 'uibDateParser', 'Messages']; + _info_Date: any; + foDate: boolean; + attendanceTypes: any; + info: any; + + constructor(public $scope, public $location, public asDate, public Attendance, public dateParser, public Messages) { + this.attendanceTypes = $scope.$parent.res.attendanceTypes; + this.info = $scope.$parent.res.info; + this._info_Date = dateParser.parse(this.info.Date, "dd-MMM-yyyy"); + this.foDate = true; + } + + info_Date(value) { + if (arguments.length) { + this.info.Date = this.asDate(value); + this._info_Date = value; + } + return this._info_Date; + } + + show() { + this.$location.path('/Attendance/' + this.info.Date); + } + + save() { + return this.info.$save((u) => { + this.Messages.push({Type: 'Success', Message: u.Code}); + }, (data) => { + this.Messages.push({Type: 'Danger', Message: data.data}); + }); + } +} diff --git a/brewman/static/app/attendance/attendance.html b/brewman/static/app/attendance/attendance.html index f7edc9e0..f720ad92 100644 --- a/brewman/static/app/attendance/attendance.html +++ b/brewman/static/app/attendance/attendance.html @@ -6,9 +6,9 @@||||||
| {{item.Code}} | -{{item.Name}} | -{{item.Designation}} | -{{item.Department}} | -- - | -{{item.Prints}} - {{item.Hours}} - | +
| {{item.Date}} | {{item.Type}} | {{item.Narration}} | diff --git a/brewman/static/app/daybook/daybook.resolver.ts b/brewman/static/app/daybook/daybook.resolver.ts new file mode 100644 index 00000000..dd7a5055 --- /dev/null +++ b/brewman/static/app/daybook/daybook.resolver.ts @@ -0,0 +1,12 @@ +import * as angular from 'angular'; + +export function DaybookResolver($route, Daybook) { + const startDate = $route.current.params.StartDate, + finishDate = $route.current.params.FinishDate; + + if (angular.isUndefined(startDate) || angular.isUndefined(finishDate)) { + return Daybook.get({}).$promise; + } else { + return Daybook.get({StartDate: startDate, FinishDate: finishDate}).$promise; + } +} diff --git a/brewman/static/app/daybook/daybook.service.ts b/brewman/static/app/daybook/daybook.service.ts new file mode 100644 index 00000000..67637ee2 --- /dev/null +++ b/brewman/static/app/daybook/daybook.service.ts @@ -0,0 +1,3 @@ +export function Daybook($resource) { + return $resource('/api/Daybook'); +} diff --git a/brewman/static/app/employee/employee-attendance-info.resolver.ts b/brewman/static/app/employee/employee-attendance-info.resolver.ts new file mode 100644 index 00000000..24327b5c --- /dev/null +++ b/brewman/static/app/employee/employee-attendance-info.resolver.ts @@ -0,0 +1,13 @@ +import * as angular from 'angular'; + +export function EmployeeAttendanceInfoResolver($route, EmployeeAttendance) { + const id = $route.current.params.id, + startDate = $route.current.params.StartDate, + finishDate = $route.current.params.FinishDate; + + if (angular.isUndefined(id)) { + return EmployeeAttendance.get({}).$promise; + } else { + return EmployeeAttendance.get({id: id, StartDate: startDate, FinishDate: finishDate}).$promise; + } +} diff --git a/brewman/static/app/employee/employee-attendance-sub.directive.ts b/brewman/static/app/employee/employee-attendance-sub.directive.ts new file mode 100644 index 00000000..010aa7d5 --- /dev/null +++ b/brewman/static/app/employee/employee-attendance-sub.directive.ts @@ -0,0 +1,14 @@ +import {AttendanceSubController} from "../attendance/attendance-sub.controller"; + +export function EmployeeAttendanceSubDirective() { + return { + scope: { + item: '=employeeAttendanceSub', + attendanceTypes: '=attendanceTypes' + }, + restrict: 'A', + templateUrl: '/app/employee/employee-attendance-sub.html', + controller: AttendanceSubController, + controllerAs: 'vmSub', + }; +} diff --git a/brewman/static/app/employee/employee-attendance-sub.html b/brewman/static/app/employee/employee-attendance-sub.html new file mode 100644 index 00000000..6df01970 --- /dev/null +++ b/brewman/static/app/employee/employee-attendance-sub.html @@ -0,0 +1,12 @@ +{{item.Date}} | ++ + + | +{{item.Prints}} {{item.Hours}} + | ++ + | diff --git a/brewman/static/app/employee/employee-attendance.component.ts b/brewman/static/app/employee/employee-attendance.component.ts new file mode 100644 index 00000000..a0120d77 --- /dev/null +++ b/brewman/static/app/employee/employee-attendance.component.ts @@ -0,0 +1,7 @@ +import {EmployeeAttendanceController} from './employee-attendance.controller'; + +export const EmployeeAttendanceComponent = { + templateUrl: '/app/employee/employee-attendance.html', + controller: EmployeeAttendanceController, + controllerAs: 'vm', +}; \ No newline at end of file diff --git a/brewman/static/app/employee/employee-attendance.controller.js b/brewman/static/app/employee/employee-attendance.controller.js deleted file mode 100644 index 95688e3e..00000000 --- a/brewman/static/app/employee/employee-attendance.controller.js +++ /dev/null @@ -1,100 +0,0 @@ -angular - .module('overlord') - .controller('EmployeeAttendanceController', EmployeeAttendanceController); -EmployeeAttendanceController.$inject = ['$scope', '$location', '$routeParams', 'asDateFilter', 'EmployeeAttendance', 'attendanceTypes', 'info', 'Employee', 'uibDateParser']; -function EmployeeAttendanceController($scope, $location, $routeParams, asDate, EmployeeAttendance, attendanceTypes, info, Employee, dateParser) { - var _info_StartDate = dateParser.parse(info.StartDate, "dd-MMM-yyyy"), - _info_FinishDate = dateParser.parse(info.FinishDate, "dd-MMM-yyyy"); - $scope.info_StartDate = function (value) { - if (arguments.length) { - $scope.info.StartDate = asDate(value); - _info_StartDate = value; - } - return _info_StartDate; - }; - $scope.info_FinishDate = function (value) { - if (arguments.length) { - $scope.info.FinishDate = asDate(value); - _info_FinishDate = value; - } - return _info_FinishDate; - }; - $scope.attendanceTypes = attendanceTypes; - $scope.info = info; - $scope.show = function () { - var id = $scope.info.Employee.LedgerID; - if (id === $routeParams.id && $scope.info.StartDate === $routeParams.StartDate && $scope.info.FinishDate === $routeParams.FinishDate) { - EmployeeAttendance.get({ - id: id, - StartDate: $scope.info.StartDate, - FinishDate: $scope.info.FinishDate - }, function (data) { - $scope.info = data; - }); - } - else { - $location.path('/EmployeeAttendance/' + id).search({ - StartDate: $scope.info.StartDate, - FinishDate: $scope.info.FinishDate - }); - } - }; - - $scope.employees = function ($viewValue) { - return Employee.autocomplete({term: $viewValue, count: 20}).$promise; - }; - - $scope.save = function () { - return $scope.info.$save(function (u, putResponseHeaders) { - $scope.toasts.push({Type: 'Success', Message: 'Saved!'}); - }, function (data, status) { - $scope.toasts.push({Type: 'Danger', Message: data.data}); - }); - }; - $scope.foEmployee = true; -} - -angular - .module('overlord') - .controller('EmployeeAttendanceSubController', EmployeeAttendanceSubController); -EmployeeAttendanceSubController.$inject = ['$scope']; -function EmployeeAttendanceSubController($scope) { - $scope.original = {}; - angular.copy($scope.item, $scope.original); - - $scope.isLabel = function () { - return true; - }; - - $scope.isError = function () { - return $scope.item.Worked === 'Error'; - }; - - $scope.isGood = function () { - return $scope.item.Worked === true; - }; - - $scope.isBad = function () { - return $scope.item.Worked === false; - }; - - $scope.isDirty = function () { - return !angular.equals($scope.original, $scope.item); - }; -} -EmployeeAttendanceController.resolve = { - info: ['$route', 'EmployeeAttendance', function ($route, EmployeeAttendance) { - var id = $route.current.params.id, - startDate = $route.current.params.StartDate, - finishDate = $route.current.params.FinishDate; - - if (angular.isUndefined(id)) { - return EmployeeAttendance.get({}).$promise; - } else { - return EmployeeAttendance.get({id: id, StartDate: startDate, FinishDate: finishDate}).$promise; - } - }], - attendanceTypes: ['AttendanceTypes', function (AttendanceTypes) { - return AttendanceTypes.query({}).$promise; - }] -}; \ No newline at end of file diff --git a/brewman/static/app/employee/employee-attendance.controller.ts b/brewman/static/app/employee/employee-attendance.controller.ts new file mode 100644 index 00000000..0d200ff6 --- /dev/null +++ b/brewman/static/app/employee/employee-attendance.controller.ts @@ -0,0 +1,64 @@ +export class EmployeeAttendanceController { + static $inject = ['$scope', '$location', '$routeParams', 'asDateFilter', 'EmployeeAttendance', 'Employee', 'uibDateParser', 'Messages']; + _info_StartDate: any; + _info_FinishDate: any; + foEmployee: boolean; + item: any; + attendanceTypes: any; + info: any; + + constructor(public $scope, public $location, public $routeParams, public asDate, public EmployeeAttendance, public Employee, public dateParser, public Messages) { + this.attendanceTypes = $scope.$parent.res.attendanceTypes; + this.info = $scope.$parent.res.info; + this._info_StartDate = dateParser.parse(this.info.StartDate, "dd-MMM-yyyy"); + this._info_FinishDate = dateParser.parse(this.info.FinishDate, "dd-MMM-yyyy"); + this.foEmployee = true; + } + + info_StartDate(value) { + if (arguments.length) { + this.info.StartDate = this.asDate(value); + this._info_StartDate = value; + } + return this._info_StartDate; + } + + info_FinishDate(value) { + if (arguments.length) { + this.info.FinishDate = this.asDate(value); + this._info_FinishDate = value; + } + return this._info_FinishDate; + } + + show() { + const id = this.info.Employee.LedgerID; + if (id === this.$routeParams.id && this.info.StartDate === this.$routeParams.StartDate && this.info.FinishDate === this.$routeParams.FinishDate) { + this.EmployeeAttendance.get({ + id: id, + StartDate: this.info.StartDate, + FinishDate: this.info.FinishDate + }, (data) => { + this.info = data; + }); + } + else { + this.$location.path('/EmployeeAttendance/' + id).search({ + StartDate: this.info.StartDate, + FinishDate: this.info.FinishDate + }); + } + } + + employees($viewValue) { + return this.Employee.autocomplete({term: $viewValue, count: 20}).$promise; + } + + save() { + return this.info.$save((u, putResponseHeaders) => { + this.Messages.push({Type: 'Success', Message: 'Saved!'}); + }, (data, status) => { + this.Messages.push({Type: 'Danger', Message: data.data}); + }); + } +} diff --git a/brewman/static/app/employee/employee-attendance.html b/brewman/static/app/employee/employee-attendance.html index abd45571..2c2fadf6 100644 --- a/brewman/static/app/employee/employee-attendance.html +++ b/brewman/static/app/employee/employee-attendance.html @@ -7,7 +7,7 @@
| {{item.Date}} | -- - - | -{{item.Prints}} {{item.Hours}} - | -
- |
+ |||
| Code | @@ -23,8 +23,8 @@||||||||
|---|---|---|---|---|---|---|---|---|
| {{item.Code}} | {{item.Name}} | {{item.Designation}} | diff --git a/brewman/static/app/employee/employee-list.resolver.ts b/brewman/static/app/employee/employee-list.resolver.ts new file mode 100644 index 00000000..634a621e --- /dev/null +++ b/brewman/static/app/employee/employee-list.resolver.ts @@ -0,0 +1,3 @@ +export function EmployeeListResolver(Employee) { + return Employee.query({}).$promise; +} diff --git a/brewman/static/app/employee/employee.component.ts b/brewman/static/app/employee/employee.component.ts new file mode 100644 index 00000000..d5c3fbdf --- /dev/null +++ b/brewman/static/app/employee/employee.component.ts @@ -0,0 +1,7 @@ +import {EmployeeController} from './employee.controller'; + +export const EmployeeComponent = { + templateUrl: '/app/employee/employee-detail.html', + controller: EmployeeController, + controllerAs: 'vm' +}; \ No newline at end of file diff --git a/brewman/static/app/employee/employee.controller.js b/brewman/static/app/employee/employee.controller.js deleted file mode 100644 index f8388be1..00000000 --- a/brewman/static/app/employee/employee.controller.js +++ /dev/null @@ -1,75 +0,0 @@ -angular - .module('overlord') - .controller('EmployeeController', EmployeeController); -EmployeeController.$inject = ['$scope', '$routeParams', '$location', 'asDateFilter', '$uibModal', 'employee', 'costCentres', 'uibDateParser']; -function EmployeeController($scope, $routeParams, $location, asDate, $modal, employee, costCentres, dateParser) { - var _employee_JoiningDate = dateParser.parse(employee.JoiningDate, "dd-MMM-yyyy"), - _employee_LeavingDate = dateParser.parse(employee.LeavingDate, "dd-MMM-yyyy"); - $scope.employee_JoiningDate = function (value) { - if (arguments.length) { - $scope.employee.JoiningDate = asDate(value); - _employee_JoiningDate = value; - } - return _employee_JoiningDate; - }; - $scope.employee_LeavingDate = function (value) { - if (arguments.length) { - $scope.employee.LeavingDate = asDate(value); - _employee_LeavingDate = value; - } - return _employee_LeavingDate; - }; - $scope.employee = employee; - - $scope.costCentres = costCentres; - - $scope.save = function () { - $scope.employee.$save(function (u, putResponseHeaders) { - $scope.toasts.push({Type: 'Success', Message: u.Code}); - $location.path('/Employees'); - }, function (data, status) { - $scope.toasts.push({Type: 'Danger', Message: data.data}); - }); - }; - - $scope.delete = function () { - $scope.employee.$delete(function (u, putResponseHeaders) { - $scope.toasts.push({Type: 'Success', Message: ''}); - $location.path('/Employees'); - }, function (data, status) { - $scope.toasts.push({Type: 'Danger', Message: data.data}); - }); - }; - - $scope.confirm = function () { - var modalInstance = $modal.open({ - backdrop: true, - templateUrl: '/template/modal/confirm.html', - controller: ['$scope', '$uibModalInstance', function ($scope, $modalInstance) { - $scope.title = "Delete Employee"; - $scope.body = "Are you sure? This cannot be undone."; - $scope.isDelete = true; - $scope.ok = function () { - $modalInstance.close(); - }; - $scope.cancel = function () { - $modalInstance.dismiss('cancel'); - }; - }] - }); - modalInstance.result.then(function () { - $scope.delete(); - }); - }; - $scope.foName = true; -} - -EmployeeController.resolve = { - employee: ['$route', 'Employee', function ($route, Employee) { - var id = $route.current.params.id; - return Employee.get({id: id}).$promise; - }], - costCentres: ['CostCentre', function (CostCentre) { - return CostCentre.query({}).$promise; - }] -}; diff --git a/brewman/static/app/employee/employee.controller.ts b/brewman/static/app/employee/employee.controller.ts new file mode 100644 index 00000000..19d53545 --- /dev/null +++ b/brewman/static/app/employee/employee.controller.ts @@ -0,0 +1,79 @@ +export class EmployeeController { + static $inject = ['$scope', '$routeParams', '$location', 'asDateFilter', '$uibModal', 'uibDateParser', 'Messages']; + _employee_JoiningDate: any; + _employee_LeavingDate: any; + foName: boolean; + employee: any; + costCentres: any; + + constructor(public $scope, public $routeParams, public $location, public asDate, public $modal, public dateParser, public Messages) { + this.employee = $scope.$parent.res.employee; + this.costCentres = $scope.$parent.res.costCentres; + this._employee_JoiningDate = dateParser.parse(this.employee.JoiningDate, "dd-MMM-yyyy"); + this._employee_LeavingDate = dateParser.parse(this.employee.LeavingDate, "dd-MMM-yyyy"); + this.foName = true; + } + + employee_JoiningDate(value) { + if (arguments.length) { + this.employee.JoiningDate = this.asDate(value); + this._employee_JoiningDate = value; + } + return this._employee_JoiningDate; + } + + employee_LeavingDate(value) { + if (arguments.length) { + this.employee.LeavingDate = this.asDate(value); + this._employee_LeavingDate = value; + } + return this._employee_LeavingDate; + } + + save() { + this.employee.$save((u, putResponseHeaders) => { + this.Messages.push({Type: 'Success', Message: u.Code}); + this.$location.path('/Employees'); + }, (data, status) => { + this.Messages.push({Type: 'Danger', Message: data.data}); + }); + } + + delete() { + this.employee.$delete((u, putResponseHeaders) => { + this.Messages.push({Type: 'Success', Message: ''}); + this.$location.path('/Employees'); + }, (data, status) => { + this.Messages.push({Type: 'Danger', Message: data.data}); + }); + } + + confirm() { + const modalInstance = this.$modal.open({ + backdrop: true, + templateUrl: '/template/modal/confirm.html', + controller: ['$uibModalInstance', class { + title: any; + body: any; + isDelete: boolean; + + constructor(public $modalInstance) { + this.title = "Delete Employee"; + this.body = "Are you sure? This cannot be undone."; + this.isDelete = true; + } + + ok() { + this.$modalInstance.close(); + } + + cancel() { + this.$modalInstance.dismiss('cancel'); + } + }] + }); + modalInstance.result.then(() => { + this.delete(); + }); + } +} diff --git a/brewman/static/app/employee/employee.resolver.ts b/brewman/static/app/employee/employee.resolver.ts new file mode 100644 index 00000000..f4c03377 --- /dev/null +++ b/brewman/static/app/employee/employee.resolver.ts @@ -0,0 +1,4 @@ +export function EmployeeResolver($route, Employee) { + const id = $route.current.params.id; + return Employee.get({id: id}).$promise; +} diff --git a/brewman/static/app/employee/employee.service.ts b/brewman/static/app/employee/employee.service.ts new file mode 100644 index 00000000..f52a9045 --- /dev/null +++ b/brewman/static/app/employee/employee.service.ts @@ -0,0 +1,7 @@ +export function Employee($resource) { + return $resource('/api/Employee/:id', + {id: '@LedgerID'}, { + query: {method: 'GET', params: {list: true}, isArray: true}, + autocomplete: {method: 'GET', params: {term: ''}, isArray: true} + }); +} diff --git a/brewman/static/app/group/group-detail.html b/brewman/static/app/group/group-detail.html index 52029164..e0480d4b 100644 --- a/brewman/static/app/group/group-detail.html +++ b/brewman/static/app/group/group-detail.html @@ -5,24 +5,24 @@||||||
| {{item.Name}} |
- Total Service Charge: {{voucher.ServiceCharge | number:2}}
- Total Points: {{TotalPoints() | number:2}}
- Point Value: {{PointValue() | number:2}}
+ Total Service Charge: {{vm.voucher.ServiceCharge | number:2}}
+ Total Points: {{vm.TotalPoints() | number:2}}
+ Point Value: {{vm.PointValue() | number:2}}
-
- Created on {{voucher.CreationDate | localTime}} and Last Edited on {{voucher.LastEditDate | localTime}}
- by {{voucher.User.Name}}. Posted by {{voucher.Poster}}
+ Created on {{vm.voucher.CreationDate | localTime}} and Last Edited on {{vm.voucher.LastEditDate | localTime}}
+ by {{vm.voucher.User.Name}}. Posted by {{vm.voucher.Poster}}
diff --git a/brewman/static/app/issue/batch.service.ts b/brewman/static/app/issue/batch.service.ts
new file mode 100644
index 00000000..28a744aa
--- /dev/null
+++ b/brewman/static/app/issue/batch.service.ts
@@ -0,0 +1,5 @@
+export function Batch ($resource) {
+ return $resource('/api/Batch', {}, {
+ autocomplete: {method: 'GET', params: {term: ''}, isArray: true}
+ });
+}
diff --git a/brewman/static/app/issue/issue-grid.resolver.ts b/brewman/static/app/issue/issue-grid.resolver.ts
new file mode 100644
index 00000000..22de84a5
--- /dev/null
+++ b/brewman/static/app/issue/issue-grid.resolver.ts
@@ -0,0 +1,15 @@
+import * as angular from 'angular';
+
+export function IssueGridResolver($route, IssueGrid) {
+ const id = $route.current.params.id,
+ source = $route.current.params.Source,
+ destination = $route.current.params.Destination;
+
+ if (!angular.isUndefined(source) && !angular.isUndefined(destination) && !angular.isUndefined(id)) {
+ return IssueGrid.query({date: id, Source: source, Destination: destination}).$promise;
+ } else if (angular.isUndefined(source) && angular.isUndefined(destination) && !angular.isUndefined(id)) {
+ return IssueGrid.query({date: id}).$promise;
+ } else {
+ return {};
+ }
+}
diff --git a/brewman/static/app/issue/issue-grid.service.ts b/brewman/static/app/issue/issue-grid.service.ts
new file mode 100644
index 00000000..a9aa9984
--- /dev/null
+++ b/brewman/static/app/issue/issue-grid.service.ts
@@ -0,0 +1,3 @@
+export function IssueGrid($resource) {
+ return $resource('/api/Issues/Services/:date');
+}
diff --git a/brewman/static/app/issue/issue-modal.controller.js b/brewman/static/app/issue/issue-modal.controller.js
deleted file mode 100644
index 56b3be64..00000000
--- a/brewman/static/app/issue/issue-modal.controller.js
+++ /dev/null
@@ -1,22 +0,0 @@
-angular
- .module('overlord')
- .controller('IssueModalController', IssueModalController);
-IssueModalController.$inject = ['$scope', '$uibModalInstance', 'edit', 'Batch'];
-function IssueModalController($scope, $modalInstance, edit, Batch) {
- $scope.edit = edit;
- $scope.ok = function () {
- $scope.edit.Product = $scope.edit.Batch.Product;
- $scope.edit.Quantity = Number($scope.edit.Quantity);
- $scope.edit.Tax = $scope.edit.Batch.Tax;
- $scope.edit.Discount = $scope.edit.Batch.Discount;
- $scope.edit.Rate = $scope.edit.Batch.Rate;
- $scope.edit.Amount = $scope.edit.Quantity * $scope.edit.Rate * (1 + $scope.edit.Tax) * (1 - $scope.edit.Discount);
- $modalInstance.close($scope.edit);
- };
- $scope.cancel = function () {
- $modalInstance.dismiss('cancel');
- };
- $scope.batches = function ($viewValue) {
- return Batch.autocomplete({term: $viewValue, count: 20}).$promise;
- };
-}
diff --git a/brewman/static/app/issue/issue-modal.controller.ts b/brewman/static/app/issue/issue-modal.controller.ts
new file mode 100644
index 00000000..19c7e244
--- /dev/null
+++ b/brewman/static/app/issue/issue-modal.controller.ts
@@ -0,0 +1,26 @@
+export class IssueModalController {
+ static $inject = ['$scope', '$uibModalInstance', 'Batch'];
+ edit:any;
+
+ constructor(public $scope, public $modalInstance, public Batch) {
+ this.edit = $scope.$resolve.edit;
+ }
+
+ ok() {
+ this.edit.Product = this.edit.Batch.Product;
+ this.edit.Quantity = Number(this.edit.Quantity);
+ this.edit.Tax = this.edit.Batch.Tax;
+ this.edit.Discount = this.edit.Batch.Discount;
+ this.edit.Rate = this.edit.Batch.Rate;
+ this.edit.Amount = this.edit.Quantity * this.edit.Rate * (1 + this.edit.Tax) * (1 - this.edit.Discount);
+ this.$modalInstance.close(this.edit);
+ }
+
+ cancel() {
+ this.$modalInstance.dismiss('cancel');
+ }
+
+ batches($viewValue) {
+ return this.Batch.autocomplete({term: $viewValue, count: 20}).$promise;
+ }
+}
diff --git a/brewman/static/app/issue/issue-modal.html b/brewman/static/app/issue/issue-modal.html
index 576dd8f3..e5e05ee8 100644
--- a/brewman/static/app/issue/issue-modal.html
+++ b/brewman/static/app/issue/issue-modal.html
@@ -8,17 +8,17 @@
-
-
+
Load |
| ||||||
| {{item.Amount | currency}} |
Load
+
+ ng-options="l.CostCentreID as l.Name for l in vm.costCentres">
-
+
+ ng-options="l.CostCentreID as l.Name for l in vm.costCentres">
₹
@@ -46,16 +46,16 @@
-
+
+ ng-model="vm.quantity" on-return="vm.add()"/>
-
@@ -73,7 +73,7 @@
| |||||||
| {{inventory.Product.Name}} | {{inventory.Batch.Name}} | {{inventory.Quantity | number:2}} | @@ -81,12 +81,12 @@{{inventory.Amount | currency}} |
- Delete
|
@@ -99,25 +99,25 @@
||||
| {{journal.Debit | debit}} | {{journal.Ledger.Name}} | {{journal.Amount | currency}} |
- Delete
|
@@ -80,14 +80,14 @@