Add optional activity experience on leads and people with form mapping and filters.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-19 21:04:43 +03:30
co-authored by Cursor
parent e90f9f9538
commit a455ab71ab
19 changed files with 430 additions and 20 deletions
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
import type { CustomerGroupDto, PersonImportSourceStatDto, PersonMood } from '@mento/shared';
import { ACTIVITY_EXPERIENCE_OPTIONS } from '@mento/shared';
import { PERSON_MOOD_LABELS, PERSON_MOODS } from '@/lib/person-mood';
import { groupSwatch } from '@/lib/customer-groups';
import { toFaDigits } from '@/lib/jalali';
@@ -12,6 +13,7 @@ export type ContactsFilterValue = {
sources: string[];
moods: PersonMood[];
disc: string;
activityExperiences: string[];
};
const props = defineProps<{
@@ -33,7 +35,13 @@ const emit = defineEmits<{
close: [];
}>();
const draft = reactive<ContactsFilterValue>({ groups: [], sources: [], moods: [], disc: '' });
const draft = reactive<ContactsFilterValue>({
groups: [],
sources: [],
moods: [],
disc: '',
activityExperiences: [],
});
const draftSort = ref('');
const groupQuery = ref('');
const GROUP_SEARCH_MIN = 8;
@@ -50,6 +58,7 @@ watch(
draft.sources = [...props.value.sources];
draft.moods = [...props.value.moods];
draft.disc = props.value.disc;
draft.activityExperiences = [...(props.value.activityExperiences ?? [])];
draftSort.value = props.sort ?? defaultSort.value;
groupQuery.value = '';
},
@@ -77,7 +86,12 @@ const filteredGroups = computed(() => {
const draftCount = computed(
() =>
draft.groups.length +
(isPeople.value ? draft.sources.length + draft.moods.length + (draft.disc ? 1 : 0) : 0) +
(isPeople.value
? draft.sources.length +
draft.moods.length +
draft.activityExperiences.length +
(draft.disc ? 1 : 0)
: 0) +
(hasSort.value && draftSort.value !== defaultSort.value ? 1 : 0),
);
@@ -92,6 +106,7 @@ function clearAll() {
draft.sources = [];
draft.moods = [];
draft.disc = '';
draft.activityExperiences = [];
if (hasSort.value) draftSort.value = defaultSort.value;
}
@@ -103,6 +118,7 @@ function apply() {
sources: [...draft.sources],
moods: [...draft.moods],
disc: draft.disc,
activityExperiences: [...draft.activityExperiences],
},
hasSort.value ? draftSort.value : undefined,
);
@@ -210,6 +226,27 @@ function apply() {
</div>
</section>
<section class="sec">
<h4>
سابقه فعالیت
<span v-if="draft.activityExperiences.length" class="sel">
{{ toFaDigits(draft.activityExperiences.length) }} انتخاب
</span>
</h4>
<div class="pills">
<button
v-for="item in ACTIVITY_EXPERIENCE_OPTIONS"
:key="item"
type="button"
class="pill"
:class="{ on: draft.activityExperiences.includes(item) }"
@click="toggle(draft.activityExperiences, item)"
>
{{ item }}
</button>
</div>
</section>
<section v-if="canBehavior" class="sec">
<h4>تیپ DISC</h4>
<div class="pills">