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