2024-09-11 17:31:40 +00:00
|
|
|
package pages
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
|
"mhtml/h"
|
|
|
|
|
"mhtml/pages/base"
|
2024-09-11 21:08:35 +00:00
|
|
|
"mhtml/partials/patient"
|
2024-09-12 02:06:34 +00:00
|
|
|
"mhtml/partials/sheet"
|
2024-09-11 17:31:40 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func PatientsIndex(ctx *fiber.Ctx) *h.Page {
|
|
|
|
|
return h.NewPage(base.RootPage(
|
|
|
|
|
h.Div(
|
2024-09-11 18:09:55 +00:00
|
|
|
h.Class("flex flex-col p-4 w-full"),
|
2024-09-11 17:31:40 +00:00
|
|
|
h.Div(
|
2024-09-11 18:09:55 +00:00
|
|
|
h.Div(
|
|
|
|
|
h.Class("flex justify-between items-center"),
|
|
|
|
|
h.P("Manage Patients", h.Class("text-lg font-bold")),
|
2024-09-11 21:08:35 +00:00
|
|
|
patient.AddPatientButton(),
|
2024-09-11 18:09:55 +00:00
|
|
|
),
|
2024-09-12 02:06:34 +00:00
|
|
|
h.PartialWithTriggers(patient.List, "load", "patient-added from:body", "every 5s"),
|
|
|
|
|
h.If(
|
|
|
|
|
h.GetQueryParam(ctx, "adding") == "true",
|
|
|
|
|
h.View(patient.AddPatientSheetPartial, h.ReloadParams{
|
|
|
|
|
Triggers: h.CreateTriggers("load"),
|
|
|
|
|
Target: sheet.Id,
|
|
|
|
|
})),
|
2024-09-11 18:09:55 +00:00
|
|
|
),
|
2024-09-11 17:31:40 +00:00
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
}
|