Adding two fields to the mesh form

This commit is contained in:
2026-09-23 14:41:16 +03:30
parent 230d7b3bf6
commit 99df327ded
7 changed files with 59 additions and 0 deletions
@@ -0,0 +1,3 @@
-- AlterTable
ALTER TABLE "Person" ADD COLUMN "website" TEXT;
ALTER TABLE "Person" ADD COLUMN "referrer" TEXT;
+4
View File
@@ -362,6 +362,10 @@ model Person {
phone String?
mobile String?
position String?
/// آدرس وب‌سایت
website String?
/// نام معرف
referrer String?
notes String?
mood PersonMood @default(newcomer)
customFields Json @default("{}")
+20
View File
@@ -165,6 +165,16 @@ export class CreatePersonDto {
@MaxLength(120)
position?: string;
@IsOptional()
@IsString()
@MaxLength(300)
website?: string;
@IsOptional()
@IsString()
@MaxLength(120)
referrer?: string;
@IsOptional()
@IsString()
@MaxLength(2000)
@@ -220,6 +230,16 @@ export class UpdatePersonDto {
@MaxLength(120)
position?: string;
@IsOptional()
@IsString()
@MaxLength(300)
website?: string;
@IsOptional()
@IsString()
@MaxLength(120)
referrer?: string;
@IsOptional()
@IsString()
@MaxLength(2000)
+8
View File
@@ -44,6 +44,8 @@ type PersonRow = {
phone: string | null;
mobile: string | null;
position: string | null;
website: string | null;
referrer: string | null;
notes: string | null;
mood: PersonMood;
customFields: unknown;
@@ -140,6 +142,8 @@ export class PeopleService {
phone: normalizePhone(dto.phone),
mobile: normalizePhone(dto.mobile),
position: emptyToNull(dto.position),
website: emptyToNull(dto.website),
referrer: emptyToNull(dto.referrer),
notes: emptyToNull(dto.notes),
mood: dto.mood ?? 'newcomer',
companyId,
@@ -185,6 +189,8 @@ export class PeopleService {
if ('phone' in dto) data.phone = normalizePhone(dto.phone);
if ('mobile' in dto) data.mobile = normalizePhone(dto.mobile);
if ('position' in dto) data.position = emptyToNull(dto.position);
if ('website' in dto) data.website = emptyToNull(dto.website);
if ('referrer' in dto) data.referrer = emptyToNull(dto.referrer);
if ('notes' in dto) data.notes = emptyToNull(dto.notes);
if (dto.mood !== undefined) data.mood = dto.mood;
if ('customFields' in dto) {
@@ -268,6 +274,8 @@ export class PeopleService {
phone: row.phone,
mobile: row.mobile,
position: row.position,
website: row.website,
referrer: row.referrer,
notes: row.notes,
mood: row.mood,
customFields: asCustomFields(row.customFields),
+14
View File
@@ -59,6 +59,8 @@ const email = ref('');
const phone = ref('');
const mobile = ref('');
const position = ref('');
const website = ref('');
const referrer = ref('');
const notes = ref('');
const companyId = ref('');
const mood = ref<PersonMood>('newcomer');
@@ -200,6 +202,8 @@ function fill(p: PersonDto) {
phone.value = p.phone ?? '';
mobile.value = p.mobile ?? '';
position.value = p.position ?? '';
website.value = p.website ?? '';
referrer.value = p.referrer ?? '';
notes.value = p.notes ?? '';
companyId.value = p.company?.id ?? '';
mood.value = p.mood || 'newcomer';
@@ -235,6 +239,8 @@ function payload(): CreatePersonRequest {
phone: phone.value || undefined,
mobile: mobile.value || undefined,
position: position.value || undefined,
website: website.value || undefined,
referrer: referrer.value || undefined,
notes: notes.value || undefined,
companyId: companyId.value || null,
mood: mood.value,
@@ -422,6 +428,14 @@ onMounted(load);
<UiInput id="position" v-model="position" />
</UiField>
<UiField label="آدرس وب‌سایت" for-id="website">
<UiInput id="website" v-model="website" dir="ltr" placeholder="https://example.com" />
</UiField>
<UiField label="معرف" for-id="referrer">
<UiInput id="referrer" v-model="referrer" placeholder="نام معرف" />
</UiField>
<div class="crm-col-span-full">
<UiField label="وضعیت مشتری">
<div class="moods">
+6
View File
@@ -331,6 +331,8 @@ const infoEmpty = computed(() => {
!p.phone &&
!p.email &&
!p.position &&
!p.website &&
!p.referrer &&
!p.company &&
!p.notes?.trim() &&
!tickets.value.length
@@ -603,6 +605,8 @@ watch(() => route.query.tab, readTab, { immediate: true });
</div>
<dl class="facts">
<div><dt>سمت</dt><dd>{{ person.position || '—' }}</dd></div>
<div><dt>وب‌سایت</dt><dd>{{ person.website || '—' }}</dd></div>
<div><dt>معرف</dt><dd>{{ person.referrer || '—' }}</dd></div>
<div><dt>شرکت</dt><dd>{{ person.company?.name || '—' }}</dd></div>
<div><dt>تلفن</dt><dd>{{ phoneDisplay }}</dd></div>
<div><dt>ایمیل</dt><dd>{{ emailDisplay }}</dd></div>
@@ -876,6 +880,8 @@ watch(() => route.query.tab, readTab, { immediate: true });
<div><dt>تلفن</dt><dd>{{ person.phone ? toFaDigits(person.phone) : '—' }}</dd></div>
<div><dt>ایمیل</dt><dd>{{ person.email || '—' }}</dd></div>
<div><dt>سمت</dt><dd>{{ person.position || '—' }}</dd></div>
<div><dt>وب‌سایت</dt><dd>{{ person.website || '—' }}</dd></div>
<div><dt>معرف</dt><dd>{{ person.referrer || '—' }}</dd></div>
<div><dt>شرکت</dt><dd>{{ person.company?.name || '—' }}</dd></div>
<div><dt>مسئول</dt><dd>{{ person.owner?.fullName || '—' }}</dd></div>
<div>
+4
View File
@@ -629,6 +629,8 @@ export interface PersonDto {
phone: string | null;
mobile: string | null;
position: string | null;
website: string | null;
referrer: string | null;
notes: string | null;
mood: PersonMood;
customFields: Record<string, unknown>;
@@ -647,6 +649,8 @@ export interface CreatePersonRequest {
phone?: string;
mobile?: string;
position?: string;
website?: string;
referrer?: string;
notes?: string;
mood?: PersonMood;
companyId?: string | null;