diff --git a/app/resources/js/components/deals/DealsTable.vue b/app/resources/js/components/deals/DealsTable.vue index b19fd419..6292f90b 100644 --- a/app/resources/js/components/deals/DealsTable.vue +++ b/app/resources/js/components/deals/DealsTable.vue @@ -43,6 +43,14 @@ function hasSource(deal: MockDeal): boolean { return Boolean(deal.sourceIdentifier || deal.sourceProjectId); } +// «Конкурент» — только бренд, без описания: имя конкурента хранится как +// «Бренд, описание…», в колонке показываем часть до первой запятой. +function competitorShort(name: string | null | undefined): string { + if (!name) return ''; + const i = name.indexOf(','); + return (i === -1 ? name : name.slice(0, i)).trim(); +} + function formatDateTime(iso: string | null | undefined): string { if (!iso) return '—'; const d = new Date(iso); @@ -103,9 +111,10 @@ function toggleSelect(id: number): void { {{ item.competitorName }}{{ competitorShort(item.competitorName) }} @@ -199,9 +208,10 @@ function toggleSelect(id: number): void { {{ deal.competitorName }}{{ competitorShort(deal.competitorName) }} {{ stripChannelPrefix(deal.project) }} {{ diff --git a/app/tests/Frontend/DealsTable.spec.ts b/app/tests/Frontend/DealsTable.spec.ts index 4ee826e9..aea789fc 100644 --- a/app/tests/Frontend/DealsTable.spec.ts +++ b/app/tests/Frontend/DealsTable.spec.ts @@ -128,6 +128,29 @@ describe('DealsTable', () => { expect(links[1].props('to')).toMatchObject({ name: 'autopodbor', query: { competitor: '3', project: '5' } }); }); + it('«Конкурент» — только бренд до первой запятой, без описания', () => { + const deal: MockDeal = { + id: 12, + name: '79000000002', + phone: '79000000002', + statusSlug: 'new', + project: 'X', + manager: { initials: '—', name: '—' }, + cost: 0, + receivedMinutesAgo: 1, + competitorId: 4, + competitorName: 'AutoMoney, микрокредитная компания', + sourceIdentifier: '79135396546', + sourceSignalType: 'call', + sourceProjectId: 5, + sourceIsActive: true, + sourceExtraCount: 0, + }; + const w = mountTable([deal]); + expect(w.text()).toContain('AutoMoney'); + expect(w.text()).not.toContain('микрокредитная'); + }); + it('показывает « · +N» при нескольких источниках проекта', () => { const deal: MockDeal = { id: 11,