Align desktop UI with mobile shop flows and polish navigation
This commit is contained in:
@@ -50,7 +50,7 @@ function getProductCount(catalogId: string) {
|
||||
subtitle="کالیته مورد نظر را انتخاب کنید"
|
||||
show-back
|
||||
centered
|
||||
@back="router.push('/companies')"
|
||||
@back="router.push('/catalogs')"
|
||||
/>
|
||||
|
||||
<header class="catalog-list-page__desk-head desktop-only">
|
||||
|
||||
@@ -82,8 +82,14 @@ async function submit() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page">
|
||||
<PageHeader title="درخواست کالیته" show-back centered @back="router.back()" />
|
||||
<div class="page catalog-request-page">
|
||||
<PageHeader class="mobile-only" title="درخواست کالیته" show-back centered @back="router.back()" />
|
||||
|
||||
<header class="desktop-page__head desktop-only">
|
||||
<h1 class="desktop-page__title">درخواست کالیته</h1>
|
||||
<p class="desktop-page__subtitle">محصولات و تعداد اقلام موردنظر را مشخص کنید</p>
|
||||
</header>
|
||||
|
||||
<div class="page__scroll page__scroll--with-nav body">
|
||||
<p class="hint">
|
||||
{{ preselectId ? 'این محصول برای درخواست کالیته انتخاب شده است. در صورت نیاز اقلام دیگر را هم اضافه کنید.' : 'محصولات و تعداد اقلام موردنظر را مشخص کنید.' }}
|
||||
@@ -91,35 +97,60 @@ async function submit() {
|
||||
<PageSkeleton v-if="loading" variant="form" />
|
||||
<p v-else-if="error" class="error">{{ error }}</p>
|
||||
<template v-else>
|
||||
<article
|
||||
v-for="item in products"
|
||||
:key="item.id"
|
||||
class="row"
|
||||
:class="{ 'row--selected': preselectId === item.id }"
|
||||
>
|
||||
<div>
|
||||
<strong>{{ item.name }}</strong>
|
||||
<span>کد {{ item.code }}</span>
|
||||
<div class="request-layout">
|
||||
<div class="request-products">
|
||||
<article
|
||||
v-for="item in products"
|
||||
:key="item.id"
|
||||
class="row"
|
||||
:class="{ 'row--selected': preselectId === item.id }"
|
||||
>
|
||||
<div>
|
||||
<strong>{{ item.name }}</strong>
|
||||
<span>کد {{ item.code }}</span>
|
||||
</div>
|
||||
<input
|
||||
class="qty"
|
||||
type="number"
|
||||
min="0"
|
||||
:value="quantities[item.id] ?? 0"
|
||||
@input="setQty(item.id, Number(($event.target as HTMLInputElement).value))"
|
||||
/>
|
||||
</article>
|
||||
</div>
|
||||
<input
|
||||
class="qty"
|
||||
type="number"
|
||||
min="0"
|
||||
:value="quantities[item.id] ?? 0"
|
||||
@input="setQty(item.id, Number(($event.target as HTMLInputElement).value))"
|
||||
/>
|
||||
</article>
|
||||
<label class="note">
|
||||
توضیحات
|
||||
<textarea v-model="note" rows="3" placeholder="آدرس یا توضیحات اختیاری" />
|
||||
</label>
|
||||
<p class="summary">اقلام انتخابشده: {{ formatNumber(selectedItems.length) }}</p>
|
||||
<button type="button" class="submit" :disabled="saving" @click="submit">
|
||||
{{ saving ? 'در حال ثبت...' : 'ثبت درخواست کالیته' }}
|
||||
</button>
|
||||
<button type="button" class="linkish" @click="router.push('/catalog-requests')">
|
||||
وضعیت درخواستهای قبلی
|
||||
</button>
|
||||
|
||||
<aside class="request-sidebar desktop-summary-panel">
|
||||
<h2 class="desktop-summary-panel__title">خلاصه درخواست</h2>
|
||||
<div class="desktop-summary-panel__row">
|
||||
<span>اقلام انتخابشده</span>
|
||||
<strong>{{ formatNumber(selectedItems.length) }}</strong>
|
||||
</div>
|
||||
<label class="note">
|
||||
توضیحات
|
||||
<textarea v-model="note" rows="3" placeholder="آدرس یا توضیحات اختیاری" />
|
||||
</label>
|
||||
<button type="button" class="submit" :disabled="saving" @click="submit">
|
||||
{{ saving ? 'در حال ثبت...' : 'ثبت درخواست کالیته' }}
|
||||
</button>
|
||||
<button type="button" class="linkish" @click="router.push('/catalog-requests')">
|
||||
وضعیت درخواستهای قبلی
|
||||
</button>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<div class="request-mobile-footer mobile-only">
|
||||
<label class="note">
|
||||
توضیحات
|
||||
<textarea v-model="note" rows="3" placeholder="آدرس یا توضیحات اختیاری" />
|
||||
</label>
|
||||
<p class="summary">اقلام انتخابشده: {{ formatNumber(selectedItems.length) }}</p>
|
||||
<button type="button" class="submit" :disabled="saving" @click="submit">
|
||||
{{ saving ? 'در حال ثبت...' : 'ثبت درخواست کالیته' }}
|
||||
</button>
|
||||
<button type="button" class="linkish" @click="router.push('/catalog-requests')">
|
||||
وضعیت درخواستهای قبلی
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
@@ -223,4 +254,61 @@ async function submit() {
|
||||
cursor: pointer;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.request-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.request-sidebar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.request-mobile-footer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.catalog-request-page {
|
||||
max-width: var(--content-max-width);
|
||||
margin-inline: auto;
|
||||
padding: 20px var(--page-padding) 28px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.request-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
|
||||
gap: 20px;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.request-sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
position: sticky;
|
||||
top: 16px;
|
||||
}
|
||||
|
||||
.request-sidebar .submit {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.request-mobile-footer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.row {
|
||||
box-shadow: var(--shadow-card);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -12,9 +12,23 @@ onMounted(() => store.hydrate())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page">
|
||||
<PageHeader title="وضعیت کالیتهها" show-back centered @back="router.push('/catalogs')" />
|
||||
<div class="page catalog-requests-page">
|
||||
<PageHeader class="mobile-only" title="وضعیت کالیتهها" show-back centered @back="router.push('/catalogs')" />
|
||||
|
||||
<header class="desktop-page__head desktop-only catalog-requests-desk-head">
|
||||
<div>
|
||||
<h1 class="desktop-page__title">وضعیت کالیتهها</h1>
|
||||
<p class="desktop-page__subtitle">پیگیری درخواستهای کالیته ثبتشده</p>
|
||||
</div>
|
||||
<button type="button" class="desk-new-btn" @click="router.push('/catalog-request')">
|
||||
درخواست کالیته جدید
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="page__scroll page__scroll--with-nav body">
|
||||
<button type="button" class="new-btn mobile-only" @click="router.push('/catalog-request')">
|
||||
درخواست کالیته جدید
|
||||
</button>
|
||||
<button type="button" class="new-btn" @click="router.push('/catalog-request')">
|
||||
درخواست کالیته جدید
|
||||
</button>
|
||||
@@ -100,4 +114,57 @@ onMounted(() => store.hydrate())
|
||||
.note {
|
||||
color: var(--color-text) !important;
|
||||
}
|
||||
|
||||
.catalog-requests-desk-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.desk-new-btn {
|
||||
border: none;
|
||||
border-radius: 12px;
|
||||
background: var(--color-primary);
|
||||
color: #fff;
|
||||
padding: 10px 16px;
|
||||
font-weight: 700;
|
||||
font-size: 0.875rem;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.catalog-requests-page {
|
||||
max-width: var(--content-max-width);
|
||||
margin-inline: auto;
|
||||
padding: 20px var(--page-padding) 28px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.body {
|
||||
padding: 0;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.empty {
|
||||
grid-column: 1 / -1;
|
||||
padding: 48px 0;
|
||||
}
|
||||
|
||||
.card {
|
||||
box-shadow: var(--shadow-card);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.body {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
filterCatalogGallery,
|
||||
type CatalogGalleryFilter,
|
||||
} from '@/utils/catalogGallery'
|
||||
import { MOCK_CALITE_CARDS } from '@/data/caliteCollections'
|
||||
import { formatNumber } from '@/utils/format'
|
||||
|
||||
const route = useRoute()
|
||||
@@ -27,8 +28,8 @@ const crm = useCrmStore()
|
||||
const catalogs = ref<Catalog[]>([])
|
||||
const products = ref<CatalogProductCard[]>([])
|
||||
const loading = ref(true)
|
||||
const searchOpen = ref(false)
|
||||
const search = ref('')
|
||||
const searchFieldRef = ref<InstanceType<typeof SearchField> | null>(null)
|
||||
const filter = ref<CatalogGalleryFilter>('all')
|
||||
|
||||
const filters: { id: CatalogGalleryFilter; label: string }[] = [
|
||||
@@ -38,7 +39,10 @@ const filters: { id: CatalogGalleryFilter; label: string }[] = [
|
||||
{ id: 'season', label: 'بر اساس فصل' },
|
||||
]
|
||||
|
||||
const gallery = computed(() => buildCatalogGallery(catalogs.value, products.value))
|
||||
const gallery = computed(() => {
|
||||
const built = buildCatalogGallery(catalogs.value, products.value)
|
||||
return built.length ? built : MOCK_CALITE_CARDS
|
||||
})
|
||||
const cards = computed(() => filterCatalogGallery(gallery.value, filter.value, search.value))
|
||||
|
||||
onMounted(async () => {
|
||||
@@ -65,9 +69,8 @@ function openCatalog(id: string) {
|
||||
router.push({ name: 'catalog-detail', params: { catalogId: id } })
|
||||
}
|
||||
|
||||
function toggleSearch() {
|
||||
searchOpen.value = !searchOpen.value
|
||||
if (!searchOpen.value) search.value = ''
|
||||
function focusSearch() {
|
||||
searchFieldRef.value?.focus()
|
||||
}
|
||||
|
||||
function metaLine(card: (typeof gallery.value)[number]) {
|
||||
@@ -90,13 +93,7 @@ function metaLine(card: (typeof gallery.value)[number]) {
|
||||
<h1>کالیتهها</h1>
|
||||
<div class="calite-hub__nav-end">
|
||||
<AuthThemeToggle variant="inline" class="mobile-only" />
|
||||
<button
|
||||
type="button"
|
||||
class="icon-btn"
|
||||
:aria-label="searchOpen ? 'بستن جستجو' : 'جستجو'"
|
||||
:aria-pressed="searchOpen"
|
||||
@click="toggleSearch"
|
||||
>
|
||||
<button type="button" class="icon-btn mobile-only" aria-label="جستجو" @click="focusSearch">
|
||||
<IconSearch :size="20" />
|
||||
</button>
|
||||
</div>
|
||||
@@ -106,10 +103,10 @@ function metaLine(card: (typeof gallery.value)[number]) {
|
||||
<p class="calite-hub__lead">مجموعهای از بهترین پارچهها، در یک نگاه</p>
|
||||
|
||||
<SearchField
|
||||
v-if="searchOpen"
|
||||
:model-value="search"
|
||||
ref="searchFieldRef"
|
||||
v-model="search"
|
||||
class="calite-hub__search"
|
||||
placeholder="جستجوی نام کالیته..."
|
||||
@update:model-value="search = $event"
|
||||
/>
|
||||
|
||||
<div class="calite-hub__chips" role="tablist" aria-label="مرتبسازی کالیتهها">
|
||||
@@ -169,8 +166,8 @@ function metaLine(card: (typeof gallery.value)[number]) {
|
||||
|
||||
<style scoped>
|
||||
.calite-hub {
|
||||
background: #f4f0ed;
|
||||
color: #2a2622;
|
||||
background: var(--color-bg);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.calite-hub__nav {
|
||||
@@ -178,7 +175,7 @@ function metaLine(card: (typeof gallery.value)[number]) {
|
||||
grid-template-columns: 40px 1fr auto;
|
||||
align-items: center;
|
||||
padding: 6px 12px 0;
|
||||
background: #f4f0ed;
|
||||
background: var(--color-bg);
|
||||
}
|
||||
|
||||
.calite-hub__nav-end {
|
||||
@@ -203,11 +200,15 @@ function metaLine(card: (typeof gallery.value)[number]) {
|
||||
.calite-hub__lead {
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
color: #8a847c;
|
||||
color: var(--color-text-muted);
|
||||
font-size: 0.78rem;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.calite-hub__search {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.icon-btn {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
@@ -234,10 +235,10 @@ function metaLine(card: (typeof gallery.value)[number]) {
|
||||
flex-shrink: 0;
|
||||
height: 36px;
|
||||
padding: 0 16px;
|
||||
border: 1px solid #eae6e2;
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 999px;
|
||||
background: #eae6e2;
|
||||
color: #615f5c;
|
||||
background: var(--color-surface);
|
||||
color: var(--color-text-muted);
|
||||
font: inherit;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 600;
|
||||
@@ -349,30 +350,7 @@ function metaLine(card: (typeof gallery.value)[number]) {
|
||||
.calite-hub__empty {
|
||||
margin: 16px 0 0;
|
||||
text-align: center;
|
||||
color: #8a847c;
|
||||
}
|
||||
|
||||
html.dark .calite-hub,
|
||||
html.dark .calite-hub__nav {
|
||||
background: #0b0f14;
|
||||
color: #eef2f8;
|
||||
}
|
||||
|
||||
html.dark .calite-hub__lead,
|
||||
html.dark .calite-hub__empty {
|
||||
color: #9aa8bc;
|
||||
}
|
||||
|
||||
html.dark .calite-chip {
|
||||
border-color: #2a3444;
|
||||
background: #1a2230;
|
||||
color: #c5d0de;
|
||||
}
|
||||
|
||||
html.dark .calite-chip.is-on {
|
||||
border-color: #e8e4df;
|
||||
background: #e8e4df;
|
||||
color: #121821;
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
html.dark .calite-card {
|
||||
@@ -416,7 +394,11 @@ html.dark .calite-card__copy small {
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
min-height: auto;
|
||||
background: #f4f0ed;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.calite-hub__nav {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.calite-hub__scroll {
|
||||
|
||||
Reference in New Issue
Block a user