+
+
diff --git a/brewman/brewman/static/partial/employee-detail.html b/brewman/brewman/static/partial/employee-detail.html
new file mode 100644
index 00000000..df819f6e
--- /dev/null
+++ b/brewman/brewman/static/partial/employee-detail.html
@@ -0,0 +1,77 @@
+
diff --git a/brewman/brewman/static/partial/employee-list.html b/brewman/brewman/static/partial/employee-list.html
new file mode 100644
index 00000000..f45d9dd6
--- /dev/null
+++ b/brewman/brewman/static/partial/employee-list.html
@@ -0,0 +1,28 @@
+
+
+
+
+ Code |
+ Name |
+ Designation |
+ Salary |
+ Service Points |
+ Department |
+ Joining Date |
+ Leaving Date |
+
+
+
+
+ {{item.Code}} |
+ {{item.Name}} |
+ {{item.Designation}} |
+ {{item.Salary}} |
+ {{item.ServicePoints}} |
+ {{item.CostCenter}} |
+ {{item.JoiningDate}} |
+ {{item.LeavingDate}} |
+
+
+
diff --git a/brewman/brewman/static/scripts/angular_service.js b/brewman/brewman/static/scripts/angular_service.js
index c7017cb0..99b40727 100644
--- a/brewman/brewman/static/scripts/angular_service.js
+++ b/brewman/brewman/static/scripts/angular_service.js
@@ -21,6 +21,14 @@ overlord_service.factory('Account', ['$resource', function ($resource) {
});
}]);
+// TODO: Replace hardcoded url with route_url
+overlord_service.factory('Employee', ['$resource', function ($resource) {
+ return $resource('/Employee/:id',
+ {id:'@LedgerID'}, {
+ query:{method:'GET', params:{list:true}, isArray:true}
+ });
+}]);
+
// TODO: Replace hardcoded url with route_url
overlord_service.factory('Ledger', ['$resource', function ($resource) {
return $resource('/Ledger/:id');
diff --git a/brewman/brewman/static/scripts/employee.js b/brewman/brewman/static/scripts/employee.js
new file mode 100644
index 00000000..5da586fb
--- /dev/null
+++ b/brewman/brewman/static/scripts/employee.js
@@ -0,0 +1,29 @@
+function EmployeeListCtrl($scope, Employee) {
+ $scope.info = Employee.query();
+}
+
+function EmployeeCtrl($scope, $routeParams, $location, Employee, CostCenter) {
+ $scope.employee = Employee.get({id: $routeParams.id});
+
+ $scope.cost_centers = CostCenter.query();
+
+ $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:'Error', 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:'Error', Message:data.data});
+ });
+ };
+ $('#txtName').focus();
+
+}
diff --git a/brewman/brewman/static/scripts/overlord.js b/brewman/brewman/static/scripts/overlord.js
index e158e795..174d0376 100644
--- a/brewman/brewman/static/scripts/overlord.js
+++ b/brewman/brewman/static/scripts/overlord.js
@@ -42,6 +42,10 @@ var overlord = angular.module('overlord', ['overlord.directive', 'overlord.filte
when('/Account', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl}).
when('/Account/:id', {templateUrl:'/partial/account-detail.html', controller:AccountCtrl}).
+ when('/Employees', {templateUrl:'/partial/employee-list.html', controller:EmployeeListCtrl}).
+ when('/Employee', {templateUrl:'/partial/employee-detail.html', controller:EmployeeCtrl}).
+ when('/Employee/:id', {templateUrl:'/partial/employee-detail.html', controller:EmployeeCtrl}).
+
when('/CostCenters', {templateUrl:'/partial/cost-center-list.html', controller:CostCenterListCtrl}).
when('/CostCenter', {templateUrl:'/partial/cost-center-detail.html', controller:CostCenterCtrl}).
when('/CostCenter/:id', {templateUrl:'/partial/cost-center-detail.html', controller:CostCenterCtrl}).
diff --git a/brewman/brewman/templates/angular_base.mako b/brewman/brewman/templates/angular_base.mako
index 0fc02b8f..1e48fe78 100644
--- a/brewman/brewman/templates/angular_base.mako
+++ b/brewman/brewman/templates/angular_base.mako
@@ -46,6 +46,7 @@
${h.ScriptLink(request, 'unposted.js')}
${h.ScriptLink(request, 'account.js')}
+ ${h.ScriptLink(request, 'employee.js')}
${h.ScriptLink(request, 'user.js')}
${h.ScriptLink(request, 'cost-center.js')}
${h.ScriptLink(request, 'product.js')}
diff --git a/brewman/brewman/templates/employee/list.pt b/brewman/brewman/templates/employee/list.pt
deleted file mode 100644
index 95f0ac71..00000000
--- a/brewman/brewman/templates/employee/list.pt
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
- LedgerID |
- Code |
- Name |
- Designation |
- Is Active? |
- CostCenterID |
- Cost Center |
- Joining Date |
- Leaving Date |
-
-
-
-
- ${item.id} |
- ${item.code} |
- ${item.name} |
- ${item.designation} |
- ${item.is_active} |
- ${item.costcenter_id} |
- ${item.costcenter.name} |
- ${'' if item.joining_date is None else item.joining_date.strftime('%d-%b-%Y')} |
- ${'' if item.leaving_date is None else item.leaving_date.strftime('%d-%b-%Y')} |
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/brewman/brewman/templates/nav_bar/employee.pt b/brewman/brewman/templates/nav_bar/employee.pt
index 222d3ce5..a0a9bd95 100644
--- a/brewman/brewman/templates/nav_bar/employee.pt
+++ b/brewman/brewman/templates/nav_bar/employee.pt
@@ -1,8 +1,7 @@