Implement trans() in activity vue components

This commit is contained in:
Julie Lenaerts 2024-10-08 13:25:31 +02:00
parent 760f74b386
commit b0b1a28f50
4 changed files with 98 additions and 25 deletions

View File

@ -22,8 +22,8 @@
<ul class="record_actions"> <ul class="record_actions">
<li class="add-persons"> <li class="add-persons">
<add-persons <add-persons
buttonTitle="activity.add_persons" :buttonTitle="trans(ACTIVITY_ADD_PERSONS)"
modalTitle="activity.add_persons" :modalTitle="trans(ACTIVITY_ADD_PERSONS)"
v-bind:key="addPersons.key" v-bind:key="addPersons.key"
v-bind:options="addPersonsOptions" v-bind:options="addPersonsOptions"
@addNewPersons="addNewPersons" @addNewPersons="addNewPersons"
@ -40,6 +40,20 @@ import { mapState, mapGetters } from 'vuex';
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue'; import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
import PersonsBloc from './ConcernedGroups/PersonsBloc.vue'; import PersonsBloc from './ConcernedGroups/PersonsBloc.vue';
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
import {
ACTIVITY_BLOC_PERSONS,
ACTIVITY_BLOC_PERSONS_ASSOCIATED,
ACTIVITY_BLOC_PERSONS_NOT_ASSOCIATED,
ACTIVITY_BLOC_THIRDPARTY,
ACTIVITY_BLOC_USERS,
ACTIVITY_ADD_PERSONS,
ACTIVITY_LOCATION,
ACTIVITY_CHOOSE_LOCATION,
MULTISELECT_SELECT_LABEL,
MULTISELECT_DESELECT_LABEL,
MULTISELECT_SELECTED_LABEL,
trans,
} from "../../../../../../../../../../../assets/translator";
export default { export default {
name: "ConcernedGroups", name: "ConcernedGroups",
@ -48,16 +62,22 @@ export default {
PersonsBloc, PersonsBloc,
PersonText PersonText
}, },
setup() {
return {
trans,
ACTIVITY_ADD_PERSONS
};
},
data() { data() {
return { return {
personsBlocs: [ personsBlocs: [
{ key: 'persons', { key: 'persons',
title: 'activity.bloc_persons', title: trans(ACTIVITY_BLOC_PERSONS),
persons: [], persons: [],
included: false included: false
}, },
{ key: 'personsAssociated', { key: 'personsAssociated',
title: 'activity.bloc_persons_associated', title: trans(ACTIVITY_BLOC_PERSONS_ASSOCIATED),
persons: [], persons: [],
included: window.activity ? window.activity.activityType.personsVisible !== 0 : true included: window.activity ? window.activity.activityType.personsVisible !== 0 : true
}, },
@ -67,12 +87,12 @@ export default {
included: window.activity ? window.activity.activityType.personsVisible !== 0 : true included: window.activity ? window.activity.activityType.personsVisible !== 0 : true
}, },
{ key: 'thirdparty', { key: 'thirdparty',
title: 'activity.bloc_thirdparty', title: trans(ACTIVITY_BLOC_THIRDPARTY),
persons: [], persons: [],
included: window.activity ? window.activity.activityType.thirdPartiesVisible !== 0 : true included: window.activity ? window.activity.activityType.thirdPartiesVisible !== 0 : true
}, },
{ key: 'users', { key: 'users',
title: 'activity.bloc_users', title: trans(ACTIVITY_BLOC_USERS),
persons: [], persons: [],
included: window.activity ? window.activity.activityType.usersVisible !== 0 : true included: window.activity ? window.activity.activityType.usersVisible !== 0 : true
}, },

View File

@ -2,7 +2,7 @@
<teleport to="#location"> <teleport to="#location">
<div class="mb-3 row"> <div class="mb-3 row">
<label :class="locationClassList"> <label :class="locationClassList">
{{ $t("activity.location") }} {{ trans(ACTIVITY_LOCATION) }}
</label> </label>
<div class="col-sm-8"> <div class="col-sm-8">
<VueMultiselect <VueMultiselect
@ -13,11 +13,11 @@
open-direction="top" open-direction="top"
:multiple="false" :multiple="false"
:searchable="true" :searchable="true"
:placeholder="$t('activity.choose_location')" :placeholder="trans(ACTIVITY_CHOOSE_LOCATION)"
:custom-label="customLabel" :custom-label="customLabel"
:select-label="$t('multiselect.select_label')" :select-label="trans(MULTISELECT_SELECT_LABEL)"
:deselect-label="$t('multiselect.deselect_label')" :deselect-label="trans(MULTISELECT_DESELECT_LABEL)"
:selected-label="$t('multiselect.selected_label')" :selected-label="trans(MULTISELECT_SELECTED_LABEL)"
:options="availableLocations" :options="availableLocations"
group-values="locations" group-values="locations"
group-label="locationGroup" group-label="locationGroup"
@ -34,6 +34,14 @@
import { mapState, mapGetters } from "vuex"; import { mapState, mapGetters } from "vuex";
import VueMultiselect from "vue-multiselect"; import VueMultiselect from "vue-multiselect";
import NewLocation from "./Location/NewLocation.vue"; import NewLocation from "./Location/NewLocation.vue";
import {
trans,
ACTIVITY_LOCATION,
ACTIVITY_CHOOSE_LOCATION,
MULTISELECT_SELECT_LABEL,
MULTISELECT_DESELECT_LABEL,
MULTISELECT_SELECTED_LABEL
} from '../../../../../../../../../../../assets/translator'
export default { export default {
name: "Location", name: "Location",
@ -41,6 +49,16 @@ export default {
NewLocation, NewLocation,
VueMultiselect, VueMultiselect,
}, },
setup() {
return {
trans,
ACTIVITY_LOCATION,
ACTIVITY_CHOOSE_LOCATION,
MULTISELECT_SELECT_LABEL,
MULTISELECT_DESELECT_LABEL,
MULTISELECT_SELECTED_LABEL
};
},
data() { data() {
return { return {
locationClassList: locationClassList:

View File

@ -3,7 +3,7 @@
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
<a class="btn btn-sm btn-create" @click="openModal"> <a class="btn btn-sm btn-create" @click="openModal">
{{ $t('activity.create_new_location') }} {{ trans(ACTIVITY_CREATE_NEW_LOCATION) }}
</a> </a>
</li> </li>
</ul> </ul>
@ -14,7 +14,7 @@
@close="modal.showModal = false"> @close="modal.showModal = false">
<template v-slot:header> <template v-slot:header>
<h3 class="modal-title">{{ $t('activity.create_new_location') }}</h3> <h3 class="modal-title">{{ trans(ACTIVITY_CREATE_NEW_LOCATION) }}</h3>
</template> </template>
<template v-slot:body> <template v-slot:body>
<form> <form>
@ -26,17 +26,17 @@
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<select class="form-select form-select-lg" id="type" required v-model="selectType"> <select class="form-select form-select-lg" id="type" required v-model="selectType">
<option selected disabled value="">{{ $t('activity.choose_location_type') }}</option> <option selected disabled value="">{{ trans(ACTIVITY_CHOOSE_LOCATION_TYPE) }}</option>
<option v-for="t in locationTypes" :value="t" :key="t.id"> <option v-for="t in locationTypes" :value="t" :key="t.id">
{{ t.title.fr }} {{ t.title.fr }}
</option> </option>
</select> </select>
<label>{{ $t('activity.location_fields.type') }}</label> <label>{{ trans(ACTIVITY_LOCATION_FIELDS_TYPE) }}</label>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input class="form-control form-control-lg" id="name" v-model="inputName" placeholder /> <input class="form-control form-control-lg" id="name" v-model="inputName" placeholder />
<label for="name">{{ $t('activity.location_fields.name') }}</label> <label for="name">{{ trans(ACTIVITY_LOCATION_FIELDS_NAME) }}</label>
</div> </div>
<add-address <add-address
@ -49,15 +49,15 @@
<div class="form-floating mb-3" v-if="showContactData"> <div class="form-floating mb-3" v-if="showContactData">
<input class="form-control form-control-lg" id="phonenumber1" v-model="inputPhonenumber1" placeholder /> <input class="form-control form-control-lg" id="phonenumber1" v-model="inputPhonenumber1" placeholder />
<label for="phonenumber1">{{ $t('activity.location_fields.phonenumber1') }}</label> <label for="phonenumber1">{{ trans(ACTIVITY_LOCATION_FIELDS_PHONENUMBER1) }}</label>
</div> </div>
<div class="form-floating mb-3" v-if="hasPhonenumber1"> <div class="form-floating mb-3" v-if="hasPhonenumber1">
<input class="form-control form-control-lg" id="phonenumber2" v-model="inputPhonenumber2" placeholder /> <input class="form-control form-control-lg" id="phonenumber2" v-model="inputPhonenumber2" placeholder />
<label for="phonenumber2">{{ $t('activity.location_fields.phonenumber2') }}</label> <label for="phonenumber2">{{ trans(ACTIVITY_LOCATION_FIELDS_PHONENUMBER2) }}</label>
</div> </div>
<div class="form-floating mb-3" v-if="showContactData"> <div class="form-floating mb-3" v-if="showContactData">
<input class="form-control form-control-lg" id="email" v-model="inputEmail" placeholder /> <input class="form-control form-control-lg" id="email" v-model="inputEmail" placeholder />
<label for="email">{{ $t('activity.location_fields.email') }}</label> <label for="email">{{ trans(ACTIVITY_LOCATION_FIELDS_EMAIL) }}</label>
</div> </div>
</form> </form>
@ -66,7 +66,7 @@
<button class="btn btn-save" <button class="btn btn-save"
@click.prevent="saveNewLocation" @click.prevent="saveNewLocation"
> >
{{ $t('action.save') }} {{ trans(SAVE) }}
</button> </button>
</template> </template>
@ -81,6 +81,13 @@ import AddAddress from "ChillMainAssets/vuejs/Address/components/AddAddress.vue"
import { mapState } from "vuex"; import { mapState } from "vuex";
import { getLocationTypes } from "../../api"; import { getLocationTypes } from "../../api";
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods'; import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
import {
SAVE,
ACTIVITY_LOCATION_FIELDS_EMAIL, ACTIVITY_LOCATION_FIELDS_PHONENUMBER1,
ACTIVITY_LOCATION_FIELDS_PHONENUMBER2, ACTIVITY_LOCATION_FIELDS_NAME,
ACTIVITY_LOCATION_FIELDS_TYPE, ACTIVITY_CHOOSE_LOCATION_TYPE, ACTIVITY_CREATE_NEW_LOCATION,
trans
} from "../../../../../../../../../../../../assets/translator";
export default { export default {
name: "NewLocation", name: "NewLocation",
@ -88,6 +95,19 @@ export default {
Modal, Modal,
AddAddress, AddAddress,
}, },
setup() {
return {
trans,
SAVE,
ACTIVITY_LOCATION_FIELDS_EMAIL,
ACTIVITY_LOCATION_FIELDS_PHONENUMBER1,
ACTIVITY_LOCATION_FIELDS_PHONENUMBER2,
ACTIVITY_LOCATION_FIELDS_NAME,
ACTIVITY_LOCATION_FIELDS_TYPE,
ACTIVITY_CHOOSE_LOCATION_TYPE,
ACTIVITY_CREATE_NEW_LOCATION,
};
},
props: ['availableLocations'], props: ['availableLocations'],
data() { data() {
return { return {

View File

@ -3,7 +3,7 @@
<div class="mb-3 row"> <div class="mb-3 row">
<div class="col-4"> <div class="col-4">
<label :class="socialIssuesClassList">{{ $t('activity.social_issues') }}</label> <label :class="socialIssuesClassList">{{ trans(ACTIVITY_SOCIAL_ISSUES) }}</label>
</div> </div>
<div class="col-8"> <div class="col-8">
@ -31,7 +31,7 @@
:allow-empty="true" :allow-empty="true"
:show-labels="false" :show-labels="false"
:loading="issueIsLoading" :loading="issueIsLoading"
:placeholder="$t('activity.choose_other_social_issue')" :placeholder="trans(ACTIVITY_CHOOSE_OTHER_SOCIAL_ISSUE)"
:options="socialIssuesOther" :options="socialIssuesOther"
@select="addIssueInList"> @select="addIssueInList">
</VueMultiselect> </VueMultiselect>
@ -42,7 +42,7 @@
<div class="mb-3 row"> <div class="mb-3 row">
<div class="col-4"> <div class="col-4">
<label :class="socialActionsClassList">{{ $t('activity.social_actions') }}</label> <label :class="socialActionsClassList">{{ trans(ACTIVITY_SOCIAL_ACTIONS) }}</label>
</div> </div>
<div class="col-8"> <div class="col-8">
@ -51,7 +51,7 @@
</div> </div>
<span v-else-if="socialIssuesSelected.length === 0" class="inline-choice chill-no-data-statement mt-3"> <span v-else-if="socialIssuesSelected.length === 0" class="inline-choice chill-no-data-statement mt-3">
{{ $t('activity.select_first_a_social_issue') }} {{ trans(ACTIVITY_SELECT_FIRST_A_SOCIAL_ISSUE) }}
</span> </span>
<template v-else-if="socialActionsList.length > 0"> <template v-else-if="socialActionsList.length > 0">
@ -66,7 +66,7 @@
</template> </template>
<span v-else-if="actionAreLoaded && socialActionsList.length === 0" class="inline-choice chill-no-data-statement mt-3"> <span v-else-if="actionAreLoaded && socialActionsList.length === 0" class="inline-choice chill-no-data-statement mt-3">
{{ $t('activity.social_action_list_empty') }} {{ trans(ACTIVITY_SOCIAL_ACTION_LIST_EMPTY) }}
</span> </span>
@ -81,6 +81,11 @@ import VueMultiselect from 'vue-multiselect';
import CheckSocialIssue from './SocialIssuesAcc/CheckSocialIssue.vue'; import CheckSocialIssue from './SocialIssuesAcc/CheckSocialIssue.vue';
import CheckSocialAction from './SocialIssuesAcc/CheckSocialAction.vue'; import CheckSocialAction from './SocialIssuesAcc/CheckSocialAction.vue';
import { getSocialIssues, getSocialActionByIssue } from '../api.js'; import { getSocialIssues, getSocialActionByIssue } from '../api.js';
import {
ACTIVITY_SOCIAL_ACTION_LIST_EMPTY,
ACTIVITY_SELECT_FIRST_A_SOCIAL_ISSUE, ACTIVITY_SOCIAL_ACTIONS,
ACTIVITY_SOCIAL_ISSUES, ACTIVITY_CHOOSE_OTHER_SOCIAL_ISSUE, trans
} from "../../../../../../../../../../../assets/translator";
export default { export default {
name: "SocialIssuesAcc", name: "SocialIssuesAcc",
@ -89,6 +94,16 @@ export default {
CheckSocialAction, CheckSocialAction,
VueMultiselect VueMultiselect
}, },
setup() {
return {
trans,
ACTIVITY_SOCIAL_ACTION_LIST_EMPTY,
ACTIVITY_SELECT_FIRST_A_SOCIAL_ISSUE,
ACTIVITY_SOCIAL_ACTIONS,
ACTIVITY_SOCIAL_ISSUES,
ACTIVITY_CHOOSE_OTHER_SOCIAL_ISSUE
};
},
data() { data() {
return { return {
issueIsLoading: false, issueIsLoading: false,