diff --git a/Sources/App/Views/Employees/EmployeeForm.swift b/Sources/App/Views/Employees/EmployeeForm.swift index 525a22f..a727710 100644 --- a/Sources/App/Views/Employees/EmployeeForm.swift +++ b/Sources/App/Views/Employees/EmployeeForm.swift @@ -46,6 +46,17 @@ struct EmployeeForm: HTML { button(.type(.submit), .class("btn-primary")) { buttonLabel } + if let employee { + Button.danger { + "Delete" + } + .attributes( + .hx.delete("/api/v1/employees/\(employee.id)"), + .hx.confirm("Are you sure you want to delete this employee?"), + .hx.target("#employee_\(employee.id)"), + .hx.swap(.outerHTML.transition(true).swap("1s")) + ) + } } } }