feat(ui): standardize design system, modals, sidebar, and form inputs

- Implement unified design system tokens, 10px radius, and IRANSans typography
- Modernize sidebar with Gemini-style collapsed expander, square 1:1 items, and elevated profile flyout
- Standardize all modal dialogs with 16px padding, fixed header/footer, 16px medium title, and sticky bottom actions
- Refactor DealFormView and CustomFieldsSection with standard UiField, UiInput, and UiSelect components
- Add draggable bottom-left QuickCreate floating action button
This commit is contained in:
s.esmaeili
2026-09-12 01:33:07 +03:30
parent 9a991fc1f1
commit 1ae87c97b7
87 changed files with 7844 additions and 5718 deletions
+259 -252
View File
@@ -12,6 +12,7 @@ import JalaliDateInput from '@/components/JalaliDateInput.vue';
import MoneyInput from '@/components/MoneyInput.vue';
import UiIcon from '@/components/UiIcon.vue';
import UserAvatar from '@/components/UserAvatar.vue';
import { UiButton, UiField, UiInput, UiPageHeader, UiSelect } from '@/components/ui';
import type {
CompanyDto,
CreateDealRequest,
@@ -394,63 +395,45 @@ async function submit() {
}
}
function openNotes() {
if (window.innerWidth < 960) tab.value = 'notes';
document.getElementById('notes')?.focus();
}
onMounted(load);
</script>
<template>
<section class="page" :class="{ embedded }" @click="closeMenus">
<div v-if="embedded" class="embed-actions">
<button class="btn primary" type="button" :disabled="saving" @click="submit">
{{ saving ? 'در حال ذخیره…' : 'ذخیره معامله' }}
</button>
<button class="btn cancel" type="button" :disabled="saving" @click="cancel">
انصراف
</button>
</div>
<header v-if="!embedded" class="desktop-head">
<div class="title-block">
<span class="doc-ico">
<UiIcon name="document" :size="22" />
<UiPageHeader
v-if="!embedded"
:title="pageTitle"
:back-to="{ name: 'pipeline' }"
>
<template #lead>
<span class="crumb">
<RouterLink :to="{ name: 'pipeline' }">کاریز فروش</RouterLink>
<span>›</span>
<strong>{{ pageTitle }}</strong>
</span>
<div>
<h1>{{ pageTitle }}</h1>
<p class="crumb">
<RouterLink :to="{ name: 'pipeline' }">کاریز فروش</RouterLink>
<span>›</span>
<strong>{{ pageTitle }}</strong>
</p>
</div>
</div>
<div class="desk-actions">
</template>
<template #actions>
<RouterLink
v-if="!isNew && id"
class="btn outline"
:to="{ name: 'quote-new', query: { fromDealId: id } }"
>
صدور پیش‌فاکتور
<UiButton variant="outline">صدور پیش‌فاکتور</UiButton>
</RouterLink>
<RouterLink
v-if="!isNew && id"
class="btn outline"
:to="{ name: 'invoice-new', query: { fromDealId: id } }"
>
صدور فاکتور
<UiButton variant="outline">صدور فاکتور</UiButton>
</RouterLink>
<button class="btn primary" type="button" :disabled="saving" @click="submit">
<UiIcon name="check-plain" :size="16" />
<UiButton variant="primary" :disabled="saving" @click="submit">
<UiIcon name="check" :size="16" />
{{ saving ? 'در حال ذخیره…' : 'ذخیره معامله' }}
</button>
<button class="btn cancel" type="button" :disabled="saving" @click="cancel">
</UiButton>
<UiButton variant="ghost" :disabled="saving" @click="cancel">
انصراف
</button>
</div>
</header>
</UiButton>
</template>
</UiPageHeader>
<header v-if="!embedded" class="mobile-head">
<button class="icon-btn" type="button" aria-label="ذخیره" :disabled="saving" @click="submit">
@@ -645,120 +628,116 @@ onMounted(load);
<section class="card extras">
<button class="extras-toggle" type="button" @click="showOthers = !showOthers">
سایر فیلدها
<span class="extras-toggle-title">
<UiIcon name="layers" :size="18" />
سایر فیلدها و اطلاعات تکمیلی
</span>
<UiIcon name="chevron" :size="16" :class="{ open: showOthers }" />
</button>
<div v-if="showOthers" class="extras-grid">
<label class="mini">
<span class="mini-ico"><UiIcon name="dollar" :size="16" /></span>
<span class="mini-copy">
<small>واحد ارزی</small>
<select v-model="currency">
<div v-if="showOthers" class="extras-body">
<div class="crm-form-grid-2">
<UiField label="واحد ارزی">
<UiSelect v-model="currency">
<option v-for="code in enabledCurrencies" :key="code" :value="code">
{{ currencySuffix(code) }}
{{ currencySuffix(code) }} ({{ code }})
</option>
</select>
</span>
<UiIcon name="chevron" :size="14" />
</label>
</UiSelect>
</UiField>
<button class="mini" type="button" @click="productsOpen = !productsOpen">
<span class="mini-ico"><UiIcon name="box" :size="16" /></span>
<span class="mini-copy">
<small>لیست محصولات</small>
<strong>{{ productsLabel }}</strong>
</span>
<UiIcon name="chevron" :size="14" />
</button>
<label class="mini">
<span class="mini-ico"><UiIcon name="flag" :size="16" /></span>
<span class="mini-copy">
<small>کاریز</small>
<select :value="pipelineId" @change="onPipelineChange(($event.target as HTMLSelectElement).value)">
<UiField label="کاریز فروش">
<UiSelect :model-value="pipelineId" @update:model-value="onPipelineChange($event)">
<option v-for="p in pipelines" :key="p.id" :value="p.id">{{ p.name }}</option>
</select>
</span>
<UiIcon name="chevron" :size="14" />
</label>
</UiSelect>
</UiField>
<label class="mini">
<span class="mini-ico"><UiIcon name="layers" :size="16" /></span>
<span class="mini-copy">
<small>مرحله کاریز</small>
<select v-model="stageId" required>
<UiField label="مرحله کاریز" required>
<UiSelect v-model="stageId" required>
<option v-for="s in stages" :key="s.id" :value="s.id">{{ s.name }}</option>
</select>
</span>
<UiIcon name="chevron" :size="14" />
</label>
</UiSelect>
</UiField>
<label class="mini">
<span class="mini-ico"><UiIcon name="target" :size="16" /></span>
<span class="mini-copy">
<small>وضعیت معامله</small>
<select v-model="health">
<UiField label="وضعیت سلامت معامله">
<UiSelect v-model="health">
<option value="normal">عادی</option>
<option value="stale">راکد</option>
<option value="rotten">فاسد</option>
</select>
</span>
<UiIcon name="chevron" :size="14" />
</label>
</UiSelect>
</UiField>
<label class="mini">
<span class="mini-ico"><UiIcon name="users" :size="16" /></span>
<span class="mini-copy">
<small>شیوه آشنایی</small>
<input v-model="source" placeholder="وب‌سایت، معرفی…" />
</span>
</label>
<UiField label="شیوه آشنایی">
<UiInput v-model="source" placeholder="مثال: وب‌سایت، معرفی، نمایشگاه…" />
</UiField>
<label class="mini">
<span class="mini-ico"><UiIcon name="filter" :size="16" /></span>
<span class="mini-copy">
<small>برچسب‌ها</small>
<input v-model="tagsRaw" placeholder="سازمانی، فوری" />
</span>
</label>
<UiField label="برچسب‌ها">
<UiInput v-model="tagsRaw" placeholder="سازمانی، فوری (با کاما جدا کنید)" />
</UiField>
<button class="mini notes-mini" type="button" @click="openNotes">
<span class="mini-ico"><UiIcon name="chat" :size="16" /></span>
<span class="mini-copy">
<small>توضیحات و یادداشت</small>
<strong>{{ notes.trim() ? 'ویرایش یادداشت' : 'افزودن یادداشت' }}</strong>
</span>
<UiIcon name="chevron" :size="14" />
</button>
</div>
<div v-if="showOthers && productsOpen" class="lines-block">
<div class="lines-head">
<h3>محصولات / خدمات</h3>
<button class="linkish" type="button" @click="addLine">افزودن ردیف</button>
<UiField v-if="!isNew" label="دلیل شکست (در صورت باخت معامله)" class="crm-col-span-full">
<UiInput id="lostReason" v-model="lostReason" placeholder="علت از دست رفتن معامله را بنویسید…" />
</UiField>
</div>
<div v-for="line in lines" :key="line.key" class="line-row">
<select v-model="line.productId" @change="onPickProduct(line)">
<option value="">محصول از کاتالوگ…</option>
<option v-for="p in products" :key="p.id" :value="p.id">{{ p.name }}</option>
</select>
<input v-model="line.name" placeholder="نام ردیف" />
<input v-model="line.quantity" type="number" min="0.01" step="0.01" placeholder="تعداد" />
<MoneyInput v-model="line.unitPrice" :decimals="0" placeholder="قیمت واحد" />
<button class="linkish danger" type="button" @click="removeLine(line.key)">حذف</button>
<!-- بخش محصولات / خدمات -->
<div class="products-section">
<div class="products-head">
<div class="products-head-info">
<span class="sec-title">محصولات / خدمات</span>
<span class="lines-count-badge">{{ productsLabel }}</span>
</div>
<div class="products-head-actions">
<UiButton
variant="outline"
size="sm"
type="button"
@click="productsOpen = !productsOpen"
>
<UiIcon name="box" :size="14" />
{{ productsOpen ? 'پنهان کردن اقلام' : 'مدیریت اقلام معامله' }}
</UiButton>
<UiButton
v-if="productsOpen"
variant="primary"
size="sm"
type="button"
@click="addLine"
>
<UiIcon name="plus" :size="14" />
افزودن ردیف
</UiButton>
</div>
</div>
<div v-if="productsOpen" class="lines-block">
<div v-if="lines.length" class="lines-table">
<div class="lines-table-head">
<span>محصول از کاتالوگ</span>
<span>نام ردیف</span>
<span>تعداد</span>
<span>قیمت واحد ({{ currencyLabel }})</span>
<span>عملیات</span>
</div>
<div v-for="line in lines" :key="line.key" class="line-row">
<UiSelect v-model="line.productId" @change="onPickProduct(line)">
<option value="">محصول از کاتالوگ…</option>
<option v-for="p in products" :key="p.id" :value="p.id">{{ p.name }}</option>
</UiSelect>
<UiInput v-model="line.name" placeholder="نام ردیف" />
<UiInput v-model="line.quantity" type="number" min="0.01" step="0.01" placeholder="تعداد" />
<MoneyInput v-model="line.unitPrice" :decimals="0" placeholder="قیمت واحد" />
<button class="line-delete-btn" type="button" title="حذف ردیف" @click="removeLine(line.key)">
<UiIcon name="trash" :size="16" />
</button>
</div>
</div>
<p v-else class="lines-empty-hint">
می‌توانید فقط مبلغ کل را در فیلد مبلغ وارد کنید یا با کلیک روی «افزودن ردیف»، اقلام را از کاتالوگ محصول مشخص فرمایید.
</p>
</div>
</div>
<p v-if="!lines.length" class="muted">
می‌توانید فقط مبلغ کل را وارد کنید یا از کاتالوگ محصول ردیف اضافه کنید.
</p>
</div>
<div v-if="showOthers && !isNew" class="field lost">
<label for="lostReason">دلیل شکست (اگر از دست رفت)</label>
<input id="lostReason" v-model="lostReason" />
<CustomFieldsSection entity-type="deal" v-model="customFields" />
</div>
<CustomFieldsSection v-if="showOthers" entity-type="deal" v-model="customFields" />
</section>
</div>
@@ -792,6 +771,16 @@ onMounted(load);
{{ saving ? 'در حال ذخیره…' : 'ذخیره معامله' }}
</button>
</footer>
<!-- Embedded Modal Actions (Fixed at bottom) -->
<div v-if="embedded" class="embed-actions">
<UiButton variant="primary" :disabled="saving" @click="submit">
{{ saving ? 'در حال ذخیره…' : 'ذخیره معامله' }}
</UiButton>
<UiButton variant="ghost" :disabled="saving" @click="cancel">
انصراف
</UiButton>
</div>
</section>
</template>
@@ -799,7 +788,8 @@ onMounted(load);
.page {
display: grid;
gap: 0.85rem;
padding-bottom: 5.8rem;
width: 100%;
max-width: 100%;
min-width: 0;
}
@@ -829,7 +819,7 @@ onMounted(load);
.doc-ico {
width: 44px;
height: 44px;
border-radius: 14px;
border-radius: var(--radius);
display: grid;
place-items: center;
background: #ecfdf5;
@@ -900,7 +890,7 @@ h1 {
.tabs .on {
color: #0f766e;
font-weight: 800;
font-weight: 600;
box-shadow: inset 0 -2px 0 #14b8a6;
}
@@ -914,7 +904,7 @@ h1 {
.card {
position: relative;
background: #fff;
border-radius: 18px;
border-radius: var(--radius);
padding: 0.95rem;
box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
min-width: 0;
@@ -1039,7 +1029,7 @@ h1 {
border: 0;
background: #f8fafc;
color: #0f766e;
border-radius: 10px;
border-radius: var(--radius);
padding: 0.35rem 0.55rem;
font: inherit;
font-weight: 700;
@@ -1065,7 +1055,7 @@ h1 {
min-height: calc(var(--control-h) - 4px);
height: calc(var(--control-h) - 4px);
border: 0;
border-radius: 8px;
border-radius: var(--radius);
background: transparent;
color: #64748b;
display: flex;
@@ -1079,7 +1069,7 @@ h1 {
.segment .on {
background: #ecfdf5;
color: #0f766e;
font-weight: 800;
font-weight: 600;
}
.menu {
@@ -1091,7 +1081,7 @@ h1 {
padding: 0.35rem;
list-style: none;
background: #fff;
border-radius: 12px;
border-radius: var(--radius);
box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
max-height: 16rem;
overflow: auto;
@@ -1110,7 +1100,7 @@ h1 {
border: 0;
background: none;
padding: 0.55rem 0.5rem;
border-radius: 8px;
border-radius: var(--radius);
font: inherit;
text-align: start;
cursor: pointer;
@@ -1127,7 +1117,7 @@ h1 {
}
.who b {
font-weight: 800;
font-weight: 600;
}
.who small {
@@ -1150,7 +1140,7 @@ h1 {
width: 28px;
height: 28px;
border: 0;
border-radius: 10px;
border-radius: var(--radius);
background: #f0fdfa;
color: #0f766e;
display: grid;
@@ -1163,141 +1153,167 @@ h1 {
display: flex;
align-items: center;
justify-content: space-between;
border: 0;
background: #f8fafc;
border-radius: 12px;
padding: 0.7rem 0.85rem;
border: 1px solid var(--line);
background: var(--surface-subtle);
border-radius: var(--radius, 10px);
padding: 0.75rem 1rem;
font: inherit;
font-weight: 800;
color: #0f172a;
font-weight: 600;
color: var(--ink);
cursor: pointer;
transition: all var(--transition-fast);
}
.extras-toggle:hover {
background: var(--surface-hover);
border-color: var(--line-strong);
}
.extras-toggle-title {
display: flex;
align-items: center;
gap: var(--sp-2);
font-size: var(--fs-base);
}
.extras-toggle :deep(.ico) {
color: #0f766e;
transform: rotate(-90deg);
color: var(--muted);
transition: transform var(--transition-fast);
}
.extras-toggle :deep(.ico.open) {
transform: rotate(90deg);
transform: rotate(180deg);
}
.extras-grid {
display: grid;
gap: 0.55rem;
margin-top: 0.75rem;
.extras-body {
display: flex;
flex-direction: column;
gap: var(--sp-5);
margin-top: var(--sp-4);
width: 100%;
}
.mini {
min-height: var(--control-h);
height: var(--control-h);
border: 1px solid #eef2f6;
border-radius: var(--radius);
background: #fff;
.products-section {
display: flex;
flex-direction: column;
gap: var(--sp-3);
padding-top: var(--sp-4);
border-top: 1px dashed var(--line);
width: 100%;
}
.products-head {
display: flex;
align-items: center;
gap: 0.65rem;
padding: 0.35rem 0.7rem;
font: inherit;
text-align: start;
cursor: pointer;
position: relative;
justify-content: space-between;
flex-wrap: wrap;
gap: var(--sp-2);
}
.mini-ico {
width: 32px;
height: 32px;
border-radius: 10px;
display: grid;
place-items: center;
background: #f0fdfa;
color: #0f766e;
flex-shrink: 0;
.products-head-info {
display: flex;
align-items: center;
gap: var(--sp-2);
}
.mini-copy {
display: grid;
min-width: 0;
flex: 1;
.sec-title {
font-size: var(--fs-sm);
font-weight: var(--fw-semibold);
color: var(--ink-secondary);
}
.mini-copy small {
color: #94a3b8;
font-size: 0.72rem;
.lines-count-badge {
font-size: var(--fs-xs);
color: var(--muted);
background: var(--surface-subtle);
border: 1px solid var(--line);
padding: 2px 8px;
border-radius: 999px;
}
.mini-copy strong {
font-size: 0.9rem;
font-weight: 700;
}
.mini select,
.mini input {
width: 100%;
border: 0;
background: transparent;
font: inherit;
font-weight: 700;
padding: 0;
appearance: none;
}
.mini :deep(.ico:last-child) {
color: #cbd5e1;
transform: rotate(90deg);
flex-shrink: 0;
.products-head-actions {
display: flex;
align-items: center;
gap: var(--sp-2);
}
.lines-block {
display: grid;
gap: 0.55rem;
margin-top: 0.85rem;
padding-top: 0.75rem;
border-top: 1px dashed #e2e8f0;
}
.lines-head {
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: column;
gap: var(--sp-3);
}
.lines-head h3 {
margin: 0;
font-size: 0.92rem;
.lines-table {
display: flex;
flex-direction: column;
gap: var(--sp-2);
width: 100%;
}
.lines-table-head {
display: grid;
grid-template-columns: 1.5fr 1.5fr 0.8fr 1.2fr 40px;
gap: var(--sp-2);
font-size: var(--fs-xs);
font-weight: var(--fw-medium);
color: var(--muted);
padding: 0 4px;
}
.line-row {
display: grid;
grid-template-columns: 1fr;
gap: 0.4rem;
}
.line-row input,
.line-row select,
.lost input {
grid-template-columns: 1.5fr 1.5fr 0.8fr 1.2fr 40px;
gap: var(--sp-2);
align-items: center;
width: 100%;
border: 1px solid #e2e8f0;
border-radius: 10px;
padding: 0.65rem 0.75rem;
background: #fff;
font: inherit;
}
.lost {
margin-top: 0.75rem;
}
.linkish {
border: 0;
background: none;
color: #0f766e;
font: inherit;
.line-delete-btn {
width: 36px;
height: 36px;
border: 1px solid var(--line);
border-radius: var(--radius, 10px);
background: var(--surface);
color: var(--danger);
display: grid;
place-items: center;
cursor: pointer;
transition: all var(--transition-fast);
}
.linkish.danger {
color: #b91c1c;
.line-delete-btn:hover {
background: #fef2f2;
border-color: #fecaca;
}
.lines-empty-hint {
margin: 0;
padding: var(--sp-3);
background: var(--surface-subtle);
border: 1px dashed var(--line);
border-radius: var(--radius, 10px);
color: var(--muted);
font-size: var(--fs-xs);
text-align: center;
}
@media (max-width: 768px) {
.lines-table-head {
display: none;
}
.line-row {
grid-template-columns: 1fr;
background: var(--surface-subtle);
padding: var(--sp-3);
border: 1px solid var(--line);
border-radius: var(--radius, 10px);
gap: var(--sp-2);
}
.line-delete-btn {
width: 100%;
}
}
.note-card {
@@ -1314,7 +1330,7 @@ h1 {
min-height: 12rem;
width: 100%;
border: 1px solid #e2e8f0;
border-radius: 12px;
border-radius: var(--radius);
padding: 0.75rem 0.85rem;
font: inherit;
resize: vertical;
@@ -1345,7 +1361,7 @@ h1 {
border-radius: var(--radius);
padding: 0 0.95rem;
font: inherit;
font-weight: 800;
font-weight: 600;
cursor: pointer;
}
@@ -1447,15 +1463,6 @@ h1 {
display: grid;
}
.extras-grid {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.line-row {
grid-template-columns: 1.2fr 1.4fr 0.7fr 0.9fr auto;
align-items: center;
}
.note-card {
display: grid;
}