mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 13:05:49 +00:00
update owner creation ui
This commit is contained in:
parent
a481ee4a8e
commit
c77f86a72d
3 changed files with 40 additions and 39 deletions
|
@ -64,9 +64,8 @@ public class OwnerResource {
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/owner", method = RequestMethod.POST)
|
@RequestMapping(value = "/owner", method = RequestMethod.POST)
|
||||||
@ResponseStatus(HttpStatus.CREATED)
|
@ResponseStatus(HttpStatus.CREATED)
|
||||||
public void createOwner(@RequestBody Owner owner) {
|
public void createOwner(@Valid @RequestBody Owner owner) {
|
||||||
this.clinicService.saveOwner(owner);
|
this.clinicService.saveOwner(owner);
|
||||||
// TODO: need to handle failure
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,37 +1,45 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<h2>Owner</h2>
|
<h2>Owner</h2>
|
||||||
<form class="form-horizontal" name="ownerForm" data-ng-controller="ownerFormController">
|
<form class="form-horizontal" name="ownerForm" data-ng-controller="ownerFormController">
|
||||||
<fieldset>
|
<div class="form-group">
|
||||||
<div class="control-group" id="firstName">
|
<label class="col-sm-2 control-label">First name</label>
|
||||||
<label class="control-label">First name </label>
|
<div class="col-sm-4">
|
||||||
<input ng-model="owner.firstName" name="firstName" required/>
|
<input class="form-control" ng-model="owner.firstName" name="firstName" required/>
|
||||||
<span ng-show="ownerForm.firstName.$error.required" class="help-inline">First name is required.</span>
|
<span ng-show="ownerForm.firstName.$error.required" class="help-inline">First name is required.</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group" id="lastName">
|
</div>
|
||||||
<label class="control-label">Last name </label>
|
<div class="form-group">
|
||||||
<input ng-model="owner.lastName" name="lastName" required/>
|
<label class="col-sm-2 control-label">Last name</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input class="form-control" ng-model="owner.lastName" name="lastName" required/>
|
||||||
<span ng-show="ownerForm.lastName.$error.required" class="help-inline">Last name is required.</span>
|
<span ng-show="ownerForm.lastName.$error.required" class="help-inline">Last name is required.</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group" id="address">
|
</div>
|
||||||
<label class="control-label">Address </label>
|
<div class="form-group">
|
||||||
<input ng-model="owner.address" name="address" required/>
|
<label class="col-sm-2 control-label">Address</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input class="form-control" ng-model="owner.address" name="address" required/>
|
||||||
<span ng-show="ownerForm.address.$error.required" class="help-inline">Address is required.</span>
|
<span ng-show="ownerForm.address.$error.required" class="help-inline">Address is required.</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group" id="city">
|
</div>
|
||||||
<label class="control-label">City </label>
|
<div class="form-group">
|
||||||
<input ng-model="owner.city" name="city" required/>
|
<label class="col-sm-2 control-label">City</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input class="form-control" ng-model="owner.city" name="city" required/>
|
||||||
<span ng-show="ownerForm.city.$error.required" class="help-inline">City is required.</span>
|
<span ng-show="ownerForm.city.$error.required" class="help-inline">City is required.</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="control-group" id="telephone">
|
</div>
|
||||||
<label class="control-label">Telephone </label>
|
<div class="form-group">
|
||||||
<input ng-model="owner.telephone" name="telephone" required/>
|
<label class="col-sm-2 control-label">Telephone</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input class="form-control" ng-model="owner.telephone" name="telephone" required/>
|
||||||
<span ng-show="ownerForm.telephone.$error.required" class="help-inline">Telephone is required.</span>
|
<span ng-show="ownerForm.telephone.$error.required" class="help-inline">Telephone is required.</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-actions">
|
<div class="form-group">
|
||||||
<button type="submit" ng-click="submitOwnerForm()">Submit</button>
|
<div class="col-sm-offset-2 col-sm-4">
|
||||||
</div>
|
<button class="btn btn-primary" type="submit" ng-click="submitOwnerForm()">Submit</button>
|
||||||
</fieldset>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
<h2>Find Owners</h2>
|
<h2>Owners</h2>
|
||||||
<form class="form-horizontal" ng-controller="ownerSearchController">
|
<form class="form-inline" ng-controller="ownerSearchController">
|
||||||
<fieldset>
|
<div class="control-group">
|
||||||
<div class="control-group" id="lastName">
|
<label class="control-label">Last name</label>
|
||||||
<label class="control-label">Last name </label>
|
<input class="form-control" type="text" ng-model="ownerSearchForm.lastName" size="30" maxlength="80"/>
|
||||||
<input ng-model="ownerSearchForm.lastName" size="30" maxlength="80"/>
|
<button class="btn btn-info" type="submit" ng-click="submitOwnerSearchForm()">Find Owners</button> |
|
||||||
</div>
|
<a class="btn btn-info" ui-sref="app.ownercreate">Add New Owner</a>
|
||||||
<div class="form-actions">
|
</div>
|
||||||
<button type="submit" ng-click="submitOwnerSearchForm()">Find Owners</button>
|
</form>
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
<a ui-sref="app.ownercreate">Add Owners</a>
|
|
Loading…
Reference in a new issue