r1753 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer wao-web/src/main/resources/i18n wao-web/src/main/webapp/WEB-INF/content/obsmer
Author: tchemit Date: 2014-03-25 19:39:11 +0100 (Tue, 25 Mar 2014) New Revision: 1753 Url: http://forge.codelutin.com/projects/wao/repository/revisions/1753 Log: refs-40 #4483 (continue ui) Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java =================================================================== --- trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java 2014-03-25 17:50:13 UTC (rev 1752) +++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java 2014-03-25 18:39:11 UTC (rev 1753) @@ -67,9 +67,6 @@ protected Set<String> orderByArguments; - //FIXME Remove this - protected boolean estimatedTides; - public ObsProgram getObsProgram() { return obsProgram; } @@ -174,14 +171,6 @@ this.orderByArguments = orderByArguments; } - public boolean isEstimatedTides() { - return estimatedTides; - } - - public void setEstimatedTides(boolean estimatedTides) { - this.estimatedTides = estimatedTides; - } - public Set<String> getSampleRowIds() { return sampleRowIds; } Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java =================================================================== --- trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-25 17:50:13 UTC (rev 1752) +++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java 2014-03-25 18:39:11 UTC (rev 1753) @@ -81,6 +81,14 @@ return ordinals; } + protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/yyyy"); + + public static boolean isCurrentMonth(Date month) { + String currentStr = dateFormat.format(new Date()); + String monthStr = dateFormat.format(month); + return currentStr.equals(monthStr); + } + /** * Wrapper on {@link org.apache.commons.collections4.CollectionUtils#isEqualCollection(java.util.Collection, java.util.Collection)} * that handles null values. Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java =================================================================== --- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-25 17:50:13 UTC (rev 1752) +++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-25 18:39:11 UTC (rev 1753) @@ -21,13 +21,13 @@ * #L% */ +import fr.ifremer.wao.WaoUtils; import fr.ifremer.wao.entity.FishingZone; import fr.ifremer.wao.entity.SampleMonth; import fr.ifremer.wao.entity.SampleRow; import java.io.Serializable; import java.text.NumberFormat; -import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Date; @@ -42,7 +42,7 @@ /** * All facades of the sampling plan. */ - protected List<ObsMerSamplingPlanFacadePart> facades; + protected Collection<ObsMerSamplingPlanFacadePart> facades; /** * Statistics over the plan by month. @@ -93,7 +93,7 @@ protected SampleRowsFilterValues filterValues; public ObsMerSamplingPlan(List<Date> months, - List<ObsMerSamplingPlanFacadePart> facadeParts, + Collection<ObsMerSamplingPlanFacadePart> facadeParts, Map<Date, ObsMerSamplingPlanStatistics> statisticsMap, Integer highTotalExpected, Integer highTotalReal, @@ -228,7 +228,6 @@ public Iterator<ObsMerSamplingPlanSectorPart> iterator() { return sectors.iterator(); } - } /** @@ -258,7 +257,7 @@ } } - protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/yyyy"); +// protected static final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/yyyy"); /** * Created on 3/24/14. @@ -372,21 +371,15 @@ public boolean hasNbTidesReal(Date month) { Date current = new Date(); - boolean validMonth = month.before(current) || isCurrentMonth(month); + boolean validMonth = month.before(current) || WaoUtils.isCurrentMonth(month); return validMonth && getNbTidesReal(month) != null; } public boolean hasNbTidesEstimated(Date month) { Date current = new Date(); - boolean validMonth = month.before(current) || isCurrentMonth(month); + boolean validMonth = month.before(current) || WaoUtils.isCurrentMonth(month); return validMonth && getNbTidesEstimated(month) != null; } - - public boolean isCurrentMonth(Date month) { - String currentStr = dateFormat.format(new Date()); - String monthStr = dateFormat.format(month); - return currentStr.equals(monthStr); - } } public static class ObsMerSamplingPlanStatistics implements Serializable { Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java =================================================================== --- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-25 17:50:13 UTC (rev 1752) +++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-25 18:39:11 UTC (rev 1753) @@ -21,6 +21,8 @@ * #L% */ +import com.google.common.base.Function; +import com.google.common.collect.Ordering; import fr.ifremer.wao.SampleRowsFilter; import fr.ifremer.wao.entity.SampleRow; import org.apache.commons.lang3.mutable.MutableDouble; @@ -28,9 +30,9 @@ import org.apache.commons.lang3.mutable.MutableLong; import org.nuiton.util.PeriodDates; +import java.util.ArrayList; +import java.util.Collection; import java.util.Date; -import java.util.LinkedHashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -64,7 +66,7 @@ /** * Dictionnary of facades indexed by their facade name. */ - protected LinkedHashMap<String, FacadeContext> facadeMap; + protected Map<String, FacadeContext> facadeMap; /** * To compute the high total expected. @@ -132,7 +134,7 @@ public ObsMerSamplingPlanBuilder(SampleRowsFilter sampleRowsFilter) { this.sampleRowsFilter = sampleRowsFilter; this.sampleRowsFilterValues = new SampleRowsFilterValues(); - this.facadeMap = new LinkedHashMap<>(); + this.facadeMap = new TreeMap<>(); this.highTotalExpected = new MutableInt(); this.highTotalReal = new MutableInt(); this.highTotalEstimated = new MutableInt(); @@ -190,18 +192,27 @@ public ObsMerSamplingPlan toPlan() { - LinkedList<ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart> facadeParts = new LinkedList<>(); + // Get facade parts + Collection<ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart> facadeParts = new ArrayList<>(); for (FacadeContext facadeContext : facadeMap.values()) { ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart facadePart = facadeContext.toBean(); facadeParts.add(facadePart); } - TreeMap<Date, ObsMerSamplingPlan.ObsMerSamplingPlanStatistics> statisticsMap = new TreeMap<>(); + // Sort them + Collection<ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart> sortedFacades = Ordering.natural().onResultOf(new Function<ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart, String>() { + public String apply(ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart input) { + return input.getFacade(); + } + }).immutableSortedCopy(facadeParts); + + // Get statistics + Map<Date, ObsMerSamplingPlan.ObsMerSamplingPlanStatistics> statisticsMap = new TreeMap<>(); for (Date month : months) { MutableInt totalExpected = totalExpectedForMonths.get(month); MutableInt totalReal = totalRealForMonths.get(month); - MutableInt totalEstimated= totalEstimatedForMonths.get(month); + MutableInt totalEstimated = totalEstimatedForMonths.get(month); ObsMerSamplingPlan.ObsMerSamplingPlanStatistics planStatistics = new ObsMerSamplingPlan.ObsMerSamplingPlanStatistics(totalExpected == null ? null : totalExpected.toInteger(), totalReal == null ? null : totalReal.toInteger(), @@ -210,7 +221,7 @@ } ObsMerSamplingPlan result = new ObsMerSamplingPlan(months, - facadeParts, + sortedFacades, statisticsMap, highTotalExpected.toInteger(), highTotalReal.toInteger(), @@ -242,7 +253,7 @@ if (estimated != null) { - MutableInt total = totalEstimatedForMonths.get(month); + MutableInt total = totalEstimatedForMonths.get(month); if (total == null) { total = new MutableInt(); totalEstimatedForMonths.put(month, total); @@ -267,11 +278,11 @@ protected String facade; - protected LinkedHashMap<String, ServiceContext> sectorMap; + protected Map<String, ServiceContext> sectorMap; protected FacadeContext(String facade) { this.facade = facade; - this.sectorMap = new LinkedHashMap<>(); + this.sectorMap = new TreeMap<>(); } protected ServiceContext getOrAddSectorContext(String sectors) { @@ -287,13 +298,20 @@ protected ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart toBean() { - LinkedList<ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart> sectorParts = new LinkedList<>(); + // get sector parts + Collection<ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart> sectorParts = new ArrayList<>(); for (ServiceContext serviceContext : sectorMap.values()) { ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart sectorPart = serviceContext.toBean(); sectorParts.add(sectorPart); } + // sort them + Collection<ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart> sortedSectors = Ordering.natural().onResultOf(new Function<ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart, String>() { + public String apply(ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart input) { + return input.getSectors(); + } + }).immutableSortedCopy(sectorParts); ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart result = - new ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart(facade, sectorParts); + new ObsMerSamplingPlan.ObsMerSamplingPlanFacadePart(facade, sortedSectors); return result; } } @@ -302,11 +320,11 @@ protected String sectors; - protected LinkedList<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart> rows; + protected Collection<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart> rows; protected ServiceContext(String sectors) { this.sectors = sectors; - rows = new LinkedList<>(); + rows = new ArrayList<>(); } protected ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart addSampleRow(SampleRow row, @@ -326,8 +344,13 @@ protected ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart toBean() { + Collection<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart> sortedRows = Ordering.natural().onResultOf(new Function<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart, String>() { + public String apply(ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart input) { + return input.getSampleRow().getCode(); + } + }).immutableSortedCopy(rows); ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart result = - new ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart(sectors, rows); + new ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart(sectors, sortedRows); return result; } } Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java =================================================================== --- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-25 17:50:13 UTC (rev 1752) +++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-25 18:39:11 UTC (rev 1753) @@ -28,12 +28,15 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Maps; import com.google.common.collect.Sets; +import fr.ifremer.wao.ContactsFilter; import fr.ifremer.wao.SampleRowsFilter; import fr.ifremer.wao.WaoTechnicalException; import fr.ifremer.wao.entity.Boat; import fr.ifremer.wao.entity.Boats; import fr.ifremer.wao.entity.Company; import fr.ifremer.wao.entity.CompanyTopiaDao; +import fr.ifremer.wao.entity.Contact; +import fr.ifremer.wao.entity.ContactState; import fr.ifremer.wao.entity.DCF5Code; import fr.ifremer.wao.entity.ElligibleBoat; import fr.ifremer.wao.entity.ElligibleBoatImpl; @@ -64,6 +67,7 @@ import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.time.DateUtils; +import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.csv.Export; @@ -79,6 +83,7 @@ import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; +import java.util.Collection; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashSet; @@ -373,10 +378,10 @@ List<SampleRow> sampleRows = dao.findAll(sampleRowsFilter); ObsMerSamplingPlanBuilder builder = new ObsMerSamplingPlanBuilder(sampleRowsFilter); for (SampleRow sampleRow : sampleRows) { - //TODO Compute see ServiceSamplingImpl#executeGetObservationTimesInDays - Double observationTimesInDaysExpected = 0d; - Long observationTimesInDaysReal = 0l; - Long observationTimesInDaysEstimated = 0l; + Double observationTimesInDaysExpected = getObservationTimesInDayExpected(sampleRow); + Pair<Long, Long> realAndEstimated = getObservationTimesInDayRealAndEstimated(sampleRowsFilter, sampleRow); + Long observationTimesInDaysReal = realAndEstimated.getLeft(); + Long observationTimesInDaysEstimated = realAndEstimated.getRight(); builder.addSampleRow(sampleRow, observationTimesInDaysExpected, observationTimesInDaysReal, @@ -562,4 +567,70 @@ } + protected double getObservationTimesInDayExpected(SampleRow sampleRow) { + double expected; + + // On prend le nombre d'observation prévue pour cette ligne du plan + // c'est à dire la somme des nombres d'observations prévues pour + // chaque mois. + int expectedObservationCount = 0; + for (SampleMonth sampleMonth : sampleRow.getSampleMonth()) { + expectedObservationCount += sampleMonth.getExpectedTidesValue(); + } + // le prévisionnel est égal au nombre d'observations attendues × + // le nombre de jours moyen d'une observation + expected = expectedObservationCount * sampleRow.getAverageTideTime(); + return expected; + } + + protected Pair<Long, Long> getObservationTimesInDayRealAndEstimated(SampleRowsFilter sampleRowFilter, + SampleRow sampleRow) { + + // D'abord, on a besoin de récupérer toutes les observations réalisées + // pour cette ligne du plan + + ContactsFilter contactFilter = new ContactsFilter(); + + sampleRowFilter.setSampleRowIds(ImmutableSet.of(sampleRow.getTopiaId())); + contactFilter.setFilterOnObservationBeginDate(true); + contactFilter.setPeriodFrom(sampleRowFilter.getPeriodFrom()); + contactFilter.setPeriodTo(sampleRowFilter.getPeriodTo()); + + contactFilter.setSampleRowFilter(sampleRowFilter); + contactFilter.setContactStates(ImmutableSet.of(ContactState.OBSERVATION_DONE)); + // on exclue les contacts qui sont invalidés par le programme + contactFilter.setProgramAcceptations(Sets.newHashSet(true, null)); + // on exclue les contacts invalidés par la société + contactFilter.setCompanyAcceptations(Sets.newHashSet(true, null)); + + Collection<Contact> contacts = getContactDao().findAll(contactFilter); + + final double minutesPerDay = 24 * 60; + // Pour calculer le temps passé, on prend pour chaque observation + // le temps qui a vraiment été passé en mer. + + // temps de mer réalisé par ligne du plan = somme [arrondi-supérieur (nb d'heures total de la marée/ 24)] + long real = 0; + long estimated = 0; + for (Contact contact : contacts) { + double actualInMinutes = DateUtil.getDifferenceInMinutes( + contact.getObservationBeginDate(), + contact.getObservationEndDate()); + Boolean validationCompany = contact.getValidationCompany(); + + double contactInDays = Math.ceil(actualInMinutes / minutesPerDay); + + if (validationCompany != null) { + // real observation + real += contactInDays; + } + // estimated observation + estimated += contactInDays; + } + + sampleRowFilter.setSampleRowIds(null); + + return Pair.of(real, estimated); + } + } Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java =================================================================== --- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-25 17:50:13 UTC (rev 1752) +++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-25 18:39:11 UTC (rev 1753) @@ -17,6 +17,8 @@ */ public class SampleRowsFilterValues implements Serializable { + private static final long serialVersionUID = 1L; + protected Set<String> fishingZoneFacadeNames = new HashSet<>(); protected Set<String> fishingZoneSectorNames = new HashSet<>(); Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java =================================================================== --- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-25 17:50:13 UTC (rev 1752) +++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-25 18:39:11 UTC (rev 1753) @@ -29,10 +29,12 @@ public class SamplingPlanAction extends WaoJspActionSupport implements Preparable { - protected ObsMerSamplingPlanService service; + private static final long serialVersionUID = 1L; - protected SampleRowsFilter filter; + protected transient ObsMerSamplingPlanService service; + protected transient SampleRowsFilter filter; + protected ObsMerSamplingPlan samplingPlan; public void setService(ObsMerSamplingPlanService service) { Modified: trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties =================================================================== --- trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-25 17:50:13 UTC (rev 1752) +++ trunk/wao-web/src/main/resources/i18n/wao-web_en_GB.properties 2014-03-25 18:39:11 UTC (rev 1753) @@ -329,6 +329,7 @@ wao.ui.misc.companies=Companies wao.ui.misc.createdOnF=Created on wao.ui.misc.creating=Creating... +wao.ui.misc.day=d. wao.ui.misc.dayOfWeek=Day wao.ui.misc.export=Export wao.ui.misc.export.longTitle=CSV export @@ -355,6 +356,7 @@ wao.ui.misc.refused=Refused wao.ui.misc.since=since wao.ui.misc.total=Total +wao.ui.misc.totals=Totals wao.ui.misc.undefined=Undefined wao.ui.misc.validated=Validated wao.ui.misc.week=Week Modified: trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties =================================================================== --- trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-25 17:50:13 UTC (rev 1752) +++ trunk/wao-web/src/main/resources/i18n/wao-web_fr_FR.properties 2014-03-25 18:39:11 UTC (rev 1753) @@ -329,6 +329,7 @@ wao.ui.misc.companies=Sociétés wao.ui.misc.createdOnF=Créée le wao.ui.misc.creating=En cours de création +wao.ui.misc.day=j. wao.ui.misc.dayOfWeek=Jour wao.ui.misc.export=Export wao.ui.misc.export.longTitle=Export CSV @@ -355,6 +356,7 @@ wao.ui.misc.refused=Réfusé wao.ui.misc.since=depuis le wao.ui.misc.total=Total +wao.ui.misc.totals=Totaux wao.ui.misc.undefined=Non-défini wao.ui.misc.validated=Validé wao.ui.misc.week=Semaine Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp =================================================================== --- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 17:50:13 UTC (rev 1752) +++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-25 18:39:11 UTC (rev 1753) @@ -27,6 +27,12 @@ <title> <s:text name="wao.ui.page.SamplingPlan.title" /> </title> + + <style> + .currentMonth{ + background-color: yellow; + } + </style> </head> <h1> @@ -137,19 +143,19 @@ <td><s:text name="wao.ui.field.SampleRow.code"/></td> <td><s:text name="wao.ui.samplingPlan.program"/></td> <s:if test="fullView"> - <td><s:text name="wao.ui.entity.Company"/></td> + <td class="only-visible-fullview"><s:text name="wao.ui.entity.Company"/></td> </s:if> <td><s:text name="wao.ui.entity.FishingZone"/></td> <s:if test="fullView"> - <td><s:text name="wao.ui.samplingPlan.fishingZoneInfo"/></td> - <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dCF5Code"/></td> - <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.meshSize"/></td> - <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.size"/></td> - <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.other"/></td> - <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.libelle"/></td> - <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.species"/></td> - <td><s:text name="wao.ui.field.SampleRow.periodBegin"/></td> - <td><s:text name="wao.ui.field.SampleRow.periodEnd"/></td> + <td class="only-visible-fullview"><s:text name="wao.ui.samplingPlan.fishingZoneInfo"/></td> + <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dCF5Code"/></td> + <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.meshSize"/></td> + <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.size"/></td> + <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.other"/></td> + <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.libelle"/></td> + <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.species"/></td> + <td class="only-visible-fullview"><s:text name="wao.ui.field.SampleRow.periodBegin"/></td> + <td class="only-visible-fullview"><s:text name="wao.ui.field.SampleRow.periodEnd"/></td> </s:if> <s:else> <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dCF5Code"/></td> @@ -158,7 +164,7 @@ <!-- Months columns --> <s:iterator value="samplingPlan.months" var="month"> - <td><s:property value="%{formatMonth(#month)}"/></td> + <td<s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> class="current-month"</s:if>><s:property value="%{formatMonth(#month)}"/></td> </s:iterator> <td><s:text name="wao.ui.misc.total"/></td> <!-- Other columns --> @@ -175,55 +181,45 @@ </thead> <tbody> - <s:if test="fullView"> - </s:if> - <s:else> - </s:else> - <%--Iterate on Facades--%> <s:iterator value="samplingPlan" var="samplingPlanFacade"> <tr> - <td colspan="${nbColumnsTotal}">FACADE <s:property value="%{#samplingPlanFacade.facade}"/></td> + <td colspan="${nbColumnsTotal}" class="facade"><s:property value="%{#samplingPlanFacade.facade}"/></td> </tr> <%--Iterate on Sectors --%> <s:iterator value="samplingPlanFacade" var="samplingPlanSector"> <tr> - <td colspan="${nbColumnsTotal}">SECTOR <s:property value="%{#samplingPlanSector.sectors}"/></td> + <td colspan="${nbColumnsTotal}" class="sector"><s:property value="%{#samplingPlanSector.sectors}"/></td> </tr> <%--Iterate on SampleRows --%> <s:iterator value="samplingPlanSector" var="samplingPlanRow"> <s:set var="sampleRow" value="%{#samplingPlanRow.sampleRow}"/> <tr<s:if test="sampleRowToHighlightId.equals(#sampleRow.topiaId)"> class="highlight"</s:if>> <th> - <s:url action="edit-sample-row!input" id="changePeriodUrl"> - <s:param name="sampleRowId" value="sampleRow.topiaId" /> - </s:url> - <s:a class="btn" href="%{changePeriodUrl}" title="Changer les dates de la période par rapport à celles de la ligne"> - <s:property value="#sampleRow.code" /> - </s:a> + <s:property value="#sampleRow.code" /> </th> <td><s:property value="#sampleRow.programName" /></td> <s:if test="fullView"> - <td>CompanyName</td> - <td><s:property value="#samplingPlanRow.fishingZones" /></td> - <td><s:property value="#sampleRow.fishingZonesInfos" /></td> - <td> + <td class="only-visible-fullview"><s:property value="#sampleRow.company.name" /></td> + <td class="only-visible-fullview"><s:property value="#samplingPlanRow.fishingZones" /></td> + <td class="only-visible-fullview"><s:property value="#sampleRow.fishingZonesInfos" /></td> + <td class="only-visible-fullview"> <s:iterator value="sampleRow.dcf5code" var="dcf5code"> <span> <s:property /> </span> </s:iterator> </td> - <td><s:property value="#sampleRow.profession.meshSize" /></td> - <td><s:property value="#sampleRow.profession.size" /></td> - <td><s:property value="#sampleRow.profession.other" /></td> - <td><s:property value="#sampleRow.profession.libelle" /></td> - <td><s:property value="#sampleRow.profession.species" /></td> - <td><s:property value="%{formatMonth(#sampleRow.periodBegin)}" /></td> - <td><s:property value="%{formatMonth(#sampleRow.periodEnd)}" /></td> + <td class="only-visible-fullview"><s:property value="#sampleRow.profession.meshSize" /></td> + <td class="only-visible-fullview"><s:property value="#sampleRow.profession.size" /></td> + <td class="only-visible-fullview"><s:property value="#sampleRow.profession.other" /></td> + <td class="only-visible-fullview"><s:property value="#sampleRow.profession.libelle" /></td> + <td class="only-visible-fullview"><s:property value="#sampleRow.profession.species" /></td> + <td class="only-visible-fullview"><s:property value="%{formatMonth(#sampleRow.periodBegin)}" /></td> + <td class="only-visible-fullview"><s:property value="%{formatMonth(#sampleRow.periodEnd)}" /></td> </s:if> <s:else> - <td>FishingZones</td> + <td><s:property value="#samplingPlanRow.fishingZones" /></td> <td> <s:iterator value="sampleRow.dcf5code" var="dcf5code"> <span> @@ -235,14 +231,12 @@ </s:else> <!-- Months columns --> <s:iterator value="samplingPlan.months" var="month"> - <td> + <td<s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> class="current-month"</s:if>> <s:property value="%{#samplingPlanRow.getNbTidesExpected(#month)}"/> - <s:if test="displayTidesReal"> - <span> - <em>(<s:property value="%{#samplingPlanRow.getNbTidesReal(#month)}"/>) - </em> - </span> - </s:if> + <span class="display-tides-real"> + <em>(<s:property value="%{#samplingPlanRow.getNbTidesReal(#month)}"/>) + </em> + </span> </td> </s:iterator> <td> @@ -256,9 +250,9 @@ </span> </td> <td> - <s:property value="#samplingPlanRow.observationTimesInDaysExpected" /> j. + <s:property value="#samplingPlanRow.observationTimesInDaysExpected" /> <s:text name="wao.ui.misc.day"/> <span> - <em>(<s:property value="#samplingPlanRow.observationTimesInDaysReal" /> j.)</em> + <em>(<s:property value="#samplingPlanRow.observationTimesInDaysReal" /> <s:text name="wao.ui.misc.day"/>)</em> </span> </td> <td><s:property value="#sampleRow.averageTideTime" /></td> @@ -342,7 +336,36 @@ </todby> <tfoot> - + <td colspan="${nbColumnsForProfession}"> + <s:text name="wao.ui.misc.totals" /> + </td> + <!-- Months columns --> + <s:iterator value="samplingPlan.months" var="month"> + <td<s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> class="current-month"</s:if>> + <s:property value="samplingPlan.getTotalExpectedForMonth(#month)"/> + <span class="display-tides-real"> + <span> + <em>(<s:property value="samplingPlan.getTotalRealForMonth(#month)"/>)</em> + </span> + <br/> + <s:property value="samplingPlan.getRatioForMonth(#month)"/> + </span> + </td> + </s:iterator> + <td> + <s:property value="#samplingPlan.highTotalExpected" /> + <s:if test="!authenticatedWaoUser.guest"> + <em>(<s:property value="samplingPlan.highTotalReal" />)</em> + <strong><s:property value="samplingPlan.highTotalRatio" /></strong> + </s:if> + </td> + <td> + <s:property value="samplingPlan.observationTimesInDaysTotalExpected" /> <s:text name="wao.ui.misc.day"/> + <span> + <em>(<s:property value="samplingPlan.observationTimesInDaysTotalReal"/> <s:text name="wao.ui.misc.day"/>)</em> + </span> + </td> + <td colspan="${nbColumnsForOther}"> </td> </tfoot> </table>
participants (1)
-
tchemit@users.forge.codelutin.com