Add order in tables

This commit is contained in:
William Bouzourène 2025-01-02 14:39:19 +01:00
parent f12e14a85d
commit fefd742da3
Signed by: bouzoure
SSH key fingerprint: SHA256:19MbXpLua4rUtk8tunMesD8KUKb91LXLHg8E/qTooww
2 changed files with 5 additions and 5 deletions

View file

@ -17,7 +17,7 @@ func Lists(c *fiber.Ctx) error {
}
var lists []models.List
result := db.Find(&lists)
result := db.Order("name collate nocase asc").Find(&lists)
if result.Error != nil && !errors.Is(result.Error, gorm.ErrRecordNotFound) {
return err
@ -54,7 +54,7 @@ func ListShow(c *fiber.Ctx) error {
)
var listItems []models.ListItem
db.Find(&listItems, "list_id = ?", id)
db.Order("value collate nocase asc").Find(&listItems, "list_id = ?", id)
return c.Render("list", fiber.Map{
"PageTitle": title,

View file

@ -18,7 +18,7 @@ func Sections(c *fiber.Ctx) error {
}
var sections []models.Section
result := db.Preload("ParentSection").Find(&sections)
result := db.Order("name collate nocase asc").Preload("ParentSection").Find(&sections)
if result.Error != nil && !errors.Is(result.Error, gorm.ErrRecordNotFound) {
return err
@ -117,7 +117,7 @@ func SectionAdd(c *fiber.Ctx) error {
}
var sections []models.Section
db.Find(&sections)
db.Order("name collate nocase asc").Find(&sections)
return c.Render("section_form", fiber.Map{
"PageTitle": "Ajouter une section",
@ -200,7 +200,7 @@ func SectionEdit(c *fiber.Ctx) error {
}
var sections []models.Section
db.Find(&sections, "id <> ?", section.ID)
db.Order("name collate nocase asc").Find(&sections, "id <> ?", section.ID)
return c.Render("section_form", fiber.Map{
"PageTitle": title,