Skip to content

Commit

Permalink
Add view_household.peb view - needs more work
Browse files Browse the repository at this point in the history
  • Loading branch information
zikani03 committed Jul 28, 2022
1 parent 955a3e4 commit 9c2a590
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

import org.cga.sctp.beneficiaries.BeneficiaryService;
import org.cga.sctp.beneficiaries.Household;
import org.cga.sctp.beneficiaries.HouseholdMember;
import org.cga.sctp.beneficiaries.Individual;
import org.cga.sctp.location.Location;
import org.cga.sctp.location.LocationService;
import org.cga.sctp.mis.core.SecuredBaseController;
Expand All @@ -42,12 +44,14 @@
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.websocket.server.PathParam;
import java.util.List;
import java.util.Objects;

import static java.util.Collections.emptyList;

Expand Down Expand Up @@ -76,7 +80,14 @@ public ModelAndView viewHouseholds(@RequestParam(value = "district", required =

@GetMapping("/households/view/{household-id}")
@AdminAndStandardAccessOnly
public ModelAndView viewHouseholdId(@PathParam("household-id") Long householdId) {
return view("case-management/view_household");
public ModelAndView viewHouseholdId(@PathVariable("household-id") Long householdId) {
Household household = beneficiaryService.findHouseholdById(householdId);
if (Objects.isNull(household)) {
return redirect("/case-management/households");
}
List<Individual> members = beneficiaryService.getHouseholdMembers(householdId);
return view("case-management/view_household")
.addObject("household", household)
.addObject("members", members);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{% extends "./base" %}
{% block contextMenu %}
{% set canModify = hasRole("ADMINISTRATOR") and isSessionOpen %}
{% set useWideContainer = true %}
<div class="context-nav-container">
<div class="level">
<div class="level-right">
<a href="/case-management/households" class="button is-success">Back to List</a>
</div>
</div>
</div>
{% endblock %}

{% block content %}
<div class="card no-overlap">
<header class="card-header">
<p class="card-header-title">Households in {{ district.districtName }}</p>
</header>
<div class="card-content">
{{ showMessages(successMessage, infoMessage, dangerMessage, warningMessage) }}
<div class="content">
<table class="table dataTable is-narrow is-striped is-hoverable">
<tr>
<th>ML Code</th>
<td>ML-{{ household.mlCode }}</td>
</tr>
<tr>
<th># of Members</th>
<td>{{ household.memberCount | numberformat("#,###") }}</td>
</tr>
<tr>
<th>Head of Household</th>
<td>{{ household.householdHead }}</td>
</tr>
<tr>
<th>TA</th>
<td>{{ household.taName }}</td>
</tr>
<tr>
<th>GVH Name</th>
<td>{{ household.villageHeadName }}</td>
</tr>
<tr>
<th>VG Cluster</th>
<td>{{ household.clusterName }}</td>
</tr>
<tr>
<th>Zone</th>
<td>{{ household.zoneName }}</td>
</tr>
<tr>
<th>Pre-Printed Num</th>
<td>{{ household.formNumber }}</td>
</tr>
<tr>
<th>Status</th>
<td>{{ household.status }}</td>
</tr>
</table>
</div>
</div>
<div class="card no-overlap">
<div class="card-header">
<div class="card-header-title">Members</div>
</div>
<div class="card-content">
</div>
</div>
<div class="card no-overlap">
<div class="card-header">
<div class="card-header-title">Household Characteristics</div>
</div>
<div class="card-content">

</div>
</div>
</div>
{% endblock %}

0 comments on commit 9c2a590

Please sign in to comment.