diff --git a/app/views/index.jade b/app/views/index.jade index 296554e..1d09b8a 100644 --- a/app/views/index.jade +++ b/app/views/index.jade @@ -62,7 +62,7 @@ html(lang="en", ng-app="biomed", ng-controller="PageCtrl") li(data-match-route='/deviceTypes.*') a(href='/deviceTypes') - | Devices + | Global Devices li(data-match-route='/checkLists.*') a(href='/checkLists') diff --git a/public/js/controllers/checkLists.js b/public/js/controllers/checkLists.js index a360843..8f3dc5b 100644 --- a/public/js/controllers/checkLists.js +++ b/public/js/controllers/checkLists.js @@ -75,7 +75,9 @@ function checkListsControllerFactory(isEdit) { function save() { if (isEdit) { - CheckLists.update({id: $scope.model._id}, $scope.model); + CheckLists.update({id: $scope.model._id}, $scope.model, function() { + $location.path("/checkLists/"); + }); } else { CheckLists.create($scope.model, function(result) { $location.path("/checkLists/" + result._id); @@ -99,4 +101,4 @@ function checkListsControllerFactory(isEdit) { $scope.model = CheckLists.get($routeParams); } } -} \ No newline at end of file +} diff --git a/public/js/controllers/deviceTypes.js b/public/js/controllers/deviceTypes.js index 06349ec..7e239a7 100644 --- a/public/js/controllers/deviceTypes.js +++ b/public/js/controllers/deviceTypes.js @@ -152,18 +152,20 @@ angular.module('biomed') .controller("DeviceTypeEditCtrl", function($scope, DeviceTypes, Devices, CheckLists, $location, $filter, $routeParams) { var images = {}; - $scope.model = DeviceTypes.get($routeParams, function() { - $scope.loading = false; + $scope.checkLists = CheckLists.index(function() { + $scope.model = DeviceTypes.get($routeParams, function() { + $scope.loading = false; - $scope.existingImages = $scope.model.images; - if ($scope.model.images) { - for (var i = 0; i < $scope.model.images.length; i++) { - images[$scope.model.images[i]] = 1; + $scope.existingImages = $scope.model.images; + if ($scope.model.images) { + for (var i = 0; i < $scope.model.images.length; i++) { + images[$scope.model.images[i]] = 1; + } } - } - $scope.categoryPicker = {id: $scope.model.category, text: $scope.model.category}; - $scope.makePicker = {id: $scope.model.make, text: $scope.model.make}; + $scope.categoryPicker = {id: $scope.model.category, text: $scope.model.category}; + $scope.makePicker = {id: $scope.model.make, text: $scope.model.make}; + }); }); console.log($routeParams); @@ -173,8 +175,6 @@ angular.module('biomed') $scope.categories = DeviceTypes.categories(); $scope.deviceMakes = DeviceTypes.makes(); - $scope.checkLists = CheckLists.index(); - $scope.categoryOpts = { containerCssClass: 'input-xxlarge', @@ -257,4 +257,4 @@ angular.module('biomed') $location.path("/deviceTypes/"); }); }; -}) \ No newline at end of file +}) diff --git a/public/js/controllers/devices.js b/public/js/controllers/devices.js index 79ecaf8..6081707 100644 --- a/public/js/controllers/devices.js +++ b/public/js/controllers/devices.js @@ -94,13 +94,14 @@ function devicesControllerFactory(isEdit) { function create() { Devices.create($scope.model, function(result) { - console.log('here'); - $location.path("/devices/" + result._id); + $location.path("/clients/" + result.client); }); } function update() { - Devices.update({id: $scope.model._id}, $scope.model); + Devices.update({id: $scope.model._id}, $scope.model, function() { + $location.path("/clients/" + $scope.model.client); + }); } var hashids = new Hashids("biomed"); diff --git a/public/partials/clients/edit.html b/public/partials/clients/edit.html index f7aff98..3e5896f 100644 --- a/public/partials/clients/edit.html +++ b/public/partials/clients/edit.html @@ -298,7 +298,7 @@ - + diff --git a/public/partials/deviceTypes/add.html b/public/partials/deviceTypes/add.html index b938cfe..aabd2a5 100644 --- a/public/partials/deviceTypes/add.html +++ b/public/partials/deviceTypes/add.html @@ -1,9 +1,8 @@
-

New Device

+

New Global Device

@@ -49,7 +48,7 @@
- +
diff --git a/public/partials/deviceTypes/edit.html b/public/partials/deviceTypes/edit.html index f310c6f..a00b553 100644 --- a/public/partials/deviceTypes/edit.html +++ b/public/partials/deviceTypes/edit.html @@ -1,14 +1,14 @@
-

Edit Device

+

Edit Global Device

-
+
@@ -53,7 +53,7 @@
- +
@@ -111,7 +111,7 @@
Device IDControl # Category Make Model
- + diff --git a/public/partials/deviceTypes/index.html b/public/partials/deviceTypes/index.html index 3434be6..f7aa826 100644 --- a/public/partials/deviceTypes/index.html +++ b/public/partials/deviceTypes/index.html @@ -1,14 +1,14 @@
-

Devices

+

Global Devices

- Create new Device + Create new Global Device
Search:
diff --git a/public/partials/devices/add.html b/public/partials/devices/add.html index e5cba49..401898c 100644 --- a/public/partials/devices/add.html +++ b/public/partials/devices/add.html @@ -39,14 +39,14 @@
- +
- +
- +
- +
Device IDControl # Client Serial No. Purchase Date