diff --git a/src/main/webapp/components/_partials/_modal_add_owner.html b/src/main/webapp/components/_partials/_modal_add_owner.html index fa1b44c7a..257a4c560 100644 --- a/src/main/webapp/components/_partials/_modal_add_owner.html +++ b/src/main/webapp/components/_partials/_modal_add_owner.html @@ -130,11 +130,11 @@
- +
- +
@@ -156,15 +156,15 @@
- +
- +
- +
@@ -173,7 +173,7 @@
- +
diff --git a/src/main/webapp/components/_partials/_modal_add_pet.html b/src/main/webapp/components/_partials/_modal_add_pet.html index 344d054ae..697182feb 100644 --- a/src/main/webapp/components/_partials/_modal_add_pet.html +++ b/src/main/webapp/components/_partials/_modal_add_pet.html @@ -37,8 +37,8 @@
- +
diff --git a/src/main/webapp/components/owners/OwnerController.js b/src/main/webapp/components/owners/OwnerController.js index bdcfd5dde..62c45a1d5 100644 --- a/src/main/webapp/components/owners/OwnerController.js +++ b/src/main/webapp/components/owners/OwnerController.js @@ -9,30 +9,26 @@ var OwnerController = ['$scope','$state','Owner',function($scope,$state,Owner) { }]; var OwnerDetailsController = ['$scope','$rootScope','$stateParams','Owner', function($scope,$rootScope,$stateParams,Owner) { - + var currentId = $stateParams.id; var nextId = parseInt($stateParams.id) + 1; var prevId = parseInt($stateParams.id) - 1; - + $scope.prevOwner = Owner.get({id:prevId}); $scope.nextOwner = Owner.get({id:nextId}); $scope.currentOwner = Owner.get($stateParams); - + $scope.saveOwner = function(){ owner = $scope.currentOwner; Owner.save(owner); } - - $scope.setCurrentOwner = function() { - $rootScope.currentOwner = $scope.currentOwner; - } - + }]; var AddOwnerController = ['$scope','Owner', function($scope,Owner) { - + $scope.owner={id:0,pets:[]}; - + $scope.addOwner = function(){ Owner.save($scope.owner); } diff --git a/src/main/webapp/components/owners/owner_details.html b/src/main/webapp/components/owners/owner_details.html index e81b5873c..e6dbfa1ab 100644 --- a/src/main/webapp/components/owners/owner_details.html +++ b/src/main/webapp/components/owners/owner_details.html @@ -59,13 +59,13 @@
@@ -81,7 +81,7 @@ Add New Pet
- View as + View as
@@ -127,4 +127,11 @@
  • {{nextOwner.firstName + ' ' + nextOwner.lastName}}
  • - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/components/pets/PetController.js b/src/main/webapp/components/pets/PetController.js index fb9c894f3..3f2eff547 100644 --- a/src/main/webapp/components/pets/PetController.js +++ b/src/main/webapp/components/pets/PetController.js @@ -5,15 +5,23 @@ var PetController = ['$scope', 'Pet', function($scope, Pet) { scrollTop: $("#pets").offset().top }, 1000); }); - + $scope.pets = Pet.query(); - + }]; -var AddPetController = ['$scope','$rootScope','PetType','Pet',function($scope,$rootScope,PetType,Pet) { +var AddPetController = ['$scope','$rootScope','PetType','OwnerPet',function($scope,$rootScope,PetType,OwnerPet) { $scope.petTypes = PetType.query(); - + $scope.currentPet = {type:{}}; + $scope.save = function(){ - Pet.$save($scope.currentPet); + currentOwnerId = $scope.currentOwner.id; + + for (i=0; i<$scope.petTypes.length; i++){ + if ($scope.petTypes[i].id == $scope.currentPet.type.id){ + $scope.currentPet.type.name = $scope.petTypes[i].name; + } + } + OwnerPet.save({ownerId:currentOwnerId},$scope.currentPet); }; }]; \ No newline at end of file diff --git a/src/main/webapp/images/avatars/owner11.jpg b/src/main/webapp/images/avatars/owner11.jpg new file mode 100644 index 000000000..2458a42b4 Binary files /dev/null and b/src/main/webapp/images/avatars/owner11.jpg differ diff --git a/src/main/webapp/images/avatars/owner12.jpg b/src/main/webapp/images/avatars/owner12.jpg new file mode 100644 index 000000000..409db1437 Binary files /dev/null and b/src/main/webapp/images/avatars/owner12.jpg differ diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index 07e4df255..5d58cba13 100644 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -21,12 +21,6 @@ - - - - - - @@ -44,7 +38,7 @@ - + diff --git a/src/main/webapp/js/app.js b/src/main/webapp/js/app.js index dbc315d45..3083b7074 100644 --- a/src/main/webapp/js/app.js +++ b/src/main/webapp/js/app.js @@ -9,9 +9,9 @@ app.constant('context', '/petclinic'); app.config(['stateHelperProvider','$urlRouterProvider','$urlMatcherFactoryProvider',function(stateHelperProvider,$urlRouterProvider,$urlMatcherFactoryProvider) { $urlRouterProvider.otherwise("/"); - + $urlMatcherFactoryProvider.strictMode(false) - + stateHelperProvider.state({ name: "landing", url: "/", @@ -49,7 +49,7 @@ app.config(['stateHelperProvider','$urlRouterProvider','$urlMatcherFactoryProvid controller: "OwnerDetailsController", data: {requireLogin : true} }); - + } ]); /** Controllers **/ @@ -67,6 +67,7 @@ app.controller('SearchController', SearchController); /** Services **/ app.factory('Owner', Owner); app.factory('Pet', Pet); +app.factory('OwnerPet', OwnerPet); app.factory('Vet', Vet); app.factory('Visit', Visit); app.factory('PetType', PetType); @@ -79,7 +80,7 @@ app.directive('scrollToTarget', function() { element.bind('click', function() { angular.element('html, body').stop().animate({ scrollTop: angular.element(angular.element(element).attr('href')).offset().top - 20 - }, 1500); + }, 1500); return false; }); };