Improved age display in service page.

This commit is contained in:
Christian P. MOMON 2021-03-01 04:42:59 +01:00
parent a957413bc2
commit 85ea317bfe
4 changed files with 22 additions and 2 deletions

View file

@ -21,6 +21,7 @@ package fr.devinsy.statoolinfos.core;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -121,6 +122,24 @@ public class Service extends PathPropertyList
super(properties);
}
/**
* Gets the age.
*
* @return the age
*/
public String getAge()
{
String result;
LocalDate startDate = StatoolInfosUtils.parseDate(getStartDate());
LocalDate endDate = StatoolInfosUtils.parseDate(getEndDate());
result = StatoolInfosUtils.toHumanDuration(startDate, endDate);
//
return result;
}
/**
* Gets the contact email.
*

View file

@ -123,6 +123,7 @@ public class ServicePage
data.setContent("serviceStartDate", StringUtils.defaultIfBlank(service.getStartDate(), "n/a"));
data.setContent("serviceEndDate", StringUtils.defaultIfBlank(service.getEndDate(), "n/a"));
data.setContent("serviceAge", StringUtils.defaultIfBlank(service.getAge(), "n/a"));
if (StringUtils.isBlank(service.getEndDate()))
{
data.setAttribute("serviceEndDateData", "style", "display: none;");

View file

@ -22,7 +22,7 @@
</div>
<p id="organizationDescription" class="center_table" style="width: 500px;">Description absente…</p>
</div>
<div><span id="organizationStartDateWord">Depuis</span> <span id="organizationStartDate">n/a</span><span id="organizationEndDateData"> Date d'arrêt : <span id="organizationEndDate">n/a</span></span> (<span id="organizationAge">n/a</span>)</div>
<div><span id="organizationStartDateWord">Depuis</span> <span id="organizationStartDate">n/a</span><span id="organizationEndDateData"> <span id="organizationEndDate">n/a</span></span> (<span id="organizationAge">n/a</span>)</div>
<div>Membre <span id="organizationMemberOfName">n/a</span> <span id="organizationMemberOfWord">depuis/:</span> <span id="organizationMemberStartDate">n/a</span><span id="organizationMemberEndDateData"> <span id="organizationMemberEndDate">n/a</span></span> (<span id="organizationMemberAge">n/a</span>)</div>
<div class="content_infos" style="margin: 5px;">
Liens :

View file

@ -23,7 +23,7 @@
<p id="serviceDescription" class="center_table" style="width: 500px;">Description absente…</p>
</div>
<div><span id="serviceStartDateWord">Depuis</span> <span id="serviceStartDate">n/a</span><span id="serviceEndDateData"> <span id="serviceEndDate">n/a</span></span>&#160;&#160;&#160;Statut : <img id="serviceStatusImg" src="status-void.png" style="width: 25px; vertical-align: bottom;" /></div>
<div><span id="serviceStartDateWord">Depuis</span> <span id="serviceStartDate">n/a</span><span id="serviceEndDateData"> <span id="serviceEndDate">n/a</span></span> (<span id="serviceAge">n/a</span>)&#160;&#160;&#160;Statut : <img id="serviceStatusImg" src="status-void.png" style="width: 25px; vertical-align: bottom;" /></div>
<div class="content_infos" style="border: 0px solid blue; border-radius: 8px; margin: 5px;">
Inscription :
<img id="registrationNoneImg" src="circle-icons/global-mono.svg" class="disabled" title="Sans compte"/>