Erweitert die Funktionalität in PredefinedActivities.vue um die Möglichkeit, eine Übungszeichnung zu erstellen. Fügt ein Zeichen-Tool hinzu, das die Zeichnungsdaten speichert und automatisch als Bild-Link verwendet, wenn kein Bild-Link vorhanden ist. Aktualisiert die Benutzeroberfläche zur Bild- und Zeichnungshinzufügung.
This commit is contained in:
1305
frontend/src/components/CourtDrawingTool.vue
Normal file
1305
frontend/src/components/CourtDrawingTool.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -56,7 +56,7 @@
|
||||
</label>
|
||||
<div class="image-section">
|
||||
<h4>Bild hinzufügen</h4>
|
||||
<p class="image-help">Du kannst entweder einen Link zu einem Bild eingeben oder ein Bild hochladen:</p>
|
||||
<p class="image-help">Du kannst entweder einen Link zu einem Bild eingeben, ein Bild hochladen oder eine Übungszeichnung erstellen:</p>
|
||||
|
||||
<label>Bild-Link (optional)
|
||||
<input type="text" v-model="editModel.imageLink" placeholder="z.B. https://example.com/bild.jpg oder /api/predefined-activities/:id/image/:imageId" />
|
||||
@@ -74,6 +74,16 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Zeichen-Tool -->
|
||||
<div class="drawing-section">
|
||||
<h5>Übungszeichnung erstellen</h5>
|
||||
<CourtDrawingTool
|
||||
v-model="editModel.drawingData"
|
||||
@save="onDrawingSave"
|
||||
@update-fields="onUpdateFields"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="image-list" v-if="images && images.length">
|
||||
<h5>Hochgeladene Bilder:</h5>
|
||||
<div class="image-grid">
|
||||
@@ -97,9 +107,13 @@
|
||||
|
||||
<script>
|
||||
import apiClient from '../apiClient.js';
|
||||
import CourtDrawingTool from '../components/CourtDrawingTool.vue';
|
||||
|
||||
export default {
|
||||
name: 'PredefinedActivities',
|
||||
components: {
|
||||
CourtDrawingTool
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activities: [],
|
||||
@@ -164,6 +178,7 @@ export default {
|
||||
duration: null,
|
||||
durationText: '',
|
||||
imageLink: '',
|
||||
drawingData: '',
|
||||
};
|
||||
},
|
||||
cancel() {
|
||||
@@ -220,6 +235,22 @@ export default {
|
||||
if (!confirm('Alle Aktivitäten mit identischem Namen werden zusammengeführt. Fortfahren?')) return;
|
||||
await apiClient.post('/predefined-activities/deduplicate', {});
|
||||
await this.reload();
|
||||
},
|
||||
onDrawingSave(drawingData) {
|
||||
if (this.editModel) {
|
||||
this.editModel.drawingData = drawingData;
|
||||
// Automatisch als Bild-Link setzen, wenn es eine Zeichnung gibt
|
||||
if (drawingData && !this.editModel.imageLink) {
|
||||
this.editModel.imageLink = drawingData;
|
||||
}
|
||||
}
|
||||
},
|
||||
onUpdateFields(fields) {
|
||||
if (this.editModel) {
|
||||
this.editModel.code = fields.code;
|
||||
this.editModel.name = fields.name;
|
||||
this.editModel.description = fields.description;
|
||||
}
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
@@ -354,5 +385,19 @@ input[type="text"], input[type="number"], textarea { width: 100%; }
|
||||
.btn-danger:hover {
|
||||
background: #c82333;
|
||||
}
|
||||
|
||||
.drawing-section {
|
||||
margin: 1rem 0;
|
||||
padding: 1rem;
|
||||
background: white;
|
||||
border-radius: var(--border-radius);
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.drawing-section h5 {
|
||||
margin: 0 0 1rem 0;
|
||||
color: #333;
|
||||
font-size: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user