Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add population UI #72

Merged
merged 1 commit into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions frontend/app-dashboard/css/side-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,18 @@ form label {
}

.box-count-left {
padding: 0 5px 5px 15px;
width: 180px;
padding: 0 2px 5px 5px;
width: 33%;
}

.box-count-right {
padding: 0 15px 5px 5px;
width: 170px;
padding: 0 5px 5px 2px;
width: 33%;
}

.box-count-middle {
padding: 0 2px 5px 2px;
width: 33%;
}

#building-count, #vulnerability-score, .score, #road-count, #vulnerability-score-road{
Expand Down
37 changes: 32 additions & 5 deletions frontend/app-dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,13 @@
<div id="chart-score-panel">
<div class="col-lg-12 panel-title panel-sub-title" style="border-bottom: none !important; padding: 0 0 10px 0">
<div class="col-lg-6 tab-active tab-title" tab-target="building">
<i class="fa fa-building-o" aria-hidden="true"></i> Buildings
<i class="fa fa-building-o" aria-hidden="true"></i><span class="tab-name"> Buildings</span>
</div>
<div class="col-lg-6 tab-title" style="border-left: 1px solid #ddd" tab-target="road">
<i class="fa fa-road" aria-hidden="true"></i> Roads
<div class="col-lg-3 tab-title" style="border-left: 1px solid #ddd" tab-target="road">
<i class="fa fa-road" aria-hidden="true"></i><span class="tab-name" style="display: none"> Roads</span>
</div>
<div class="col-lg-3 tab-title" style="border-left: 1px solid #ddd" tab-target="population">
<i class="fa fa-users" aria-hidden="true"></i><span class="tab-name" style="display: none"> Population</span>
</div>
</div>
<div class="tab-wrapper tab-building">
Expand Down Expand Up @@ -488,6 +491,24 @@
<canvas id="summary-chart-road" style="height: 350px"></canvas>
</div>
</div>
<div class="tab-wrapper tab-population" style="display: none">
<div class="col-lg-12">
<div class="col-lg-5 box-vulnerability">
<div id="vulnerability-score-population">-</div>
<div class="subtext">Vulnerability Score Total</div>
</div>
<div class="col-lg-5 box-building">
<div id="population-count">-</div>
<div class="subtext">Potentially affected population</div>
</div>
</div>
<div class="col-lg-12 panel-chart-population-residential" style="min-height: 250px">
<canvas id="summary-chart-population-residential" style="height: 50px"></canvas>
</div>
<div class="col-lg-12 panel-chart-population" style="min-height: 350px">
<canvas id="summary-chart-population" style="height: 350px"></canvas>
</div>
</div>
</div>
<div id="region-summary-panel" style="border-top: 1px solid #ddd; padding-bottom: 35px">
</div>
Expand All @@ -501,7 +522,7 @@

<script type="text/template" id="region-summary-panel-template">
<tr>
<td class="text-center item-header" colspan="2">
<td class="text-center item-header" colspan="3">
<button class="btn btn-arrow pull-right drilldown trigger-status-<%= trigger_status %>" data-region="<%= region %>" data-region-id="<%= id %>" data-region-trigger-status="<%= trigger_status %>"><i class="fa fa-chevron-circle-right" aria-hidden="true"></i></button>
<%= name %>
</td>
Expand All @@ -513,12 +534,18 @@
<div class="subtext">Potentially affected buildings</div>
</div>
</td>
<td class="box-count-right">
<td class="box-count-middle">
<div class="box-count" data-road-region-id="<%= id %>">
<div class="score"><%= flooded_road_count %></div>
<div class="subtext">Potentially affected roads</div>
</div>
</td>
<td class="box-count-right">
<div class="box-count">
<div class="score"><%= flooded_population_count %></div>
<div class="subtext">Potentially affected population</div>
</div>
</td>
</tr>
</script>

Expand Down
20 changes: 20 additions & 0 deletions frontend/app-dashboard/js/model/population_district_summary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
define([
'backbone',
'moment'
], function (Backbone) {

const PopulationDistrictSummary = Backbone.Model.extend({
urlRoot: postgresUrl + 'mv_flood_event_population_district_summary',
url: function () {
return `${this.urlRoot}?id=eq.${this.id}`
}
});

return Backbone.Collection.extend({
model: PopulationDistrictSummary,
urlRoot: postgresUrl + 'mv_flood_event_population_district_summary',
url: function () {
return this.urlRoot;
}
});
});
20 changes: 20 additions & 0 deletions frontend/app-dashboard/js/model/population_sub_district_summary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
define([
'backbone',
'moment'
], function (Backbone) {

const PopulationSubDistrictSummary = Backbone.Model.extend({
urlRoot: postgresUrl + 'mv_flood_event_population_sub_district_summary',
url: function () {
return `${this.urlRoot}?id=eq.${this.id}`
}
});

return Backbone.Collection.extend({
model: PopulationSubDistrictSummary,
urlRoot: postgresUrl + 'mv_flood_event_population_sub_district_summary',
url: function () {
return this.urlRoot;
}
});
});
20 changes: 20 additions & 0 deletions frontend/app-dashboard/js/model/population_village_summary.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
define([
'backbone',
'moment'
], function (Backbone) {

const PopulationVillageSummary = Backbone.Model.extend({
urlRoot: postgresUrl + 'mv_flood_event_population_village_summary',
url: function () {
return `${this.urlRoot}?id=eq.${this.id}`
}
});

return Backbone.Collection.extend({
model: PopulationVillageSummary,
urlRoot: postgresUrl + 'mv_flood_event_population_village_summary',
url: function () {
return this.urlRoot;
}
});
});
Loading