Combine organisation lists into one with badges for warnings
This commit is contained in:
parent
11d6785062
commit
ed8607fd35
2 changed files with 11 additions and 29 deletions
|
@ -6,12 +6,10 @@ use Try::Tiny;
|
|||
sub list {
|
||||
my $c = shift;
|
||||
|
||||
my $valid_orgs_rs = $c->schema->resultset('Organisation')->search({ pending => 0 });
|
||||
my $pending_orgs_rs = $c->schema->resultset('Organisation')->search({ pending => 1 });
|
||||
my $orgs_rs = $c->schema->resultset('Organisation');
|
||||
|
||||
$c->stash(
|
||||
valid_orgs_rs => $valid_orgs_rs,
|
||||
pending_orgs_rs => $pending_orgs_rs,
|
||||
orgs_rs => $orgs_rs,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,39 +15,23 @@
|
|||
<div class="col">
|
||||
<div class="card">
|
||||
<h3 class="card-header">
|
||||
Valid Organisations
|
||||
Organisations
|
||||
<a href="<%= url_for . '/add' %>" class="btn btn-success" style="float: right">Add Organisation</a>
|
||||
</h3>
|
||||
<div class="list-group list-group-flush">
|
||||
% for my $valid_org ($valid_orgs_rs->all) {
|
||||
<a href="<%= url_for . '/' . $valid_org->id %>" class="list-group-item list-group-item-action">
|
||||
% for my $org_result ($orgs_rs->all) {
|
||||
<a href="<%= url_for . '/' . $org_result->id %>" class="list-group-item list-group-item-action d-flex justify-content-between">
|
||||
<div>
|
||||
%= $valid_org->name
|
||||
%= $org_result->name
|
||||
</div>
|
||||
<div>
|
||||
% if ( $org_result->pending ) {
|
||||
<span class="badge badge-warning">Unvalidated</span>
|
||||
% }
|
||||
</div>
|
||||
</a>
|
||||
% }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<h3 class="card-header">
|
||||
Pending Organisations
|
||||
</h3>
|
||||
<div class="list-group list-group-flush">
|
||||
% if ( $pending_orgs_rs->count == 0 ) {
|
||||
<div class="list-group-item">
|
||||
No Pending Organisations!
|
||||
</div>
|
||||
% } else {
|
||||
% for my $pending_org ($pending_orgs_rs->all) {
|
||||
<a href="<%= url_for . '/' . $pending_org->id %>" class="list-group-item list-group-item-action">
|
||||
<div>
|
||||
%= $pending_org->name
|
||||
</div>
|
||||
</a>
|
||||
% }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Reference in a new issue