Refactor entity handling in TypeUser.vue and PickEntity.vue for improved consistency and type safety.

- Adjusted `TypeUser.vue` to correctly reference `props.item.result` and removed unused `hasParent` logic.
- Updated `PickEntity.vue` to include handling for households with new `isEntityHousehold` utility.
- Added `isEntityHousehold` function to `types.ts` for reusable type checks.
This commit is contained in:
2025-10-25 01:06:29 +02:00
parent df6087d468
commit 6d4c4d2c74
3 changed files with 19 additions and 10 deletions

View File

@@ -12,13 +12,20 @@
>{{ trans(USER_CURRENT_USER) }}</span
>
<span
v-else
v-else-if="!isEntityHousehold(p)"
:class="getBadgeClass(p)"
class="chill_denomination"
:style="getBadgeStyle(p)"
>
{{ p.text }}
</span>
<span v-else
:class="getBadgeClass(p)"
class="chill_denomination"
:style="getBadgeStyle(p)"
>
Ménage n°{{ p.id }}
</span>
</li>
</ul>
<ul class="record_actions mb-0">
@@ -54,9 +61,12 @@
@click="addNewSuggested(s)"
style="margin: 0"
>
<span :class="getBadgeClass(s)" :style="getBadgeStyle(s)">
<span v-if="!isEntityHousehold(s)" :class="getBadgeClass(s)" :style="getBadgeStyle(s)">
{{ s.text }}
</span>
<span v-else>
Ménage n°{{ s.id }}
</span>
</li>
</ul>
</div>
@@ -75,7 +85,7 @@ import AddPersons from "ChillPersonAssets/vuejs/_components/AddPersons.vue";
import {
Entities,
EntitiesOrMe,
EntityType,
EntityType, isEntityHousehold,
SearchOptions,
Suggestion,
} from "ChillPersonAssets/types";