Initial deployment
This commit is contained in:
@@ -17,24 +17,28 @@
|
||||
vm.uploading = false;
|
||||
vm.file = "";
|
||||
|
||||
vm.statusMessage = "Import inventory items below.";
|
||||
vm.statusMessage = "Select your inventory excel document to import.";
|
||||
vm.errorMessages = [];
|
||||
|
||||
// upload later on form submit or something similar
|
||||
vm.submit = function () {
|
||||
console.log("vm.submit");
|
||||
if (vm.form.file.$valid && vm.file) {
|
||||
console.log("if (vm.form.file.$valid && vm.file)");
|
||||
vm.upload(vm.file);
|
||||
}
|
||||
};
|
||||
|
||||
// upload on file select or drop
|
||||
vm.upload = function(file) {
|
||||
console.log("vm.upload");
|
||||
vm.uploading = true;
|
||||
angular.copy([], vm.errorMessages);
|
||||
inventorySvc
|
||||
.importFile(file)
|
||||
.then(function(resp) {
|
||||
console.log("Success " + resp.config.data.file.name + "uploaded. Response: " + resp.data);
|
||||
vm.uploading = false;
|
||||
console.log("Success " + resp.config.data.file.name + "uploaded. Response: " + resp.data);
|
||||
vm.uploading = false;
|
||||
},
|
||||
function (resp) {
|
||||
if (angular.isArray(resp.data))
|
||||
|
||||
@@ -95,10 +95,13 @@
|
||||
|
||||
function importFile(file) {
|
||||
return Upload.upload({
|
||||
url: "/api/Import",
|
||||
method: 'POST',
|
||||
data: { file: file}
|
||||
});
|
||||
url: "/api/Import",
|
||||
method: 'POST',
|
||||
data: { file: file }
|
||||
})
|
||||
.success(function() {
|
||||
loadInventories();
|
||||
});
|
||||
}
|
||||
|
||||
function isShredReady(inventory) {
|
||||
|
||||
@@ -12,15 +12,21 @@
|
||||
<status-message message="vm.statusMessage" ng-hide="vm.errorMessages.length"></status-message>
|
||||
<error-list errors="vm.errorMessages"></error-list>
|
||||
|
||||
<div class="btn btn-default"
|
||||
ngf-select
|
||||
ng-model="vm.file"
|
||||
name="file"
|
||||
ngf-pattern="'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'"
|
||||
ngf-accept="'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'">Select</div>
|
||||
|
||||
<div>{{vm.file.name}}</div>
|
||||
<p>Download the import template: <a href="/Content/InventoryTraker_ImportTemplate.xlsx">Excel template</a></p>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="btn btn-default"
|
||||
ngf-select
|
||||
ng-model="vm.file"
|
||||
name="file"
|
||||
ngf-pattern="'.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'"
|
||||
ngf-accept="'.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'">Select</div>
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<div>{{vm.file.name}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
||||
Reference in New Issue
Block a user