Box modifications

This commit is contained in:
2016-10-18 11:10:01 -04:00
parent 3caf0bd766
commit fdc34c4ef7
109 changed files with 11033 additions and 2442 deletions
@@ -1,8 +1,8 @@
(function() {
window.app.factory("inventorySvc",
[
"$http", "$filter",
function($http, $filter) {
"$http", "$filter", 'Upload',
function($http, $filter, Upload) {
var inventories = [];
loadInventories();
@@ -15,8 +15,10 @@
inventories: inventories,
get: get,
refresh: refresh,
find: find,
exportInventory: exportInventory
load: load,
exportInventory: exportInventory,
isShredReady: isShredReady,
importFile: importFile
};
return svc;
@@ -73,15 +75,34 @@
function refresh(id) {
var existingInventory = get(id);
if (existingInventory) {
find(id)
load(id)
.success(function(inventory) {
angular.copy(inventory, existingInventory);
});
}
}
function find(id) {
return $http.post("/Inventory/Find", { id: id });
function load(id) {
return $http.post("/Inventory/Find", { id: id })
.success(function (inventory) {
var existingInventory = get(id);
if (existingInventory != null)
angular.copy(inventory, existingInventory);
else
inventories.unshift(inventory);
});
}
function importFile(file) {
return Upload.upload({
url: "/api/Import",
method: 'POST',
data: { file: file}
});
}
function isShredReady(inventory) {
return new Date(inventory.shredReadyDate) <= new Date();
}
}
]);