merge and news and notif

This commit is contained in:
Parsa Nazer
2025-05-24 22:02:42 +03:30
6 changed files with 56 additions and 57 deletions
+19 -10
View File
@@ -4,10 +4,12 @@
type OptionChildren = {
id: number | string;
name: string;
slug: string;
};
type Option = {
name: string;
slug: string;
children: OptionChildren[];
};
@@ -39,7 +41,7 @@ watch(
() => value.value,
(newValue) => {
if (!!newValue) {
emit("update:modelValue", newValue.id);
emit("update:modelValue", newValue.slug);
}
}
);
@@ -94,22 +96,29 @@ watch(
/>
<ComboboxLabel
class="flex items-center justify-between px-[1.2rem] w-full max-lg:text-sm text-black bg-slate-200/50 leading-[25px] py-2 lg:py-3 rounded-lg"
class="flex items-center justify-between px-[1.2rem] w-full max-lg:text-sm text-black bg-slate-200/50 leading-[25px] py-2 lg:py-4 rounded-lg"
>
<span>
{{ group.name }}
</span>
<Icon
name="ci:delivery-boxes"
class="text-lg"
/>
<ComboboxItem
:value="group"
class="w-full text-sm cursor-pointer leading-none text-slate-700 rounded-md flex items-center relative select-none data-[disabled]:text-slate-50 data-[disabled]:pointer-events-none"
>
<div class="w-full flex items-center justify-between gap-2 max-lg:text-xs">
<span>
{{ group.name }}
</span>
<Icon
name="ci:delivery-boxes"
class="text-lg"
/>
</div>
</ComboboxItem>
</ComboboxLabel>
<ComboboxItem
v-for="option in group.children"
:key="option.name"
:value="option"
class="text-sm cursor-pointer leading-none text-slate-700 my-1.5 rounded-md hover:bg-slate-200/25 flex items-center py-2.5 px-[1.2rem] relative select-none data-[disabled]:text-slate-50 data-[disabled]:pointer-events-none"
class="text-sm cursor-pointer leading-none text-slate-700 my-1.5 rounded-md hover:bg-slate-200/25 flex items-center py-3 px-[1.2rem] relative select-none data-[disabled]:text-slate-50 data-[disabled]:pointer-events-none"
>
<ComboboxItemIndicator
class="absolute left-3 w-[25px] inline-flex items-center justify-center"
@@ -63,10 +63,12 @@ const allCategories = computed(() => {
return categories.value!.map((category) => {
return {
name: category.name,
slug: category.slug,
children: category.subcategorys.map((sub) => {
return {
id: sub.id,
name: sub.name,
slug: sub.slug,
};
}),
};
-6
View File
@@ -18,12 +18,6 @@ if (response.isError) {
statusMessage: `Landing error : ${response.error.message}`,
});
}
// lifecycle
onMounted(() => {
window.scrollTo(0, 0);
});
</script>
<template>
+1 -1
View File
@@ -15,7 +15,7 @@ useSeoMeta({
definePageMeta({
validate: (route) => {
if (Array.isArray(route.params.slug)) {
return route.params.slug.length === 2 && route.params.slug[0] === "category";
return route.params.slug.length === 2 && route.params.slug[0].startsWith("category");
}
return true;
@@ -1,12 +1,10 @@
<script setup lang="ts">
import useGetAllOrders, {
type GetAllOrdersRequest,
} from "~/composables/api/orders/useGetAllOrders";
import useGetAllOrders, { type GetAllOrdersRequest } from "~/composables/api/orders/useGetAllOrders";
// meta
useSeoMeta({
title : "پنل کاربری سفارشات"
title: "پنل کاربری سفارشات",
});
definePageMeta({
@@ -26,14 +24,7 @@ const filters = computed(() => {
};
});
const tableHeads = ref([
"شماره سفارش",
"تاریخ ثبت",
"تعداد اقلام",
"مبلغ",
"وضعیت",
"عملیات",
]);
const tableHeads = ref(["شماره سفارش", "تاریخ ثبت", "تعداد اقلام", "مبلغ", "وضعیت", "عملیات"]);
const sortFilters = ref([
{
@@ -119,15 +110,14 @@ const clearFilters = () => {
<template>
<div class="w-full flex flex-col gap-5">
<ProfilePageTitle title="خرید ها و سفارش های شما" icon="bi:cart" />
<ProfilePageTitle
title="خرید ها و سفارش های شما"
icon="bi:cart"
/>
<div class="w-full flex flex-col gap-5">
<div
class="w-full flex flex-col-reverse lg:flex-row items-center justify-between lg:px-5 gap-5"
>
<div
class="max-lg:w-full flex items-center justify-start gap-8"
>
<div class="w-full flex flex-col-reverse lg:flex-row items-center justify-between lg:px-5 gap-5">
<div class="max-lg:w-full flex items-center justify-start gap-8">
<div
class="flex flex-col lg:flex-row items-start lg:items-center justify-start gap-3 max-lg:w-full"
>
@@ -148,11 +138,12 @@ const clearFilters = () => {
<SelectItemIndicator
class="absolute left-0 w-[25px] inline-flex items-center justify-center"
>
<Icon name="bi:check" size="20" />
<Icon
name="bi:check"
size="20"
/>
</SelectItemIndicator>
<SelectItemText
class="text-end font-iran-yekan-x text-xs lg:text-sm"
>
<SelectItemText class="text-end font-iran-yekan-x text-xs lg:text-sm">
{{ category.title }}
</SelectItemText>
</SelectItem>
@@ -172,9 +163,7 @@ const clearFilters = () => {
<template #content>
<SelectGroup>
<SelectItem
v-for="(
category, index
) in statusFilters"
v-for="(category, index) in statusFilters"
:key="index"
class="text-xs leading-none w-full rounded-sm py-4 lg:py-5 flex items-center justify-between h-[25px] pr-[12px] relative select-none data-[disabled]:pointer-events-none data-[highlighted]:outline-none data-[highlighted]:bg-slate-300 data-[highlighted]:text-black"
:value="category.value"
@@ -182,11 +171,12 @@ const clearFilters = () => {
<SelectItemIndicator
class="absolute left-0 w-[25px] inline-flex items-center justify-center"
>
<Icon name="bi:check" size="20" />
<Icon
name="bi:check"
size="20"
/>
</SelectItemIndicator>
<SelectItemText
class="text-end font-iran-yekan-x text-xs lg:text-sm"
>
<SelectItemText class="text-end font-iran-yekan-x text-xs lg:text-sm">
{{ category.title }}
</SelectItemText>
</SelectItem>
@@ -210,7 +200,7 @@ const clearFilters = () => {
<span class="whitespace-pre"> حذف فیلتر ها </span>
</Button>
<NuxtLink :to="{ name: 'products' }">
<NuxtLink to="/products">
<Button
end-icon="bi:plus"
size="md"
@@ -235,13 +225,7 @@ const clearFilters = () => {
v-for="(tableHead, index) in tableHeads"
:key="index"
scope="col"
:class="
[0, 1].includes(index)
? 'w-3/12'
: tableHeads.length - 1 == index
? 'w-1/2'
: 'w-2/12'
"
:class="[0, 1].includes(index) ? 'w-3/12' : tableHeads.length - 1 == index ? 'w-1/2' : 'w-2/12'"
class="px-6 py-5 text-xs lg:text-sm font-normal shrink-0 whitespace-pre"
>
{{ tableHead }}
@@ -265,7 +249,10 @@ const clearFilters = () => {
v-if="data && paginationData && data.count > 10"
class="w-full flex-center py-10"
>
<Pagination :items="paginationData" :total="data.count" />
<Pagination
:items="paginationData"
:total="data.count"
/>
</div>
</div>
</div>
+8 -1
View File
@@ -1,5 +1,12 @@
export default defineNuxtPlugin((nuxtApp) => {
let previousPath: string | null = null;
nuxtApp.hook("page:finish", () => {
window.scrollTo(0, 0);
const currentPath = useRoute().fullPath;
if (previousPath !== currentPath) {
window.scrollTo(0, 0);
previousPath = currentPath;
}
});
});