TN: Disable the fields that not supported and refresh owner pet after adding

This commit is contained in:
Tony.Nguyen 2015-02-11 18:12:46 +08:00
parent a5fa3431e8
commit 87c47c6fce
3 changed files with 12 additions and 10 deletions

View file

@ -33,17 +33,17 @@
</div>
<div class="form-group">
<label for="occupation">Occupation</label>
<input type="text" class="form-control" id="occupation">
<input type="text" class="form-control" id="occupation" readonly>
</div>
<div class="form-group">
<label for="company">Company</label>
<input type="text" class="form-control" id="company">
<input type="text" class="form-control" id="company" readonly>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="birthDate">Birth Date</label>
<input type="text" class="form-control" id="birthDate">
<input type="text" class="form-control" id="birthDate" readonly>
</div>
<div class="form-group">
<label for="address">Address</label>
@ -59,7 +59,7 @@
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="text" class="form-control" id="email">
<input type="text" class="form-control" id="email" readonly>
</div>
</div>
<div class="col-md-8 col-md-offset-2">
@ -142,17 +142,17 @@
</div>
<div class="form-group">
<label for="occupation">Occupation</label>
<input type="text" class="form-control" id="occupation" value="Accountant">
<input type="text" class="form-control" id="occupation" value="Accountant" readonly>
</div>
<div class="form-group">
<label for="company">Company</label>
<input type="text" class="form-control" id="company" value="Ledger Associates">
<input type="text" class="form-control" id="company" value="Ledger Associates" readonly>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="birthDate">Birth Date</label>
<input type="text" class="form-control" id="birthDate" value="04 Feb 1988">
<input type="text" class="form-control" id="birthDate" value="04 Feb 1988" readonly>
</div>
<div class="form-group">
<label for="address">Address</label>
@ -168,7 +168,7 @@
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="text" class="form-control" id="email" value="maria.escobito@gmail.com">
<input type="text" class="form-control" id="email" value="maria.escobito@gmail.com" readonly>
</div>
</div>
<div class="col-md-8 col-md-offset-2">

View file

@ -33,7 +33,7 @@
</div>
<div class="form-group">
<label for="birthDate">Birth Date</label>
<input type="text" class="form-control" id="birthDate" data-ng-model="currentPet.birthDate">
<input type="text" class="form-control" id="birthDate" data-ng-model="currentPet.birthDate" readonly>
</div>
<div class="form-group">
<label for="type">Type</label>

View file

@ -22,6 +22,8 @@ var AddPetController = ['$scope','$rootScope','PetType','OwnerPet',function($sco
$scope.currentPet.type.name = $scope.petTypes[i].name;
}
}
OwnerPet.save({ownerId:currentOwnerId},$scope.currentPet);
OwnerPet.save({ownerId:currentOwnerId},$scope.currentPet, function(pet) {
$scope.currentOwner.pets.push(pet);
});
};
}];