Chat settings in Super Admin and changing the chat title and position.

This commit is contained in:
2026-09-29 14:45:19 +03:30
parent 125976f3eb
commit 66af7e577c
14 changed files with 332 additions and 269 deletions
+43 -35
View File
@@ -17,6 +17,7 @@ import {
UiPageHeader,
} from '@/components/ui';
import UiIcon from '@/components/UiIcon.vue';
import ExcelImportFlow from '@/components/ExcelImportFlow.vue';
import PhoneContactsImport from '@/components/PhoneContactsImport.vue';
import {
filterPhoneContacts,
@@ -120,7 +121,6 @@ const assignOpen = ref(false);
const stageOpen = ref(false);
const assignUserId = ref('');
const bulkStageId = ref('');
const fileInput = ref<HTMLInputElement | null>(null);
const importJob = ref<LeadImportJobDto | null>(null);
const createOpen = ref(false);
const createBusy = ref(false);
@@ -935,27 +935,28 @@ function startImportPoll(jobId: string) {
importTimer = setInterval(() => void pollImport(jobId), 1500);
}
async function onImportFile(ev: Event) {
const input = ev.target as HTMLInputElement;
const file = input.files?.[0];
input.value = '';
if (!file) return;
function onExcelImportStart() {
busy.value = true;
error.value = '';
okMsg.value = '';
try {
const form = new FormData();
form.append('file', file);
const { data: job } = await api.post<LeadImportJobDto>('/leads/import/file', form, {
headers: { 'Content-Type': 'multipart/form-data' },
});
importJob.value = job;
startImportPoll(job.id);
} catch {
error.value = '';
}
function onExcelImportDone(result: Record<string, unknown> | LeadImportJobDto) {
const job = result as LeadImportJobDto;
if (!job?.id) {
error.value = 'ورود فایل ناموفق بود.';
} finally {
busy.value = false;
return;
}
importJob.value = job;
startImportPoll(job.id);
}
function onExcelImportFail(message: string) {
error.value = message;
}
function onExcelImportSettled() {
busy.value = false;
}
function onPhoneImportStart() {
@@ -1034,22 +1035,20 @@ onBeforeUnmount(() => {
<span class="btn-full">خروجی اکسل</span>
<span class="btn-short">خروجی</span>
</UiButton>
<UiButton
variant="ghost"
size="sm"
<ExcelImportFlow
preview-path="/leads/import/preview"
import-path="/leads/import/file"
:disabled="busy"
@click.stop="fileInput?.click()"
@start="onExcelImportStart"
@done="onExcelImportDone"
@fail="onExcelImportFail"
@settled="onExcelImportSettled"
>
<span class="btn-full">ورود از اکسل</span>
<span class="btn-short">ورود</span>
</UiButton>
<input
ref="fileInput"
type="file"
accept=".xlsx,.xls,.csv"
hidden
@change="onImportFile"
/>
<UiButton variant="ghost" size="sm" :disabled="busy">
<span class="btn-full">ورود از اکسل</span>
<span class="btn-short">ورود</span>
</UiButton>
</ExcelImportFlow>
<input
ref="logoFileInput"
type="file"
@@ -1565,9 +1564,18 @@ onBeforeUnmount(() => {
<template #action>
<div class="empty-actions">
<UiButton variant="primary" @click="openCreate">ثبت لید جدید</UiButton>
<UiButton v-if="isAdmin" variant="ghost" :disabled="busy" @click="fileInput?.click()">
ورود از فایل
</UiButton>
<ExcelImportFlow
v-if="isAdmin"
preview-path="/leads/import/preview"
import-path="/leads/import/file"
:disabled="busy"
@start="onExcelImportStart"
@done="onExcelImportDone"
@fail="onExcelImportFail"
@settled="onExcelImportSettled"
>
<UiButton variant="ghost" :disabled="busy">ورود از فایل</UiButton>
</ExcelImportFlow>
</div>
</template>
</UiEmptyState>