mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-09-08 15:41:20 +02:00
- Added sorting capabilities to file metadata lists, including SortBy and SortDir fields. - Integrated a toast notification system for user feedback on actions. - Updated templates and JavaScript for improved user interaction and responsiveness. - Refactored file metadata handlers to utilize new sorting features and ensure proper data flow. - Introduced new notification dialog components for better user confirmation on actions.
43 lines
2.2 KiB
Templ
43 lines
2.2 KiB
Templ
package dialog
|
|
|
|
import (
|
|
"fmt"
|
|
// "strconv" // No longer needed here
|
|
)
|
|
|
|
// NotificationDialog component for confirmation dialogs using Flowbite modal
|
|
templ NotificationDialog(id string, title string, message string, confirmClass string, confirmText string, action string, serviceID uint, serviceName string) {
|
|
<div id={ id } tabindex="-1" aria-hidden="true" class="hidden fixed top-0 right-0 left-0 z-50 justify-center items-center w-full md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
|
<!-- Backdrop -->
|
|
<div id={ fmt.Sprintf("%s-backdrop", id) } class="fixed inset-0 bg-gray-900/50 dark:bg-gray-900/80 backdrop-blur-sm"></div>
|
|
<!-- Modal content -->
|
|
<div class="relative p-4 w-full max-w-md max-h-full mx-auto">
|
|
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700">
|
|
<div class="p-6 text-center">
|
|
if action == "delete" {
|
|
<i class="fas fa-trash-alt text-red-400 text-3xl mb-4"></i>
|
|
} else {
|
|
<i class="fas fa-exclamation-triangle text-yellow-400 text-3xl mb-4"></i>
|
|
}
|
|
<h3 class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">{ message }</h3>
|
|
<button
|
|
type="button"
|
|
class={ confirmClass }
|
|
hx-delete={ fmt.Sprintf("/admin/settings/notifications/%d", serviceID) }
|
|
hx-target="body"
|
|
data-service-name={ serviceName }
|
|
data-service-id={ fmt.Sprint(serviceID) }
|
|
id={ fmt.Sprintf("delete-btn-%d", serviceID) }
|
|
onclick={ templ.ComponentScript{Call: fmt.Sprintf("triggerServiceDelete('%s', %d, '%s')", id, serviceID, serviceName)} }>
|
|
{ confirmText }
|
|
</button>
|
|
<button type="button" onclick={ templ.ComponentScript{Call: fmt.Sprintf("closeModal('%s')", id)} } class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:text-white dark:hover:bg-gray-600 dark:focus:ring-gray-600">
|
|
Cancel
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
// Scripts (triggerServiceDelete, closeModal, showModal) are now expected to be defined globally or in the calling template (e.g., list.templ). |