mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-18 13:35:50 +00:00
TN: Make add pet work without BirthDate
This commit is contained in:
parent
9dfcd77233
commit
a5fa3431e8
9 changed files with 45 additions and 39 deletions
|
@ -130,11 +130,11 @@
|
|||
<div class="col-md-4 col-md-offset-2">
|
||||
<div class="form-group">
|
||||
<label for="firstName">First Name</label>
|
||||
<input type="text" class="form-control" id="firstName" value="Maria">
|
||||
<input type="text" class="form-control" id="firstName" ng-model="currentOwner.firstName">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="lastName">Last Name</label>
|
||||
<input type="text" class="form-control" id="lastName" value="Rodriguez">
|
||||
<input type="text" class="form-control" id="lastName" ng-model="currentOwner.lastName">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="profileImg">Profile Photo</label>
|
||||
|
@ -156,15 +156,15 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="address">Address</label>
|
||||
<input type="text" class="form-control" id="address" value="345 Maple St.">
|
||||
<input type="text" class="form-control" id="address" ng-model="currentOwner.address">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="city">City</label>
|
||||
<input type="text" class="form-control" id="city" value="Madison">
|
||||
<input type="text" class="form-control" id="city" ng-model="currentOwner.city">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="contactNumber">Contact Number</label>
|
||||
<input type="text" class="form-control" id="contactNumber" value="6085557683">
|
||||
<input type="text" class="form-control" id="contactNumber" ng-model="currentOwner.telephone">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="email">Email</label>
|
||||
|
@ -173,7 +173,7 @@
|
|||
</div>
|
||||
<div class="col-md-8 col-md-offset-2">
|
||||
<div class="form-group form-group-action">
|
||||
<button type="submit" class="btn btn-primary" data-toggle="modal" data-target="#editOwnerSuccessModal" data-dismiss="modal" aria-label="Close" ng-click="addOwner()">Update Owner</button>
|
||||
<button type="submit" class="btn btn-primary" data-toggle="modal" data-target="#editOwnerSuccessModal" data-dismiss="modal" aria-label="Close" ng-click="saveOwner()">Update Owner</button>
|
||||
<button class="btn btn-link" class="close" data-dismiss="modal" aria-label="Close">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
</div>
|
||||
<div class="form-group">
|
||||
<label for="type">Type</label>
|
||||
<select class="form-control" id="type" data-ng-model="currentPet.type">
|
||||
<option data-ng-repeat="type in petTypes" data-ng-value="type.id" data-ng-selected="currentPet.type.id == type.id" data-ng-bind="type.name"></option>
|
||||
<select class="form-control" id="type" data-ng-model="currentPet.type.id">
|
||||
<option data-ng-repeat="type in petTypes" data-ng-value="type.id" data-ng-bind="type.name"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group form-group-action">
|
||||
|
|
|
@ -23,10 +23,6 @@ var OwnerDetailsController = ['$scope','$rootScope','$stateParams','Owner', func
|
|||
Owner.save(owner);
|
||||
}
|
||||
|
||||
$scope.setCurrentOwner = function() {
|
||||
$rootScope.currentOwner = $scope.currentOwner;
|
||||
}
|
||||
|
||||
}];
|
||||
|
||||
var AddOwnerController = ['$scope','Owner', function($scope,Owner) {
|
||||
|
|
|
@ -128,3 +128,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Add Owner modal -->
|
||||
<data-ng-include src="'components/_partials/_modal_add_owner.html'"></data-ng-include>
|
||||
<!-- Add Pet modal -->
|
||||
<data-ng-include src="'components/_partials/_modal_add_pet.html'"></data-ng-include>
|
||||
<!-- Add Pet Visit modal -->
|
||||
<data-ng-include src="'components/_partials/_modal_add_pet_visit.html'"></data-ng-include>
|
|
@ -10,10 +10,18 @@ var PetController = ['$scope', 'Pet', function($scope, Pet) {
|
|||
|
||||
}];
|
||||
|
||||
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);
|
||||
};
|
||||
}];
|
BIN
src/main/webapp/images/avatars/owner11.jpg
Normal file
BIN
src/main/webapp/images/avatars/owner11.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
src/main/webapp/images/avatars/owner12.jpg
Normal file
BIN
src/main/webapp/images/avatars/owner12.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
|
@ -21,12 +21,6 @@
|
|||
|
||||
<!-- Search modal -->
|
||||
<data-ng-include src="'components/_partials/_modal_search.html'"></data-ng-include>
|
||||
<!-- Add Owner modal -->
|
||||
<data-ng-include src="'components/_partials/_modal_add_owner.html'"></data-ng-include>
|
||||
<!-- Add Pet modal -->
|
||||
<data-ng-include src="'components/_partials/_modal_add_pet.html'"></data-ng-include>
|
||||
<!-- Add Pet Visit modal -->
|
||||
<data-ng-include src="'components/_partials/_modal_add_pet_visit.html'"></data-ng-include>
|
||||
|
||||
<!--<script src="http://code.jquery.com/jquery.js"></script>-->
|
||||
<script src="plugins/jquery/jquery-2.1.0.min.js"></script>
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue