package components import ( "fmt" "context" ) type NotificationService struct { ID uint Name string Type string // "email", "webhook", etc. IsEnabled bool Config map[string]string Description string EventTriggers []string PayloadTemplate string SecretKey string RetryPolicy string SuccessCount int FailureCount int } type SettingsData struct { NotificationServices []NotificationService ErrorMessage string SuccessMessage string } templ Settings(ctx context.Context, data SettingsData) { @LayoutWithContext("Application Settings", ctx) {

Application Settings

Configure global settings for your GoMFT instance.

if data.SuccessMessage != "" { } if data.ErrorMessage != "" { }

Notification Services

Add Notification Service

if len(data.NotificationServices) == 0 {

No notification services configured

Use the form above to add your first notification service.

} else {
    for _, service := range data.NotificationServices {
  • if service.Type == "email" {
    } else if service.Type == "webhook" {
    } else {
    }

    { service.Name }

    { service.Description }

    if service.IsEnabled { Active } else { Disabled } { service.Type } if len(service.EventTriggers) > 0 && service.Type == "webhook" { { fmt.Sprintf("%d triggers", len(service.EventTriggers)) } } if service.SuccessCount > 0 || service.FailureCount > 0 { { fmt.Sprintf("%d/%d", service.SuccessCount, service.SuccessCount + service.FailureCount) } }
    if service.Type == "webhook" {
    Events: if len(service.EventTriggers) == 0 { None } else { for i, trigger := range service.EventTriggers { if i > 0 { , } { trigger } } }
    Retry: if service.RetryPolicy == "" { Default } else { { service.RetryPolicy } }
    } else {

    Last sent: if service.SuccessCount > 0 { "Recently" } else { "Never" }

    }
  • }
}
} @toggleNotificationFields() } script toggleNotificationFields() { document.addEventListener('DOMContentLoaded', function() { const typeSelector = document.getElementById('notification_type'); const allFields = document.querySelectorAll('.notification-fields'); const commonFields = document.querySelectorAll('.common-fields'); typeSelector.addEventListener('change', function() { // Hide all fields first allFields.forEach(field => field.classList.add('hidden')); // Show/hide common fields based on selection const selectedType = this.value; if (selectedType) { // Show common fields (name, description) commonFields.forEach(field => field.classList.remove('hidden')); // Show the selected type's specific fields const fieldsToShow = document.getElementById(`${selectedType}_fields`); if (fieldsToShow) { fieldsToShow.classList.remove('hidden'); } } else { // Hide common fields if no type selected commonFields.forEach(field => field.classList.add('hidden')); } }); }); }