fixed functionality
This commit is contained in:
@ -7,6 +7,7 @@ import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import de.jottyfan.timetrack.db.done.tables.records.TDoneRecord;
|
||||
@ -31,7 +32,7 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
|
||||
private TProjectRecord project;
|
||||
private TModuleRecord module;
|
||||
private TJobRecord activity;
|
||||
private String wp;
|
||||
private WpBean wp;
|
||||
|
||||
public DoneBean() {
|
||||
}
|
||||
@ -44,14 +45,24 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
|
||||
this.project = projectMap.get(r.getFkProject());
|
||||
this.module = moduleMap.get(r.getFkModule());
|
||||
this.activity = jobMap.get(r.getFkJob());
|
||||
this.wp = r.getWp();
|
||||
List<WpBean> list = DoneGateway.getAllWps();
|
||||
String key = r.getWp();
|
||||
if (key != null && key.isBlank()) {
|
||||
key = null;
|
||||
}
|
||||
if (key != null) {
|
||||
for (WpBean bean : list) {
|
||||
if (bean.getKey().equals(r.getWp())) {
|
||||
this.wp = bean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* set the day of timeFrom and timeUntil, keeping the times
|
||||
*
|
||||
* @param day
|
||||
* the day
|
||||
* @param day the day
|
||||
*/
|
||||
public void setDay(Date day) {
|
||||
if (timeFrom != null) {
|
||||
@ -96,7 +107,8 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
|
||||
* get local date time from s
|
||||
*
|
||||
* @param s the HH:mm formatted values
|
||||
* @param ldt the date as basic for that datetime, for today one can use LocalDateTime.now(); in fact this is set if ldt is null internally
|
||||
* @param ldt the date as basic for that datetime, for today one can use
|
||||
* LocalDateTime.now(); in fact this is set if ldt is null internally
|
||||
* @return the generated datetime
|
||||
*/
|
||||
public LocalDateTime getLocalDateTimeFromHHmm(String s, LocalDateTime ldt) {
|
||||
@ -124,8 +136,8 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
|
||||
public String getProjectNameWithWP() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append(project == null ? "" : project.getName());
|
||||
if (wp != null && !wp.isBlank()) {
|
||||
buf.append(" (").append(wp).append(")");
|
||||
if (wp != null) {
|
||||
buf.append(" (").append(wp.getKey()).append(")");
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
@ -142,6 +154,10 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
|
||||
return activity == null ? "" : activity.getName();
|
||||
}
|
||||
|
||||
public String getWpName() {
|
||||
return wp == null ? "" : wp.getName();
|
||||
}
|
||||
|
||||
public String getTimeFromString() {
|
||||
return timeFrom == null ? "" : timeFrom.format(hhmm);
|
||||
}
|
||||
@ -209,14 +225,14 @@ public class DoneBean implements Bean, Serializable, Comparable<DoneBean> {
|
||||
/**
|
||||
* @return the wp
|
||||
*/
|
||||
public String getWp() {
|
||||
public WpBean getWp() {
|
||||
return wp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wp the wp to set
|
||||
*/
|
||||
public void setWp(String wp) {
|
||||
public void setWp(WpBean wp) {
|
||||
this.wp = wp;
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ import static de.jottyfan.timetrack.db.done.Tables.V_TOTALOFDAY;
|
||||
import static de.jottyfan.timetrack.db.done.Tables.V_WORKTIME;
|
||||
import static de.jottyfan.timetrack.db.profile.Tables.T_LOGIN;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
@ -151,8 +153,7 @@ public class DoneGateway extends JooqGateway {
|
||||
/**
|
||||
* get all from t_done of the given day
|
||||
*
|
||||
* @param day
|
||||
* the day; if null, the current date is used
|
||||
* @param day the day; if null, the current date is used
|
||||
*
|
||||
* @return a list of found times, an empty one at least
|
||||
* @throws SQLException
|
||||
@ -202,6 +203,7 @@ public class DoneGateway extends JooqGateway {
|
||||
Integer fkProject = bean.getProject() == null ? null : bean.getProject().getPk();
|
||||
Integer fkModule = bean.getModule() == null ? null : bean.getModule().getPk();
|
||||
Integer fkJob = bean.getActivity() == null ? null : bean.getActivity().getPk();
|
||||
String wp = bean.getWp() == null ? null : bean.getWp().getKey();
|
||||
Integer fkLogin = getFkLogin();
|
||||
|
||||
try (CloseableDSLContext jooq = getJooq()) {
|
||||
@ -215,7 +217,7 @@ public class DoneGateway extends JooqGateway {
|
||||
T_DONE.FK_JOB,
|
||||
T_DONE.WP,
|
||||
T_DONE.FK_LOGIN)
|
||||
.values(bean.getTimeFrom(), bean.getTimeUntil(), fkProject, fkModule, fkJob, bean.getWp(), fkLogin);
|
||||
.values(bean.getTimeFrom(), bean.getTimeUntil(), fkProject, fkModule, fkJob, wp, fkLogin);
|
||||
// @formatter:on
|
||||
LOGGER.debug(sql.toString());
|
||||
sql.execute();
|
||||
@ -231,6 +233,7 @@ public class DoneGateway extends JooqGateway {
|
||||
*/
|
||||
public void update(DoneBean bean) throws DataAccessException, ClassNotFoundException, SQLException {
|
||||
try (CloseableDSLContext jooq = getJooq()) {
|
||||
String wp = bean.getWp() == null ? null : bean.getWp().getKey();
|
||||
UpdateConditionStep<TDoneRecord> sql = jooq
|
||||
// @formatter:off
|
||||
.update(T_DONE)
|
||||
@ -239,7 +242,7 @@ public class DoneGateway extends JooqGateway {
|
||||
.set(T_DONE.FK_PROJECT, bean.getProject() == null ? null : bean.getProject().getPk())
|
||||
.set(T_DONE.FK_JOB, bean.getActivity() == null ? null : bean.getActivity().getPk())
|
||||
.set(T_DONE.FK_MODULE, bean.getModule() == null ? null : bean.getModule().getPk())
|
||||
.set(T_DONE.WP, bean.getWp())
|
||||
.set(T_DONE.WP, wp)
|
||||
.where(T_DONE.PK.eq(bean.getPk()));
|
||||
// @formatter:on
|
||||
LOGGER.debug(sql.toString());
|
||||
@ -265,14 +268,14 @@ public class DoneGateway extends JooqGateway {
|
||||
/**
|
||||
* get day summary
|
||||
*
|
||||
* @param day
|
||||
* the day
|
||||
* @param day the day
|
||||
* @return the day summary if found, an empty map otherwise
|
||||
* @throws SQLException
|
||||
* @throws ClassNotFoundException
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
public WholeDaySummaryBean getDaySummary(java.util.Date day) throws DataAccessException, ClassNotFoundException, SQLException {
|
||||
public WholeDaySummaryBean getDaySummary(java.util.Date day)
|
||||
throws DataAccessException, ClassNotFoundException, SQLException {
|
||||
try (CloseableDSLContext jooq = getJooq()) {
|
||||
SelectConditionStep<Record4<String, String, String, String>> sql = jooq
|
||||
// @formatter:off
|
||||
@ -300,14 +303,14 @@ public class DoneGateway extends JooqGateway {
|
||||
/**
|
||||
* get all jobs of day
|
||||
*
|
||||
* @param day
|
||||
* the day
|
||||
* @param day the day
|
||||
* @return list of found jobs; an empty list at least
|
||||
* @throws SQLException
|
||||
* @throws ClassNotFoundException
|
||||
* @throws DataAccessException
|
||||
*/
|
||||
public List<DailySummaryBean> getAllJobs(java.util.Date day) throws DataAccessException, ClassNotFoundException, SQLException {
|
||||
public List<DailySummaryBean> getAllJobs(java.util.Date day)
|
||||
throws DataAccessException, ClassNotFoundException, SQLException {
|
||||
try (CloseableDSLContext jooq = getJooq()) {
|
||||
SelectConditionStep<Record6<String, Double, String, String, String, String>> sql = jooq
|
||||
// @formatter:off
|
||||
@ -330,6 +333,7 @@ public class DoneGateway extends JooqGateway {
|
||||
String moduleName = r.get(V_WORKTIME.MODULE_NAME);
|
||||
String jobName = r.get(V_WORKTIME.JOB_NAME);
|
||||
String wp = r.get(V_WORKTIME.WP);
|
||||
durationHours = durationHours == null ? null : new BigDecimal(durationHours).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
list.add(new DailySummaryBean(projectName, moduleName, jobName, duration, wp, durationHours));
|
||||
}
|
||||
return list;
|
||||
@ -380,7 +384,8 @@ public class DoneGateway extends JooqGateway {
|
||||
buf.append(": ");
|
||||
buf.append(jobName);
|
||||
|
||||
FullCalendarEventBean bean = new FullCalendarEventBean(buf.toString(), java.util.Date.from(timeFrom.atZone(ZoneId.systemDefault()).toInstant())) {
|
||||
FullCalendarEventBean bean = new FullCalendarEventBean(buf.toString(),
|
||||
java.util.Date.from(timeFrom.atZone(ZoneId.systemDefault()).toInstant())) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
@ -434,7 +439,8 @@ public class DoneGateway extends JooqGateway {
|
||||
// @formatter:on
|
||||
LOGGER.debug(sql.toString());
|
||||
String sep = ";";
|
||||
buf.append("day").append(sep).append("duration").append(sep).append("project").append(sep).append("module").append(sep).append("activity\n");
|
||||
buf.append("day").append(sep).append("duration").append(sep).append("project").append(sep).append("module")
|
||||
.append(sep).append("activity\n");
|
||||
for (Record r : sql.fetch()) {
|
||||
LocalDate workday = r.get(V_HAMSTERSUMMARY.WORKDAY);
|
||||
String date = workday.format(DateTimeFormatter.ofPattern("dd.MM.yyyy"));
|
||||
@ -447,4 +453,18 @@ public class DoneGateway extends JooqGateway {
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* dummy method to use until a table has been created
|
||||
*
|
||||
* @return all valid wps
|
||||
*/
|
||||
public static final List<WpBean> getAllWps() {
|
||||
List<WpBean> list = new ArrayList<>();
|
||||
list.add(new WpBean("WP2", "WP2 (eucs) - Opal/Mica/..., REST"));
|
||||
list.add(new WpBean("WP4", "WP4 (eucs) - Square²"));
|
||||
list.add(new WpBean("WP5", "WP5 (eucs) - SHIP-Datenbereitstellung"));
|
||||
list.add(new WpBean("NFDI TA3", "TA3 (nfdi) - Mica Dev"));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ public class DoneModel implements Model, Serializable {
|
||||
private List<TProjectRecord> projects;
|
||||
private List<TModuleRecord> modules;
|
||||
private List<TJobRecord> activities;
|
||||
private List<WpBean> wps;
|
||||
private List<TimeBean> times;
|
||||
private List<DailySummaryBean> allJobs;
|
||||
private WholeDaySummaryBean daySummary;
|
||||
@ -57,6 +58,7 @@ public class DoneModel implements Model, Serializable {
|
||||
modules = gw.getAllModules();
|
||||
activities = gw.getAllActivities();
|
||||
projects = gw.getAllProjects();
|
||||
wps = DoneGateway.getAllWps();
|
||||
daySummary = gw.getDaySummary(day);
|
||||
allJobs = gw.getAllJobs(day);
|
||||
calendarEvents = gw.getAllCalendarEvents();
|
||||
@ -244,6 +246,10 @@ public class DoneModel implements Model, Serializable {
|
||||
return activities;
|
||||
}
|
||||
|
||||
public List<WpBean> getWps() {
|
||||
return wps;
|
||||
}
|
||||
|
||||
public List<DailySummaryBean> getAllJobs() {
|
||||
return allJobs;
|
||||
}
|
||||
|
34
src/main/java/de/jottyfan/timetrack/modules/done/WpBean.java
Normal file
34
src/main/java/de/jottyfan/timetrack/modules/done/WpBean.java
Normal file
@ -0,0 +1,34 @@
|
||||
package de.jottyfan.timetrack.modules.done;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
public class WpBean implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final String name;
|
||||
private final String key;
|
||||
|
||||
public WpBean(String key, String name) {
|
||||
super();
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the key
|
||||
*/
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
}
|
@ -45,7 +45,7 @@
|
||||
<h:outputText value="Projekt" />
|
||||
<h:outputText value="Modul" />
|
||||
<h:outputText value="Tätigkeit" />
|
||||
<h:outputText value="euCanShare WP" />
|
||||
<h:outputText value="Abrechnung" />
|
||||
<b:selectOneMenu id="project" value="#{doneModel.bean.project}">
|
||||
<f:selectItem itemValue="" itemLabel="--- bitte wählen ---" />
|
||||
<f:selectItems value="#{doneModel.projects}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
|
||||
@ -59,10 +59,8 @@
|
||||
<f:selectItems value="#{doneModel.activities}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
|
||||
</b:selectOneMenu>
|
||||
<b:selectOneMenu id="wp" value="#{doneModel.bean.wp}">
|
||||
<f:selectItem itemValue="" itemLabel="---" />
|
||||
<f:selectItem itemValue="WP2" itemLabel="WP2 - Opal/Mica/..., REST" />
|
||||
<f:selectItem itemValue="WP4" itemLabel="WP4 - Square²" />
|
||||
<f:selectItem itemValue="WP5" itemLabel="WP5 - SHIP-Datenbereitstellung" />
|
||||
<f:selectItem itemValue="" itemLabel="--- bitte wählen ---" />
|
||||
<f:selectItems value="#{doneModel.wps}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
|
||||
</b:selectOneMenu>
|
||||
</b:panelGrid>
|
||||
<b:buttonGroup>
|
||||
|
@ -45,7 +45,7 @@
|
||||
<h:outputText value="Projekt (#{doneModel.bean.projectName})" />
|
||||
<h:outputText value="Modul (#{doneModel.bean.moduleName})" />
|
||||
<h:outputText value="Tätigkeit (#{doneModel.bean.jobName})" />
|
||||
<h:outputText value="euCanSHare WP" />
|
||||
<h:outputText value="Abrechnung (#{doneModel.bean.wpName})" />
|
||||
<b:selectOneMenu id="project" value="#{doneModel.bean.project}">
|
||||
<f:selectItem itemValue="" itemLabel="--- bitte wählen ---" />
|
||||
<f:selectItems value="#{doneModel.projects}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
|
||||
@ -59,10 +59,8 @@
|
||||
<f:selectItems value="#{doneModel.activities}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
|
||||
</b:selectOneMenu>
|
||||
<b:selectOneMenu id="wp" value="#{doneModel.bean.wp}">
|
||||
<f:selectItem itemValue="" itemLabel="---" />
|
||||
<f:selectItem itemValue="WP2" itemLabel="WP2 - Opal/Mica/..., REST" />
|
||||
<f:selectItem itemValue="WP4" itemLabel="WP4 - Square²" />
|
||||
<f:selectItem itemValue="WP5" itemLabel="WP5 - SHIP-Datenbereitstellung" />
|
||||
<f:selectItem itemValue="" itemLabel="--- bitte wählen ---" />
|
||||
<f:selectItems value="#{doneModel.wps}" var="i" itemValue="#{i}" itemLabel="#{i.name}" />
|
||||
</b:selectOneMenu>
|
||||
</b:panelGrid>
|
||||
<b:buttonGroup>
|
||||
|
@ -79,7 +79,7 @@
|
||||
</b:dataTableColumn>
|
||||
<b:dataTableColumn label="" value="#{col.moduleName}" contentStyle="font-size: 120%" orderable="false" />
|
||||
<b:dataTableColumn label="" value="#{col.jobName}" contentStyle="font-size: 120%" orderable="false" />
|
||||
<b:dataTableColumn label="" value="#{col.duration} = #{col.durationHours} h" contentStyle="font-size: 120%" orderable="false" />
|
||||
<b:dataTableColumn label="" value="#{col.durationHours} h" contentStyle="font-size: 120%" orderable="false" />
|
||||
</b:dataTable>
|
||||
</b:tab>
|
||||
<b:tab title="Anhang">
|
||||
@ -92,6 +92,27 @@
|
||||
defaultDate="#{doneModel.dayIso8601}" defaultView="agendaDay" hidden="xs" scrollTime="08:00:00"
|
||||
slotDuration="00:15:00" span="half" allDaySlot="false" lang="de" />
|
||||
</b:tab>
|
||||
<b:tab title="Projekt">
|
||||
<ui:repeat value="#{doneModel.projects}" var="col">
|
||||
<b:badge value="#{col.name}" class="prompt" />
|
||||
</ui:repeat>
|
||||
</b:tab>
|
||||
<b:tab title="Modul">
|
||||
<ui:repeat value="#{doneModel.modules}" var="col">
|
||||
<b:badge value="#{col.name}" class="prompt" />
|
||||
</ui:repeat>
|
||||
</b:tab>
|
||||
<b:tab title="Tätigkeit">
|
||||
<ui:repeat value="#{doneModel.activities}" var="col">
|
||||
<b:badge value="#{col.name}" class="prompt" />
|
||||
</ui:repeat>
|
||||
</b:tab>
|
||||
<b:tab title="Abrechnung">
|
||||
<b:dataTable value="#{doneModel.wps}" var="col" border="false" info="false">
|
||||
<b:dataTableColumn label="Schlüssel" value="#{col.key}" />
|
||||
<b:dataTableColumn label="Name" value="#{col.name}" />
|
||||
</b:dataTable>
|
||||
</b:tab>
|
||||
</b:tabView>
|
||||
</b:form>
|
||||
</b:panel>
|
||||
|
@ -7,7 +7,7 @@
|
||||
.page {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-image: linear-gradient(to bottom, #fff 0%, #ccc 20%)
|
||||
background-image: linear-gradient(to bottom, #ffffff 10%, #afffff 40%)
|
||||
!important;
|
||||
}
|
||||
|
||||
@ -68,6 +68,14 @@
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.prompt {
|
||||
margin: 4px;
|
||||
padding: 4px !important;
|
||||
padding-bottom: 2px !important;
|
||||
font-size: medium !important;
|
||||
background-color: #005782 !important;
|
||||
}
|
||||
|
||||
.version {
|
||||
font-size: small;
|
||||
color: silver;
|
||||
|
Reference in New Issue
Block a user