Skip to content

Commit

Permalink
Add specialty column
Browse files Browse the repository at this point in the history
  • Loading branch information
Rupert Bedford committed May 26, 2016
1 parent 8478b40 commit 2099086
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/app/consultants/consultants-component.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
ConsultantPermission,
firstPromise,
$injector,
store
store,
_
) {
function ConsultantsController($scope) {
var self = this;
Expand All @@ -24,7 +25,14 @@
}
});

self.load(store.findMany('consultants'));
self.load(firstPromise([
store.findMany('consultants'),
store.findMany('specialties').then(function(specialties) {
$scope.specialties = _.sortBy(specialties, function(x) {
return x.name;
});
})
]));

$scope.create = function() {
var item = store.create('consultants');
Expand All @@ -43,7 +51,8 @@
'ConsultantPermission',
'firstPromise',
'$injector',
'store'
'store',
'_'
];

app.factory('ConsultantsController', controllerFactory);
Expand Down
16 changes: 16 additions & 0 deletions src/app/consultants/consultants-component.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
<td>{{item.lastName}}</td>
</tr>

<tr>
<th>Specialty</th>
<td>{{item.specialty.name}}</td>
</tr>

<tr>
<th>Email Address</th>
<td>{{item.email | missing}}</td>
Expand Down Expand Up @@ -71,6 +76,15 @@
</div>
</div>

<div frm-field frm-group>
<div frm-label>Specialty</div>

<div frm-control>
<div frm-select-field model="item.specialty" options="specialties" options-label="name" required="true"></div>
<div frm-errors errors="item.errors.specialty"></div>
</div>
</div>

<div frm-field frm-group>
<div frm-label>Email</div>

Expand Down Expand Up @@ -124,6 +138,7 @@
<th></th>
<th sort-helper="firstName">First Name</th>
<th sort-helper="lastName">Last Name</th>
<th sort-helper="specialty.name">Specialty</th>
<th sort-helper="email">Email</th>
<th sort-helper="telephoneNumber">Telephone Number</th>
<th sort-helper="gmcNumber">GMC Number</th>
Expand All @@ -141,6 +156,7 @@

<td>{{item.firstName}}</td>
<td>{{item.lastName}}</td>
<td>{{item.specialty.name}}</td>
<td>{{item.email | missing}}</td>
<td>{{item.telephoneNumber | missing}}</td>
<td>{{item.gmcNumber | missing}}</td>
Expand Down

0 comments on commit 2099086

Please sign in to comment.