Skip to content

Commit

Permalink
fixup! WIP add ebp settings page
Browse files Browse the repository at this point in the history
  • Loading branch information
onyxvd committed Dec 13, 2024
1 parent 4559a0c commit ebbc6e1
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 4 deletions.
16 changes: 15 additions & 1 deletion client/scripts/controllers/EBPSettingsController.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
require('../app').controller('EBPSettingsController', /* @ngInject */function ($q, $translate, user, ngToast, Raven, User) {
require('../app').controller('EBPSettingsController', /* @ngInject */function ($q, $stateParams, EBPSpecies) {
const $ctrl = this

$ctrl.selected = 'sources'

if ($stateParams.settings) {
$ctrl.selected = $stateParams.settings
}

$ctrl.requestSpecies = function () {
$q.resolve(EBPSpecies.query().$promise).then(function (species) {
$ctrl.species = species
})
}

$ctrl.requestSpecies()
})
4 changes: 4 additions & 0 deletions client/scripts/models/ebp_species.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require('../app').factory('EBPSpecies', /* @ngInject */function ($resource, ENDPOINT_URL, localization) {
const EBPSpecies = $resource(ENDPOINT_URL + '/ebp-species')
return EBPSpecies
})
8 changes: 5 additions & 3 deletions client/views/ebp.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ <h1 class="page-header" translate>
</ul>
</div>

<div class="col-md-9">
content
</div>
<div ng-if="$ctrl.selected === 'organizations'" ng-include="'/views/ebp/organizations.html'" class="col-md-9"></div>
<div ng-if="$ctrl.selected === 'sources'" ng-include="'/views/ebp/sources.html'" class="col-md-9"></div>
<div ng-if="$ctrl.selected === 'protocol'" ng-include="'/views/ebp/protocol.html'" class="col-md-9"></div>
<div ng-if="$ctrl.selected === 'species'" ng-include="'/views/ebp/species.html'" class="col-md-9"></div>
<div ng-if="$ctrl.selected === 'species_status'" ng-include="'/views/ebp/species_status.html'" class="col-md-9"></div>
</div>

<div ng-if="!$user.isAdmin()" class="row">
Expand Down
1 change: 1 addition & 0 deletions client/views/ebp/organizations.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div>Organizations</div>
1 change: 1 addition & 0 deletions client/views/ebp/protocol.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div>Protocol</div>
1 change: 1 addition & 0 deletions client/views/ebp/sources.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div>Sources</div>
82 changes: 82 additions & 0 deletions client/views/ebp/species.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{{ $ctrl.species | json }}
<form name="editform"
role="form"
class="table-responsive"
confirm-on-exit="editform.$dirty"
confirm-message-window="{{'SPECIES_UNSAVED_DATA_TITLE' | translate}}"
confirm-message-route="{{'SPECIES_UNSAVED_DATA_MESSAGE' | translate}}">
<table class="table table-hover table-striped table-responsive">
<thead>
<tr>
<th>#</th>
<th>EBP species code</th>
<th>SB name la</th>
<th>EBP name</th>
<th class="btn-group btn-group-xs">
<button
type="button"
class="btn btn-info btn-xs"
title="{{'SPECIES_BUTTON_ADD' | translate}}"
ng-click="$ctrl.addSpecies()">
<i class="fa fa-plus fa-fw"></i>
</button>
<button ng-disabled="editform.$pristine"
type="button"
class="btn btn-success btn-xs"
title="{{'SPECIES_BUTTON_SAVE' | translate}}"
ng-click="$ctrl.saveSpecies()">
<i class="fa fa-check fa-fw"></i>
</button>
</th>
</tr>
</thead>
<tbody>
<tr class="hover" ng-repeat="item in $ctrl.visibleSpecies track by item.ebpId">
<td>{{$index+1+($ctrl.page-1)*$ctrl.pageSize}}</td>
<td>
<field type="text"
model="item.ebpId"
required></field>
</td>
<td>
<field type="text"
model="item.sbNameLa" required></field>
</td>
<td>
<field type="text"
model="item.ebpNameLa"></field>
</td>
<td>
<button type="button" class="btn btn-danger btn-xs visible-hover"
ng-click="$ctrl.removeSpecies($index)">
<i class="fa fa-remove fa-fw"></i>
</button>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>#</th>
<th>EBP species code</th>
<th>SB name la</th>
<th>EBP name</th>
<th class="btn-group btn-group-xs">
<button
type="button"
class="btn btn-info btn-xs"
title="{{'SPECIES_BUTTON_ADD' | translate}}"
ng-click="$ctrl.addSpecies()">
<i class="fa fa-plus fa-fw"></i>
</button>
<button ng-disabled="editform.$pristine"
type="button"
class="btn btn-success btn-xs"
title="{{'SPECIES_BUTTON_SAVE' | translate}}"
ng-click="$ctrl.saveSpecies()">
<i class="fa fa-check fa-fw"></i>
</button>
</th>
</tr>
</tfoot>
</table>
</form>
1 change: 1 addition & 0 deletions client/views/ebp/species_status.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div>Species status</div>

0 comments on commit ebbc6e1

Please sign in to comment.