Order columns in people list

This commit is contained in:
William Bouzourène 2025-07-11 11:56:47 +02:00
parent 9dda517b03
commit 56a2d30189
Signed by: bouzoure
SSH key fingerprint: SHA256:19MbXpLua4rUtk8tunMesD8KUKb91LXLHg8E/qTooww
4 changed files with 171 additions and 22 deletions

View file

@ -68,6 +68,9 @@ func Contacts(c *fiber.Ctx) error {
params.PageSize = 50
params.PersonType = "contacts"
params.OrderColumn = c.Query("c")
params.OrderDirection = c.Query("o")
var sections []models.Section
db.Order("name asc").Find(&sections, "contains_contacts = ? AND id IN ?", true, allowedSections)
params.AllowedSections = allowedSections
@ -100,6 +103,8 @@ func Contacts(c *fiber.Ctx) error {
"SearchJSON": searchJSON,
"Sections": sections,
"Fields": fields,
"OrderCol": params.OrderColumn,
"OrderDir": params.OrderDirection,
})
}