Diary fix
This commit is contained in:
@@ -8,8 +8,7 @@ class AccidentService {
|
||||
await checkAccess(userToken, clubId);
|
||||
const user = await getUserByToken(userToken);
|
||||
if (!user) {
|
||||
console.log('---------------');
|
||||
throw new Error('User not found');
|
||||
throw new Error('User not found');
|
||||
}
|
||||
const member = await Member.findByPk(memberId);
|
||||
if (!member || member.clubId != clubId) {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<div v-if="!showForm && date !== null && date !== 'new'">
|
||||
<h3>Trainingszeiten bearbeiten <span @click="toggleShowGeneralData" class="clickable">{{ showGeneralData ?
|
||||
'-' : '+' }}</span></h3>
|
||||
'-' : '+' }}</span></h3>
|
||||
<form @submit.prevent="updateTrainingTimes" v-if="showGeneralData">
|
||||
<div>
|
||||
<label for="editTrainingStart">Trainingsbeginn:</label>
|
||||
@@ -54,7 +54,7 @@
|
||||
<ul>
|
||||
<li v-for="group in groups" :key="group.id">
|
||||
<span v-if="editingGroupId !== group.id" @click="editGroup(group.id)">{{ group.name
|
||||
}}</span>
|
||||
}}</span>
|
||||
<input v-else type="text" v-model="group.name" @blur="saveGroup(group)"
|
||||
@keyup.enter="saveGroup(group)" @keyup.esc="cancelEditGroup"
|
||||
style="display: inline;width:10em" />
|
||||
@@ -88,6 +88,7 @@
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th> <!-- Neue Spalte für Drag-Handle -->
|
||||
<th>Startzeit</th>
|
||||
<th>Aktivität / Zeitblock</th>
|
||||
<th>Gruppe</th>
|
||||
@@ -98,6 +99,7 @@
|
||||
<tbody ref="sortableList">
|
||||
<template v-for="(item, index) in trainingPlan" :key="item.id">
|
||||
<tr>
|
||||
<td class="drag-handle" style="cursor: move;">☰</td> <!-- Drag-Handle -->
|
||||
<td>{{ item.startTime }}</td>
|
||||
<td>
|
||||
<span v-if="item.isTimeblock"><i>Zeitblock</i></span>
|
||||
@@ -105,12 +107,16 @@
|
||||
item.activity }}</span>
|
||||
</td>
|
||||
<td>{{ item.groupActivity ? item.groupActivity.name : '' }}</td>
|
||||
<td><span v-if="item.durationText">{{ item.durationText }} / </span>{{
|
||||
item.duration }}</td>
|
||||
<td>
|
||||
{{ item.duration }}<span
|
||||
v-if="item.durationText && item.durationText.trim() !== ''"> ({{
|
||||
item.durationText }})</span>
|
||||
</td>
|
||||
<td><button @click="removePlanItem(item.id)">Entfernen</button></td>
|
||||
</tr>
|
||||
<template v-for="groupItem in item.groupActivities">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>{{ groupItem.groupPredefinedActivity.name }}</td>
|
||||
<td>{{ groupItem.groupsGroupActivity.name }}</td>
|
||||
@@ -119,7 +125,9 @@
|
||||
</tr>
|
||||
</template>
|
||||
</template>
|
||||
<!-- Zeile zum Hinzufügen eines neuen Items -->
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>{{ calculateNextTime }}</td>
|
||||
<td colspan="4" v-if="!addNewItem && !addNewTimeblock && !addNewGroupActivity">
|
||||
<button @click="openNewPlanItem()">Gesamt-Aktivität</button>
|
||||
@@ -140,7 +148,7 @@
|
||||
</td>
|
||||
<td v-else-if="addNewItem || addNewTimeblock"></td>
|
||||
<td v-if="(addNewItem || addNewTimeblock) && !addNewGroupActivity">
|
||||
<input type="text" v-model="newPlanItem.durationInput"
|
||||
<input type="text" v-model="newPlanItem.durationText"
|
||||
@input="calculateDuration" placeholder="z.B. 2x7 oder 3*5"
|
||||
style="width:10em" />
|
||||
<input type="number" v-model="newPlanItem.duration" placeholder="Minuten" />
|
||||
@@ -154,7 +162,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<button v-if="trainingPlan && trainingPlan.length && trainingPlan.length > 0"
|
||||
@click="generatePDF">Als PDF herunterladen</button>
|
||||
@click="generatePDF">Als PDF
|
||||
herunterladen</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
@@ -181,9 +190,9 @@
|
||||
:checked="isParticipant(member.id)">
|
||||
<span class="clickable" @click="selectMember(member)"
|
||||
:class="{ highlighted: selectedMember && selectedMember.id === member.id }">{{
|
||||
member ? member.firstName : ''
|
||||
member ? member.firstName : ''
|
||||
}} {{
|
||||
member ? member.lastName : '' }}</span>
|
||||
member ? member.lastName : '' }}</span>
|
||||
<span v-if="false" @click="openNotesModal(member)" class="clickable">📝</span>
|
||||
<span @click="showPic(member)" class="img-icon" v-if="member.hasImage">🖼</span>
|
||||
<span class="pointer" @click="openTagInfos(member)">ℹ️</span>
|
||||
@@ -252,18 +261,21 @@
|
||||
<label for="memberId">Mitglied:</label>
|
||||
<select id="memberId" v-model="accident.memberId">
|
||||
<template v-for="member in members" :key="member.id" :value="member.id">
|
||||
<option v-if="participants.indexOf(member.id) >= 0" :value="member.id">{{ member.firstName + ' ' + member.lastName }}</option>
|
||||
<option v-if="participants.indexOf(member.id) >= 0" :value="member.id">{{ member.firstName + ' '
|
||||
+ member.lastName }}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="accident">Unfall:</label>
|
||||
<textarea id="accident" v-model="accident.accident" required ></textarea>
|
||||
<textarea id="accident" v-model="accident.accident" required></textarea>
|
||||
</div>
|
||||
<button type="button" @click="saveAccident">Eintragen</button>
|
||||
<button type="button" @click="closeAccidentForm">Schießen</button>
|
||||
<ul>
|
||||
<li v-for="accident in accidents" :key="accident.id">{{ accident.firstName + ' ' + accident.lastName + ': ' + accident.accident}}</li>
|
||||
<li v-for="accident in accidents" :key="accident.id">{{ accident.firstName + ' ' + accident.lastName +
|
||||
': '
|
||||
+ accident.accident}}</li>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
@@ -856,7 +868,7 @@ export default {
|
||||
return `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`;
|
||||
},
|
||||
calculateDuration() {
|
||||
const input = this.newPlanItem.durationInput;
|
||||
const input = this.newPlanItem.durationText;
|
||||
let calculatedDuration = 0;
|
||||
const multiplyPattern = /(\d+)\s*[x*]\s*(\d+)/i;
|
||||
const match = input.match(multiplyPattern);
|
||||
@@ -893,17 +905,17 @@ export default {
|
||||
alert('Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.');
|
||||
}
|
||||
},
|
||||
/* async loadMemberImage(member) {
|
||||
try {
|
||||
const response = await apiClient.get(`/clubmembers/image/${this.currentClub}/${member.id}`, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
const imageUrl = URL.createObjectURL(response.data);
|
||||
member.imageUrl = imageUrl;
|
||||
} catch (error) {
|
||||
member.imageUrl = null;
|
||||
}
|
||||
},*/
|
||||
/* async loadMemberImage(member) {
|
||||
try {
|
||||
const response = await apiClient.get(`/clubmembers/image/${this.currentClub}/${member.id}`, {
|
||||
responseType: 'blob',
|
||||
});
|
||||
const imageUrl = URL.createObjectURL(response.data);
|
||||
member.imageUrl = imageUrl;
|
||||
} catch (error) {
|
||||
member.imageUrl = null;
|
||||
}
|
||||
},*/
|
||||
async generatePDF() {
|
||||
const pdf = new PDFGenerator();
|
||||
pdf.addTrainingPlan(this.currentClubName, this.date.date, this.trainingStart, this.trainingEnd, this.trainingPlan);
|
||||
@@ -985,7 +997,7 @@ export default {
|
||||
this.showGeneralData = !this.showGeneralData;
|
||||
},
|
||||
getFormattedDate(date) {
|
||||
return (new Date(date)).toLocaleDateString('de-DE', { year: 'numeric', month: '2-digit', day: '2-digit'});
|
||||
return (new Date(date)).toLocaleDateString('de-DE', { year: 'numeric', month: '2-digit', day: '2-digit' });
|
||||
},
|
||||
editGroup(groupId) {
|
||||
this.editingGroupId = groupId;
|
||||
@@ -998,14 +1010,14 @@ export default {
|
||||
clubid: this.currentClub,
|
||||
dateid: this.date.id,
|
||||
});
|
||||
this.editingGroupId = null;
|
||||
this.editingGroupId = null;
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Speichern der Gruppendaten:', error);
|
||||
alert('Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.');
|
||||
}
|
||||
},
|
||||
cancelEditGroup() {
|
||||
this.editingGroupId = null;
|
||||
this.editingGroupId = null;
|
||||
},
|
||||
async openTagInfos(member) {
|
||||
if (!member) {
|
||||
@@ -1029,7 +1041,7 @@ export default {
|
||||
},
|
||||
async addNewTagForDay(tag) {
|
||||
await apiClient.post(`/diarydatetags/${this.currentClub}`, {
|
||||
dateId:this.date.id,
|
||||
dateId: this.date.id,
|
||||
memberId: this.tagHistoryMember.id,
|
||||
tag: tag,
|
||||
});
|
||||
@@ -1047,7 +1059,7 @@ export default {
|
||||
if (this.timeChecker) clearInterval(this.timeChecker);
|
||||
this.timeChecker = setInterval(() => {
|
||||
const currentTime = new Date().toLocaleTimeString('de-DE', { hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
||||
if (!this.trainingStart || ! this.trainingEnd) {
|
||||
if (!this.trainingStart || !this.trainingEnd) {
|
||||
return;
|
||||
}
|
||||
let startCheckTime = this.trainingStart;
|
||||
@@ -1100,12 +1112,12 @@ export default {
|
||||
let times = [];
|
||||
let currentTime = new Date("2025-01-01 " + this.trainingStart);
|
||||
this.trainingPlan.forEach(item => {
|
||||
const rawItem = JSON.parse(JSON.stringify(item));
|
||||
const rawItem = JSON.parse(JSON.stringify(item));
|
||||
currentTime.setMinutes(currentTime.getMinutes() + item.duration);
|
||||
times.push(currentTime.toTimeString({ hours: '2-digit', minutes: '2-digit', seconds: '2-digit' }).slice(0, 8));
|
||||
});
|
||||
times = [...new Set(times)].sort();
|
||||
this.intermediateTimes = times.filter(time =>
|
||||
this.intermediateTimes = times.filter(time =>
|
||||
time !== this.trainingStart && time !== this.trainingEnd
|
||||
);
|
||||
},
|
||||
@@ -1188,7 +1200,8 @@ h3 {
|
||||
.column:first-child {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
height: 100%;justify-self: start;
|
||||
height: 100%;
|
||||
justify-self: start;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user