Add user management
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
window.app.directive('inventoryAdd', inventoryAdd);
|
||||
|
||||
function inventoryAdd() {
|
||||
return {
|
||||
templateUrl: '/inventory/template/inventoryAdd.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
window.app.directive('inventoryAdd',
|
||||
function() {
|
||||
return {
|
||||
templateUrl: '/inventory/template/inventoryAdd.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
});
|
||||
|
||||
controller.$inject = ['$scope', 'inventorySvc', 'inventoryTypeSvc'];
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
window.app.directive('inventoryDistribute', inventoryDistribute);
|
||||
|
||||
function inventoryDistribute() {
|
||||
return {
|
||||
templateUrl: '/inventory/template/inventoryDistribute.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
window.app.directive('inventoryDistribute',
|
||||
function() {
|
||||
return {
|
||||
templateUrl: '/inventory/template/inventoryDistribute.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
});
|
||||
|
||||
controller.$inject = ['$scope', 'inventorySvc'];
|
||||
function controller($scope, inventorySvc) {
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
window.app.directive('editInventory', editInventory);
|
||||
|
||||
function editInventory() {
|
||||
return {
|
||||
scope: {
|
||||
inventory: "="
|
||||
},
|
||||
templateUrl: '/inventory/template/inventoryEdit.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
window.app.directive('editInventory',
|
||||
function() {
|
||||
return {
|
||||
scope: {
|
||||
inventory: "="
|
||||
},
|
||||
templateUrl: '/inventory/template/inventoryEdit.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
});
|
||||
|
||||
controller.$inject = ['$scope', '$uibModal', 'inventorySvc', 'transactionSvc'];
|
||||
function controller($scope, $uibModal, inventorySvc, transactionSvc) {
|
||||
|
||||
@@ -1,33 +1,29 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
window.app.controller('InventoryListController', InventoryListController);
|
||||
window.app.controller('InventoryListController',
|
||||
function($uibModal, inventorySvc, downloadSvc) {
|
||||
var vm = this;
|
||||
|
||||
InventoryListController.$inject = ['$uibModal', 'inventorySvc', 'downloadSvc'];
|
||||
function InventoryListController($uibModal, inventorySvc, downloadSvc) {
|
||||
var vm = this;
|
||||
vm.inventories = inventorySvc.inventories;
|
||||
|
||||
vm.add = add;
|
||||
vm.distribute = distribute;
|
||||
vm.inventories = inventorySvc.inventories;
|
||||
|
||||
function add() {
|
||||
$uibModal.open({
|
||||
template: '<inventory-add />',
|
||||
backdrop: 'static'
|
||||
});
|
||||
}
|
||||
vm.add = function() {
|
||||
$uibModal.open({
|
||||
template: '<inventory-add />',
|
||||
backdrop: 'static'
|
||||
});
|
||||
};
|
||||
|
||||
function distribute() {
|
||||
$uibModal.open({
|
||||
template: '<inventory-distribute />',
|
||||
backdrop: 'static'
|
||||
});
|
||||
}
|
||||
vm.distribute = function() {
|
||||
$uibModal.open({
|
||||
template: '<inventory-distribute />',
|
||||
backdrop: 'static'
|
||||
});
|
||||
};
|
||||
|
||||
vm.export = function () {
|
||||
inventorySvc.exportInventory()
|
||||
.success(downloadSvc.success);
|
||||
}
|
||||
}
|
||||
vm.export = function() {
|
||||
inventorySvc.exportInventory()
|
||||
.success(downloadSvc.success);
|
||||
};
|
||||
});
|
||||
})();
|
||||
@@ -1,15 +1,15 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
window.app.directive('inventoryList', inventoryList);
|
||||
function inventoryList() {
|
||||
return {
|
||||
scope: {"inventories" : "="},
|
||||
templateUrl: '/inventory/template/inventoryList.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
window.app.directive('inventoryList',
|
||||
function () {
|
||||
return {
|
||||
scope: {"inventories" : "="},
|
||||
templateUrl: '/inventory/template/inventoryList.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
});
|
||||
|
||||
controller.$inject = ['$scope', '$uibModal'];
|
||||
function controller($scope, $uibModal) {
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
window.app.directive('inventoryInfo', inventoryInfo);
|
||||
|
||||
function inventoryInfo() {
|
||||
return {
|
||||
scope: { "inventory": "=" },
|
||||
templateUrl: '/inventory/template/inventoryInfo.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
window.app.directive('inventoryInfo',
|
||||
function() {
|
||||
return {
|
||||
scope: { "inventory": "=" },
|
||||
templateUrl: '/inventory/template/inventoryInfo.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
});
|
||||
|
||||
controller.$inject = ['$scope'];
|
||||
function controller($scope) {
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
window.app.directive('inventoryRemove', inventoryRemove);
|
||||
|
||||
function inventoryRemove() {
|
||||
return {
|
||||
scope: { "inventory": "=" },
|
||||
templateUrl: '/inventory/template/inventoryRemove.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
}
|
||||
window.app.directive('inventoryRemove',
|
||||
function() {
|
||||
return {
|
||||
scope: { "inventory": "=" },
|
||||
templateUrl: '/inventory/template/inventoryRemove.tmpl.cshtml',
|
||||
controller: controller,
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
});
|
||||
|
||||
controller.$inject = ['$scope', 'inventorySvc'];
|
||||
function controller($scope, inventorySvc) {
|
||||
|
||||
@@ -1,87 +1,85 @@
|
||||
(function() {
|
||||
window.app.factory('inventorySvc', inventorySvc);
|
||||
window.app.factory('inventorySvc',
|
||||
function($http, $filter) {
|
||||
var inventories = [];
|
||||
|
||||
inventorySvc.$inject = ['$http', '$filter'];
|
||||
function inventorySvc($http, $filter) {
|
||||
var inventories = [];
|
||||
loadInventories();
|
||||
|
||||
loadInventories();
|
||||
var svc = {
|
||||
add: add,
|
||||
distribute: distribute,
|
||||
update: update,
|
||||
remove: remove,
|
||||
inventories: inventories,
|
||||
get: get,
|
||||
refresh: refresh,
|
||||
find: find,
|
||||
exportInventory: exportInventory
|
||||
};
|
||||
|
||||
var svc = {
|
||||
add: add,
|
||||
distribute: distribute,
|
||||
update: update,
|
||||
remove: remove,
|
||||
inventories: inventories,
|
||||
get: get,
|
||||
refresh: refresh,
|
||||
find: find,
|
||||
exportInventory: exportInventory
|
||||
};
|
||||
return svc;
|
||||
|
||||
return svc;
|
||||
|
||||
function loadInventories() {
|
||||
$http.post('/Inventory/All')
|
||||
.success(function(data) {
|
||||
angular.copy(data, inventories);
|
||||
});
|
||||
}
|
||||
|
||||
function exportInventory() {
|
||||
return $http.post('/Inventory/Export', {}, { responseType: 'arraybuffer' });
|
||||
}
|
||||
|
||||
function add(inventory) {
|
||||
return $http.post('/Inventory/Add', inventory)
|
||||
.success(function(inventory) {
|
||||
inventories.unshift(inventory);
|
||||
});
|
||||
}
|
||||
|
||||
function distribute(distribution) {
|
||||
return $http.post('/Inventory/Distribute', distribution)
|
||||
.success(function (data) {
|
||||
angular.copy(data, inventories);
|
||||
});
|
||||
}
|
||||
|
||||
function update(existingInventory, updatedInventory) {
|
||||
return $http.post('/Inventory/Update', updatedInventory)
|
||||
.success(function(inventory) {
|
||||
angular.extend(existingInventory, inventory);
|
||||
});
|
||||
}
|
||||
|
||||
// remove quantity from this inventory
|
||||
function remove(removeForm) {
|
||||
var existingInventory = get(removeForm.inventoryId);
|
||||
return $http.post('/Inventory/Remove', removeForm)
|
||||
.success(function(data) {
|
||||
angular.copy(data, existingInventory);
|
||||
});
|
||||
}
|
||||
|
||||
function get(id) {
|
||||
var results = $filter('filter')(inventories, { id: id });
|
||||
if (results.length > 0)
|
||||
return results[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
// refresh this inventory from the server
|
||||
function refresh(id) {
|
||||
var existingInventory = get(id);
|
||||
if (existingInventory) {
|
||||
find(id)
|
||||
.success(function(inventory) {
|
||||
angular.copy(inventory, existingInventory);
|
||||
function loadInventories() {
|
||||
$http.post('/Inventory/All')
|
||||
.success(function(data) {
|
||||
angular.copy(data, inventories);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function find(id) {
|
||||
return $http.post('/Inventory/Find', { id: id });
|
||||
}
|
||||
}
|
||||
function exportInventory() {
|
||||
return $http.post('/Inventory/Export', {}, { responseType: 'arraybuffer' });
|
||||
}
|
||||
|
||||
function add(inventory) {
|
||||
return $http.post('/Inventory/Add', inventory)
|
||||
.success(function(inventory) {
|
||||
inventories.unshift(inventory);
|
||||
});
|
||||
}
|
||||
|
||||
function distribute(distribution) {
|
||||
return $http.post('/Inventory/Distribute', distribution)
|
||||
.success(function(data) {
|
||||
angular.copy(data, inventories);
|
||||
});
|
||||
}
|
||||
|
||||
function update(existingInventory, updatedInventory) {
|
||||
return $http.post('/Inventory/Update', updatedInventory)
|
||||
.success(function(inventory) {
|
||||
angular.extend(existingInventory, inventory);
|
||||
});
|
||||
}
|
||||
|
||||
// remove quantity from this inventory
|
||||
function remove(removeForm) {
|
||||
var existingInventory = get(removeForm.inventoryId);
|
||||
return $http.post('/Inventory/Remove', removeForm)
|
||||
.success(function(data) {
|
||||
angular.copy(data, existingInventory);
|
||||
});
|
||||
}
|
||||
|
||||
function get(id) {
|
||||
var results = $filter('filter')(inventories, { id: id });
|
||||
if (results.length > 0)
|
||||
return results[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
// refresh this inventory from the server
|
||||
function refresh(id) {
|
||||
var existingInventory = get(id);
|
||||
if (existingInventory) {
|
||||
find(id)
|
||||
.success(function(inventory) {
|
||||
angular.copy(inventory, existingInventory);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function find(id) {
|
||||
return $http.post('/Inventory/Find', { id: id });
|
||||
}
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user