|
|
@@ -9,30 +9,63 @@
|
|
|
<v-row>
|
|
|
<v-col cols="12" sm="6">
|
|
|
<div>
|
|
|
- <span>{{ $t('otherWebsite') }} : </span>
|
|
|
- <span>{{ entry['otherWebsite'] }}</span>
|
|
|
+ <span>{{ $t('yourWebsiteAddressIs') }} : </span>
|
|
|
+ <span>{{ getCurrentWebsite(entry) || $t('none') }}</span>
|
|
|
</div>
|
|
|
</v-col>
|
|
|
|
|
|
- <v-col cols="12" sm="6">
|
|
|
- <div>
|
|
|
- <span>{{ $t('subDomainHistorical') }} : </span>
|
|
|
- </div>
|
|
|
- </v-col>
|
|
|
-
|
|
|
- <v-col cols="12" sm="6">
|
|
|
- <UiInputText field="newSubDomain" :data="entry['newSubDomain']" />
|
|
|
+ <v-col cols="12" sm="6" v-if="!organizationProfile.isCmf()">
|
|
|
+ <v-btn
|
|
|
+ color="error"
|
|
|
+ v-if="entry['desactivateOpentalentSiteWeb'] === false"
|
|
|
+ @click="confirmWebsiteDeactivation()"
|
|
|
+ >{{ $t('desactivateOpentalentSiteWeb') }} </v-btn>
|
|
|
+
|
|
|
+ <v-btn
|
|
|
+ color="primary"
|
|
|
+ v-else
|
|
|
+ @click="reactivateOpentalentSiteWeb()"
|
|
|
+ >{{ $t('reactivateOpentalentSiteWeb') }}</v-btn>
|
|
|
+
|
|
|
+ <lazy-LayoutDialog
|
|
|
+ :show="showSiteWebConfirmationDialog"
|
|
|
+ >
|
|
|
+ <template #dialogTitle>{{ $t('please_confirm')}}</template>
|
|
|
+ <template #dialogText>
|
|
|
+ <div class="ma-2">
|
|
|
+ {{ $t('areYourSureYouWantToDisableYourOpentalentWebsite')}} ?
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template #dialogBtn>
|
|
|
+ <v-btn
|
|
|
+ color="ot_super_light_grey"
|
|
|
+ @click="showSiteWebConfirmationDialog=false"
|
|
|
+ >
|
|
|
+ {{ $t('cancel') }}
|
|
|
+ </v-btn>
|
|
|
+ <v-btn
|
|
|
+ color="primary"
|
|
|
+ @click="showSiteWebConfirmationDialog=false;desactivateOpentalentSiteWeb()"
|
|
|
+ >
|
|
|
+ {{ $t('yes') }}
|
|
|
+ </v-btn>
|
|
|
+ </template>
|
|
|
+ </lazy-LayoutDialog>
|
|
|
</v-col>
|
|
|
|
|
|
- <v-col cols="12" sm="6" v-if="!organizationProfile.isCmf()">
|
|
|
- <UiInputCheckbox field="desactivateOpentalentSiteWeb" :data="entry['desactivateOpentalentSiteWeb']" @update="updateRepository" />
|
|
|
+ <v-col
|
|
|
+ cols="12"
|
|
|
+ sm="6"
|
|
|
+ v-if="entry['desactivateOpentalentSiteWeb'] === false"
|
|
|
+ >
|
|
|
+ <FormParametersSubdomains></FormParametersSubdomains>
|
|
|
</v-col>
|
|
|
|
|
|
<v-col cols="12" sm="6">
|
|
|
- <UiInputText field="website" :data="entry['website']" @update="updateRepository" />
|
|
|
+ <UiInputText field="otherWebsite" :data="entry['otherWebsite']" @update="updateRepository" />
|
|
|
</v-col>
|
|
|
|
|
|
- <v-col cols="12" sm="6">
|
|
|
+ <v-col cols="12" sm="6" v-if="entry['desactivateOpentalentSiteWeb'] === false">
|
|
|
<UiInputAutocompleteWithAPI
|
|
|
field="publicationDirectors"
|
|
|
label="publicationDirectors"
|
|
|
@@ -77,23 +110,27 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
-import {computed, ComputedRef, defineComponent, reactive, ref, useContext} from '@nuxtjs/composition-api'
|
|
|
-import { Organization } from '@/models/Organization/Organization'
|
|
|
-import { repositoryHelper } from '~/services/store/repository'
|
|
|
+import {computed, ComputedRef, defineComponent, reactive, ref, Ref, useContext} from '@nuxtjs/composition-api'
|
|
|
import {useDataUtils} from "~/composables/data/useDataUtils";
|
|
|
import {Parameters} from "~/models/Organization/Parameters";
|
|
|
-import {Query} from "@vuex-orm/core";
|
|
|
import {$organizationProfile} from "~/services/profile/organizationProfile";
|
|
|
-import ModelsUtils from "~/services/utils/modelsUtils";
|
|
|
import {useAccessesProvider} from "~/composables/data/useAccessesProvider";
|
|
|
+import {repositoryHelper} from "~/services/store/repository";
|
|
|
+import {Query} from "@vuex-orm/core";
|
|
|
+import UrlBuilder from "~/services/connection/urlBuilder";
|
|
|
+import {Subdomain} from "~/models/Organization/Subdomain";
|
|
|
+import {AnyJson} from "~/types/interfaces";
|
|
|
+import {queryHelper} from "~/services/store/query";
|
|
|
|
|
|
export default defineComponent({
|
|
|
- name: 'parameters',
|
|
|
+ name: 'communication',
|
|
|
setup () {
|
|
|
const {store, $dataProvider, app: {i18n}} = useContext()
|
|
|
const {getItemToEdit} = useDataUtils($dataProvider)
|
|
|
const {getPhysicalByFullName: accessSearch} = useAccessesProvider($dataProvider)
|
|
|
|
|
|
+ const showSiteWebConfirmationDialog: Ref<boolean> = ref(false);
|
|
|
+
|
|
|
const organizationProfile = reactive($organizationProfile(store))
|
|
|
|
|
|
const id = store.state.profile.organization.parametersId
|
|
|
@@ -102,6 +139,45 @@ export default defineComponent({
|
|
|
const repository = repositoryHelper.getRepository(Parameters)
|
|
|
const query: ComputedRef<Query> = computed(() => repository.query())
|
|
|
|
|
|
+ const entry: ComputedRef<AnyJson> = computed(() => {
|
|
|
+ return queryHelper.getFlattenEntry(query.value, id)
|
|
|
+ })
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Build the URL of the current website of the organization
|
|
|
+ * Anywhere else, you can rely on organizationProfile.getWebsite(), but here this url has to be
|
|
|
+ * dynamic.
|
|
|
+ *
|
|
|
+ * @see https://ressources.opentalent.fr/display/SPEC/Preferences#Preferences-Siteinternet
|
|
|
+ *
|
|
|
+ * @param parameters
|
|
|
+ */
|
|
|
+ const getCurrentWebsite = function (parameters: Parameters) {
|
|
|
+ if (parameters.desactivateOpentalentSiteWeb) {
|
|
|
+ if (parameters.otherWebsite) {
|
|
|
+ return UrlBuilder.prependHttps(parameters.otherWebsite)
|
|
|
+ }
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ if (parameters.customDomain) {
|
|
|
+ return UrlBuilder.prependHttps(parameters.customDomain)
|
|
|
+ }
|
|
|
+ // A ce niveau, tous les attributs de Parameters qui pourraient influer sur l'url du site ont été testés, les
|
|
|
+ // sous-domaines étant gérés sur d'autres écrans dédiés.
|
|
|
+ // On peut donc se reposer sur le profil de l'organisation.
|
|
|
+ return organizationProfile.getWebsite()
|
|
|
+ }
|
|
|
+
|
|
|
+ const confirmWebsiteDeactivation = function () {
|
|
|
+ showSiteWebConfirmationDialog.value = true
|
|
|
+ }
|
|
|
+ const desactivateOpentalentSiteWeb = function() {
|
|
|
+ repositoryHelper.updateStoreFromField(Parameters, entry.value, '1', 'desactivateOpentalentSiteWeb')
|
|
|
+ }
|
|
|
+ const reactivateOpentalentSiteWeb = function() {
|
|
|
+ repositoryHelper.updateStoreFromField(Parameters, entry.value, '0', 'desactivateOpentalentSiteWeb')
|
|
|
+ }
|
|
|
+
|
|
|
return {
|
|
|
query: () => query.value,
|
|
|
rules: () => getRules(i18n),
|
|
|
@@ -109,7 +185,13 @@ export default defineComponent({
|
|
|
id,
|
|
|
fetchState,
|
|
|
accessSearch,
|
|
|
- model: Parameters
|
|
|
+ model: Parameters,
|
|
|
+ getCurrentWebsite,
|
|
|
+ confirmWebsiteDeactivation,
|
|
|
+ desactivateOpentalentSiteWeb,
|
|
|
+ showSiteWebConfirmationDialog,
|
|
|
+ reactivateOpentalentSiteWeb,
|
|
|
+ UrlBuilder
|
|
|
}
|
|
|
}
|
|
|
})
|