Order categories newest-first and uppercase menu category names.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -83,7 +83,7 @@ func (r repository) GetCategories(ctx context.Context) ([]users.CategoryDTO, err
|
||||
LEFT JOIN sub_categories sc ON sc.category_id = c.id AND sc.status = true
|
||||
WHERE c.status = true
|
||||
GROUP BY c.id
|
||||
ORDER BY c.created_at ASC;`
|
||||
ORDER BY c.created_at DESC;`
|
||||
|
||||
rows, err := r.client.Query(ctx, q)
|
||||
if err != nil {
|
||||
|
||||
@@ -148,10 +148,12 @@ async function fetchMenuItems() {
|
||||
})
|
||||
}
|
||||
|
||||
const categoryName = (menuItem.name[window.locale] || '').toUpperCase()
|
||||
|
||||
container.insertAdjacentHTML('beforeend', `
|
||||
<div class="dropdown" style="z-index:1000">
|
||||
<button class="dropbtn flex items-center">
|
||||
${menuItem.name[window.locale]}
|
||||
${categoryName}
|
||||
${
|
||||
subcategoriesTemplate !== ''
|
||||
? '<img class="w-4 h-4" src="/images/arrow-down.svg" alt="">'
|
||||
@@ -167,11 +169,11 @@ async function fetchMenuItems() {
|
||||
sideBarMenuItems.insertAdjacentHTML('beforeend', `
|
||||
${
|
||||
subcategoriesTemplate === ''
|
||||
? `<li><a>${menuItem.name[window.locale]}</a></li>`
|
||||
? `<li><a>${categoryName}</a></li>`
|
||||
: `
|
||||
<li>
|
||||
<details class="w-[250px]">
|
||||
<summary>${menuItem.name[window.locale]}</summary>
|
||||
<summary>${categoryName}</summary>
|
||||
<ul>
|
||||
${subcategoriesTemplate}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user