feat(web): continue Ant settings migration and tighten page chrome
Migrate remaining settings screens to Ant Design Vue, densify teams/roles UI, drop page-header subtitles project-wide, and polish notes cards plus contacts row actions. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,16 +3,31 @@ import { computed, onMounted, ref } from 'vue';
|
||||
import { RouterLink, useRouter } from 'vue-router';
|
||||
import axios from 'axios';
|
||||
import { api } from '@/lib/api';
|
||||
import {
|
||||
UiBadge,
|
||||
UiButton,
|
||||
UiCard,
|
||||
UiEmptyState,
|
||||
UiPageHeader,
|
||||
} from '@/components/ui';
|
||||
import UiIcon from '@/components/UiIcon.vue';
|
||||
import type { LeadFormDto } from '@mento/shared';
|
||||
import { toFaDigits } from '@/lib/jalali';
|
||||
import {
|
||||
Alert as AAlert,
|
||||
Button as AButton,
|
||||
Card as ACard,
|
||||
Empty as AEmpty,
|
||||
Flex as AFlex,
|
||||
List as AList,
|
||||
ListItem as AListItem,
|
||||
ListItemMeta as AListItemMeta,
|
||||
Space as ASpace,
|
||||
Spin as ASpin,
|
||||
Tag as ATag,
|
||||
Typography,
|
||||
} from 'ant-design-vue';
|
||||
import {
|
||||
CopyOutlined,
|
||||
DeleteOutlined,
|
||||
EditOutlined,
|
||||
EyeOutlined,
|
||||
PlusOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
const { Title: ATypographyTitle, Text: ATypographyText } = Typography;
|
||||
|
||||
const router = useRouter();
|
||||
const loading = ref(false);
|
||||
@@ -78,201 +93,97 @@ async function copyPublishLink(form: LeadFormDto) {
|
||||
await navigator.clipboard.writeText(publicUrl(form));
|
||||
}
|
||||
|
||||
function formMeta(form: LeadFormDto) {
|
||||
const parts = [
|
||||
`${toFaDigits(form.fields.length)} فیلد سفارشی`,
|
||||
`${toFaDigits(form.submitCount ?? form.submissionCount ?? 0)} ارسال`,
|
||||
`${toFaDigits(form.leadCreateCount ?? 0)} لید`,
|
||||
];
|
||||
if (form.source) parts.push(`منبع: ${form.source}`);
|
||||
return parts.join(' · ');
|
||||
}
|
||||
|
||||
const countLabel = computed(() => toFaDigits(forms.value.length));
|
||||
const listEmpty = computed(() => !loading.value && !forms.value.length);
|
||||
|
||||
onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="crm-page lead-forms-page" dir="rtl">
|
||||
<UiPageHeader
|
||||
title="فرمساز وب"
|
||||
description="فرمهای آنلاین بسازید، در وبسایت منتشر کنید و لیدها را مستقیم در CRM دریافت کنید."
|
||||
>
|
||||
<template #actions>
|
||||
<UiButton :loading="saving" @click="createForm">
|
||||
<template #icon>
|
||||
<UiIcon name="plus" />
|
||||
</template>
|
||||
فرم جدید
|
||||
</UiButton>
|
||||
</template>
|
||||
</UiPageHeader>
|
||||
<a-flex vertical :gap="16">
|
||||
<a-flex justify="space-between" align="flex-start" wrap="wrap" :gap="12">
|
||||
<a-typography-title :level="3" :style="{ margin: 0 }">فرمساز وب</a-typography-title>
|
||||
<a-button type="primary" :loading="saving" @click="createForm">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
فرم جدید
|
||||
</a-button>
|
||||
</a-flex>
|
||||
|
||||
<div v-if="error" class="crm-alert crm-alert-danger">{{ error }}</div>
|
||||
<a-alert v-if="error" type="error" show-icon :message="error" />
|
||||
|
||||
<div v-else-if="!loading && forms.length" class="forms-summary">
|
||||
<span class="forms-count-badge">{{ countLabel }} فرم ساخته شده</span>
|
||||
</div>
|
||||
<a-spin :spinning="loading">
|
||||
<a-card v-if="listEmpty && !error" :bordered="false">
|
||||
<a-empty
|
||||
description="هنوز فرمی نساختهاید. با ساخت اولین فرم، میتوانید در وبسایت یا شبکههای اجتماعی سرنخ و مشتری جذب کنید."
|
||||
>
|
||||
<a-button type="primary" :loading="saving" @click="createForm">
|
||||
<template #icon><PlusOutlined /></template>
|
||||
ساخت اولین فرم
|
||||
</a-button>
|
||||
</a-empty>
|
||||
</a-card>
|
||||
|
||||
<UiEmptyState
|
||||
v-if="!loading && !forms.length"
|
||||
title="هنوز فرمی نساختهاید"
|
||||
description="با ساخت اولین فرم، میتوانید در وبسایت یا شبکههای اجتماعی سرنخ و مشتری جذب کنید."
|
||||
icon="document"
|
||||
>
|
||||
<template #action>
|
||||
<UiButton :loading="saving" @click="createForm">
|
||||
<template #icon>
|
||||
<UiIcon name="plus" />
|
||||
</template>
|
||||
ساخت اولین فرم
|
||||
</UiButton>
|
||||
</template>
|
||||
</UiEmptyState>
|
||||
<a-card v-else-if="!error && forms.length" :bordered="false">
|
||||
<a-flex vertical :gap="12">
|
||||
<a-typography-text type="secondary">
|
||||
{{ countLabel }} فرم ساخته شده
|
||||
</a-typography-text>
|
||||
|
||||
<div v-else class="forms-list">
|
||||
<UiCard v-for="form in forms" :key="form.id" class="form-card">
|
||||
<div class="form-info">
|
||||
<div class="form-title-row">
|
||||
<strong class="form-name">{{ form.name }}</strong>
|
||||
<UiBadge :variant="form.isActive ? 'success' : 'neutral'">
|
||||
{{ form.isActive ? 'فعال' : 'غیرفعال' }}
|
||||
</UiBadge>
|
||||
</div>
|
||||
<p class="form-meta">
|
||||
<span>{{ toFaDigits(form.fields.length) }} فیلد سفارشی</span>
|
||||
<span class="meta-dot">·</span>
|
||||
<span>{{ toFaDigits(form.submitCount ?? form.submissionCount ?? 0) }} ارسال</span>
|
||||
<span class="meta-dot">·</span>
|
||||
<span>{{ toFaDigits(form.leadCreateCount ?? 0) }} لید</span>
|
||||
<span v-if="form.source" class="meta-dot">·</span>
|
||||
<span v-if="form.source">منبع: {{ form.source }}</span>
|
||||
</p>
|
||||
</div>
|
||||
<a-list item-layout="horizontal" :data-source="forms">
|
||||
<template #renderItem="{ item }">
|
||||
<a-list-item>
|
||||
<template #actions>
|
||||
<a-space wrap>
|
||||
<RouterLink
|
||||
:to="{ name: 'lead-form-builder', params: { id: item.id } }"
|
||||
custom
|
||||
v-slot="{ href, navigate }"
|
||||
>
|
||||
<a-button :href="href" @click="navigate">
|
||||
<template #icon><EditOutlined /></template>
|
||||
ویرایش فیلدها
|
||||
</a-button>
|
||||
</RouterLink>
|
||||
<a-button @click="copyPublishLink(item)">
|
||||
<template #icon><CopyOutlined /></template>
|
||||
کپی لینک انتشار
|
||||
</a-button>
|
||||
<a-button :href="item.publicPath" target="_blank" rel="noopener">
|
||||
<template #icon><EyeOutlined /></template>
|
||||
پیشنمایش
|
||||
</a-button>
|
||||
<a-button danger @click="removeForm(item)">
|
||||
<template #icon><DeleteOutlined /></template>
|
||||
حذف
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<div class="form-actions">
|
||||
<RouterLink :to="{ name: 'lead-form-builder', params: { id: form.id } }">
|
||||
<UiButton variant="secondary" size="sm">
|
||||
<template #icon>
|
||||
<UiIcon name="pencil" />
|
||||
</template>
|
||||
ویرایش فیلدها
|
||||
</UiButton>
|
||||
</RouterLink>
|
||||
|
||||
<UiButton variant="secondary" size="sm" @click="copyPublishLink(form)">
|
||||
<template #icon>
|
||||
<UiIcon name="megaphone" />
|
||||
<a-list-item-meta :description="formMeta(item)">
|
||||
<template #title>
|
||||
<a-space :size="8" align="center" wrap>
|
||||
<a-typography-text strong>{{ item.name }}</a-typography-text>
|
||||
<a-tag :color="item.isActive ? 'success' : 'default'" :bordered="false">
|
||||
{{ item.isActive ? 'فعال' : 'غیرفعال' }}
|
||||
</a-tag>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-list-item-meta>
|
||||
</a-list-item>
|
||||
</template>
|
||||
کپی لینک انتشار
|
||||
</UiButton>
|
||||
|
||||
<a :href="form.publicPath" target="_blank" rel="noopener" class="preview-link">
|
||||
<UiButton variant="ghost" size="sm">
|
||||
<template #icon>
|
||||
<UiIcon name="eye" />
|
||||
</template>
|
||||
پیشنمایش
|
||||
</UiButton>
|
||||
</a>
|
||||
|
||||
<UiButton variant="danger" size="sm" @click="removeForm(form)">
|
||||
<template #icon>
|
||||
<UiIcon name="trash" />
|
||||
</template>
|
||||
حذف
|
||||
</UiButton>
|
||||
</div>
|
||||
</UiCard>
|
||||
</div>
|
||||
</section>
|
||||
</a-list>
|
||||
</a-flex>
|
||||
</a-card>
|
||||
</a-spin>
|
||||
</a-flex>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.lead-forms-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--sp-6);
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.forms-summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.forms-count-badge {
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--color-text-secondary);
|
||||
background: var(--color-surface-soft);
|
||||
padding: var(--sp-1) var(--sp-3);
|
||||
border-radius: var(--radius-full);
|
||||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
.forms-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--sp-4);
|
||||
}
|
||||
|
||||
.form-card {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: var(--sp-4);
|
||||
padding: var(--sp-4) var(--sp-5);
|
||||
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
|
||||
}
|
||||
|
||||
.form-card:hover {
|
||||
border-color: var(--color-brand-300, #5eead4);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.form-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--sp-1);
|
||||
}
|
||||
|
||||
.form-title-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-3);
|
||||
}
|
||||
|
||||
.form-name {
|
||||
font-size: var(--fs-md);
|
||||
font-weight: 700;
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.form-meta {
|
||||
margin: 0;
|
||||
font-size: var(--fs-xs);
|
||||
color: var(--color-text-secondary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
}
|
||||
|
||||
.meta-dot {
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--sp-2);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.preview-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.form-card {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
width: 100%;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user