diff --git a/client/src/locales/en-US.json b/client/src/locales/en-US.json index 7817174deb8..837bb16d0af 100644 --- a/client/src/locales/en-US.json +++ b/client/src/locales/en-US.json @@ -1625,7 +1625,28 @@ "description": "You can change your credit card at any time.", "update": "Update" }, - "processing": "Your order is being processed." + "processing": { + "requestSent": { + "title": "Request sent", + "description": "Your request is being processed. We will contact you as soon as possible." + }, + "estimateLinked": { + "title": "Exchange with the sales department", + "description": "Our sales department will contact you to finalize your order." + }, + "invoiceToBePaid": { + "title": "Invoice to be paid", + "description": "Your organization will be available upon payment of the invoice." + }, + "organizationAvailable": { + "title": "Organization available", + "description": "You can now access to your organization." + }, + "error": { + "title": "Failed to retrieve the information.", + "description": "An error occurred while processing your order. Please contact us." + } + } }, "billingDetailsPage": { "placeholders": { diff --git a/client/src/locales/fr-FR.json b/client/src/locales/fr-FR.json index c0aa513c6cc..f6bf856db5a 100644 --- a/client/src/locales/fr-FR.json +++ b/client/src/locales/fr-FR.json @@ -1625,7 +1625,28 @@ "description": "Vous pouvez à tout moment changer votre carte bancaire.", "update": "Modifier" }, - "processing": "Votre commande est en cours de traitement." + "processing": { + "requestSent": { + "title": "Demande envoyée", + "description": "Nous traitons votre demande. Nous allons vous recontacter dès que possible." + }, + "estimateLinked": { + "title": "Échange avec le service commercial", + "description": "Vous allez être contacté par notre service commercial pour finaliser votre commande." + }, + "invoiceToBePaid": { + "title": "Facture à régler", + "description": "Votre organisation sera disponible au règlement de la facture." + }, + "organizationAvailable": { + "title": "Organisation disponible", + "description": "Vous avez maintenant accès à votre organisation." + }, + "error": { + "title": "Erreur lors de la récupération des informations", + "description": "Une erreur est survenue. Veuillez nous contacter." + } + } }, "billingDetailsPage": { "placeholders": { diff --git a/client/src/services/translation.ts b/client/src/services/translation.ts index c4bc9c6e9b8..9ea64e7b5c0 100644 --- a/client/src/services/translation.ts +++ b/client/src/services/translation.ts @@ -1,6 +1,7 @@ // Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS import { InvitationStatus, UserProfile, WorkspaceRole } from '@/parsec'; +import { CustomOrderStatus } from '@/services/bms'; import { Locale, Translatable } from 'megashark-lib'; export function getProfileTranslationKey(profile: UserProfile): Translatable { @@ -53,6 +54,49 @@ export function getWorkspaceRoleTranslationKey(role: WorkspaceRole | null): Work } } +interface CustomOrderStatusTranslations { + title: Translatable; + description?: Translatable; +} + +export function getCustomOrderStatusTranslationKey(status: CustomOrderStatus): CustomOrderStatusTranslations { + const locale = 'clientArea.dashboard.processing'; + + switch (status) { + case CustomOrderStatus.Unknown: { + return { + title: `${locale}.error.title`, + description: `${locale}.error.description`, + }; + } + case CustomOrderStatus.NothingLinked: + return { + title: `${locale}.requestSent.title`, + description: `${locale}.requestSent.description`, + }; + case CustomOrderStatus.EstimateLinked: + return { + title: `${locale}.estimateLinked.title`, + description: `${locale}.estimateLinked.description`, + }; + case CustomOrderStatus.InvoiceToBePaid: + return { + title: `${locale}.invoiceToBePaid.title`, + description: `${locale}.invoiceToBePaid.description`, + }; + case CustomOrderStatus.InvoicePaid: + return { + title: `${locale}.organizationAvailable.title`, + description: `${locale}.organizationAvailable.description`, + }; + default: + return { + title: `${locale}.error.title`, + description: `${locale}.error.description`, + }; + } +} + export function getInvitationStatusTranslationKey(status: InvitationStatus): Translatable { switch (status) { case InvitationStatus.Ready: diff --git a/client/src/views/client-area/ClientAreaPage.vue b/client/src/views/client-area/ClientAreaPage.vue index 84c2d8d48ab..d650f18dfed 100644 --- a/client/src/views/client-area/ClientAreaPage.vue +++ b/client/src/views/client-area/ClientAreaPage.vue @@ -99,7 +99,7 @@ :organization="currentOrganization" /> @@ -107,7 +107,10 @@ v-if="currentPage === ClientAreaPages.CustomOrderBillingDetails" :organization="currentOrganization" /> - + @@ -120,7 +123,14 @@ import { IonPage, IonContent, IonSkeletonText, IonSplitPane, IonMenu, GestureDetail, createGesture } from '@ionic/vue'; import ClientAreaHeader from '@/views/client-area/ClientAreaHeader.vue'; import ClientAreaSidebar from '@/views/client-area/ClientAreaSidebar.vue'; -import { BillingSystem, BmsAccessInstance, BmsOrganization, CustomOrderStatus, DataType } from '@/services/bms'; +import { + BillingSystem, + BmsAccessInstance, + BmsOrganization, + CustomOrderStatus, + DataType, + OrganizationStatusResultData, +} from '@/services/bms'; import { inject, onMounted, onUnmounted, ref, watch } from 'vue'; import { DefaultBmsOrganization, ClientAreaPages, isDefaultOrganization } from '@/views/client-area/types'; import BillingDetailsPage from '@/views/client-area/billing-details/BillingDetailsPage.vue'; @@ -150,6 +160,7 @@ const sidebarWidthProperty = ref(''); const loggedIn = ref(false); const refresh = ref(0); const querying = ref(true); +const statusOrganization = ref(null); const watchSidebarWidthCancel = watch(computedWidth, (value: number) => { sidebarWidthProperty.value = `${value}px`; @@ -196,10 +207,16 @@ onMounted(async () => { if (billingSystem === BillingSystem.CustomOrder || billingSystem === BillingSystem.ExperimentalCandidate) { currentPage.value = ClientAreaPages.Contracts; const statusResp = await BmsAccessInstance.get().getCustomOrderStatus(currentOrganization.value); - if (!statusResp.isError && statusResp.data && statusResp.data.type === DataType.CustomOrderStatus) { - if (statusResp.data.status === CustomOrderStatus.NothingLinked) { + const organizationStatusResp = await BmsAccessInstance.get().getOrganizationStatus(currentOrganization.value.bmsId); + if (!organizationStatusResp.isError && organizationStatusResp.data) { + statusOrganization.value = organizationStatusResp.data as OrganizationStatusResultData; + } + if (!statusResp.isError && statusResp.data && statusResp.data.type === DataType.CustomOrderStatus && statusOrganization.value) { + if (statusResp.data.status !== CustomOrderStatus.ContractEnded && !statusOrganization.value.isBootstrapped) { currentPage.value = ClientAreaPages.CustomOrderProcessing; } + } else { + currentPage.value = ClientAreaPages.Contracts; } } else { currentPage.value = ClientAreaPages.Dashboard; diff --git a/client/src/views/client-area/dashboard/CustomOrderProcessingPage.vue b/client/src/views/client-area/dashboard/CustomOrderProcessingPage.vue index 662b169d517..453e557c315 100644 --- a/client/src/views/client-area/dashboard/CustomOrderProcessingPage.vue +++ b/client/src/views/client-area/dashboard/CustomOrderProcessingPage.vue @@ -2,14 +2,124 @@ diff --git a/newsfragments/9111.feature.rst b/newsfragments/9111.feature.rst new file mode 100644 index 00000000000..b2c7545b231 --- /dev/null +++ b/newsfragments/9111.feature.rst @@ -0,0 +1 @@ +Added page for tracking order (custom order only).