Skip to content
Snippets Groups Projects
Commit 68219179 authored by Dasan Ibrahim's avatar Dasan Ibrahim
Browse files

Löschen Button hinzugefügt.

parent c2bbb593
No related branches found
No related tags found
1 merge request!4merge dev to main
...@@ -4,6 +4,9 @@ import ( ...@@ -4,6 +4,9 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"errors" "errors"
"os"
"path/filepath"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/org-harmony/harmony/src/app/template" "github.com/org-harmony/harmony/src/app/template"
"github.com/org-harmony/harmony/src/app/user" "github.com/org-harmony/harmony/src/app/user"
...@@ -12,8 +15,6 @@ import ( ...@@ -12,8 +15,6 @@ import (
"github.com/org-harmony/harmony/src/core/trace" "github.com/org-harmony/harmony/src/core/trace"
"github.com/org-harmony/harmony/src/core/validation" "github.com/org-harmony/harmony/src/core/validation"
"github.com/org-harmony/harmony/src/core/web" "github.com/org-harmony/harmony/src/core/web"
"os"
"path/filepath"
) )
var ( var (
......
...@@ -28,17 +28,20 @@ ...@@ -28,17 +28,20 @@
class="btn btn-outline-primary"> class="btn btn-outline-primary">
✏️ Bearbeiten ✏️ Bearbeiten
</a> </a>
<!-- Delete button with custom confirmation modal -->
<button class="btn btn-outline-danger"
onclick="showDeleteConfirmation('{{ .Data.Project.Name }}', '{{ .Data.Project.ID.Hex }}')">
🗑️ Löschen
</button>
<!-- Dropdown toggle for additional actions --> <!-- Dropdown toggle for additional actions -->
<button class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" <button class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split"
data-bs-toggle="dropdown"> data-bs-toggle="dropdown">
<span class="visually-hidden">Toggle Dropdown</span> <span class="visually-hidden">Toggle Dropdown</span>
</button> </button>
<!-- Dropdown menu with export and delete options --> <!-- Dropdown menu with export options -->
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">📄 Export als JSON</a></li> <li><a class="dropdown-item" href="#">📄 Export als JSON</a></li>
<li><a class="dropdown-item" href="#">📄 Export als TXT</a></li> <li><a class="dropdown-item" href="#">📄 Export als TXT</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item text-danger" href="#">🗑️ Projekt löschen</a></li>
</ul> </ul>
</div> </div>
</div> </div>
...@@ -80,6 +83,55 @@ ...@@ -80,6 +83,55 @@
{{ end }} {{ end }}
</div> </div>
</div> </div>
<!-- Delete Confirmation Modal -->
<div class="modal fade" id="deleteConfirmModal" tabindex="-1" aria-labelledby="deleteConfirmModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="deleteConfirmModalLabel">Projekt löschen</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<p>Möchten Sie das Projekt <strong id="projectNameToDelete"></strong> wirklich löschen?</p>
<div class="alert alert-warning d-flex align-items-center" role="alert">
<div class="me-2">⚠️</div>
<div>
<strong>Achtung:</strong> Alle zugehörigen Anforderungen werden ebenfalls gelöscht!
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Abbrechen</button>
<button type="button" class="btn btn-danger" id="confirmDeleteBtn">Projekt löschen</button>
</div>
</div>
</div>
</div>
<script>
function showDeleteConfirmation(projectName, projectId) {
// Set project name in modal
document.getElementById('projectNameToDelete').textContent = '"' + projectName + '"';
// Set up confirm button
const confirmBtn = document.getElementById('confirmDeleteBtn');
confirmBtn.onclick = function() {
// Execute HTMX delete request
htmx.ajax('DELETE', '/project/' + projectId, {
target: 'body',
headers: {
'HX-Push-Url': '/projects'
}
});
// Close modal
bootstrap.Modal.getInstance(document.getElementById('deleteConfirmModal')).hide();
};
// Show modal
new bootstrap.Modal(document.getElementById('deleteConfirmModal')).show();
}
</script>
{{ end }} {{ end }}
<!-- General Tab Template: Detailed project information display --> <!-- General Tab Template: Detailed project information display -->
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment