Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ddad894404 |
@@ -36,6 +36,14 @@ function sourceSignalLabel(deal: MockDeal): string {
|
||||
return t ? (SIGNAL_LABELS[t] ?? '') : '';
|
||||
}
|
||||
|
||||
// «Конкурент» — только бренд, без описания: имя конкурента хранится как
|
||||
// «Бренд, описание…», в колонке показываем часть до первой запятой.
|
||||
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);
|
||||
@@ -85,8 +93,9 @@ function rowProps(deal: MockDeal): Record<string, unknown> {
|
||||
v-if="item.competitorId"
|
||||
class="cell-link"
|
||||
:to="{ name: 'autopodbor', query: { competitor: String(item.competitorId) } }"
|
||||
:title="item.competitorName ?? undefined"
|
||||
@click.stop
|
||||
>{{ item.competitorName }}</router-link
|
||||
>{{ competitorShort(item.competitorName) }}</router-link
|
||||
>
|
||||
<span v-else class="text-medium-emphasis">—</span>
|
||||
</template>
|
||||
|
||||
@@ -128,6 +128,29 @@ describe('DealsTable', () => {
|
||||
expect(links[1].props('to')).toMatchObject({ name: 'autopodbor', query: { competitor: '3', project: '5' } });
|
||||
});
|
||||
|
||||
it('«Конкурент» показывает только бренд, без описания (до первой запятой)', () => {
|
||||
const deal: MockDeal = {
|
||||
id: 13,
|
||||
name: 'z',
|
||||
phone: 'z',
|
||||
statusSlug: 'new',
|
||||
project: 'X',
|
||||
manager: { initials: '—', name: '—' },
|
||||
cost: 0,
|
||||
receivedMinutesAgo: 1,
|
||||
competitorId: 7,
|
||||
competitorName: 'Сфера займа24, микрокредитная компания',
|
||||
sourceIdentifier: '79029826282',
|
||||
sourceSignalType: 'call',
|
||||
sourceProjectId: 9,
|
||||
sourceIsActive: true,
|
||||
sourceExtraCount: 0,
|
||||
};
|
||||
const w = mountTable([deal]);
|
||||
expect(w.text()).toContain('Сфера займа24');
|
||||
expect(w.text()).not.toContain('микрокредитная компания');
|
||||
});
|
||||
|
||||
it('показывает « · +N» при нескольких источниках проекта', () => {
|
||||
const deal: MockDeal = {
|
||||
id: 11,
|
||||
|
||||
Reference in New Issue
Block a user