mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-12-19 00:25:42 +00:00
Merge branch 'ticket-app-master' into 1849-1848-1920-1921-fix-bugs
This commit is contained in:
@@ -11,7 +11,6 @@
|
|||||||
"@hotwired/stimulus": "^3.0.0",
|
"@hotwired/stimulus": "^3.0.0",
|
||||||
"@luminateone/eslint-baseline": "^1.0.9",
|
"@luminateone/eslint-baseline": "^1.0.9",
|
||||||
"@symfony/stimulus-bridge": "^3.2.0",
|
"@symfony/stimulus-bridge": "^3.2.0",
|
||||||
"@symfony/ux-translator": "file:vendor/symfony/ux-translator/assets",
|
|
||||||
"@symfony/webpack-encore": "^4.1.0",
|
"@symfony/webpack-encore": "^4.1.0",
|
||||||
"@tsconfig/node20": "^20.1.4",
|
"@tsconfig/node20": "^20.1.4",
|
||||||
"@types/dompurify": "^3.0.5",
|
"@types/dompurify": "^3.0.5",
|
||||||
|
|||||||
@@ -49,9 +49,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<div v-if="actionIsLoading === true">
|
<div v-if="actionIsLoading === true">
|
||||||
<i
|
<i class="chill-green fa fa-circle-o-notch fa-spin fa-lg"></i>
|
||||||
class="chill-green fa fa-circle-o-notch fa-spin fa-lg"
|
|
||||||
></i>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
@@ -64,8 +62,7 @@
|
|||||||
<template
|
<template
|
||||||
v-else-if="
|
v-else-if="
|
||||||
socialActionsList.length > 0 &&
|
socialActionsList.length > 0 &&
|
||||||
(socialIssuesSelected.length ||
|
(socialIssuesSelected.length || socialActionsSelected.length)
|
||||||
socialActionsSelected.length)
|
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -88,9 +85,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<span
|
<span
|
||||||
v-else-if="
|
v-else-if="actionAreLoaded && socialActionsList.length === 0"
|
||||||
actionAreLoaded && socialActionsList.length === 0
|
|
||||||
"
|
|
||||||
class="inline-choice chill-no-data-statement mt-3"
|
class="inline-choice chill-no-data-statement mt-3"
|
||||||
>
|
>
|
||||||
{{ trans(ACTIVITY_SOCIAL_ACTION_LIST_EMPTY) }}
|
{{ trans(ACTIVITY_SOCIAL_ACTION_LIST_EMPTY) }}
|
||||||
@@ -190,8 +185,7 @@ export default {
|
|||||||
/* Add in list the issues already associated (if not yet listed) */
|
/* Add in list the issues already associated (if not yet listed) */
|
||||||
this.socialIssuesSelected.forEach((issue) => {
|
this.socialIssuesSelected.forEach((issue) => {
|
||||||
if (
|
if (
|
||||||
this.socialIssuesList.filter((i) => i.id === issue.id)
|
this.socialIssuesList.filter((i) => i.id === issue.id).length !== 1
|
||||||
.length !== 1
|
|
||||||
) {
|
) {
|
||||||
this.$store.commit("addIssueInList", issue);
|
this.$store.commit("addIssueInList", issue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ span.badge {
|
|||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
max-width: 100%;margin-bottom: 5px;
|
max-width: 100%;
|
||||||
|
margin-bottom: 5px;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
line-height: 1.2em;
|
line-height: 1.2em;
|
||||||
|
|||||||
@@ -45,8 +45,10 @@ span.badge {
|
|||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
max-width: 100%;margin-bottom: 5px;
|
max-width: 100%;
|
||||||
margin-right: 1em;text-align: left;
|
margin-bottom: 5px;
|
||||||
|
margin-right: 1em;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -61,11 +61,7 @@
|
|||||||
<label class="input-group-text" for="slotDuration"
|
<label class="input-group-text" for="slotDuration"
|
||||||
>Durée des créneaux</label
|
>Durée des créneaux</label
|
||||||
>
|
>
|
||||||
<select
|
<select v-model="slotDuration" id="slotDuration" class="form-select">
|
||||||
v-model="slotDuration"
|
|
||||||
id="slotDuration"
|
|
||||||
class="form-select"
|
|
||||||
>
|
|
||||||
<option value="00:05:00">5 minutes</option>
|
<option value="00:05:00">5 minutes</option>
|
||||||
<option value="00:10:00">10 minutes</option>
|
<option value="00:10:00">10 minutes</option>
|
||||||
<option value="00:15:00">15 minutes</option>
|
<option value="00:15:00">15 minutes</option>
|
||||||
@@ -74,11 +70,7 @@
|
|||||||
<option value="00:60:00">60 minutes</option>
|
<option value="00:60:00">60 minutes</option>
|
||||||
</select>
|
</select>
|
||||||
<label class="input-group-text" for="slotMinTime">De</label>
|
<label class="input-group-text" for="slotMinTime">De</label>
|
||||||
<select
|
<select v-model="slotMinTime" id="slotMinTime" class="form-select">
|
||||||
v-model="slotMinTime"
|
|
||||||
id="slotMinTime"
|
|
||||||
class="form-select"
|
|
||||||
>
|
|
||||||
<option value="00:00:00">0h</option>
|
<option value="00:00:00">0h</option>
|
||||||
<option value="01:00:00">1h</option>
|
<option value="01:00:00">1h</option>
|
||||||
<option value="02:00:00">2h</option>
|
<option value="02:00:00">2h</option>
|
||||||
@@ -94,11 +86,7 @@
|
|||||||
<option value="12:00:00">12h</option>
|
<option value="12:00:00">12h</option>
|
||||||
</select>
|
</select>
|
||||||
<label class="input-group-text" for="slotMaxTime">À</label>
|
<label class="input-group-text" for="slotMaxTime">À</label>
|
||||||
<select
|
<select v-model="slotMaxTime" id="slotMaxTime" class="form-select">
|
||||||
v-model="slotMaxTime"
|
|
||||||
id="slotMaxTime"
|
|
||||||
class="form-select"
|
|
||||||
>
|
|
||||||
<option value="12:00:00">12h</option>
|
<option value="12:00:00">12h</option>
|
||||||
<option value="13:00:00">13h</option>
|
<option value="13:00:00">13h</option>
|
||||||
<option value="14:00:00">14h</option>
|
<option value="14:00:00">14h</option>
|
||||||
@@ -126,9 +114,7 @@
|
|||||||
v-model="hideWeekends"
|
v-model="hideWeekends"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<label
|
<label for="showHideWE" class="form-check-label input-group-text"
|
||||||
for="showHideWE"
|
|
||||||
class="form-check-label input-group-text"
|
|
||||||
>Week-ends</label
|
>Week-ends</label
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -144,9 +130,7 @@
|
|||||||
<b v-else-if="arg.event.extendedProps.is === 'range'"
|
<b v-else-if="arg.event.extendedProps.is === 'range'"
|
||||||
>{{ arg.timeText }}
|
>{{ arg.timeText }}
|
||||||
{{ arg.event.extendedProps.locationName }}
|
{{ arg.event.extendedProps.locationName }}
|
||||||
<small>{{
|
<small>{{ arg.event.extendedProps.userLabel }}</small></b
|
||||||
arg.event.extendedProps.userLabel
|
|
||||||
}}</small></b
|
|
||||||
>
|
>
|
||||||
<b v-else-if="arg.event.extendedProps.is === 'current'"
|
<b v-else-if="arg.event.extendedProps.is === 'current'"
|
||||||
>{{ arg.timeText }} {{ $t("current_selected") }}
|
>{{ arg.timeText }} {{ $t("current_selected") }}
|
||||||
@@ -154,9 +138,7 @@
|
|||||||
<b v-else-if="arg.event.extendedProps.is === 'local'">{{
|
<b v-else-if="arg.event.extendedProps.is === 'local'">{{
|
||||||
arg.event.title
|
arg.event.title
|
||||||
}}</b>
|
}}</b>
|
||||||
<b v-else
|
<b v-else>{{ arg.timeText }} {{ $t("current_selected") }} </b>
|
||||||
>{{ arg.timeText }} {{ $t("current_selected") }}
|
|
||||||
</b>
|
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</FullCalendar>
|
</FullCalendar>
|
||||||
@@ -270,9 +252,7 @@ export default {
|
|||||||
this.$store.state.activity.endDate !== null)
|
this.$store.state.activity.endDate !== null)
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
!window.confirm(
|
!window.confirm(this.$t("change_main_user_will_reset_event_data"))
|
||||||
this.$t("change_main_user_will_reset_event_data"),
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -280,13 +260,9 @@ export default {
|
|||||||
|
|
||||||
// add the previous user, if any, in the previous user list (in use for suggestion)
|
// add the previous user, if any, in the previous user list (in use for suggestion)
|
||||||
if (null !== this.$store.getters.getMainUser) {
|
if (null !== this.$store.getters.getMainUser) {
|
||||||
const suggestedUids = new Set(
|
const suggestedUids = new Set(this.$data.previousUser.map((u) => u.id));
|
||||||
this.$data.previousUser.map((u) => u.id),
|
|
||||||
);
|
|
||||||
if (!suggestedUids.has(this.$store.getters.getMainUser.id)) {
|
if (!suggestedUids.has(this.$store.getters.getMainUser.id)) {
|
||||||
this.$data.previousUser.push(
|
this.$data.previousUser.push(this.$store.getters.getMainUser);
|
||||||
this.$store.getters.getMainUser,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,8 +292,7 @@ export default {
|
|||||||
// show an alert if changing mainUser
|
// show an alert if changing mainUser
|
||||||
if (
|
if (
|
||||||
(this.$store.getters.getMainUser !== null &&
|
(this.$store.getters.getMainUser !== null &&
|
||||||
this.$store.state.me.id !==
|
this.$store.state.me.id !== this.$store.getters.getMainUser.id) ||
|
||||||
this.$store.getters.getMainUser.id) ||
|
|
||||||
this.$store.getters.getMainUser === null
|
this.$store.getters.getMainUser === null
|
||||||
) {
|
) {
|
||||||
if (!window.confirm(this.$t("will_change_main_user_for_me"))) {
|
if (!window.confirm(this.$t("will_change_main_user_for_me"))) {
|
||||||
@@ -361,9 +336,7 @@ export default {
|
|||||||
this.$store.getters.getMainUser.id
|
this.$store.getters.getMainUser.id
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
!window.confirm(
|
!window.confirm(this.$t("this_calendar_range_will_change_main_user"))
|
||||||
this.$t("this_calendar_range_will_change_main_user"),
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,7 @@
|
|||||||
<label class="input-group-text" for="slotDuration"
|
<label class="input-group-text" for="slotDuration"
|
||||||
>Durée des créneaux</label
|
>Durée des créneaux</label
|
||||||
>
|
>
|
||||||
<select
|
<select v-model="slotDuration" id="slotDuration" class="form-select">
|
||||||
v-model="slotDuration"
|
|
||||||
id="slotDuration"
|
|
||||||
class="form-select"
|
|
||||||
>
|
|
||||||
<option value="00:05:00">5 minutes</option>
|
<option value="00:05:00">5 minutes</option>
|
||||||
<option value="00:10:00">10 minutes</option>
|
<option value="00:10:00">10 minutes</option>
|
||||||
<option value="00:15:00">15 minutes</option>
|
<option value="00:15:00">15 minutes</option>
|
||||||
@@ -36,11 +32,7 @@
|
|||||||
<option value="00:60:00">60 minutes</option>
|
<option value="00:60:00">60 minutes</option>
|
||||||
</select>
|
</select>
|
||||||
<label class="input-group-text" for="slotMinTime">De</label>
|
<label class="input-group-text" for="slotMinTime">De</label>
|
||||||
<select
|
<select v-model="slotMinTime" id="slotMinTime" class="form-select">
|
||||||
v-model="slotMinTime"
|
|
||||||
id="slotMinTime"
|
|
||||||
class="form-select"
|
|
||||||
>
|
|
||||||
<option value="00:00:00">0h</option>
|
<option value="00:00:00">0h</option>
|
||||||
<option value="01:00:00">1h</option>
|
<option value="01:00:00">1h</option>
|
||||||
<option value="02:00:00">2h</option>
|
<option value="02:00:00">2h</option>
|
||||||
@@ -56,11 +48,7 @@
|
|||||||
<option value="12:00:00">12h</option>
|
<option value="12:00:00">12h</option>
|
||||||
</select>
|
</select>
|
||||||
<label class="input-group-text" for="slotMaxTime">À</label>
|
<label class="input-group-text" for="slotMaxTime">À</label>
|
||||||
<select
|
<select v-model="slotMaxTime" id="slotMaxTime" class="form-select">
|
||||||
v-model="slotMaxTime"
|
|
||||||
id="slotMaxTime"
|
|
||||||
class="form-select"
|
|
||||||
>
|
|
||||||
<option value="12:00:00">12h</option>
|
<option value="12:00:00">12h</option>
|
||||||
<option value="13:00:00">13h</option>
|
<option value="13:00:00">13h</option>
|
||||||
<option value="14:00:00">14h</option>
|
<option value="14:00:00">14h</option>
|
||||||
@@ -88,9 +76,7 @@
|
|||||||
v-model="showWeekends"
|
v-model="showWeekends"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<label
|
<label for="showHideWE" class="form-check-label input-group-text"
|
||||||
for="showHideWE"
|
|
||||||
class="form-check-label input-group-text"
|
|
||||||
>Week-ends</label
|
>Week-ends</label
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@@ -100,9 +86,7 @@
|
|||||||
<FullCalendar :options="calendarOptions" ref="calendarRef">
|
<FullCalendar :options="calendarOptions" ref="calendarRef">
|
||||||
<template v-slot:eventContent="{ event }: { event: EventApi }">
|
<template v-slot:eventContent="{ event }: { event: EventApi }">
|
||||||
<span :class="eventClasses">
|
<span :class="eventClasses">
|
||||||
<b v-if="event.extendedProps.is === 'remote'">{{
|
<b v-if="event.extendedProps.is === 'remote'">{{ event.title }}</b>
|
||||||
event.title
|
|
||||||
}}</b>
|
|
||||||
<b v-else-if="event.extendedProps.is === 'range'"
|
<b v-else-if="event.extendedProps.is === 'range'"
|
||||||
>{{ formatDate(event.startStr, "time") }} -
|
>{{ formatDate(event.startStr, "time") }} -
|
||||||
{{ formatDate(event.endStr, "time") }}:
|
{{ formatDate(event.endStr, "time") }}:
|
||||||
@@ -132,11 +116,7 @@
|
|||||||
<h6 class="chill-red">{{ $t("copy_range_from_to") }}</h6>
|
<h6 class="chill-red">{{ $t("copy_range_from_to") }}</h6>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-9 col-md-2">
|
<div class="col-xs-12 col-sm-9 col-md-2">
|
||||||
<select
|
<select v-model="dayOrWeek" id="dayOrWeek" class="form-select">
|
||||||
v-model="dayOrWeek"
|
|
||||||
id="dayOrWeek"
|
|
||||||
class="form-select"
|
|
||||||
>
|
|
||||||
<option value="day">{{ $t("from_day_to_day") }}</option>
|
<option value="day">{{ $t("from_day_to_day") }}</option>
|
||||||
<option value="week">
|
<option value="week">
|
||||||
{{ $t("from_week_to_week") }}
|
{{ $t("from_week_to_week") }}
|
||||||
@@ -145,27 +125,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<template v-if="dayOrWeek === 'day'">
|
<template v-if="dayOrWeek === 'day'">
|
||||||
<div class="col-xs-12 col-sm-3 col-md-3">
|
<div class="col-xs-12 col-sm-3 col-md-3">
|
||||||
<input
|
<input class="form-control" type="date" v-model="copyFrom" />
|
||||||
class="form-control"
|
|
||||||
type="date"
|
|
||||||
v-model="copyFrom"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-1 col-md-1 copy-chevron">
|
<div class="col-xs-12 col-sm-1 col-md-1 copy-chevron">
|
||||||
<i class="fa fa-angle-double-right"></i>
|
<i class="fa fa-angle-double-right"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-3 col-md-3">
|
<div class="col-xs-12 col-sm-3 col-md-3">
|
||||||
<input
|
<input class="form-control" type="date" v-model="copyTo" />
|
||||||
class="form-control"
|
|
||||||
type="date"
|
|
||||||
v-model="copyTo"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-5 col-md-1">
|
<div class="col-xs-12 col-sm-5 col-md-1">
|
||||||
<button
|
<button class="btn btn-action float-end" @click="copyDay">
|
||||||
class="btn btn-action float-end"
|
|
||||||
@click="copyDay"
|
|
||||||
>
|
|
||||||
{{ $t("copy_range") }}
|
{{ $t("copy_range") }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -177,11 +146,7 @@
|
|||||||
id="copyFromWeek"
|
id="copyFromWeek"
|
||||||
class="form-select"
|
class="form-select"
|
||||||
>
|
>
|
||||||
<option
|
<option v-for="w in lastWeeks" :value="w.value" :key="w.value">
|
||||||
v-for="w in lastWeeks"
|
|
||||||
:value="w.value"
|
|
||||||
:key="w.value"
|
|
||||||
>
|
|
||||||
{{ w.text }}
|
{{ w.text }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -190,25 +155,14 @@
|
|||||||
<i class="fa fa-angle-double-right"></i>
|
<i class="fa fa-angle-double-right"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-3 col-md-3">
|
<div class="col-xs-12 col-sm-3 col-md-3">
|
||||||
<select
|
<select v-model="copyToWeek" id="copyToWeek" class="form-select">
|
||||||
v-model="copyToWeek"
|
<option v-for="w in nextWeeks" :value="w.value" :key="w.value">
|
||||||
id="copyToWeek"
|
|
||||||
class="form-select"
|
|
||||||
>
|
|
||||||
<option
|
|
||||||
v-for="w in nextWeeks"
|
|
||||||
:value="w.value"
|
|
||||||
:key="w.value"
|
|
||||||
>
|
|
||||||
{{ w.text }}
|
{{ w.text }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-sm-5 col-md-1">
|
<div class="col-xs-12 col-sm-5 col-md-1">
|
||||||
<button
|
<button class="btn btn-action float-end" @click="copyWeek">
|
||||||
class="btn btn-action float-end"
|
|
||||||
@click="copyWeek"
|
|
||||||
>
|
|
||||||
{{ $t("copy_range") }}
|
{{ $t("copy_range") }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -46,8 +46,7 @@ export interface StoredObjectVersionCreated extends StoredObjectVersion {
|
|||||||
persisted: false;
|
persisted: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StoredObjectVersionPersisted
|
export interface StoredObjectVersionPersisted extends StoredObjectVersionCreated {
|
||||||
extends StoredObjectVersionCreated {
|
|
||||||
version: number;
|
version: number;
|
||||||
id: number;
|
id: number;
|
||||||
createdAt: DateTime | null;
|
createdAt: DateTime | null;
|
||||||
@@ -61,8 +60,7 @@ export interface StoredObjectStatusChange {
|
|||||||
type: string;
|
type: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StoredObjectVersionWithPointInTime
|
export interface StoredObjectVersionWithPointInTime extends StoredObjectVersionPersisted {
|
||||||
extends StoredObjectVersionPersisted {
|
|
||||||
"point-in-times": StoredObjectPointInTime[];
|
"point-in-times": StoredObjectPointInTime[];
|
||||||
"from-restored": StoredObjectVersionPersisted | null;
|
"from-restored": StoredObjectVersionPersisted | null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ const isRestored = computed<boolean>(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const isDuplicated = computed<boolean>(
|
const isDuplicated = computed<boolean>(
|
||||||
() =>
|
() => props.version.version === 0 && null !== props.version["from-restored"],
|
||||||
props.version.version === 0 && null !== props.version["from-restored"],
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const classes = computed<{
|
const classes = computed<{
|
||||||
@@ -70,16 +69,9 @@ const classes = computed<{
|
|||||||
<div :class="classes">
|
<div :class="classes">
|
||||||
<div
|
<div
|
||||||
class="col-12 tags"
|
class="col-12 tags"
|
||||||
v-if="
|
v-if="isCurrent || isKeptBeforeConversion || isRestored || isDuplicated"
|
||||||
isCurrent ||
|
|
||||||
isKeptBeforeConversion ||
|
|
||||||
isRestored ||
|
|
||||||
isDuplicated
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<span class="badge bg-success" v-if="isCurrent"
|
|
||||||
>Version actuelle</span
|
|
||||||
>
|
>
|
||||||
|
<span class="badge bg-success" v-if="isCurrent">Version actuelle</span>
|
||||||
<span class="badge bg-info" v-if="isKeptBeforeConversion"
|
<span class="badge bg-info" v-if="isKeptBeforeConversion"
|
||||||
>Conservée avant conversion dans un autre format</span
|
>Conservée avant conversion dans un autre format</span
|
||||||
>
|
>
|
||||||
@@ -96,21 +88,17 @@ const classes = computed<{
|
|||||||
<span
|
<span
|
||||||
><strong> #{{ version.version + 1 }} </strong></span
|
><strong> #{{ version.version + 1 }} </strong></span
|
||||||
>
|
>
|
||||||
<template
|
<template v-if="version.createdBy !== null && version.createdAt !== null"
|
||||||
v-if="version.createdBy !== null && version.createdAt !== null"
|
|
||||||
><strong v-if="version.version == 0">créé par</strong
|
><strong v-if="version.version == 0">créé par</strong
|
||||||
><strong v-else>modifié par</strong>
|
><strong v-else>modifié par</strong>
|
||||||
<span class="badge-user"
|
<span class="badge-user"
|
||||||
><UserRenderBoxBadge
|
><UserRenderBoxBadge :user="version.createdBy"></UserRenderBoxBadge
|
||||||
:user="version.createdBy"
|
|
||||||
></UserRenderBoxBadge
|
|
||||||
></span>
|
></span>
|
||||||
<strong>à</strong>
|
<strong>à</strong>
|
||||||
{{
|
{{
|
||||||
$d(ISOToDatetime(version.createdAt.datetime8601), "long")
|
$d(ISOToDatetime(version.createdAt.datetime8601), "long")
|
||||||
}}</template
|
}}</template
|
||||||
><template
|
><template v-if="version.createdBy === null && version.createdAt !== null"
|
||||||
v-if="version.createdBy === null && version.createdAt !== null"
|
|
||||||
><strong v-if="version.version == 0">Créé le</strong
|
><strong v-if="version.version == 0">Créé le</strong
|
||||||
><strong v-else>modifié le</strong>
|
><strong v-else>modifié le</strong>
|
||||||
{{
|
{{
|
||||||
|
|||||||
@@ -61,9 +61,7 @@ export const ISOToDatetime = (str: string | null): Date | null => {
|
|||||||
[time, timezone] = times.split(times.charAt(8)),
|
[time, timezone] = times.split(times.charAt(8)),
|
||||||
[hours, minutes, seconds] = time.split(":").map((s) => parseInt(s));
|
[hours, minutes, seconds] = time.split(":").map((s) => parseInt(s));
|
||||||
if ("0000" === timezone) {
|
if ("0000" === timezone) {
|
||||||
return new Date(
|
return new Date(Date.UTC(year, month - 1, date, hours, minutes, seconds));
|
||||||
Date.UTC(year, month - 1, date, hours, minutes, seconds),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Date(year, month - 1, date, hours, minutes, seconds);
|
return new Date(year, month - 1, date, hours, minutes, seconds);
|
||||||
@@ -158,9 +156,7 @@ export const intervalISOToDays = (str: string | null): number | null => {
|
|||||||
vstring = "";
|
vstring = "";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw Error(
|
throw Error("this character should not appears: " + str.charAt(i));
|
||||||
"this character should not appears: " + str.charAt(i),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,4 +176,3 @@ export function getTimezoneOffsetString(date: Date, timeZone: string): string {
|
|||||||
|
|
||||||
return `${sign}${hours}:${minutes}`;
|
return `${sign}${hours}:${minutes}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
Scope,
|
Scope,
|
||||||
ValidationExceptionInterface,
|
ValidationExceptionInterface,
|
||||||
ValidationProblemFromMap,
|
ValidationProblemFromMap,
|
||||||
ViolationFromMap
|
ViolationFromMap,
|
||||||
} from "../../types";
|
} from "../../types";
|
||||||
|
|
||||||
export type body = Record<string, boolean | string | number | null>;
|
export type body = Record<string, boolean | string | number | null>;
|
||||||
@@ -68,7 +68,10 @@ export class ValidationException<
|
|||||||
|
|
||||||
this.byProperty = problem.violations.reduce(
|
this.byProperty = problem.violations.reduce(
|
||||||
(acc, v) => {
|
(acc, v) => {
|
||||||
const key = v.propertyPath.replace('/\[\d+\]$/', "") as Extract<keyof M, string>;
|
const key = v.propertyPath.replace("/\[\d+\]$/", "") as Extract<
|
||||||
|
keyof M,
|
||||||
|
string
|
||||||
|
>;
|
||||||
(acc[key] ||= []).push(v.title);
|
(acc[key] ||= []).push(v.title);
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
@@ -80,19 +83,18 @@ export class ValidationException<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
violationsByNormalizedProperty(property: Extract<keyof M, string>): ViolationFromMap<M>[] {
|
violationsByNormalizedProperty(
|
||||||
return this.violationsList.filter((v) => v.propertyPath.replace(/\[\d+\]$/, "") === property);
|
property: Extract<keyof M, string>,
|
||||||
|
): ViolationFromMap<M>[] {
|
||||||
|
return this.violationsList.filter(
|
||||||
|
(v) => v.propertyPath.replace(/\[\d+\]$/, "") === property,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
violationsByNormalizedPropertyAndParams<
|
violationsByNormalizedPropertyAndParams<
|
||||||
P extends Extract<keyof M, string>,
|
P extends Extract<keyof M, string>,
|
||||||
K extends Extract<keyof M[P], string>
|
K extends Extract<keyof M[P], string>,
|
||||||
>(
|
>(property: P, param: K, param_value: M[P][K]): ViolationFromMap<M>[] {
|
||||||
property: P,
|
|
||||||
param: K,
|
|
||||||
param_value: M[P][K]
|
|
||||||
): ViolationFromMap<M>[]
|
|
||||||
{
|
|
||||||
const list = this.violationsByNormalizedProperty(property);
|
const list = this.violationsByNormalizedProperty(property);
|
||||||
|
|
||||||
return list.filter(
|
return list.filter(
|
||||||
@@ -101,7 +103,7 @@ export class ValidationException<
|
|||||||
// `with_parameter in v.parameters` check indexing
|
// `with_parameter in v.parameters` check indexing
|
||||||
param in v.parameters &&
|
param in v.parameters &&
|
||||||
// the cast is safe, because we have overloading that bind the types
|
// the cast is safe, because we have overloading that bind the types
|
||||||
(v.parameters as M[P])[param] === param_value
|
(v.parameters as M[P])[param] === param_value,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,9 +112,9 @@ export class ValidationException<
|
|||||||
* Check that the exception is a ValidationExceptionInterface
|
* Check that the exception is a ValidationExceptionInterface
|
||||||
* @param x
|
* @param x
|
||||||
*/
|
*/
|
||||||
export function isValidationException<M extends Record<string, Record<string, string|number>>>(
|
export function isValidationException<
|
||||||
x: unknown,
|
M extends Record<string, Record<string, string | number>>,
|
||||||
): x is ValidationExceptionInterface<M> {
|
>(x: unknown): x is ValidationExceptionInterface<M> {
|
||||||
return (
|
return (
|
||||||
x instanceof ValidationException ||
|
x instanceof ValidationException ||
|
||||||
(typeof x === "object" &&
|
(typeof x === "object" &&
|
||||||
@@ -147,8 +149,7 @@ export interface AccessExceptionInterface extends TransportExceptionInterface {
|
|||||||
violations: string[];
|
violations: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NotFoundExceptionInterface
|
export interface NotFoundExceptionInterface extends TransportExceptionInterface {
|
||||||
extends TransportExceptionInterface {
|
|
||||||
name: "NotFoundException";
|
name: "NotFoundException";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,8 +160,7 @@ export interface ServerExceptionInterface extends TransportExceptionInterface {
|
|||||||
body: string;
|
body: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConflictHttpExceptionInterface
|
export interface ConflictHttpExceptionInterface extends TransportExceptionInterface {
|
||||||
extends TransportExceptionInterface {
|
|
||||||
name: "ConflictHttpException";
|
name: "ConflictHttpException";
|
||||||
violations: string[];
|
violations: string[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import {Gender, GenderTranslation} from "ChillMainAssets/types";
|
|||||||
* @return {GenderTranslation} Returns the gender translation string corresponding to the provided gender,
|
* @return {GenderTranslation} Returns the gender translation string corresponding to the provided gender,
|
||||||
* or "unknown" if the gender is null.
|
* or "unknown" if the gender is null.
|
||||||
*/
|
*/
|
||||||
export function toGenderTranslation(gender: Gender|null): GenderTranslation
|
export function toGenderTranslation(gender: Gender | null): GenderTranslation {
|
||||||
{
|
|
||||||
if (null === gender) {
|
if (null === gender) {
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ export interface SetCivility {
|
|||||||
id: number;
|
id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gender translation.
|
* Gender translation.
|
||||||
*
|
*
|
||||||
@@ -380,13 +379,16 @@ export type DynamicKeys<M extends Record<string, Record<string, unknown>>> =
|
|||||||
|
|
||||||
type NormalizeKey<K extends string> = K extends `${infer B}[${number}]` ? B : K;
|
type NormalizeKey<K extends string> = K extends `${infer B}[${number}]` ? B : K;
|
||||||
|
|
||||||
export type ViolationFromMap<M extends Record<string, Record<string, unknown>>> = {
|
export type ViolationFromMap<
|
||||||
[K in DynamicKeys<M> & string]: { // <- note le "& string" ici
|
M extends Record<string, Record<string, unknown>>,
|
||||||
|
> = {
|
||||||
|
[K in DynamicKeys<M> & string]: {
|
||||||
|
// <- note le "& string" ici
|
||||||
propertyPath: K;
|
propertyPath: K;
|
||||||
title: string;
|
title: string;
|
||||||
parameters?: M[NormalizeKey<K>];
|
parameters?: M[NormalizeKey<K>];
|
||||||
type?: string;
|
type?: string;
|
||||||
}
|
};
|
||||||
}[DynamicKeys<M> & string];
|
}[DynamicKeys<M> & string];
|
||||||
|
|
||||||
export type ValidationProblemFromMap<
|
export type ValidationProblemFromMap<
|
||||||
@@ -418,15 +420,17 @@ export interface ValidationExceptionInterface<
|
|||||||
/** Indexing by property (useful for display by field) */
|
/** Indexing by property (useful for display by field) */
|
||||||
byProperty: Record<Extract<keyof M, string>, string[]>;
|
byProperty: Record<Extract<keyof M, string>, string[]>;
|
||||||
|
|
||||||
violationsByNormalizedProperty(property: Extract<keyof M, string>): ViolationFromMap<M>[];
|
violationsByNormalizedProperty(
|
||||||
|
property: Extract<keyof M, string>,
|
||||||
|
): ViolationFromMap<M>[];
|
||||||
|
|
||||||
violationsByNormalizedPropertyAndParams<
|
violationsByNormalizedPropertyAndParams<
|
||||||
P extends Extract<keyof M, string>,
|
P extends Extract<keyof M, string>,
|
||||||
K extends Extract<keyof M[P], string>
|
K extends Extract<keyof M[P], string>,
|
||||||
>(
|
>(
|
||||||
property: P,
|
property: P,
|
||||||
param: K,
|
param: K,
|
||||||
param_value: M[P][K]
|
param_value: M[P][K],
|
||||||
): ViolationFromMap<M>[];
|
): ViolationFromMap<M>[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,8 +439,7 @@ export interface AccessExceptionInterface extends TransportExceptionInterface {
|
|||||||
violations: string[];
|
violations: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NotFoundExceptionInterface
|
export interface NotFoundExceptionInterface extends TransportExceptionInterface {
|
||||||
extends TransportExceptionInterface {
|
|
||||||
name: "NotFoundException";
|
name: "NotFoundException";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -447,8 +450,7 @@ export interface ServerExceptionInterface extends TransportExceptionInterface {
|
|||||||
body: string;
|
body: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ConflictHttpExceptionInterface
|
export interface ConflictHttpExceptionInterface extends TransportExceptionInterface {
|
||||||
extends TransportExceptionInterface {
|
|
||||||
name: "ConflictHttpException";
|
name: "ConflictHttpException";
|
||||||
violations: string[];
|
violations: string[];
|
||||||
}
|
}
|
||||||
@@ -496,16 +498,16 @@ export interface TabDefinition {
|
|||||||
counter: () => number;
|
counter: () => number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CreateComponentConfigGeneral = {
|
export interface CreateComponentConfigGeneral {
|
||||||
action: 'create';
|
action: "create";
|
||||||
allowedTypes: CreatableEntityType[];
|
allowedTypes: CreatableEntityType[];
|
||||||
query: string;
|
query: string;
|
||||||
parent: null;
|
parent: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type CreateComponentThirdPartyAddContact = {
|
export interface CreateComponentThirdPartyAddContact {
|
||||||
action: 'addContact';
|
action: "addContact";
|
||||||
allowedTypes: readonly ['thirdparty'];
|
allowedTypes: readonly ["thirdparty"];
|
||||||
query: string;
|
query: string;
|
||||||
parent: ThirdpartyCompany;
|
parent: ThirdpartyCompany;
|
||||||
}
|
}
|
||||||
@@ -513,8 +515,9 @@ export type CreateComponentThirdPartyAddContact = {
|
|||||||
/**
|
/**
|
||||||
* Configuration for the CreateModal and Create component
|
* Configuration for the CreateModal and Create component
|
||||||
*/
|
*/
|
||||||
export type CreateComponentConfig = CreateComponentConfigGeneral | CreateComponentThirdPartyAddContact;
|
export type CreateComponentConfig =
|
||||||
|
| CreateComponentConfigGeneral
|
||||||
|
| CreateComponentThirdPartyAddContact;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Possible states for the WaitingScreen Component.
|
* Possible states for the WaitingScreen Component.
|
||||||
|
|||||||
@@ -69,10 +69,9 @@ const props = withDefaults(defineProps<CreateComponentConfig>(), {
|
|||||||
parent: null,
|
parent: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit =
|
const emit = defineEmits<{
|
||||||
defineEmits<{
|
(e: "onPersonCreated", payload: { person: Person }): void;
|
||||||
(e: "onPersonCreated", payload: { person: Person }): void,
|
(e: "onThirdPartyCreated", payload: { thirdParty: Thirdparty }): void;
|
||||||
(e: "onThirdPartyCreated", payload: { thirdParty: Thirdparty }): void,
|
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const type = ref<CreatableEntityType | null>(null);
|
const type = ref<CreatableEntityType | null>(null);
|
||||||
@@ -106,7 +105,7 @@ const containsThirdParty = computed<boolean>(() =>
|
|||||||
props.allowedTypes.includes("thirdparty"),
|
props.allowedTypes.includes("thirdparty"),
|
||||||
);
|
);
|
||||||
const containsPerson = computed<boolean>(() => {
|
const containsPerson = computed<boolean>(() => {
|
||||||
if (props.action === 'addContact') {
|
if (props.action === "addContact") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return props.allowedTypes.includes("person");
|
return props.allowedTypes.includes("person");
|
||||||
@@ -115,7 +114,10 @@ const containsPerson = computed<boolean>(() => {
|
|||||||
function save(): void {
|
function save(): void {
|
||||||
if (radioType.value === "person" && castPerson.value !== null) {
|
if (radioType.value === "person" && castPerson.value !== null) {
|
||||||
castPerson.value.postPerson();
|
castPerson.value.postPerson();
|
||||||
} else if (radioType.value === "thirdparty" && castThirdparty.value !== null) {
|
} else if (
|
||||||
|
radioType.value === "thirdparty" &&
|
||||||
|
castThirdparty.value !== null
|
||||||
|
) {
|
||||||
castThirdparty.value.postThirdParty();
|
castThirdparty.value.postThirdParty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,13 @@ const onPersonCreated = ({person}: {person: Person}): void => {
|
|||||||
emit("onPersonCreated", { person });
|
emit("onPersonCreated", { person });
|
||||||
};
|
};
|
||||||
|
|
||||||
const onThirdPartyCreated = ({thirdParty}: {thirdParty: Thirdparty}): void => {
|
const onThirdPartyCreated = ({
|
||||||
|
thirdParty,
|
||||||
|
}: {
|
||||||
|
thirdParty: Thirdparty;
|
||||||
|
}): void => {
|
||||||
emit("onThirdPartyCreated", { thirdParty: thirdParty });
|
emit("onThirdPartyCreated", { thirdParty: thirdParty });
|
||||||
}
|
};
|
||||||
|
|
||||||
function save(): void {
|
function save(): void {
|
||||||
console.log("save from CreateModal");
|
console.log("save from CreateModal");
|
||||||
|
|||||||
@@ -177,14 +177,19 @@ const props = withDefaults(defineProps<OnTheFlyComponentProps>(), {
|
|||||||
query: "",
|
query: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit =
|
||||||
(e: "saveFormOnTheFly", payload: { type: string | undefined; data: any }): void;
|
defineEmits<
|
||||||
}>();
|
(
|
||||||
|
e: "saveFormOnTheFly",
|
||||||
|
payload: { type: string | undefined; data: any },
|
||||||
|
) => void
|
||||||
|
>();
|
||||||
|
|
||||||
type castEditPersonType = InstanceType<typeof PersonEdit>;
|
type castEditPersonType = InstanceType<typeof PersonEdit>;
|
||||||
type castEditThirdPartyType = InstanceType<typeof ThirdPartyEdit>;
|
type castEditThirdPartyType = InstanceType<typeof ThirdPartyEdit>;
|
||||||
const castEditPerson = useTemplateRef<castEditPersonType>('castEditPerson')
|
const castEditPerson = useTemplateRef<castEditPersonType>("castEditPerson");
|
||||||
const castEditThirdParty = useTemplateRef<castEditThirdPartyType>('castEditThirdParty');
|
const castEditThirdParty =
|
||||||
|
useTemplateRef<castEditThirdPartyType>("castEditThirdParty");
|
||||||
|
|
||||||
const modal = ref<{ showModal: boolean; modalDialogClass: string }>({
|
const modal = ref<{ showModal: boolean; modalDialogClass: string }>({
|
||||||
showModal: false,
|
showModal: false,
|
||||||
@@ -234,35 +239,35 @@ const titleAction = computed<string>(() => {
|
|||||||
|
|
||||||
const titleCreate = computed<string>(() => {
|
const titleCreate = computed<string>(() => {
|
||||||
if (typeof props.allowedTypes === "undefined") {
|
if (typeof props.allowedTypes === "undefined") {
|
||||||
return trans(ONTHEFLY_CREATE_TITLE_DEFAULT)
|
return trans(ONTHEFLY_CREATE_TITLE_DEFAULT);
|
||||||
}
|
}
|
||||||
return props.allowedTypes.every((t: EntityType) => t === "person")
|
return props.allowedTypes.every((t: EntityType) => t === "person")
|
||||||
? (trans(ONTHEFLY_CREATE_TITLE_PERSON))
|
? trans(ONTHEFLY_CREATE_TITLE_PERSON)
|
||||||
: props.allowedTypes.every((t: EntityType) => t === "thirdparty")
|
: props.allowedTypes.every((t: EntityType) => t === "thirdparty")
|
||||||
? (trans(ONTHEFLY_CREATE_TITLE_THIRDPARTY))
|
? trans(ONTHEFLY_CREATE_TITLE_THIRDPARTY)
|
||||||
: (trans(ONTHEFLY_CREATE_TITLE_DEFAULT));
|
: trans(ONTHEFLY_CREATE_TITLE_DEFAULT);
|
||||||
});
|
});
|
||||||
|
|
||||||
const titleModal = computed<string>(() => {
|
const titleModal = computed<string>(() => {
|
||||||
switch (props.action) {
|
switch (props.action) {
|
||||||
case "show":
|
case "show":
|
||||||
if (props.type == "person") {
|
if (props.type == "person") {
|
||||||
return trans(ONTHEFLY_SHOW_PERSON)
|
return trans(ONTHEFLY_SHOW_PERSON);
|
||||||
} else if (props.type == "thirdparty") {
|
} else if (props.type == "thirdparty") {
|
||||||
return trans(ONTHEFLY_SHOW_THIRDPARTY)
|
return trans(ONTHEFLY_SHOW_THIRDPARTY);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "edit":
|
case "edit":
|
||||||
if (props.type == "person") {
|
if (props.type == "person") {
|
||||||
return trans(ONTHEFLY_EDIT_PERSON)
|
return trans(ONTHEFLY_EDIT_PERSON);
|
||||||
} else if (props.type == "thirdparty") {
|
} else if (props.type == "thirdparty") {
|
||||||
return trans(ONTHEFLY_EDIT_THIRDPARTY)
|
return trans(ONTHEFLY_EDIT_THIRDPARTY);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "create":
|
case "create":
|
||||||
return titleCreate.value;
|
return titleCreate.value;
|
||||||
case "addContact":
|
case "addContact":
|
||||||
return trans(THIRDPARTY_ADDCONTACT_TITLE)
|
return trans(THIRDPARTY_ADDCONTACT_TITLE);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -311,7 +316,10 @@ function openModal(): void {
|
|||||||
modal.value.showModal = true;
|
modal.value.showModal = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildLocation(id: string | number | undefined, type: EntityType | undefined): string | undefined {
|
function buildLocation(
|
||||||
|
id: string | number | undefined,
|
||||||
|
type: EntityType | undefined,
|
||||||
|
): string | undefined {
|
||||||
if (type === "person") {
|
if (type === "person") {
|
||||||
return encodeURI(`/fr/person/${id}/general${getReturnPath.value}`);
|
return encodeURI(`/fr/person/${id}/general${getReturnPath.value}`);
|
||||||
} else if (type === "thirdparty") {
|
} else if (type === "thirdparty") {
|
||||||
@@ -324,17 +332,16 @@ async function saveAction() {
|
|||||||
if (props.type === "person") {
|
if (props.type === "person") {
|
||||||
const person = await castEditPerson.value?.postPerson();
|
const person = await castEditPerson.value?.postPerson();
|
||||||
if (null !== person) {
|
if (null !== person) {
|
||||||
emit("saveFormOnTheFly", {type: props.type, data: person})
|
emit("saveFormOnTheFly", { type: props.type, data: person });
|
||||||
}
|
}
|
||||||
} else if (props.type === 'thirdparty') {
|
} else if (props.type === "thirdparty") {
|
||||||
const thirdParty = await castEditThirdParty.value?.postThirdParty();
|
const thirdParty = await castEditThirdParty.value?.postThirdParty();
|
||||||
if (null !== thirdParty) {
|
if (null !== thirdParty) {
|
||||||
emit("saveFormOnTheFly", {type: props.type, data: thirdParty })
|
emit("saveFormOnTheFly", { type: props.type, data: thirdParty });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
openModal,
|
openModal,
|
||||||
closeModal,
|
closeModal,
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
>
|
>
|
||||||
{{ p.text }}
|
{{ p.text }}
|
||||||
</span>
|
</span>
|
||||||
<span v-else
|
<span
|
||||||
|
v-else
|
||||||
:class="getBadgeClass(p)"
|
:class="getBadgeClass(p)"
|
||||||
class="chill_denomination"
|
class="chill_denomination"
|
||||||
:style="getBadgeStyle(p)"
|
:style="getBadgeStyle(p)"
|
||||||
@@ -61,12 +62,14 @@
|
|||||||
@click="addNewSuggested(s)"
|
@click="addNewSuggested(s)"
|
||||||
style="margin: 0"
|
style="margin: 0"
|
||||||
>
|
>
|
||||||
<span v-if="!isEntityHousehold(s)" :class="getBadgeClass(s)" :style="getBadgeStyle(s)">
|
<span
|
||||||
|
v-if="!isEntityHousehold(s)"
|
||||||
|
:class="getBadgeClass(s)"
|
||||||
|
:style="getBadgeStyle(s)"
|
||||||
|
>
|
||||||
{{ s.text }}
|
{{ s.text }}
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else> Ménage n°{{ s.id }} </span>
|
||||||
Ménage n°{{ s.id }}
|
|
||||||
</span>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -85,7 +88,8 @@ import AddPersons from "ChillPersonAssets/vuejs/_components/AddPersons.vue";
|
|||||||
import {
|
import {
|
||||||
Entities,
|
Entities,
|
||||||
EntitiesOrMe,
|
EntitiesOrMe,
|
||||||
EntityType, isEntityHousehold,
|
EntityType,
|
||||||
|
isEntityHousehold,
|
||||||
SearchOptions,
|
SearchOptions,
|
||||||
Suggestion,
|
Suggestion,
|
||||||
} from "ChillPersonAssets/types";
|
} from "ChillPersonAssets/types";
|
||||||
|
|||||||
@@ -47,9 +47,7 @@ const canRemove = computed<boolean>((): boolean => {
|
|||||||
</p>
|
</p>
|
||||||
<div v-else class="flex-table">
|
<div v-else class="flex-table">
|
||||||
<div v-for="a in notNullAttachments" :key="a.id" class="item-bloc">
|
<div v-for="a in notNullAttachments" :key="a.id" class="item-bloc">
|
||||||
<generic-doc-item-box
|
<generic-doc-item-box :generic-doc="a.genericDoc"></generic-doc-item-box>
|
||||||
:generic-doc="a.genericDoc"
|
|
||||||
></generic-doc-item-box>
|
|
||||||
<div class="item-row separator">
|
<div class="item-row separator">
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -49,9 +49,8 @@ onMounted(async () => {
|
|||||||
|
|
||||||
genericDocs.value = fetchedGenericDocs.filter(
|
genericDocs.value = fetchedGenericDocs.filter(
|
||||||
(doc) =>
|
(doc) =>
|
||||||
!documentClasses.includes(
|
!documentClasses.includes(props.workflow?.relatedEntityClass || "") ||
|
||||||
props.workflow?.relatedEntityClass || "",
|
props.workflow?.relatedEntityId !== doc.identifiers.id,
|
||||||
) || props.workflow?.relatedEntityId !== doc.identifiers.id,
|
|
||||||
);
|
);
|
||||||
loaded.value = true;
|
loaded.value = true;
|
||||||
});
|
});
|
||||||
@@ -124,9 +123,7 @@ const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return needles.every((n: string) =>
|
return needles.every((n: string) => title.toLowerCase().includes(n));
|
||||||
title.toLowerCase().includes(n),
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.filter((genericDoc: GenericDocForAccompanyingPeriod) => {
|
.filter((genericDoc: GenericDocForAccompanyingPeriod) => {
|
||||||
if (placesFilter.value.length === 0) {
|
if (placesFilter.value.length === 0) {
|
||||||
@@ -167,8 +164,7 @@ const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => {
|
|||||||
aria-controls="filterOrderCollapse"
|
aria-controls="filterOrderCollapse"
|
||||||
>
|
>
|
||||||
<strong
|
<strong
|
||||||
><i class="fa fa-fw fa-filter"></i>Filtrer la
|
><i class="fa fa-fw fa-filter"></i>Filtrer la liste</strong
|
||||||
liste</strong
|
|
||||||
>
|
>
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
@@ -193,10 +189,7 @@ const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => {
|
|||||||
placeholder="Chercher dans la liste"
|
placeholder="Chercher dans la liste"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
/>
|
/>
|
||||||
<button
|
<button type="submit" class="btn btn-misc">
|
||||||
type="submit"
|
|
||||||
class="btn btn-misc"
|
|
||||||
>
|
|
||||||
<i class="fa fa-search"></i>
|
<i class="fa fa-search"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -204,9 +197,7 @@ const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row my-2">
|
<div class="row my-2">
|
||||||
<legend
|
<legend class="col-form-label col-sm-4 required">
|
||||||
class="col-form-label col-sm-4 required"
|
|
||||||
>
|
|
||||||
Date du document
|
Date du document
|
||||||
</legend>
|
</legend>
|
||||||
<div class="col-sm-8 pt-1">
|
<div class="col-sm-8 pt-1">
|
||||||
@@ -232,15 +223,9 @@ const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row my-2">
|
<div class="row my-2">
|
||||||
<div class="col-sm-4 col-form-label">
|
<div class="col-sm-4 col-form-label">Filtrer par</div>
|
||||||
Filtrer par
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-8 pt-2">
|
<div class="col-sm-8 pt-2">
|
||||||
<div
|
<div class="form-check" v-for="p in availablePlaces" :key="p">
|
||||||
class="form-check"
|
|
||||||
v-for="p in availablePlaces"
|
|
||||||
:key="p"
|
|
||||||
>
|
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
v-model="placesFilter"
|
v-model="placesFilter"
|
||||||
@@ -248,9 +233,7 @@ const filteredDocuments = computed<GenericDocForAccompanyingPeriod[]>(() => {
|
|||||||
class="form-check-input"
|
class="form-check-input"
|
||||||
:value="p"
|
:value="p"
|
||||||
/>
|
/>
|
||||||
<label class="form-check-label">{{
|
<label class="form-check-label">{{ placeTrans(p) }}</label>
|
||||||
placeTrans(p)
|
|
||||||
}}</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -100,8 +100,8 @@ defineExpose({ openModal, closeModal });
|
|||||||
@click="onConfirm"
|
@click="onConfirm"
|
||||||
>
|
>
|
||||||
<template v-if="numberOfPicked > 1">
|
<template v-if="numberOfPicked > 1">
|
||||||
<i class="fa fa-plus"></i> Ajouter
|
<i class="fa fa-plus"></i> Ajouter {{ numberOfPicked }} pièces
|
||||||
{{ numberOfPicked }} pièces jointes
|
jointes
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<i class="fa fa-plus"></i> Ajouter une pièce jointe
|
<i class="fa fa-plus"></i> Ajouter une pièce jointe
|
||||||
|
|||||||
@@ -5,10 +5,7 @@
|
|||||||
:class="{ active: subscriberFinal }"
|
:class="{ active: subscriberFinal }"
|
||||||
type="button"
|
type="button"
|
||||||
@click="
|
@click="
|
||||||
subscribeTo(
|
subscribeTo(subscriberFinal ? 'unsubscribe' : 'subscribe', 'final')
|
||||||
subscriberFinal ? 'unsubscribe' : 'subscribe',
|
|
||||||
'final',
|
|
||||||
)
|
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
@@ -21,12 +18,7 @@
|
|||||||
class="btn btn-outline-primary text-start d-flex align-items-center"
|
class="btn btn-outline-primary text-start d-flex align-items-center"
|
||||||
:class="{ active: subscriberStep }"
|
:class="{ active: subscriberStep }"
|
||||||
type="button"
|
type="button"
|
||||||
@click="
|
@click="subscribeTo(subscriberStep ? 'unsubscribe' : 'subscribe', 'step')"
|
||||||
subscribeTo(
|
|
||||||
subscriberStep ? 'unsubscribe' : 'subscribe',
|
|
||||||
'step',
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="fa fa-fw me-2"
|
class="fa fa-fw me-2"
|
||||||
|
|||||||
@@ -23,10 +23,7 @@
|
|||||||
<slot name="body"></slot>
|
<slot name="body"></slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer" v-if="!hideFooter">
|
<div class="modal-footer" v-if="!hideFooter">
|
||||||
<button
|
<button class="btn btn-cancel" @click="emits('close')">
|
||||||
class="btn btn-cancel"
|
|
||||||
@click="emits('close')"
|
|
||||||
>
|
|
||||||
{{ trans(MODAL_ACTION_CLOSE) }}
|
{{ trans(MODAL_ACTION_CLOSE) }}
|
||||||
</button>
|
</button>
|
||||||
<slot name="footer"></slot>
|
<slot name="footer"></slot>
|
||||||
@@ -53,10 +50,10 @@ import { trans, MODAL_ACTION_CLOSE } from "translator";
|
|||||||
import { defineProps } from "vue";
|
import { defineProps } from "vue";
|
||||||
|
|
||||||
defineSlots<{
|
defineSlots<{
|
||||||
header?: () => any,
|
header?: () => any;
|
||||||
body?: () => any,
|
body?: () => any;
|
||||||
footer?: () => any,
|
footer?: () => any;
|
||||||
"body-head"?: () => any,
|
"body-head"?: () => any;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
export interface ModalProps {
|
export interface ModalProps {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { ValidationExceptionInterface } from "ChillMainAssets/types";
|
import { ValidationExceptionInterface } from "ChillMainAssets/types";
|
||||||
|
|
||||||
export function useViolationList<T extends Record<string, Record<string, string>>>() {
|
export function useViolationList<
|
||||||
|
T extends Record<string, Record<string, string>>,
|
||||||
|
>() {
|
||||||
type ViolationKey = Extract<keyof T, string>;
|
type ViolationKey = Extract<keyof T, string>;
|
||||||
const violationsList = ref<ValidationExceptionInterface<T> | null>(null);
|
const violationsList = ref<ValidationExceptionInterface<T> | null>(null);
|
||||||
|
|
||||||
@@ -9,15 +11,15 @@ export function useViolationList<T extends Record<string, Record<string, string>
|
|||||||
if (null === violationsList.value) {
|
if (null === violationsList.value) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
const r = violationsList.value.violationsByNormalizedProperty(property).map((v) => v.title);
|
const r = violationsList.value
|
||||||
|
.violationsByNormalizedProperty(property)
|
||||||
|
.map((v) => v.title);
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
}
|
}
|
||||||
function violationTitlesWithParameter<
|
function violationTitlesWithParameter<
|
||||||
P extends ViolationKey,
|
P extends ViolationKey,
|
||||||
Param extends Extract<keyof T[P], string>
|
Param extends Extract<keyof T[P], string>,
|
||||||
>(
|
>(
|
||||||
property: P,
|
property: P,
|
||||||
with_parameter: Param,
|
with_parameter: Param,
|
||||||
@@ -26,26 +28,38 @@ export function useViolationList<T extends Record<string, Record<string, string>
|
|||||||
if (violationsList.value === null) {
|
if (violationsList.value === null) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return violationsList.value.violationsByNormalizedPropertyAndParams(property, with_parameter, with_parameter_value)
|
return violationsList.value
|
||||||
|
.violationsByNormalizedPropertyAndParams(
|
||||||
|
property,
|
||||||
|
with_parameter,
|
||||||
|
with_parameter_value,
|
||||||
|
)
|
||||||
.map((v) => v.title);
|
.map((v) => v.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function hasViolation<P extends ViolationKey>(property: P): boolean {
|
function hasViolation<P extends ViolationKey>(property: P): boolean {
|
||||||
return violationTitles(property).length > 0;
|
return violationTitles(property).length > 0;
|
||||||
}
|
}
|
||||||
function hasViolationWithParameter<
|
function hasViolationWithParameter<
|
||||||
P extends ViolationKey,
|
P extends ViolationKey,
|
||||||
Param extends Extract<keyof T[P], string>
|
Param extends Extract<keyof T[P], string>,
|
||||||
>(
|
>(
|
||||||
property: P,
|
property: P,
|
||||||
with_parameter: Param,
|
with_parameter: Param,
|
||||||
with_parameter_value: T[P][Param],
|
with_parameter_value: T[P][Param],
|
||||||
): boolean {
|
): boolean {
|
||||||
return violationTitlesWithParameter(property, with_parameter, with_parameter_value).length > 0;
|
return (
|
||||||
|
violationTitlesWithParameter(
|
||||||
|
property,
|
||||||
|
with_parameter,
|
||||||
|
with_parameter_value,
|
||||||
|
).length > 0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValidationException<V extends ValidationExceptionInterface<T>>(validationException: V): void {
|
function setValidationException<V extends ValidationExceptionInterface<T>>(
|
||||||
|
validationException: V,
|
||||||
|
): void {
|
||||||
violationsList.value = validationException;
|
violationsList.value = validationException;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,5 +67,12 @@ export function useViolationList<T extends Record<string, Record<string, string>
|
|||||||
violationsList.value = null;
|
violationsList.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {violationTitles, violationTitlesWithParameter, setValidationException, cleanException, hasViolationWithParameter, hasViolation};
|
return {
|
||||||
|
violationTitles,
|
||||||
|
violationTitlesWithParameter,
|
||||||
|
setValidationException,
|
||||||
|
cleanException,
|
||||||
|
hasViolationWithParameter,
|
||||||
|
hasViolation,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ import {
|
|||||||
DateTimeWrite,
|
DateTimeWrite,
|
||||||
SetGender,
|
SetGender,
|
||||||
SetCenter,
|
SetCenter,
|
||||||
SetCivility, Gender,
|
SetCivility,
|
||||||
|
Gender,
|
||||||
} from "ChillMainAssets/types";
|
} from "ChillMainAssets/types";
|
||||||
import { StoredObject } from "ChillDocStoreAssets/types";
|
import { StoredObject } from "ChillDocStoreAssets/types";
|
||||||
import { Thirdparty } from "../../../ChillThirdPartyBundle/Resources/public/types";
|
import { Thirdparty } from "../../../ChillThirdPartyBundle/Resources/public/types";
|
||||||
@@ -299,7 +300,7 @@ export interface AccompanyingPeriodWorkGoal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AccompanyingPeriodWorkEvaluation {
|
export interface AccompanyingPeriodWorkEvaluation {
|
||||||
type: 'accompanying_period_work_evaluation';
|
type: "accompanying_period_work_evaluation";
|
||||||
accompanyingPeriodWork: AccompanyingPeriodWork | null;
|
accompanyingPeriodWork: AccompanyingPeriodWork | null;
|
||||||
comment: string;
|
comment: string;
|
||||||
createdAt: DateTime | null;
|
createdAt: DateTime | null;
|
||||||
@@ -432,7 +433,7 @@ export type EntityType =
|
|||||||
| "user"
|
| "user"
|
||||||
| "household";
|
| "household";
|
||||||
|
|
||||||
export type Entities = (UserGroup | User | Person | Thirdparty | Household);
|
export type Entities = UserGroup | User | Person | Thirdparty | Household;
|
||||||
|
|
||||||
export function isEntityHousehold(e: Entities): e is Household {
|
export function isEntityHousehold(e: Entities): e is Household {
|
||||||
return e.type === "household";
|
return e.type === "household";
|
||||||
@@ -440,25 +441,34 @@ export function isEntityHousehold(e: Entities): e is Household {
|
|||||||
|
|
||||||
export type EntitiesOrMe = "me" | Entities;
|
export type EntitiesOrMe = "me" | Entities;
|
||||||
|
|
||||||
|
|
||||||
// Type guards to discriminate Suggestions by their result kind
|
// Type guards to discriminate Suggestions by their result kind
|
||||||
export function isSuggestionForUserGroup(s: Suggestion): s is Suggestion & { result: UserGroup } {
|
export function isSuggestionForUserGroup(
|
||||||
|
s: Suggestion,
|
||||||
|
): s is Suggestion & { result: UserGroup } {
|
||||||
return (s as any)?.result?.type === "user_group";
|
return (s as any)?.result?.type === "user_group";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isSuggestionForUser(s: Suggestion): s is Suggestion & { result: User } {
|
export function isSuggestionForUser(
|
||||||
|
s: Suggestion,
|
||||||
|
): s is Suggestion & { result: User } {
|
||||||
return (s as any)?.result?.type === "user";
|
return (s as any)?.result?.type === "user";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isSuggestionForPerson(s: Suggestion): s is Suggestion & { result: Person } {
|
export function isSuggestionForPerson(
|
||||||
|
s: Suggestion,
|
||||||
|
): s is Suggestion & { result: Person } {
|
||||||
return (s as any)?.result?.type === "person";
|
return (s as any)?.result?.type === "person";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isSuggestionForThirdParty(s: Suggestion): s is Suggestion & { result: Thirdparty } {
|
export function isSuggestionForThirdParty(
|
||||||
|
s: Suggestion,
|
||||||
|
): s is Suggestion & { result: Thirdparty } {
|
||||||
return (s as any)?.result?.type === "thirdparty";
|
return (s as any)?.result?.type === "thirdparty";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isSuggestionForHousehold(s: Suggestion): s is Suggestion & { result: Household } {
|
export function isSuggestionForHousehold(
|
||||||
|
s: Suggestion,
|
||||||
|
): s is Suggestion & { result: Household } {
|
||||||
return (s as any)?.result?.type === "household";
|
return (s as any)?.result?.type === "household";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,7 +492,7 @@ export interface SearchPagination {
|
|||||||
export interface Search {
|
export interface Search {
|
||||||
count: number;
|
count: number;
|
||||||
pagination: SearchPagination;
|
pagination: SearchPagination;
|
||||||
results: {relevance: number, result: Entities}[];
|
results: { relevance: number; result: Entities }[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SearchOptions {
|
export interface SearchOptions {
|
||||||
@@ -498,7 +508,11 @@ export interface SearchOptions {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
type PersonIdentifierPresence = 'NOT_EDITABLE' | 'ON_EDIT' | 'ON_CREATION' | 'REQUIRED';
|
type PersonIdentifierPresence =
|
||||||
|
| "NOT_EDITABLE"
|
||||||
|
| "ON_EDIT"
|
||||||
|
| "ON_CREATION"
|
||||||
|
| "REQUIRED";
|
||||||
|
|
||||||
export interface PersonIdentifierWorker {
|
export interface PersonIdentifierWorker {
|
||||||
type: "person_identifier_worker";
|
type: "person_identifier_worker";
|
||||||
|
|||||||
@@ -42,9 +42,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button class="btn btn-save" @click="modal.showModal = true">
|
||||||
class="btn btn-save"
|
|
||||||
@click="modal.showModal = true">
|
|
||||||
{{ $t("confirm.ok") }}
|
{{ $t("confirm.ok") }}
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -84,8 +84,12 @@
|
|||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li class="add-persons">
|
<li class="add-persons">
|
||||||
<add-persons
|
<add-persons
|
||||||
:button-title="trans(ACCOMPANYING_COURSE_PERSONS_ASSOCIATED_ADD_PERSON)"
|
:button-title="
|
||||||
:modal-title="trans(ACCOMPANYING_COURSE_PERSONS_ASSOCIATED_ADD_PERSON)"
|
trans(ACCOMPANYING_COURSE_PERSONS_ASSOCIATED_ADD_PERSON)
|
||||||
|
"
|
||||||
|
:modal-title="
|
||||||
|
trans(ACCOMPANYING_COURSE_PERSONS_ASSOCIATED_ADD_PERSON)
|
||||||
|
"
|
||||||
:key="addPersons.key"
|
:key="addPersons.key"
|
||||||
:options="addPersons.options"
|
:options="addPersons.options"
|
||||||
@add-new-persons="addNewPersons"
|
@add-new-persons="addNewPersons"
|
||||||
@@ -108,7 +112,10 @@ import { mapGetters, mapState } from "vuex";
|
|||||||
import ParticipationItem from "./PersonsAssociated/ParticipationItem.vue";
|
import ParticipationItem from "./PersonsAssociated/ParticipationItem.vue";
|
||||||
import AddPersons from "ChillPersonAssets/vuejs/_components/AddPersons.vue";
|
import AddPersons from "ChillPersonAssets/vuejs/_components/AddPersons.vue";
|
||||||
import PersonText from "ChillPersonAssets/vuejs/_components/Entity/PersonText.vue";
|
import PersonText from "ChillPersonAssets/vuejs/_components/Entity/PersonText.vue";
|
||||||
import {ACCOMPANYING_COURSE_PERSONS_ASSOCIATED_ADD_PERSON, trans} from "translator";
|
import {
|
||||||
|
ACCOMPANYING_COURSE_PERSONS_ASSOCIATED_ADD_PERSON,
|
||||||
|
trans,
|
||||||
|
} from "translator";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "PersonsAssociated",
|
name: "PersonsAssociated",
|
||||||
|
|||||||
@@ -55,9 +55,7 @@
|
|||||||
<!-- 1. Goals with results that were already selected/saved to the entity -->
|
<!-- 1. Goals with results that were already selected/saved to the entity -->
|
||||||
<div v-for="g in goalsPicked" :key="g.goal.id">
|
<div v-for="g in goalsPicked" :key="g.goal.id">
|
||||||
<div class="item-title" @click="removeGoal(g)">
|
<div class="item-title" @click="removeGoal(g)">
|
||||||
<span class="removable">{{
|
<span class="removable">{{ localizeString(g.goal.title) }}</span>
|
||||||
localizeString(g.goal.title)
|
|
||||||
}}</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<add-result :goal="g.goal" destination="goal"></add-result>
|
<add-result :goal="g.goal" destination="goal"></add-result>
|
||||||
@@ -90,14 +88,8 @@
|
|||||||
|
|
||||||
<!-- 3. Selector for objectives with results -->
|
<!-- 3. Selector for objectives with results -->
|
||||||
<div class="accordion" id="expandedSuggestions">
|
<div class="accordion" id="expandedSuggestions">
|
||||||
<div
|
<div v-if="availableForCheckGoal.length > 0" class="accordion-item">
|
||||||
v-if="availableForCheckGoal.length > 0"
|
<h2 class="accordion-header" id="heading_expanded_suggestions">
|
||||||
class="accordion-item"
|
|
||||||
>
|
|
||||||
<h2
|
|
||||||
class="accordion-header"
|
|
||||||
id="heading_expanded_suggestions"
|
|
||||||
>
|
|
||||||
<button
|
<button
|
||||||
v-if="isExpanded"
|
v-if="isExpanded"
|
||||||
class="accordion-button"
|
class="accordion-button"
|
||||||
@@ -138,10 +130,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<p
|
<p v-if="goalsPicked.length === 0" class="chill-no-data-statement">
|
||||||
v-if="goalsPicked.length === 0"
|
|
||||||
class="chill-no-data-statement"
|
|
||||||
>
|
|
||||||
Aucun objectif associé
|
Aucun objectif associé
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -188,10 +177,7 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<ul
|
<ul class="record_actions" v-if="evaluationsForAction.length > 0">
|
||||||
class="record_actions"
|
|
||||||
v-if="evaluationsForAction.length > 0"
|
|
||||||
>
|
|
||||||
<li>
|
<li>
|
||||||
<button
|
<button
|
||||||
:title="$t('add_an_evaluation')"
|
:title="$t('add_an_evaluation')"
|
||||||
@@ -223,10 +209,7 @@
|
|||||||
class="me-2 form-check-input"
|
class="me-2 form-check-input"
|
||||||
:id="'person_check' + p.id"
|
:id="'person_check' + p.id"
|
||||||
/>
|
/>
|
||||||
<label
|
<label :for="'person_check' + p.id" class="form-check-label">
|
||||||
:for="'person_check' + p.id"
|
|
||||||
class="form-check-label"
|
|
||||||
>
|
|
||||||
<person-text :person="p"></person-text>
|
<person-text :person="p"></person-text>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -244,10 +227,7 @@
|
|||||||
class="me-2 form-check-input"
|
class="me-2 form-check-input"
|
||||||
:id="'person_check' + p.id"
|
:id="'person_check' + p.id"
|
||||||
/>
|
/>
|
||||||
<label
|
<label :for="'person_check' + p.id" class="form-check-label">
|
||||||
:for="'person_check' + p.id"
|
|
||||||
class="form-check-label"
|
|
||||||
>
|
|
||||||
<person-text :person="p"></person-text>
|
<person-text :person="p"></person-text>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -310,9 +290,7 @@
|
|||||||
<add-persons
|
<add-persons
|
||||||
ref="handlingThirdPartyPicker"
|
ref="handlingThirdPartyPicker"
|
||||||
v-bind:key="handlingThirdPartyPicker.key"
|
v-bind:key="handlingThirdPartyPicker.key"
|
||||||
v-bind:buttonTitle="
|
v-bind:buttonTitle="$t('precise_handling_thirdparty')"
|
||||||
$t('precise_handling_thirdparty')
|
|
||||||
"
|
|
||||||
v-bind:modalTitle="$t('choose_a_thirdparty')"
|
v-bind:modalTitle="$t('choose_a_thirdparty')"
|
||||||
v-bind:options="handlingThirdPartyPicker.options"
|
v-bind:options="handlingThirdPartyPicker.options"
|
||||||
@addNewPersons="setHandlingThirdParty"
|
@addNewPersons="setHandlingThirdParty"
|
||||||
@@ -458,23 +436,16 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
</button>
|
</button>
|
||||||
<ul
|
<ul class="dropdown-menu" aria-labelledby="btnGroupNotifyButtons">
|
||||||
class="dropdown-menu"
|
|
||||||
aria-labelledby="btnGroupNotifyButtons"
|
|
||||||
>
|
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="dropdown-item" @click="goToGenerateNotification(true)">{{
|
||||||
class="dropdown-item"
|
$t("notification_notify_referrer")
|
||||||
@click="goToGenerateNotification(true)"
|
}}</a>
|
||||||
>{{ $t("notification_notify_referrer") }}</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="dropdown-item" @click="goToGenerateNotification(false)">{{
|
||||||
class="dropdown-item"
|
$t("notification_notify_any")
|
||||||
@click="goToGenerateNotification(false)"
|
}}</a>
|
||||||
>{{ $t("notification_notify_any") }}</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</template>
|
</template>
|
||||||
@@ -523,8 +494,7 @@ const i18n = {
|
|||||||
available_goals_text:
|
available_goals_text:
|
||||||
"Motifs, objectifs et dispositifs disponibles pour ajout :",
|
"Motifs, objectifs et dispositifs disponibles pour ajout :",
|
||||||
results_title: "Orientations - résultats",
|
results_title: "Orientations - résultats",
|
||||||
results_without_objective:
|
results_without_objective: "Résultats - orientations sans objectifs",
|
||||||
"Résultats - orientations sans objectifs",
|
|
||||||
add_objectif: "Ajouter un motif - objectif - dispositif",
|
add_objectif: "Ajouter un motif - objectif - dispositif",
|
||||||
add_an_objective: "Ajouter un objectif",
|
add_an_objective: "Ajouter un objectif",
|
||||||
Evaluations: "Évaluations",
|
Evaluations: "Évaluations",
|
||||||
@@ -725,10 +695,7 @@ export default {
|
|||||||
this.showAddEvaluation = !this.showAddEvaluation;
|
this.showAddEvaluation = !this.showAddEvaluation;
|
||||||
},
|
},
|
||||||
setHandlingThirdParty({ selected, modal }) {
|
setHandlingThirdParty({ selected, modal }) {
|
||||||
this.$store.commit(
|
this.$store.commit("setHandlingThirdParty", selected.shift().result);
|
||||||
"setHandlingThirdParty",
|
|
||||||
selected.shift().result,
|
|
||||||
);
|
|
||||||
this.$refs.handlingThirdPartyPicker.resetSearch();
|
this.$refs.handlingThirdPartyPicker.resetSearch();
|
||||||
modal.showModal = false;
|
modal.showModal = false;
|
||||||
},
|
},
|
||||||
@@ -840,9 +807,7 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
scrollToElement(docAnchorId) {
|
scrollToElement(docAnchorId) {
|
||||||
const documentEl = document.getElementById(
|
const documentEl = document.getElementById(`document_${docAnchorId}`);
|
||||||
`document_${docAnchorId}`,
|
|
||||||
);
|
|
||||||
if (documentEl) {
|
if (documentEl) {
|
||||||
documentEl.scrollIntoView({ behavior: "smooth" });
|
documentEl.scrollIntoView({ behavior: "smooth" });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,15 +6,11 @@
|
|||||||
class="item-bloc"
|
class="item-bloc"
|
||||||
v-for="(d, i) in documents"
|
v-for="(d, i) in documents"
|
||||||
:key="d.id"
|
:key="d.id"
|
||||||
:class="[
|
:class="[parseInt(docAnchorId) === d.id ? 'bg-blink' : 'nothing']"
|
||||||
parseInt(docAnchorId) === d.id ? 'bg-blink' : 'nothing',
|
|
||||||
]"
|
|
||||||
>
|
>
|
||||||
<div :id="'document_' + d.id" class="item-row">
|
<div :id="'document_' + d.id" class="item-row">
|
||||||
<div class="input-group input-group-lg mb-3 row">
|
<div class="input-group input-group-lg mb-3 row">
|
||||||
<label class="col-sm-3 col-form-label"
|
<label class="col-sm-3 col-form-label">Titre du document:</label>
|
||||||
>Titre du document:</label
|
|
||||||
>
|
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<input
|
<input
|
||||||
class="form-control document-title"
|
class="form-control document-title"
|
||||||
@@ -32,9 +28,7 @@
|
|||||||
<p v-if="d.createdBy" class="createdBy">
|
<p v-if="d.createdBy" class="createdBy">
|
||||||
Créé par {{ d.createdBy.text }}<br />
|
Créé par {{ d.createdBy.text }}<br />
|
||||||
Le
|
Le
|
||||||
{{
|
{{ $d(ISOToDatetime(d.createdAt.datetime), "long") }}
|
||||||
$d(ISOToDatetime(d.createdAt.datetime), "long")
|
|
||||||
}}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -43,8 +37,7 @@
|
|||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li
|
<li
|
||||||
v-if="
|
v-if="
|
||||||
d.workflows_availables.length > 0 ||
|
d.workflows_availables.length > 0 || d.workflows.length > 0
|
||||||
d.workflows.length > 0
|
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<list-workflow-modal
|
<list-workflow-modal
|
||||||
@@ -52,9 +45,7 @@
|
|||||||
:allowCreate="true"
|
:allowCreate="true"
|
||||||
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument"
|
relatedEntityClass="Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument"
|
||||||
:relatedEntityId="d.id"
|
:relatedEntityId="d.id"
|
||||||
:workflowsAvailables="
|
:workflowsAvailables="d.workflows_availables"
|
||||||
d.workflows_availables
|
|
||||||
"
|
|
||||||
:preventDefaultMoveToGenerate="true"
|
:preventDefaultMoveToGenerate="true"
|
||||||
:goToGenerateWorkflowPayload="{ doc: d }"
|
:goToGenerateWorkflowPayload="{ doc: d }"
|
||||||
@go-to-generate-workflow="
|
@go-to-generate-workflow="
|
||||||
@@ -66,22 +57,14 @@
|
|||||||
<button
|
<button
|
||||||
v-if="AmIRefferer"
|
v-if="AmIRefferer"
|
||||||
class="btn btn-notify"
|
class="btn btn-notify"
|
||||||
@click="
|
@click="$emit('goToGenerateNotification', d, false)"
|
||||||
$emit(
|
|
||||||
'goToGenerateNotification',
|
|
||||||
d,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
></button>
|
></button>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<button
|
<button
|
||||||
id="btnGroupNotifyButtons"
|
id="btnGroupNotifyButtons"
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-notify dropdown-toggle"
|
class="btn btn-notify dropdown-toggle"
|
||||||
:title="
|
:title="trans(EVALUATION_NOTIFICATION_SEND)"
|
||||||
trans(EVALUATION_NOTIFICATION_SEND)
|
|
||||||
"
|
|
||||||
data-bs-toggle="dropdown"
|
data-bs-toggle="dropdown"
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
>
|
>
|
||||||
@@ -94,35 +77,17 @@
|
|||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
@click="
|
@click="goToGenerateDocumentNotification(d, true)"
|
||||||
goToGenerateDocumentNotification(
|
|
||||||
d,
|
|
||||||
true,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{
|
{{ trans(EVALUATION_NOTIFICATION_NOTIFY_REFERRER) }}
|
||||||
trans(
|
|
||||||
EVALUATION_NOTIFICATION_NOTIFY_REFERRER,
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
@click="
|
@click="goToGenerateDocumentNotification(d, false)"
|
||||||
goToGenerateDocumentNotification(
|
|
||||||
d,
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
{{
|
{{ trans(EVALUATION_NOTIFICATION_NOTIFY_ANY) }}
|
||||||
trans(
|
|
||||||
EVALUATION_NOTIFICATION_NOTIFY_ANY,
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -133,15 +98,10 @@
|
|||||||
:stored-object="d.storedObject"
|
:stored-object="d.storedObject"
|
||||||
:filename="d.title"
|
:filename="d.title"
|
||||||
:can-edit="true"
|
:can-edit="true"
|
||||||
:execute-before-leave="
|
:execute-before-leave="submitBeforeLeaveToEditor"
|
||||||
submitBeforeLeaveToEditor
|
:davLink="d.storedObject._links?.dav_link.href"
|
||||||
"
|
|
||||||
:davLink="
|
|
||||||
d.storedObject._links?.dav_link.href
|
|
||||||
"
|
|
||||||
:davLinkExpiration="
|
:davLinkExpiration="
|
||||||
d.storedObject._links?.dav_link
|
d.storedObject._links?.dav_link.expiration
|
||||||
.expiration
|
|
||||||
"
|
"
|
||||||
@on-stored-object-status-change="
|
@on-stored-object-status-change="
|
||||||
$emit('statusDocumentChanged', $event)
|
$emit('statusDocumentChanged', $event)
|
||||||
@@ -151,8 +111,7 @@
|
|||||||
<!--replace document-->
|
<!--replace document-->
|
||||||
<li
|
<li
|
||||||
v-if="
|
v-if="
|
||||||
Number.isInteger(d.id) &&
|
Number.isInteger(d.id) && d.storedObject._permissions.canEdit
|
||||||
d.storedObject._permissions.canEdit
|
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<drop-file-modal
|
<drop-file-modal
|
||||||
@@ -183,56 +142,28 @@
|
|||||||
<li v-if="d.workflows.length === 0">
|
<li v-if="d.workflows.length === 0">
|
||||||
<a
|
<a
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
@click="
|
@click="$emit('removeDocument', d)"
|
||||||
$emit('removeDocument', d)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<i
|
<i class="fa fa-trash-o" aria-hidden="true"></i>
|
||||||
class="fa fa-trash-o"
|
{{ trans(EVALUATION_DOCUMENT_DELETE) }}
|
||||||
aria-hidden="true"
|
|
||||||
></i>
|
|
||||||
{{
|
|
||||||
trans(
|
|
||||||
EVALUATION_DOCUMENT_DELETE,
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<!--duplicate document-->
|
<!--duplicate document-->
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
@click="
|
@click="$emit('duplicateDocument', d)"
|
||||||
$emit(
|
|
||||||
'duplicateDocument',
|
|
||||||
d,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<i
|
<i class="fa fa-copy" aria-hidden="true"></i>
|
||||||
class="fa fa-copy"
|
{{ trans(EVALUATION_DOCUMENT_DUPLICATE_HERE) }}
|
||||||
aria-hidden="true"
|
|
||||||
></i>
|
|
||||||
{{
|
|
||||||
trans(
|
|
||||||
EVALUATION_DOCUMENT_DUPLICATE_HERE,
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
@click="
|
@click="prepareDocumentDuplicationToWork(d)"
|
||||||
prepareDocumentDuplicationToWork(
|
|
||||||
d,
|
|
||||||
)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<i
|
<i class="fa fa-copy" aria-hidden="true"></i>
|
||||||
class="fa fa-copy"
|
|
||||||
aria-hidden="true"
|
|
||||||
></i>
|
|
||||||
{{
|
{{
|
||||||
trans(
|
trans(
|
||||||
EVALUATION_DOCUMENT_DUPLICATE_TO_OTHER_EVALUATION,
|
EVALUATION_DOCUMENT_DUPLICATE_TO_OTHER_EVALUATION,
|
||||||
@@ -241,27 +172,13 @@
|
|||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<!--move document-->
|
<!--move document-->
|
||||||
<li
|
<li v-if="d.storedObject._permissions.canEdit">
|
||||||
v-if="
|
|
||||||
d.storedObject._permissions
|
|
||||||
.canEdit
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<a
|
<a
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
@click="
|
@click="prepareDocumentMoveToWork(d)"
|
||||||
prepareDocumentMoveToWork(d)
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<i
|
<i class="fa fa-arrows" aria-hidden="true"></i>
|
||||||
class="fa fa-arrows"
|
{{ trans(EVALUATION_DOCUMENT_MOVE) }}</a
|
||||||
aria-hidden="true"
|
|
||||||
></i>
|
|
||||||
{{
|
|
||||||
trans(
|
|
||||||
EVALUATION_DOCUMENT_MOVE,
|
|
||||||
)
|
|
||||||
}}</a
|
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -427,9 +344,7 @@ async function goToGenerateDocumentNotification(document, tos) {
|
|||||||
buildLinkCreateNotification(
|
buildLinkCreateNotification(
|
||||||
"Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument",
|
"Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument",
|
||||||
updatedDocument.id,
|
updatedDocument.id,
|
||||||
tos === true
|
tos === true ? store.state.work.accompanyingPeriod.user?.id : null,
|
||||||
? store.state.work.accompanyingPeriod.user?.id
|
|
||||||
: null,
|
|
||||||
window.location.pathname +
|
window.location.pathname +
|
||||||
window.location.search +
|
window.location.search +
|
||||||
window.location.hash,
|
window.location.hash,
|
||||||
|
|||||||
@@ -29,9 +29,7 @@
|
|||||||
@inputDocumentTitle="onInputDocumentTitle"
|
@inputDocumentTitle="onInputDocumentTitle"
|
||||||
@removeDocument="removeDocument"
|
@removeDocument="removeDocument"
|
||||||
@duplicateDocument="duplicateDocument"
|
@duplicateDocument="duplicateDocument"
|
||||||
@duplicate-document-to-evaluation="
|
@duplicate-document-to-evaluation="duplicateDocumentToEvaluation"
|
||||||
duplicateDocumentToEvaluation
|
|
||||||
"
|
|
||||||
@move-document-to-evaluation="moveDocumentToEvaluation"
|
@move-document-to-evaluation="moveDocumentToEvaluation"
|
||||||
@statusDocumentChanged="onStatusDocumentChanged"
|
@statusDocumentChanged="onStatusDocumentChanged"
|
||||||
@goToGenerateNotification="goToGenerateDocumentNotification"
|
@goToGenerateNotification="goToGenerateDocumentNotification"
|
||||||
@@ -381,9 +379,7 @@ function goToGenerateDocumentNotification(document, tos) {
|
|||||||
buildLinkCreateNotification(
|
buildLinkCreateNotification(
|
||||||
"Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument",
|
"Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument",
|
||||||
updatedDocument.id,
|
updatedDocument.id,
|
||||||
tos === true
|
tos === true ? store.state.work.accompanyingPeriod.user.id : null,
|
||||||
? store.state.work.accompanyingPeriod.user.id
|
|
||||||
: null,
|
|
||||||
window.location.pathname +
|
window.location.pathname +
|
||||||
window.location.search +
|
window.location.search +
|
||||||
window.location.hash,
|
window.location.hash,
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import { fetchResults, makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
|||||||
import { Center, Civility, Gender, SetCenter } from "ChillMainAssets/types";
|
import { Center, Civility, Gender, SetCenter } from "ChillMainAssets/types";
|
||||||
import {
|
import {
|
||||||
AltName,
|
AltName,
|
||||||
Person, PersonIdentifier,
|
Person,
|
||||||
|
PersonIdentifier,
|
||||||
PersonIdentifierWorker,
|
PersonIdentifierWorker,
|
||||||
PersonWrite,
|
PersonWrite,
|
||||||
} from "ChillPersonAssets/types";
|
} from "ChillPersonAssets/types";
|
||||||
@@ -26,21 +27,43 @@ export const personToWritePerson = (person: Person): PersonWrite => {
|
|||||||
type: "person",
|
type: "person",
|
||||||
firstName: person.firstName,
|
firstName: person.firstName,
|
||||||
lastName: person.lastName,
|
lastName: person.lastName,
|
||||||
altNames: person.altNames.map((altName) => ({key: altName.key, value: altName.label})),
|
altNames: person.altNames.map((altName) => ({
|
||||||
|
key: altName.key,
|
||||||
|
value: altName.label,
|
||||||
|
})),
|
||||||
addressId: null,
|
addressId: null,
|
||||||
birthdate: null === person.birthdate ? null : {datetime: person.birthdate.datetime8601},
|
birthdate:
|
||||||
deathdate: null === person.deathdate ? null : {datetime: person.deathdate.datetime8601},
|
null === person.birthdate
|
||||||
|
? null
|
||||||
|
: { datetime: person.birthdate.datetime8601 },
|
||||||
|
deathdate:
|
||||||
|
null === person.deathdate
|
||||||
|
? null
|
||||||
|
: { datetime: person.deathdate.datetime8601 },
|
||||||
phonenumber: person.phonenumber,
|
phonenumber: person.phonenumber,
|
||||||
mobilenumber: person.mobilenumber,
|
mobilenumber: person.mobilenumber,
|
||||||
center: null === person.centers ? null : person.centers
|
center:
|
||||||
|
null === person.centers
|
||||||
|
? null
|
||||||
|
: person.centers
|
||||||
.map((center): SetCenter => ({ id: center.id, type: "center" }))
|
.map((center): SetCenter => ({ id: center.id, type: "center" }))
|
||||||
.find(() => true) || null,
|
.find(() => true) || null,
|
||||||
email: person.email,
|
email: person.email,
|
||||||
civility: null === person.civility ? null : {id: person.civility.id, type: "chill_main_civility"},
|
civility:
|
||||||
gender: null === person.gender ? null : {id: person.gender.id, type: "chill_main_gender"},
|
null === person.civility
|
||||||
identifiers: person.identifiers.map((identifier: PersonIdentifier) => ({type: "person_identifier", definition_id: identifier.definition.id, value: identifier.value})),
|
? null
|
||||||
}
|
: { id: person.civility.id, type: "chill_main_civility" },
|
||||||
}
|
gender:
|
||||||
|
null === person.gender
|
||||||
|
? null
|
||||||
|
: { id: person.gender.id, type: "chill_main_gender" },
|
||||||
|
identifiers: person.identifiers.map((identifier: PersonIdentifier) => ({
|
||||||
|
type: "person_identifier",
|
||||||
|
definition_id: identifier.definition.id,
|
||||||
|
value: identifier.value,
|
||||||
|
})),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const getPersonAltNames = async (): Promise<AltName[]> =>
|
export const getPersonAltNames = async (): Promise<AltName[]> =>
|
||||||
fetch("/api/1.0/person/config/alt_names.json").then((response) => {
|
fetch("/api/1.0/person/config/alt_names.json").then((response) => {
|
||||||
@@ -65,10 +88,12 @@ export const getPersonIdentifiers = async (): Promise<
|
|||||||
PersonIdentifierWorker[]
|
PersonIdentifierWorker[]
|
||||||
> => fetchResults("/api/1.0/person/identifiers/workers");
|
> => fetchResults("/api/1.0/person/identifiers/workers");
|
||||||
|
|
||||||
export interface WritePersonViolationMap
|
export interface WritePersonViolationMap extends Record<
|
||||||
extends Record<string, Record<string, string>> {
|
string,
|
||||||
|
Record<string, string>
|
||||||
|
> {
|
||||||
firstName: {
|
firstName: {
|
||||||
"{{ value }}": string
|
"{{ value }}": string;
|
||||||
};
|
};
|
||||||
lastName: {
|
lastName: {
|
||||||
"{{ value }}": string;
|
"{{ value }}": string;
|
||||||
@@ -96,7 +121,7 @@ export interface WritePersonViolationMap
|
|||||||
birthdate: {};
|
birthdate: {};
|
||||||
identifiers: {
|
identifiers: {
|
||||||
"{{ value }}": string;
|
"{{ value }}": string;
|
||||||
"definition_id": string;
|
definition_id: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export const createPerson = async (person: PersonWrite): Promise<Person> => {
|
export const createPerson = async (person: PersonWrite): Promise<Person> => {
|
||||||
@@ -107,10 +132,13 @@ export const createPerson = async (person: PersonWrite): Promise<Person> => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const editPerson = async (person: PersonWrite, personId: number): Promise<Person> => {
|
export const editPerson = async (
|
||||||
|
person: PersonWrite,
|
||||||
|
personId: number,
|
||||||
|
): Promise<Person> => {
|
||||||
return makeFetch<PersonWrite, Person, WritePersonViolationMap>(
|
return makeFetch<PersonWrite, Person, WritePersonViolationMap>(
|
||||||
"PATCH",
|
"PATCH",
|
||||||
`/api/1.0/person/person/${personId}.json`,
|
`/api/1.0/person/person/${personId}.json`,
|
||||||
person,
|
person,
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -15,11 +15,7 @@
|
|||||||
<ul class="small_in_title columns mt-1">
|
<ul class="small_in_title columns mt-1">
|
||||||
<li>
|
<li>
|
||||||
<span class="item-key">
|
<span class="item-key">
|
||||||
{{
|
{{ trans(ACCOMPANYING_COURSE_WORK_START_DATE) }}
|
||||||
trans(
|
|
||||||
ACCOMPANYING_COURSE_WORK_START_DATE,
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
:
|
:
|
||||||
</span>
|
</span>
|
||||||
<b>{{ formatDate(eval.startDate) }}</b>
|
<b>{{ formatDate(eval.startDate) }}</b>
|
||||||
@@ -27,9 +23,7 @@
|
|||||||
|
|
||||||
<li v-if="eval.endDate">
|
<li v-if="eval.endDate">
|
||||||
<span class="item-key">
|
<span class="item-key">
|
||||||
{{
|
{{ trans(ACCOMPANYING_COURSE_WORK_END_DATE) }}
|
||||||
trans(ACCOMPANYING_COURSE_WORK_END_DATE)
|
|
||||||
}}
|
|
||||||
:
|
:
|
||||||
</span>
|
</span>
|
||||||
<b>{{ formatDate(eval.endDate) }}</b>
|
<b>{{ formatDate(eval.endDate) }}</b>
|
||||||
|
|||||||
@@ -34,8 +34,10 @@
|
|||||||
|
|
||||||
<template #body>
|
<template #body>
|
||||||
<accompanying-period-work-list
|
<accompanying-period-work-list
|
||||||
v-if="evaluations.length === 0":accompanying-period-works="accompanyingPeriodWorks"
|
v-if="evaluations.length === 0"
|
||||||
v-model:selectedAcpw="selectedAcpw"/>
|
:accompanying-period-works="accompanyingPeriodWorks"
|
||||||
|
v-model:selectedAcpw="selectedAcpw"
|
||||||
|
/>
|
||||||
<accompanying-period-work-evaluation-list
|
<accompanying-period-work-evaluation-list
|
||||||
v-if="evaluations.length > 0"
|
v-if="evaluations.length > 0"
|
||||||
:evaluations="evaluations"
|
:evaluations="evaluations"
|
||||||
@@ -59,9 +61,10 @@ import Modal from "ChillMainAssets/vuejs/_components/Modal.vue";
|
|||||||
import AccompanyingPeriodWorkList from "./AccompanyingPeriodWorkList.vue";
|
import AccompanyingPeriodWorkList from "./AccompanyingPeriodWorkList.vue";
|
||||||
import { AccompanyingPeriodWork } from "../../../types";
|
import { AccompanyingPeriodWork } from "../../../types";
|
||||||
import {
|
import {
|
||||||
trans,ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK,
|
trans,
|
||||||
ACPW_DUPLICATE_SELECT_AN_EVALUATION,CONFIRM,
|
ACPW_DUPLICATE_SELECT_ACCOMPANYING_PERIOD_WORK,
|
||||||
|
ACPW_DUPLICATE_SELECT_AN_EVALUATION,
|
||||||
|
CONFIRM,
|
||||||
} from "translator";
|
} from "translator";
|
||||||
import { fetchResults } from "ChillMainAssets/lib/api/apiMethods";
|
import { fetchResults } from "ChillMainAssets/lib/api/apiMethods";
|
||||||
import AccompanyingPeriodWorkEvaluationList from "ChillPersonAssets/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkEvaluationList.vue";
|
import AccompanyingPeriodWorkEvaluationList from "ChillPersonAssets/vuejs/_components/AccompanyingPeriodWorkSelector/AccompanyingPeriodWorkEvaluationList.vue";
|
||||||
@@ -147,14 +150,14 @@ const confirmSelection = () => {
|
|||||||
if (!props.isEvaluationSelector) {
|
if (!props.isEvaluationSelector) {
|
||||||
if (selectedAcpw.value) {
|
if (selectedAcpw.value) {
|
||||||
// only emit if something is actually selected!emit("pickWork", { work: selectedAcpw.value });
|
// only emit if something is actually selected!emit("pickWork", { work: selectedAcpw.value });
|
||||||
closeModal();}
|
closeModal();
|
||||||
|
}
|
||||||
// optionally show some error or warning if not selected
|
// optionally show some error or warning if not selected
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedAcpw.value && props.isEvaluationSelector) {
|
if (selectedAcpw.value && props.isEvaluationSelector) {
|
||||||
evaluations.value =
|
evaluations.value = selectedAcpw.value.accompanyingPeriodWorkEvaluations;
|
||||||
selectedAcpw.value.accompanyingPeriodWorkEvaluations;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedEvaluation.value && props.isEvaluationSelector) {
|
if (selectedEvaluation.value && props.isEvaluationSelector) {
|
||||||
|
|||||||
@@ -25,7 +25,11 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<CreateModal
|
<CreateModal
|
||||||
v-if="creatableEntityTypes.length > 0 && showModalCreate && null == thirdPartyParentAddContact"
|
v-if="
|
||||||
|
creatableEntityTypes.length > 0 &&
|
||||||
|
showModalCreate &&
|
||||||
|
null == thirdPartyParentAddContact
|
||||||
|
"
|
||||||
action="create"
|
action="create"
|
||||||
:allowed-types="creatableEntityTypes"
|
:allowed-types="creatableEntityTypes"
|
||||||
:query="query"
|
:query="query"
|
||||||
@@ -62,7 +66,10 @@ import type {
|
|||||||
import { marked } from "marked";
|
import { marked } from "marked";
|
||||||
import options = marked.options;
|
import options = marked.options;
|
||||||
import CreateModal from "ChillMainAssets/vuejs/OnTheFly/components/CreateModal.vue";
|
import CreateModal from "ChillMainAssets/vuejs/OnTheFly/components/CreateModal.vue";
|
||||||
import {Thirdparty, ThirdpartyCompany} from "../../../../../ChillThirdPartyBundle/Resources/public/types";
|
import {
|
||||||
|
Thirdparty,
|
||||||
|
ThirdpartyCompany,
|
||||||
|
} from "../../../../../ChillThirdPartyBundle/Resources/public/types";
|
||||||
|
|
||||||
interface AddPersonsConfig {
|
interface AddPersonsConfig {
|
||||||
suggested?: Suggestion[];
|
suggested?: Suggestion[];
|
||||||
@@ -80,13 +87,13 @@ const props = withDefaults(defineProps<AddPersonsConfig>(), {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const emit =
|
const emit =
|
||||||
defineEmits<{
|
defineEmits<
|
||||||
(e: "addNewPersons", payload: { selected: Suggestion[] }): void;
|
(e: "addNewPersons", payload: { selected: Suggestion[] }) => void
|
||||||
}
|
|
||||||
>();
|
>();
|
||||||
|
|
||||||
type PersonChooseModalType = InstanceType<typeof PersonChooseModal>;
|
type PersonChooseModalType = InstanceType<typeof PersonChooseModal>;
|
||||||
const personChooseModal = useTemplateRef<PersonChooseModalType>('personChooseModal');
|
const personChooseModal =
|
||||||
|
useTemplateRef<PersonChooseModalType>("personChooseModal");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to show/hide the modal "choose".
|
* Flag to show/hide the modal "choose".
|
||||||
@@ -156,7 +163,7 @@ function closeModalChoose(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function closeModalCreate(): void {
|
function closeModalCreate(): void {
|
||||||
if (null !== thirdPartyParentAddContact) {
|
if (null !== thirdPartyParentAddContact.value) {
|
||||||
thirdPartyParentAddContact.value = null;
|
thirdPartyParentAddContact.value = null;
|
||||||
}
|
}
|
||||||
showModalCreate.value = false;
|
showModalCreate.value = false;
|
||||||
@@ -165,7 +172,10 @@ function closeModalCreate(): void {
|
|||||||
/**
|
/**
|
||||||
* Called by PersonSuggestion's updateSelection event, when an element is checked/unchecked
|
* Called by PersonSuggestion's updateSelection event, when an element is checked/unchecked
|
||||||
*/
|
*/
|
||||||
function updateSelected(payload: {suggestion: Suggestion, isSelected: boolean}): void {
|
function updateSelected(payload: {
|
||||||
|
suggestion: Suggestion;
|
||||||
|
isSelected: boolean;
|
||||||
|
}): void {
|
||||||
if (payload.isSelected) {
|
if (payload.isSelected) {
|
||||||
addSuggestionToSelected(payload.suggestion);
|
addSuggestionToSelected(payload.suggestion);
|
||||||
} else {
|
} else {
|
||||||
@@ -236,7 +246,7 @@ function resetSearch(): void {
|
|||||||
personChooseModal.value?.resetSearch();
|
personChooseModal.value?.resetSearch();
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({resetSearch})
|
defineExpose({ resetSearch });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -82,7 +82,11 @@
|
|||||||
v-if="props.allowCreate && query.length > 0"
|
v-if="props.allowCreate && query.length > 0"
|
||||||
class="create-button"
|
class="create-button"
|
||||||
>
|
>
|
||||||
<button type="button" class="btn btn-submit" @click="emit('onAskForCreate', { query })">
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-submit"
|
||||||
|
@click="emit('onAskForCreate', { query })"
|
||||||
|
>
|
||||||
{{ trans(ONTHEFLY_CREATE_BUTTON, { q: query }) }}
|
{{ trans(ONTHEFLY_CREATE_BUTTON, { q: query }) }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -147,7 +151,10 @@ const emit = defineEmits<{
|
|||||||
(e: "onPickEntities"): void;
|
(e: "onPickEntities"): void;
|
||||||
(e: "onAskForCreate", payload: { query: string }): void;
|
(e: "onAskForCreate", payload: { query: string }): void;
|
||||||
(e: "triggerAddContact", payload: { parent: ThirdpartyCompany }): void;
|
(e: "triggerAddContact", payload: { parent: ThirdpartyCompany }): void;
|
||||||
(e: "updateSelected", payload: {suggestion: Suggestion, isSelected: boolean}): void;
|
(
|
||||||
|
e: "updateSelected",
|
||||||
|
payload: { suggestion: Suggestion; isSelected: boolean },
|
||||||
|
): void;
|
||||||
(e: "cleanSelected"): void;
|
(e: "cleanSelected"): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
@@ -181,11 +188,10 @@ const queryLength = computed(() => search.query.length);
|
|||||||
const suggestedCounter = computed(() => suggested.value.length);
|
const suggestedCounter = computed(() => suggested.value.length);
|
||||||
const selectedCounter = computed(() => props.selected.size);
|
const selectedCounter = computed(() => props.selected.size);
|
||||||
|
|
||||||
const checkUniq = computed(() =>
|
const checkUniq = computed(() => (props.options.uniq ? "radio" : "checkbox"));
|
||||||
props.options.uniq ? "radio" : "checkbox",
|
|
||||||
);
|
|
||||||
|
|
||||||
const selectedAndSuggested = computed<(Suggestion & {isSelected: boolean})[]>(() => {
|
const selectedAndSuggested = computed<(Suggestion & { isSelected: boolean })[]>(
|
||||||
|
() => {
|
||||||
const selectedAndSuggested = [];
|
const selectedAndSuggested = [];
|
||||||
|
|
||||||
// add selected that are not in the search results
|
// add selected that are not in the search results
|
||||||
@@ -195,13 +201,19 @@ const selectedAndSuggested = computed<(Suggestion & {isSelected: boolean})[]>(()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const suggestion of suggested.value) {
|
for (const suggestion of suggested.value) {
|
||||||
selectedAndSuggested.push({...suggestion, isSelected: props.selected.has(suggestion.key)})
|
selectedAndSuggested.push({
|
||||||
|
...suggestion,
|
||||||
|
isSelected: props.selected.has(suggestion.key),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return selectedAndSuggested;
|
return selectedAndSuggested;
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const hasNoResult = computed(() => search.hasPreviousQuery && suggested.value.length === 0);
|
const hasNoResult = computed(
|
||||||
|
() => search.hasPreviousQuery && suggested.value.length === 0,
|
||||||
|
);
|
||||||
|
|
||||||
function setQuery(q: string) {
|
function setQuery(q: string) {
|
||||||
search.query = q;
|
search.query = q;
|
||||||
@@ -240,14 +252,15 @@ function setQuery(q: string) {
|
|||||||
}, delay);
|
}, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadSuggestions(
|
||||||
function loadSuggestions(suggestedArr: {relevance: number, result: Entities}[]): void {
|
suggestedArr: { relevance: number; result: Entities }[],
|
||||||
|
): void {
|
||||||
suggested.value = suggestedArr.map((item) => {
|
suggested.value = suggestedArr.map((item) => {
|
||||||
return {
|
return {
|
||||||
key: item.result.type + item.result.id,
|
key: item.result.type + item.result.id,
|
||||||
relevance: item.relevance,
|
relevance: item.relevance,
|
||||||
result: item.result
|
result: item.result,
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +280,7 @@ function resetSearch() {
|
|||||||
|
|
||||||
function selectAll() {
|
function selectAll() {
|
||||||
suggested.value.forEach((suggestion: Suggestion) => {
|
suggested.value.forEach((suggestion: Suggestion) => {
|
||||||
emit("updateSelected", {suggestion, isSelected: true})
|
emit("updateSelected", { suggestion, isSelected: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +292,7 @@ function triggerAddContact(payload: {parent: ThirdpartyCompany}) {
|
|||||||
* Triggered when the user clicks on the "add" button.
|
* Triggered when the user clicks on the "add" button.
|
||||||
*/
|
*/
|
||||||
function pickEntities(): void {
|
function pickEntities(): void {
|
||||||
emit("onPickEntities", );
|
emit("onPickEntities");
|
||||||
search.query = "";
|
search.query = "";
|
||||||
emit("close");
|
emit("close");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,9 +53,10 @@ import SuggestionUserGroup from "./TypeUserGroup.vue";
|
|||||||
import {
|
import {
|
||||||
isSuggestionForHousehold,
|
isSuggestionForHousehold,
|
||||||
isSuggestionForPerson,
|
isSuggestionForPerson,
|
||||||
isSuggestionForThirdParty, isSuggestionForUser,
|
isSuggestionForThirdParty,
|
||||||
|
isSuggestionForUser,
|
||||||
isSuggestionForUserGroup,
|
isSuggestionForUserGroup,
|
||||||
Suggestion
|
Suggestion,
|
||||||
} from "ChillPersonAssets/types";
|
} from "ChillPersonAssets/types";
|
||||||
import { ThirdpartyCompany } from "../../../../../../ChillThirdPartyBundle/Resources/public/types";
|
import { ThirdpartyCompany } from "../../../../../../ChillThirdPartyBundle/Resources/public/types";
|
||||||
|
|
||||||
@@ -65,11 +66,14 @@ const props = defineProps<{
|
|||||||
type: "radio" | "checkbox";
|
type: "radio" | "checkbox";
|
||||||
}>();
|
}>();
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: "updateSelected", payload: {suggestion: Suggestion, isSelected: boolean}): void;
|
(
|
||||||
|
e: "updateSelected",
|
||||||
|
payload: { suggestion: Suggestion; isSelected: boolean },
|
||||||
|
): void;
|
||||||
(e: "triggerAddContact", payload: { parent: ThirdpartyCompany }): void;
|
(e: "triggerAddContact", payload: { parent: ThirdpartyCompany }): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const isChecked = computed<boolean>(() => props.isSelected)
|
const isChecked = computed<boolean>(() => props.isSelected);
|
||||||
|
|
||||||
const onUpdateValue = (event: Event) => {
|
const onUpdateValue = (event: Event) => {
|
||||||
const target = event?.target;
|
const target = event?.target;
|
||||||
@@ -77,8 +81,11 @@ const onUpdateValue = (event: Event) => {
|
|||||||
console.error("the value of checked is not an HTMLInputElement");
|
console.error("the value of checked is not an HTMLInputElement");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit("updateSelected", {suggestion: props.item, isSelected: props.type === "radio" ? true : target.checked});
|
emit("updateSelected", {
|
||||||
}
|
suggestion: props.item,
|
||||||
|
isSelected: props.type === "radio" ? true : target.checked,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
function triggerAddContact(payload: { parent: ThirdpartyCompany }) {
|
function triggerAddContact(payload: { parent: ThirdpartyCompany }) {
|
||||||
emit("triggerAddContact", payload);
|
emit("triggerAddContact", payload);
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function formatDate(dateString: string | undefined, format: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
item: Suggestion & { result: Person },
|
item: Suggestion & { result: Person };
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const hasBirthdate = computed(() => props.item.result.birthdate !== null);
|
const hasBirthdate = computed(() => props.item.result.birthdate !== null);
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="container tpartycontainer">
|
<div class="container tpartycontainer">
|
||||||
<div class="tparty-identification">
|
<div class="tparty-identification">
|
||||||
<span v-if="(isThirdpartyChild(item.result) || isThirdpartyContact(item.result)) && item.result.profession" class="profession">{{
|
<span
|
||||||
|
v-if="
|
||||||
|
(isThirdpartyChild(item.result) ||
|
||||||
|
isThirdpartyContact(item.result)) &&
|
||||||
item.result.profession
|
item.result.profession
|
||||||
}}</span>
|
"
|
||||||
|
class="profession"
|
||||||
|
>{{ item.result.profession }}</span
|
||||||
|
>
|
||||||
<span class="name"> {{ item.result.text }} </span>
|
<span class="name"> {{ item.result.text }} </span>
|
||||||
<span class="location">
|
<span class="location">
|
||||||
<template v-if="hasAddress">
|
<template v-if="hasAddress">
|
||||||
@@ -12,7 +18,10 @@
|
|||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="tpartyparent" v-if="isThirdpartyChild(item.result) && null !== item.result.parent">
|
<div
|
||||||
|
class="tpartyparent"
|
||||||
|
v-if="isThirdpartyChild(item.result) && null !== item.result.parent"
|
||||||
|
>
|
||||||
<span class="name"> > {{ item.result.parent.text }} </span>
|
<span class="name"> > {{ item.result.parent.text }} </span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,7 +32,8 @@
|
|||||||
v-if="item.result.type === 'thirdparty' && item.result.kind === 'company'"
|
v-if="item.result.type === 'thirdparty' && item.result.kind === 'company'"
|
||||||
class="btn btn-tpchild"
|
class="btn btn-tpchild"
|
||||||
@click="emit('triggerAddContact', { parent: item.result })"
|
@click="emit('triggerAddContact', { parent: item.result })"
|
||||||
><i class="bi bi-person-fill-add"></i></a>
|
><i class="bi bi-person-fill-add"></i
|
||||||
|
></a>
|
||||||
<on-the-fly type="thirdparty" :id="item.result.id" action="show" />
|
<on-the-fly type="thirdparty" :id="item.result.id" action="show" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -38,7 +48,8 @@ import { Result, Suggestion } from "ChillPersonAssets/types";
|
|||||||
import {
|
import {
|
||||||
isThirdpartyChild,
|
isThirdpartyChild,
|
||||||
isThirdpartyContact,
|
isThirdpartyContact,
|
||||||
Thirdparty, ThirdpartyCompany
|
Thirdparty,
|
||||||
|
ThirdpartyCompany,
|
||||||
} from "./../../../../../../ChillThirdPartyBundle/Resources/public/types";
|
} from "./../../../../../../ChillThirdPartyBundle/Resources/public/types";
|
||||||
|
|
||||||
interface TypeThirdPartyProps {
|
interface TypeThirdPartyProps {
|
||||||
@@ -47,7 +58,10 @@ interface TypeThirdPartyProps {
|
|||||||
|
|
||||||
const props = defineProps<TypeThirdPartyProps>();
|
const props = defineProps<TypeThirdPartyProps>();
|
||||||
|
|
||||||
const emit = defineEmits<(e: "triggerAddContact", payload: {parent: ThirdpartyCompany}) => void>();
|
const emit =
|
||||||
|
defineEmits<
|
||||||
|
(e: "triggerAddContact", payload: { parent: ThirdpartyCompany }) => void
|
||||||
|
>();
|
||||||
|
|
||||||
const onTheFly = ref<InstanceType<typeof OnTheFly> | null>(null);
|
const onTheFly = ref<InstanceType<typeof OnTheFly> | null>(null);
|
||||||
const toast = useToast();
|
const toast = useToast();
|
||||||
@@ -56,7 +70,10 @@ const hasAddress = computed(() => {
|
|||||||
if (props.item.result.address !== null) {
|
if (props.item.result.address !== null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isThirdpartyChild(props.item.result) && props.item.result.parent !== null) {
|
if (
|
||||||
|
isThirdpartyChild(props.item.result) &&
|
||||||
|
props.item.result.parent !== null
|
||||||
|
) {
|
||||||
return props.item.result.parent.address !== null;
|
return props.item.result.parent.address !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +84,11 @@ const getAddress = computed(() => {
|
|||||||
if (props.item.result.address !== null) {
|
if (props.item.result.address !== null) {
|
||||||
return props.item.result.address;
|
return props.item.result.address;
|
||||||
}
|
}
|
||||||
if (isThirdpartyChild(props.item.result) && props.item.result.parent !== null && props.item.result.parent.address !== null) {
|
if (
|
||||||
|
isThirdpartyChild(props.item.result) &&
|
||||||
|
props.item.result.parent !== null &&
|
||||||
|
props.item.result.parent.address !== null
|
||||||
|
) {
|
||||||
return props.item.result.parent.address;
|
return props.item.result.parent.address;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ interface TypeUserProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<TypeUserProps>();
|
const props = defineProps<TypeUserProps>();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -23,9 +23,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span
|
<span v-if="options.addId == true" :title="person.personId"
|
||||||
v-if="options.addId == true"
|
|
||||||
:title="person.personId"
|
|
||||||
><i class="bi bi-info-circle"></i> {{ person.personId }}</span
|
><i class="bi bi-info-circle"></i> {{ person.personId }}</span
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
@@ -34,10 +32,14 @@
|
|||||||
<gender-icon-render-box
|
<gender-icon-render-box
|
||||||
v-if="person.gender"
|
v-if="person.gender"
|
||||||
:gender="person.gender"
|
:gender="person.gender"
|
||||||
/> <span
|
/>
|
||||||
v-if="person.birthdate"
|
<span v-if="person.birthdate">
|
||||||
>
|
{{
|
||||||
{{ trans(RENDERBOX_BIRTHDAY_STATEMENT, {gender: toGenderTranslation(person.gender), birthdate: ISOToDate(person.birthdate?.datetime)}) }}
|
trans(RENDERBOX_BIRTHDAY_STATEMENT, {
|
||||||
|
gender: toGenderTranslation(person.gender),
|
||||||
|
birthdate: ISOToDate(person.birthdate?.datetime),
|
||||||
|
})
|
||||||
|
}}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="options.addAge && person.birthdate" class="age">
|
<span v-if="options.addAge && person.birthdate" class="age">
|
||||||
({{ trans(RENDERBOX_YEARS_OLD, { n: person.age }) }})
|
({{ trans(RENDERBOX_YEARS_OLD, { n: person.age }) }})
|
||||||
@@ -45,13 +47,15 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<span
|
<span v-if="person.deathdate">
|
||||||
v-if="person.deathdate"
|
{{
|
||||||
>
|
trans(RENDERBOX_DEATHDATE_STATEMENT, {
|
||||||
{{ trans(RENDERBOX_DEATHDATE_STATEMENT, {gender: toGenderTranslation(person.gender), deathdate: ISOToDate(person.deathdate?.datetime)}) }}
|
gender: toGenderTranslation(person.gender),
|
||||||
|
deathdate: ISOToDate(person.deathdate?.datetime),
|
||||||
|
})
|
||||||
|
}}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -302,7 +306,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
addNoData: true,
|
addNoData: true,
|
||||||
isMultiline: true,
|
isMultiline: true,
|
||||||
isHolder: false,
|
isHolder: false,
|
||||||
addHouseholdLink: true
|
addHouseholdLink: true,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -81,11 +81,12 @@
|
|||||||
value=""
|
value=""
|
||||||
@input="onAltNameInput($event, a.key)"
|
@input="onAltNameInput($event, a.key)"
|
||||||
/>
|
/>
|
||||||
<label :for="'label_' + a.key">{{ localizeString(a.labels) }}</label>
|
<label :for="'label_' + a.key">{{
|
||||||
|
localizeString(a.labels)
|
||||||
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="action === 'create'">
|
<template v-if="action === 'create'">
|
||||||
@@ -98,18 +99,30 @@
|
|||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input
|
<input
|
||||||
class="form-control form-control-lg"
|
class="form-control form-control-lg"
|
||||||
:class="{'is-invalid': violations.hasViolationWithParameter('identifiers', 'definition_id', worker.definition_id.toString())}"
|
:class="{
|
||||||
|
'is-invalid': violations.hasViolationWithParameter(
|
||||||
|
'identifiers',
|
||||||
|
'definition_id',
|
||||||
|
worker.definition_id.toString(),
|
||||||
|
),
|
||||||
|
}"
|
||||||
type="text"
|
type="text"
|
||||||
:name="'worker_' + worker.definition_id"
|
:name="'worker_' + worker.definition_id"
|
||||||
:placeholder="localizeString(worker.label)"
|
:placeholder="localizeString(worker.label)"
|
||||||
@input="onIdentifierInput($event, worker.definition_id)"
|
@input="onIdentifierInput($event, worker.definition_id)"
|
||||||
/>
|
/>
|
||||||
<label :for="'worker_' + worker.definition_id" :class="{required: worker.presence == 'REQUIRED'}">{{
|
<label
|
||||||
localizeString(worker.label)
|
:for="'worker_' + worker.definition_id"
|
||||||
}}</label>
|
:class="{ required: worker.presence == 'REQUIRED' }"
|
||||||
|
>{{ localizeString(worker.label) }}</label
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="err in violations.violationTitlesWithParameter('identifiers', 'definition_id', worker.definition_id.toString())"
|
v-for="err in violations.violationTitlesWithParameter(
|
||||||
|
'identifiers',
|
||||||
|
'definition_id',
|
||||||
|
worker.definition_id.toString(),
|
||||||
|
)"
|
||||||
class="invalid-feedback was-validated-force"
|
class="invalid-feedback was-validated-force"
|
||||||
>
|
>
|
||||||
{{ err }}
|
{{ err }}
|
||||||
@@ -163,7 +176,9 @@
|
|||||||
{{ c.name }}
|
{{ c.name }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="center" class="required">{{ trans(PERSON_MESSAGES_PERSON_CENTER_TITLE) }}</label>
|
<label for="center" class="required">{{
|
||||||
|
trans(PERSON_MESSAGES_PERSON_CENTER_TITLE)
|
||||||
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="err in violations.violationTitles('center')"
|
v-for="err in violations.violationTitles('center')"
|
||||||
@@ -190,7 +205,9 @@
|
|||||||
{{ localizeString(c.name) }}
|
{{ localizeString(c.name) }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="civility">{{ trans(PERSON_MESSAGES_PERSON_CIVILITY_TITLE) }}</label>
|
<label for="civility">{{
|
||||||
|
trans(PERSON_MESSAGES_PERSON_CIVILITY_TITLE)
|
||||||
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="err in violations.violationTitles('civility')"
|
v-for="err in violations.violationTitles('civility')"
|
||||||
@@ -241,7 +258,9 @@
|
|||||||
:aria-label="trans(PERSON_MESSAGES_PERSON_PHONENUMBER)"
|
:aria-label="trans(PERSON_MESSAGES_PERSON_PHONENUMBER)"
|
||||||
aria-describedby="phonenumber"
|
aria-describedby="phonenumber"
|
||||||
/>
|
/>
|
||||||
<label for="phonenumber">{{ trans(PERSON_MESSAGES_PERSON_PHONENUMBER) }}</label>
|
<label for="phonenumber">{{
|
||||||
|
trans(PERSON_MESSAGES_PERSON_PHONENUMBER)
|
||||||
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="err in violations.violationTitles('phonenumber')"
|
v-for="err in violations.violationTitles('phonenumber')"
|
||||||
@@ -266,7 +285,9 @@
|
|||||||
:aria-label="trans(PERSON_MESSAGES_PERSON_MOBILENUMBER)"
|
:aria-label="trans(PERSON_MESSAGES_PERSON_MOBILENUMBER)"
|
||||||
aria-describedby="mobilenumber"
|
aria-describedby="mobilenumber"
|
||||||
/>
|
/>
|
||||||
<label for="mobilenumber">{{ trans(PERSON_MESSAGES_PERSON_MOBILENUMBER) }}</label>
|
<label for="mobilenumber">{{
|
||||||
|
trans(PERSON_MESSAGES_PERSON_MOBILENUMBER)
|
||||||
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-for="err in violations.violationTitles('mobilenumber')"
|
v-for="err in violations.violationTitles('mobilenumber')"
|
||||||
@@ -326,11 +347,8 @@
|
|||||||
ref="addAddress"
|
ref="addAddress"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
|
||||||
<div v-else>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -338,7 +356,8 @@ import { ref, reactive, computed, onMounted } from "vue";
|
|||||||
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
||||||
import AddAddress from "ChillMainAssets/vuejs/Address/components/AddAddress.vue";
|
import AddAddress from "ChillMainAssets/vuejs/Address/components/AddAddress.vue";
|
||||||
import {
|
import {
|
||||||
createPerson, editPerson,
|
createPerson,
|
||||||
|
editPerson,
|
||||||
getCentersForPersonCreation,
|
getCentersForPersonCreation,
|
||||||
getCivilities,
|
getCivilities,
|
||||||
getGenders,
|
getGenders,
|
||||||
@@ -366,22 +385,19 @@ import {
|
|||||||
PERSON_MESSAGES_PERSON_ADDRESS_SHOW_ADDRESS_FORM,
|
PERSON_MESSAGES_PERSON_ADDRESS_SHOW_ADDRESS_FORM,
|
||||||
PERSON_MESSAGES_PERSON_ADDRESS_WARNING,
|
PERSON_MESSAGES_PERSON_ADDRESS_WARNING,
|
||||||
} from "translator";
|
} from "translator";
|
||||||
import {
|
import { Center, Civility, Gender } from "ChillMainAssets/types";
|
||||||
Center,
|
|
||||||
Civility,
|
|
||||||
Gender,
|
|
||||||
} from "ChillMainAssets/types";
|
|
||||||
import {
|
import {
|
||||||
AltName,
|
AltName,
|
||||||
Person,
|
Person,
|
||||||
PersonWrite,
|
PersonWrite,
|
||||||
PersonIdentifierWorker,
|
PersonIdentifierWorker,
|
||||||
} from "ChillPersonAssets/types";
|
} from "ChillPersonAssets/types";
|
||||||
import {
|
import { isValidationException } from "ChillMainAssets/lib/api/apiMethods";
|
||||||
isValidationException,
|
|
||||||
} from "ChillMainAssets/lib/api/apiMethods";
|
|
||||||
import { useToast } from "vue-toast-notification";
|
import { useToast } from "vue-toast-notification";
|
||||||
import {getTimezoneOffsetString, ISOToDate} from "ChillMainAssets/chill/js/date";
|
import {
|
||||||
|
getTimezoneOffsetString,
|
||||||
|
ISOToDate,
|
||||||
|
} from "ChillMainAssets/chill/js/date";
|
||||||
import { useViolationList } from "ChillMainAssets/vuejs/_composables/violationList";
|
import { useViolationList } from "ChillMainAssets/vuejs/_composables/violationList";
|
||||||
|
|
||||||
interface PersonEditComponentConfig {
|
interface PersonEditComponentConfig {
|
||||||
@@ -486,13 +502,16 @@ const birthDate = computed({
|
|||||||
person.birthdate = null;
|
person.birthdate = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const offset = getTimezoneOffsetString(date, Intl.DateTimeFormat().resolvedOptions().timeZone);
|
const offset = getTimezoneOffsetString(
|
||||||
|
date,
|
||||||
|
Intl.DateTimeFormat().resolvedOptions().timeZone,
|
||||||
|
);
|
||||||
if (person.birthdate) {
|
if (person.birthdate) {
|
||||||
person.birthdate.datetime = value + "T00:00:00" + offset;
|
person.birthdate.datetime = value + "T00:00:00" + offset;
|
||||||
} else {
|
} else {
|
||||||
person.birthdate = { datetime: value + "T00:00:00" + offset };
|
person.birthdate = { datetime: value + "T00:00:00" + offset };
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
const phonenumber = computed({
|
const phonenumber = computed({
|
||||||
get: () => person.phonenumber,
|
get: () => person.phonenumber,
|
||||||
@@ -566,7 +585,7 @@ async function loadData() {
|
|||||||
const w = personToWritePerson(p);
|
const w = personToWritePerson(p);
|
||||||
person.firstName = w.firstName;
|
person.firstName = w.firstName;
|
||||||
person.lastName = w.lastName;
|
person.lastName = w.lastName;
|
||||||
person.altNames.push(...w.altNames)
|
person.altNames.push(...w.altNames);
|
||||||
person.civility = w.civility;
|
person.civility = w.civility;
|
||||||
person.addressId = w.addressId;
|
person.addressId = w.addressId;
|
||||||
person.birthdate = w.birthdate;
|
person.birthdate = w.birthdate;
|
||||||
@@ -633,7 +652,7 @@ function submitNewAddress(payload: { addressId: number }) {
|
|||||||
|
|
||||||
async function postPerson(): Promise<Person> {
|
async function postPerson(): Promise<Person> {
|
||||||
try {
|
try {
|
||||||
if (props.action === 'create') {
|
if (props.action === "create") {
|
||||||
const createdPerson = await createPerson(person);
|
const createdPerson = await createPerson(person);
|
||||||
emit("onPersonCreated", { person: createdPerson });
|
emit("onPersonCreated", { person: createdPerson });
|
||||||
|
|
||||||
@@ -667,7 +686,7 @@ onMounted(() => {
|
|||||||
getPersonIdentifiers().then((identifiers) => {
|
getPersonIdentifiers().then((identifiers) => {
|
||||||
config.identifiers = identifiers.filter(
|
config.identifiers = identifiers.filter(
|
||||||
(w: PersonIdentifierWorker) =>
|
(w: PersonIdentifierWorker) =>
|
||||||
w.presence === 'ON_CREATION' || w.presence === 'REQUIRED'
|
w.presence === "ON_CREATION" || w.presence === "REQUIRED",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
if (props.action !== "create") {
|
if (props.action !== "create") {
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ const personMessages = {
|
|||||||
fr: {
|
fr: {
|
||||||
add_persons: {
|
add_persons: {
|
||||||
title: "Ajouter des usagers",
|
title: "Ajouter des usagers",
|
||||||
suggested_counter:
|
suggested_counter: "Pas de résultats | 1 résultat | {count} résultats",
|
||||||
"Pas de résultats | 1 résultat | {count} résultats",
|
|
||||||
selected_counter: " 1 sélectionné | {count} sélectionnés",
|
selected_counter: " 1 sélectionné | {count} sélectionnés",
|
||||||
search_some_persons: "Rechercher des personnes..",
|
search_some_persons: "Rechercher des personnes..",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import {
|
|||||||
Address,
|
Address,
|
||||||
Center,
|
Center,
|
||||||
Civility,
|
Civility,
|
||||||
DateTime, SetAddress, SetCivility,
|
DateTime,
|
||||||
|
SetAddress,
|
||||||
|
SetCivility,
|
||||||
User,
|
User,
|
||||||
} from "ChillMainAssets/types";
|
} from "ChillMainAssets/types";
|
||||||
|
|
||||||
@@ -35,7 +37,10 @@ function isBaseThirdParty(t: unknown): t is BaseThirdParty {
|
|||||||
(o as any).type === "thirdparty" &&
|
(o as any).type === "thirdparty" &&
|
||||||
typeof o.id === "number" &&
|
typeof o.id === "number" &&
|
||||||
typeof o.text === "string" &&
|
typeof o.text === "string" &&
|
||||||
(o.kind === "" || o.kind === "contact" || o.kind === "child" || o.kind === "company") &&
|
(o.kind === "" ||
|
||||||
|
o.kind === "contact" ||
|
||||||
|
o.kind === "child" ||
|
||||||
|
o.kind === "company") &&
|
||||||
typeof o.active === "boolean"
|
typeof o.active === "boolean"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -51,13 +56,8 @@ export interface ThirdpartyCompany extends BaseThirdParty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Type guard to distinguish a ThirdpartyCompany
|
// Type guard to distinguish a ThirdpartyCompany
|
||||||
export function isThirdpartyCompany(
|
export function isThirdpartyCompany(t: BaseThirdParty): t is ThirdpartyCompany {
|
||||||
t: BaseThirdParty
|
return t.type === "thirdparty" && t.kind === "company";
|
||||||
): t is ThirdpartyCompany {
|
|
||||||
return (
|
|
||||||
t.type === "thirdparty" &&
|
|
||||||
t.kind === "company"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ThirdpartyChild extends BaseThirdParty {
|
export interface ThirdpartyChild extends BaseThirdParty {
|
||||||
@@ -75,13 +75,8 @@ export interface ThirdpartyChild extends BaseThirdParty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Type guard to distinguish a ThirdpartyChild
|
// Type guard to distinguish a ThirdpartyChild
|
||||||
export function isThirdpartyChild(
|
export function isThirdpartyChild(t: BaseThirdParty): t is ThirdpartyChild {
|
||||||
t: BaseThirdParty
|
return t.type === "thirdparty" && t.kind === "child";
|
||||||
): t is ThirdpartyChild {
|
|
||||||
return (
|
|
||||||
t.type === "thirdparty" &&
|
|
||||||
t.kind === "child"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ThirdpartyContact extends BaseThirdParty {
|
export interface ThirdpartyContact extends BaseThirdParty {
|
||||||
@@ -99,24 +94,23 @@ export interface ThirdpartyContact extends BaseThirdParty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Type guard to distinguish a ThirdpartyContact
|
// Type guard to distinguish a ThirdpartyContact
|
||||||
export function isThirdpartyContact(
|
export function isThirdpartyContact(t: BaseThirdParty): t is ThirdpartyContact {
|
||||||
t: BaseThirdParty
|
return t.type === "thirdparty" && t.kind === "contact";
|
||||||
): t is ThirdpartyContact {
|
|
||||||
return (
|
|
||||||
t.type === "thirdparty" &&
|
|
||||||
t.kind === "contact"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Thirdparty = ThirdpartyCompany | ThirdpartyContact | ThirdpartyChild;
|
export type Thirdparty =
|
||||||
|
| ThirdpartyCompany
|
||||||
|
| ThirdpartyContact
|
||||||
|
| ThirdpartyChild;
|
||||||
|
|
||||||
export function isThirdparty(t: unknown): t is Thirdparty {
|
export function isThirdparty(t: unknown): t is Thirdparty {
|
||||||
if (!isBaseThirdParty(t)) {
|
if (!isBaseThirdParty(t)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (isThirdpartyCompany(t) || isThirdpartyContact(t) || isThirdpartyChild(t));
|
return (
|
||||||
|
isThirdpartyCompany(t) || isThirdpartyContact(t) || isThirdpartyChild(t)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ThirdpartyType {
|
interface ThirdpartyType {
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* GET a thirdparty by id
|
* GET a thirdparty by id
|
||||||
*/
|
*/
|
||||||
import {isThirdpartyChild, isThirdpartyCompany, isThirdpartyContact, Thirdparty, ThirdPartyWrite} from '../../types';
|
import {
|
||||||
|
isThirdpartyChild,
|
||||||
|
isThirdpartyCompany,
|
||||||
|
isThirdpartyContact,
|
||||||
|
Thirdparty,
|
||||||
|
ThirdPartyWrite,
|
||||||
|
} from "../../types";
|
||||||
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
import { makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||||
|
|
||||||
export const getThirdparty = async (id: number): Promise<Thirdparty> => {
|
export const getThirdparty = async (id: number): Promise<Thirdparty> => {
|
||||||
@@ -21,40 +27,41 @@ export const thirdpartyToWriteThirdParty = (t: Thirdparty): ThirdPartyWrite => {
|
|||||||
const isChild = isThirdpartyChild(t);
|
const isChild = isThirdpartyChild(t);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'thirdparty',
|
type: "thirdparty",
|
||||||
kind: t.kind,
|
kind: t.kind,
|
||||||
civility:
|
civility:
|
||||||
(isContact || isChild) && t.civility
|
(isContact || isChild) && t.civility
|
||||||
? { type: 'chill_main_civility', id: t.civility.id }
|
? { type: "chill_main_civility", id: t.civility.id }
|
||||||
: null,
|
: null,
|
||||||
profession: (isContact || isChild) ? (t.profession ?? '') : '',
|
profession: isContact || isChild ? (t.profession ?? "") : "",
|
||||||
firstname: isCompany ? '' : (t.firstname ?? ''),
|
firstname: isCompany ? "" : (t.firstname ?? ""),
|
||||||
name: isCompany
|
name: isCompany ? (t.nameCompany ?? "") : (t.name ?? ""),
|
||||||
? (t.nameCompany ?? '')
|
email: t.email ?? "",
|
||||||
: (t.name ?? ''),
|
telephone: t.telephone ?? "",
|
||||||
email: t.email ?? '',
|
telephone2: t.telephone2 ?? "",
|
||||||
telephone: t.telephone ?? '',
|
|
||||||
telephone2: t.telephone2 ?? '',
|
|
||||||
address: null,
|
address: null,
|
||||||
comment: isChild ? (t.comment ?? '') : '',
|
comment: isChild ? (t.comment ?? "") : "",
|
||||||
parent: isChild && t.parent ? { type: 'thirdparty', id: t.parent.id } : null,
|
parent:
|
||||||
|
isChild && t.parent ? { type: "thirdparty", id: t.parent.id } : null,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface WriteThirdPartyViolationMap
|
export interface WriteThirdPartyViolationMap extends Record<
|
||||||
extends Record<string, Record<string, string>> {
|
string,
|
||||||
|
Record<string, string>
|
||||||
|
> {
|
||||||
email: {
|
email: {
|
||||||
"{{ value }}": string;
|
"{{ value }}": string;
|
||||||
},
|
};
|
||||||
name: {
|
name: {
|
||||||
"{{ value }}": string;
|
"{{ value }}": string;
|
||||||
},
|
};
|
||||||
telephone: {
|
telephone: {
|
||||||
"{{ value }}": string;
|
"{{ value }}": string;
|
||||||
}
|
};
|
||||||
telephone2: {
|
telephone2: {
|
||||||
"{{ value }}": string;
|
"{{ value }}": string;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -63,13 +70,16 @@ extends Record<string, Record<string, string>> {
|
|||||||
export const createThirdParty = async (body: ThirdPartyWrite) => {
|
export const createThirdParty = async (body: ThirdPartyWrite) => {
|
||||||
const url = `/api/1.0/thirdparty/thirdparty.json`;
|
const url = `/api/1.0/thirdparty/thirdparty.json`;
|
||||||
|
|
||||||
return makeFetch<ThirdPartyWrite, Thirdparty>('POST', url, body);
|
return makeFetch<ThirdPartyWrite, Thirdparty>("POST", url, body);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PATCH an existing thirdparty
|
* PATCH an existing thirdparty
|
||||||
*/
|
*/
|
||||||
export const patchThirdparty = async (id: number, body: ThirdPartyWrite): Promise<Thirdparty> => {
|
export const patchThirdparty = async (
|
||||||
|
id: number,
|
||||||
|
body: ThirdPartyWrite,
|
||||||
|
): Promise<Thirdparty> => {
|
||||||
const url = `/api/1.0/thirdparty/thirdparty/${id}.json`;
|
const url = `/api/1.0/thirdparty/thirdparty/${id}.json`;
|
||||||
return makeFetch('PATCH', url, body);
|
return makeFetch("PATCH", url, body);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -133,13 +133,14 @@ import { computed, defineAsyncComponent } from "vue";
|
|||||||
import AddressRenderBox from "ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue";
|
import AddressRenderBox from "ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue";
|
||||||
import Confidential from "ChillMainAssets/vuejs/_components/Confidential.vue";
|
import Confidential from "ChillMainAssets/vuejs/_components/Confidential.vue";
|
||||||
import BadgeEntity from "ChillMainAssets/vuejs/_components/BadgeEntity.vue";
|
import BadgeEntity from "ChillMainAssets/vuejs/_components/BadgeEntity.vue";
|
||||||
import {isThirdpartyChild, isThirdpartyCompany, Thirdparty} from "../../../types";
|
import {
|
||||||
|
isThirdpartyChild,
|
||||||
|
isThirdpartyCompany,
|
||||||
|
Thirdparty,
|
||||||
|
} from "../../../types";
|
||||||
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
import { localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
||||||
import OnTheFly from "ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue";
|
import OnTheFly from "ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue";
|
||||||
import {
|
import { THIRDPARTY_MESSAGES_CHILD_OF, trans } from "translator";
|
||||||
THIRDPARTY_MESSAGES_CHILD_OF,
|
|
||||||
trans
|
|
||||||
} from "translator";
|
|
||||||
|
|
||||||
// Async to avoid recursive resolution issues
|
// Async to avoid recursive resolution issues
|
||||||
/*
|
/*
|
||||||
@@ -160,7 +161,9 @@ interface RenderOptions {
|
|||||||
|
|
||||||
const props = defineProps<{ thirdparty: Thirdparty; options: RenderOptions }>();
|
const props = defineProps<{ thirdparty: Thirdparty; options: RenderOptions }>();
|
||||||
|
|
||||||
const isMultiline = computed<boolean>(() => props.options?.isMultiline ?? false);
|
const isMultiline = computed<boolean>(
|
||||||
|
() => props.options?.isMultiline ?? false,
|
||||||
|
);
|
||||||
|
|
||||||
const hasParent = computed<boolean>(() => {
|
const hasParent = computed<boolean>(() => {
|
||||||
return isThirdpartyChild(props.thirdparty);
|
return isThirdpartyChild(props.thirdparty);
|
||||||
|
|||||||
@@ -20,29 +20,34 @@
|
|||||||
action === 'edit' || action === 'create' || action === 'addContact'
|
action === 'edit' || action === 'create' || action === 'addContact'
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<ThirdPartyEdit :id="id" :type="type" :action="action" :query="query" :parent="parent" />
|
<ThirdPartyEdit
|
||||||
|
:id="id"
|
||||||
|
:type="type"
|
||||||
|
:action="action"
|
||||||
|
:query="query"
|
||||||
|
:parent="parent"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {onMounted, ref} from 'vue'
|
import { onMounted, ref } from "vue";
|
||||||
import ThirdPartyRenderBox from '../Entity/ThirdPartyRenderBox.vue'
|
import ThirdPartyRenderBox from "../Entity/ThirdPartyRenderBox.vue";
|
||||||
import ThirdPartyEdit from './ThirdPartyEdit.vue'
|
import ThirdPartyEdit from "./ThirdPartyEdit.vue";
|
||||||
import { getThirdparty } from '../../_api/OnTheFly'
|
import { getThirdparty } from "../../_api/OnTheFly";
|
||||||
import {Thirdparty, ThirdpartyCompany} from '../../../types'
|
import { Thirdparty, ThirdpartyCompany } from "../../../types";
|
||||||
|
|
||||||
type ThirdPartyProp = {
|
interface ThirdPartyProp {
|
||||||
id: number,
|
id: number;
|
||||||
type: 'thirdparty',
|
type: "thirdparty";
|
||||||
action: 'show'|'edit'|'create',
|
action: "show" | "edit" | "create";
|
||||||
parent?: null,
|
parent?: null;
|
||||||
}
|
}
|
||||||
type ThirdPartyAddContact = {
|
interface ThirdPartyAddContact {
|
||||||
id: number,
|
id: number;
|
||||||
type: 'thirdparty',
|
type: "thirdparty";
|
||||||
action: 'addContact',
|
action: "addContact";
|
||||||
parent: ThirdpartyCompany,
|
parent: ThirdpartyCompany;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ThirdPartyProps = ThirdPartyProp | ThirdPartyAddContact;
|
type ThirdPartyProps = ThirdPartyProp | ThirdPartyAddContact;
|
||||||
@@ -58,10 +63,10 @@ async function loadData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.action === 'show' && props.id) {
|
if (props.action === "show" && props.id) {
|
||||||
loadData()
|
loadData();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
<div class="parent-info">
|
<div class="parent-info">
|
||||||
<i class="fa fa-li fa-hand-o-right" />
|
<i class="fa fa-li fa-hand-o-right" />
|
||||||
<b class="me-2">{{ trans(THIRDPARTY_MESSAGES_CHILD_OF) }}</b>
|
<b class="me-2">{{ trans(THIRDPARTY_MESSAGES_CHILD_OF) }}</b>
|
||||||
<span class="chill-entity badge-thirdparty">{{ resolvedParent.text }}</span>
|
<span class="chill-entity badge-thirdparty">{{
|
||||||
|
resolvedParent.text
|
||||||
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating mb-3" v-else-if="props.action === 'create'">
|
<div class="form-floating mb-3" v-else-if="props.action === 'create'">
|
||||||
@@ -77,7 +79,9 @@
|
|||||||
{{ localizeString(civility.name) }}
|
{{ localizeString(civility.name) }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<label for="civility">{{ trans(THIRDPARTY_MESSAGES_THIRDPARTY_CIVILITY) }}</label>
|
<label for="civility">{{
|
||||||
|
trans(THIRDPARTY_MESSAGES_THIRDPARTY_CIVILITY)
|
||||||
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -93,7 +97,9 @@
|
|||||||
:aria-label="trans(THIRDPARTY_MESSAGES_THIRDPARTY_PROFESSION)"
|
:aria-label="trans(THIRDPARTY_MESSAGES_THIRDPARTY_PROFESSION)"
|
||||||
aria-describedby="profession"
|
aria-describedby="profession"
|
||||||
/>
|
/>
|
||||||
<label for="profession">{{ trans(THIRDPARTY_MESSAGES_THIRDPARTY_PROFESSION) }}</label>
|
<label for="profession">{{
|
||||||
|
trans(THIRDPARTY_MESSAGES_THIRDPARTY_PROFESSION)
|
||||||
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -224,7 +230,9 @@
|
|||||||
:aria-label="trans(THIRDPARTY_MESSAGES_THIRDPARTY_EMAIL)"
|
:aria-label="trans(THIRDPARTY_MESSAGES_THIRDPARTY_EMAIL)"
|
||||||
aria-describedby="email"
|
aria-describedby="email"
|
||||||
/>
|
/>
|
||||||
<label for="email">{{ trans(THIRDPARTY_MESSAGES_THIRDPARTY_EMAIL) }}</label>
|
<label for="email">{{
|
||||||
|
trans(THIRDPARTY_MESSAGES_THIRDPARTY_EMAIL)
|
||||||
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -250,7 +258,9 @@
|
|||||||
:aria-label="trans(THIRDPARTY_MESSAGES_THIRDPARTY_PHONENUMBER)"
|
:aria-label="trans(THIRDPARTY_MESSAGES_THIRDPARTY_PHONENUMBER)"
|
||||||
aria-describedby="phonenumber"
|
aria-describedby="phonenumber"
|
||||||
/>
|
/>
|
||||||
<label for="phonenumber">{{ trans(THIRDPARTY_MESSAGES_THIRDPARTY_PHONENUMBER) }}</label>
|
<label for="phonenumber">{{
|
||||||
|
trans(THIRDPARTY_MESSAGES_THIRDPARTY_PHONENUMBER)
|
||||||
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -263,7 +273,9 @@
|
|||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<div class="input-group has-validation">
|
<div class="input-group has-validation">
|
||||||
<span class="input-group-text" id="phonenumber2"><i class="fa fa-fw fa-phone"/></span>
|
<span class="input-group-text" id="phonenumber2"
|
||||||
|
><i class="fa fa-fw fa-phone"
|
||||||
|
/></span>
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input
|
<input
|
||||||
class="form-control form-control-lg"
|
class="form-control form-control-lg"
|
||||||
@@ -274,7 +286,9 @@
|
|||||||
:aria-label="trans(THIRDPARTY_MESSAGES_THIRDPARTY_PHONENUMBER2)"
|
:aria-label="trans(THIRDPARTY_MESSAGES_THIRDPARTY_PHONENUMBER2)"
|
||||||
aria-describedby="phonenumber2"
|
aria-describedby="phonenumber2"
|
||||||
/>
|
/>
|
||||||
<label for="phonenumber2">{{ trans(THIRDPARTY_MESSAGES_THIRDPARTY_PHONENUMBER2) }}</label>
|
<label for="phonenumber2">{{
|
||||||
|
trans(THIRDPARTY_MESSAGES_THIRDPARTY_PHONENUMBER2)
|
||||||
|
}}</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -301,17 +315,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {ref, reactive, computed, onMounted, getCurrentInstance} from 'vue'
|
import { ref, reactive, computed, onMounted, getCurrentInstance } from "vue";
|
||||||
import ThirdPartyRenderBox from '../Entity/ThirdPartyRenderBox.vue'
|
import ThirdPartyRenderBox from "../Entity/ThirdPartyRenderBox.vue";
|
||||||
import AddAddress from "ChillMainAssets/vuejs/Address/components/AddAddress.vue";
|
import AddAddress from "ChillMainAssets/vuejs/Address/components/AddAddress.vue";
|
||||||
import {
|
import {
|
||||||
createThirdParty,
|
createThirdParty,
|
||||||
getThirdparty, patchThirdparty,
|
getThirdparty,
|
||||||
|
patchThirdparty,
|
||||||
thirdpartyToWriteThirdParty,
|
thirdpartyToWriteThirdParty,
|
||||||
WriteThirdPartyViolationMap
|
WriteThirdPartyViolationMap,
|
||||||
} from '../../_api/OnTheFly'
|
} from "../../_api/OnTheFly";
|
||||||
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue'
|
import BadgeEntity from "ChillMainAssets/vuejs/_components/BadgeEntity.vue";
|
||||||
import {localizeString as _localizeString} from 'ChillMainAssets/lib/localizationHelper/localizationHelper'
|
import { localizeString as _localizeString } from "ChillMainAssets/lib/localizationHelper/localizationHelper";
|
||||||
import {
|
import {
|
||||||
trans,
|
trans,
|
||||||
THIRDPARTY_MESSAGES_THIRDPARTY_FIRSTNAME,
|
THIRDPARTY_MESSAGES_THIRDPARTY_FIRSTNAME,
|
||||||
@@ -323,11 +338,13 @@ import {
|
|||||||
THIRDPARTY_MESSAGES_THIRDPARTY_COMMENT,
|
THIRDPARTY_MESSAGES_THIRDPARTY_COMMENT,
|
||||||
THIRDPARTY_MESSAGES_THIRDPARTY_PROFESSION,
|
THIRDPARTY_MESSAGES_THIRDPARTY_PROFESSION,
|
||||||
THIRDPARTY_MESSAGES_THIRDPARTY_CIVILITY,
|
THIRDPARTY_MESSAGES_THIRDPARTY_CIVILITY,
|
||||||
THIRDPARTY_MESSAGES_CHILD_OF, PERSON_EDIT_ERROR_WHILE_SAVING,
|
THIRDPARTY_MESSAGES_CHILD_OF,
|
||||||
} from 'translator'
|
PERSON_EDIT_ERROR_WHILE_SAVING,
|
||||||
|
} from "translator";
|
||||||
import {
|
import {
|
||||||
createPerson,
|
createPerson,
|
||||||
getCivilities, WritePersonViolationMap,
|
getCivilities,
|
||||||
|
WritePersonViolationMap,
|
||||||
} from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
} from "ChillPersonAssets/vuejs/_api/OnTheFly";
|
||||||
import {
|
import {
|
||||||
isThirdpartyChild,
|
isThirdpartyChild,
|
||||||
@@ -335,36 +352,41 @@ import {
|
|||||||
Thirdparty,
|
Thirdparty,
|
||||||
ThirdpartyCompany,
|
ThirdpartyCompany,
|
||||||
ThirdPartyKind,
|
ThirdPartyKind,
|
||||||
ThirdPartyWrite
|
ThirdPartyWrite,
|
||||||
} from "../../../types";
|
} from "../../../types";
|
||||||
import { Civility, SetCivility } from "ChillMainAssets/types";
|
import { Civility, SetCivility } from "ChillMainAssets/types";
|
||||||
import { isValidationException } from "ChillMainAssets/lib/api/apiMethods";
|
import { isValidationException } from "ChillMainAssets/lib/api/apiMethods";
|
||||||
import { useViolationList } from "ChillMainAssets/vuejs/_composables/violationList";
|
import { useViolationList } from "ChillMainAssets/vuejs/_composables/violationList";
|
||||||
import { useToast } from "vue-toast-notification";
|
import { useToast } from "vue-toast-notification";
|
||||||
|
|
||||||
|
|
||||||
interface ThirdPartyEditWriteProps {
|
interface ThirdPartyEditWriteProps {
|
||||||
id?: number;
|
id?: number;
|
||||||
type?: 'thirdparty';
|
type?: "thirdparty";
|
||||||
action: 'edit' | 'create'
|
action: "edit" | "create";
|
||||||
query?: string;
|
query?: string;
|
||||||
parent?: null;
|
parent?: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ThirdPartyAddContactProps {
|
interface ThirdPartyAddContactProps {
|
||||||
id?: null;
|
id?: null;
|
||||||
type?: 'thirdparty';
|
type?: "thirdparty";
|
||||||
action: 'addContact';
|
action: "addContact";
|
||||||
query?: "";
|
query?: "";
|
||||||
parent: ThirdpartyCompany;
|
parent: ThirdpartyCompany;
|
||||||
}
|
}
|
||||||
|
|
||||||
type ThirdPartyEditProps = ThirdPartyAddContactProps | ThirdPartyEditWriteProps;
|
type ThirdPartyEditProps = ThirdPartyAddContactProps | ThirdPartyEditWriteProps;
|
||||||
|
|
||||||
const props = withDefaults(defineProps<ThirdPartyEditProps>(), {type: 'thirdparty', query: "", parent: null});
|
const props = withDefaults(defineProps<ThirdPartyEditProps>(), {
|
||||||
|
type: "thirdparty",
|
||||||
|
query: "",
|
||||||
|
parent: null,
|
||||||
|
});
|
||||||
|
|
||||||
const emit =
|
const emit =
|
||||||
defineEmits<(e: "onThirdPartyCreated", payload: { thirdParty: Thirdparty }) => void>();
|
defineEmits<
|
||||||
|
(e: "onThirdPartyCreated", payload: { thirdParty: Thirdparty }) => void
|
||||||
|
>();
|
||||||
|
|
||||||
defineExpose({ postThirdParty });
|
defineExpose({ postThirdParty });
|
||||||
|
|
||||||
@@ -372,7 +394,7 @@ const toast = useToast();
|
|||||||
|
|
||||||
const thirdParty = ref<ThirdPartyWrite>({
|
const thirdParty = ref<ThirdPartyWrite>({
|
||||||
type: "thirdparty",
|
type: "thirdparty",
|
||||||
kind: 'company',
|
kind: "company",
|
||||||
address: null,
|
address: null,
|
||||||
civility: null,
|
civility: null,
|
||||||
email: "",
|
email: "",
|
||||||
@@ -401,17 +423,17 @@ const civility = computed<number | null>({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const civilities = ref<Civility[]>([])
|
const civilities = ref<Civility[]>([]);
|
||||||
|
|
||||||
const addAddress = reactive({
|
const addAddress = reactive({
|
||||||
options: {
|
options: {
|
||||||
openPanesInModal: true,
|
openPanesInModal: true,
|
||||||
onlyButton: false,
|
onlyButton: false,
|
||||||
button: {size: 'btn-sm'},
|
button: { size: "btn-sm" },
|
||||||
title: {create: 'add_an_address_title', edit: 'edit_address'},
|
title: { create: "add_an_address_title", edit: "edit_address" },
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
const addAddressRef = ref<any>(null)
|
const addAddressRef = ref<any>(null);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We need a specific computed for the kind
|
* We need a specific computed for the kind
|
||||||
@@ -421,7 +443,7 @@ const kind = computed<ThirdPartyKind>({
|
|||||||
return thirdParty.value.kind;
|
return thirdParty.value.kind;
|
||||||
},
|
},
|
||||||
set(v) {
|
set(v) {
|
||||||
thirdParty.value.kind = v
|
thirdParty.value.kind = v;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -431,21 +453,24 @@ const context = computed(() => {
|
|||||||
edit: false,
|
edit: false,
|
||||||
addressId: null as number | null,
|
addressId: null as number | null,
|
||||||
defaults: (window as any).addaddress,
|
defaults: (window as any).addaddress,
|
||||||
}
|
};
|
||||||
if (thirdParty.value.address) {
|
if (thirdParty.value.address) {
|
||||||
ctx.addressId = thirdParty.value.address.id
|
ctx.addressId = thirdParty.value.address.id;
|
||||||
ctx.edit = true
|
ctx.edit = true;
|
||||||
}
|
}
|
||||||
return ctx
|
return ctx;
|
||||||
})
|
});
|
||||||
|
|
||||||
const resolvedParent = computed<null | ThirdpartyCompany>(() => {
|
const resolvedParent = computed<null | ThirdpartyCompany>(() => {
|
||||||
if (null !== originalThirdParty.value && isThirdpartyChild(originalThirdParty.value)) {
|
if (
|
||||||
|
null !== originalThirdParty.value &&
|
||||||
|
isThirdpartyChild(originalThirdParty.value)
|
||||||
|
) {
|
||||||
return originalThirdParty.value.parent;
|
return originalThirdParty.value.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return props.parent ?? null;
|
return props.parent ?? null;
|
||||||
})
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the query items to display for suggestion
|
* Find the query items to display for suggestion
|
||||||
@@ -461,7 +486,10 @@ const queryItems = computed(() => {
|
|||||||
.trim()
|
.trim()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.split(" ");
|
.split(" ");
|
||||||
const lastNameWords = (thirdParty.value.name || "").trim().toLowerCase().split(" ");
|
const lastNameWords = (thirdParty.value.name || "")
|
||||||
|
.trim()
|
||||||
|
.toLowerCase()
|
||||||
|
.split(" ");
|
||||||
|
|
||||||
return words
|
return words
|
||||||
.filter((word) => !firstNameWords.includes(word.toLowerCase()))
|
.filter((word) => !firstNameWords.includes(word.toLowerCase()))
|
||||||
@@ -469,20 +497,19 @@ const queryItems = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function localizeString(str: any) {
|
function localizeString(str: any) {
|
||||||
return _localizeString(str)
|
return _localizeString(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getCivilities().then((cv) => {
|
getCivilities().then((cv) => {
|
||||||
civilities.value = cv;
|
civilities.value = cv;
|
||||||
});
|
});
|
||||||
if (props.action === "edit") {
|
if (props.action === "edit") {
|
||||||
loadData();
|
loadData();
|
||||||
} else if (props.action === 'addContact') {
|
} else if (props.action === "addContact") {
|
||||||
thirdParty.value.kind = 'child';
|
thirdParty.value.kind = "child";
|
||||||
thirdParty.value.address = null;
|
thirdParty.value.address = null;
|
||||||
thirdParty.value.parent = {id: props.parent.id, type: 'thirdparty'};
|
thirdParty.value.parent = { id: props.parent.id, type: "thirdparty" };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -498,35 +525,35 @@ function submitAddress(payload: { addressId: number }) {
|
|||||||
thirdParty.value.address = { id: payload.addressId };
|
thirdParty.value.address = { id: payload.addressId };
|
||||||
}
|
}
|
||||||
|
|
||||||
function addQueryItem(field: 'name' | 'firstName', queryItem: string) {
|
function addQueryItem(field: "name" | "firstName", queryItem: string) {
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case 'name':
|
case "name":
|
||||||
if (thirdParty.value.name) {
|
if (thirdParty.value.name) {
|
||||||
thirdParty.value.name += ` ${queryItem}`
|
thirdParty.value.name += ` ${queryItem}`;
|
||||||
} else {
|
} else {
|
||||||
thirdParty.value.name = queryItem
|
thirdParty.value.name = queryItem;
|
||||||
}
|
}
|
||||||
break
|
break;
|
||||||
case 'firstName':
|
case "firstName":
|
||||||
thirdParty.value.firstname = queryItem
|
thirdParty.value.firstname = queryItem;
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addQuery(query: string) {
|
function addQuery(query: string) {
|
||||||
thirdParty.value.name = query
|
thirdParty.value.name = query;
|
||||||
}
|
}
|
||||||
|
|
||||||
const violations = useViolationList<WriteThirdPartyViolationMap>();
|
const violations = useViolationList<WriteThirdPartyViolationMap>();
|
||||||
|
|
||||||
async function postThirdParty(): Promise<Thirdparty> {
|
async function postThirdParty(): Promise<Thirdparty> {
|
||||||
try {
|
try {
|
||||||
if (props.action === 'edit' && props.id) {
|
if (props.action === "edit" && props.id) {
|
||||||
const tp = await patchThirdparty(props.id, thirdParty.value);
|
const tp = await patchThirdparty(props.id, thirdParty.value);
|
||||||
return Promise.resolve(tp);
|
return Promise.resolve(tp);
|
||||||
} else if (props.action === 'addContact' || props.action === 'create') {
|
} else if (props.action === "addContact" || props.action === "create") {
|
||||||
const tp = await createThirdParty(thirdParty.value);
|
const tp = await createThirdParty(thirdParty.value);
|
||||||
emit('onThirdPartyCreated', {thirdParty: tp});
|
emit("onThirdPartyCreated", { thirdParty: tp });
|
||||||
return Promise.resolve(tp);
|
return Promise.resolve(tp);
|
||||||
}
|
}
|
||||||
} catch (e: unknown) {
|
} catch (e: unknown) {
|
||||||
@@ -539,7 +566,6 @@ async function postThirdParty(): Promise<Thirdparty> {
|
|||||||
}
|
}
|
||||||
throw "'action' is not edit with and id, or addContact or create";
|
throw "'action' is not edit with and id, or addContact or create";
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -148,9 +148,8 @@ export type TicketHistoryLine =
|
|||||||
| CallerStateEvent;
|
| CallerStateEvent;
|
||||||
|
|
||||||
interface BaseTicket<
|
interface BaseTicket<
|
||||||
T extends
|
T extends "ticket_ticket:simple" | "ticket_ticket:extended" =
|
||||||
| "ticket_ticket:simple"
|
"ticket_ticket:simple",
|
||||||
| "ticket_ticket:extended" = "ticket_ticket:simple",
|
|
||||||
> {
|
> {
|
||||||
type_extended: T;
|
type_extended: T;
|
||||||
type: "ticket_ticket";
|
type: "ticket_ticket";
|
||||||
|
|||||||
Reference in New Issue
Block a user