Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed staff account id redirection #45

Merged
merged 13 commits into from
Jan 8, 2025
11 changes: 7 additions & 4 deletions business-registry-dashboard/app/layouts/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ const config = useRuntimeConfig().public
const { isAuthenticated } = useKeycloak()

useHead({
title: t('page.home.title')
title: accountStore.isStaffOrSbcStaff ? t('page.home.titleStaff') : t('page.home.title')
JazzarKarim marked this conversation as resolved.
Show resolved Hide resolved
})

setBreadcrumbs([
{ to: `${config.registryHomeURL}dashboard?accountid=${accountStore.currentAccount.id}`, label: t('labels.bcRegDashboard') },
{ label: t('page.home.h1') }
{
to: `${config.registryHomeURL}dashboard?accountid=${accountStore.currentAccount.id}`,
label: accountStore.isStaffOrSbcStaff ? t('labels.bcRegStaffDashboard') : t('labels.bcRegDashboard')
},
{ label: accountStore.isStaffOrSbcStaff ? t('page.home.h1Staff') : t('page.home.h1') }
])

onMounted(() => {
Expand All @@ -28,7 +31,7 @@ onMounted(() => {
<div class="flex flex-col gap-4 md:flex-row md:justify-between">
<div class="flex flex-col gap-4 md:flex-1">
<h1 class="text-[32px]">
{{ $t('page.home.h1') }}
{{ accountStore.isStaffOrSbcStaff ? t('page.home.h1Staff') : t('page.home.h1') }}
</h1>

<p class="text-gray-700">
Expand Down
5 changes: 4 additions & 1 deletion business-registry-dashboard/app/locales/en-CA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@ export default {
resendEmail: 'Resend Email',
removeFromList: 'Remove From List',
removeBusiness: 'Remove Business',
bcRegDashboard: 'BC Registries Dashboard'
bcRegDashboard: 'BC Registries Dashboard',
bcRegStaffDashboard: 'Staff Dashboard'
},
links: {
busCorpAct: {
Expand Down Expand Up @@ -610,7 +611,9 @@ export default {
},
home: {
title: 'My Business Registry',
titleStaff: 'My Staff Business Registry',
h1: 'My Business Registry',
h1Staff: 'My Staff Business Registry',
intro: 'Start B.C. based businesses and keep business records up to date.',
busOrNRSearch: {
label: 'Retrieve an existing business or active Name Request to manage:',
Expand Down
5 changes: 4 additions & 1 deletion business-registry-dashboard/app/locales/fr-CA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ export default {
resendEmail: 'Renvoyer le Courriel',
removeFromList: 'Supprimer de la Liste',
removeBusiness: "Supprimer l'Entreprise",
bcRegDashboard: 'Tableau de Bord des Registres de la CB'
bcRegDashboard: 'Tableau de Bord des Registres de la CB',
bcRegStaffDashboard: 'Tableau de Bord du Personnel'
},
links: {
busCorpAct: {
Expand Down Expand Up @@ -600,7 +601,9 @@ export default {
},
home: {
title: "Mon Registre d'Entreprise",
titleStaff: 'Registre des Entreprises de mon Personnel',
h1: "Mon Registre d'Entreprise",
h1Staff: 'Registre des Entreprises de mon Personnel',
intro: 'Commencer la CB entreprises basées et tenir à jour les dossiers commerciaux.',
busOrNRSearch: {
label: 'Rechercher une Entreprise Existante ou une Demande de Nom Active à Gérer:',
Expand Down
13 changes: 13 additions & 0 deletions business-registry-dashboard/app/pages/[orgId].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script setup lang="ts">
definePageMeta({
order: 0
})
</script>
<template>
<NuxtLayout name="dashboard">
<div>
<BusinessLookup class="-mt-4" />
<TableAffiliatedEntity class="mt-6" />
</div>
</NuxtLayout>
</template>
13 changes: 12 additions & 1 deletion business-registry-dashboard/app/stores/affiliations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,18 @@ export const useAffiliationsStore = defineStore('brd-affiliations-store', () =>
affiliations.loading = true

if (!accountStore.currentAccount.id || !$keycloak.authenticated) { return }
const response = await $authApi<{ entities: AffiliationResponse[] }>(`/orgs/${accountStore.currentAccount.id}/affiliations?new=true`)

const route = useRoute()
// Use route param if staff, otherwise use current account
const orgId = (isStaffOrSbcStaff && route.params.orgId)
? route.params.orgId
: accountStore.currentAccount.id
severinbeauvais marked this conversation as resolved.
Show resolved Hide resolved

if (!orgId) { return }

const response = await $authApi<{ entities: AffiliationResponse[] }>(
`/orgs/${orgId}/affiliations?new=true`
)

let affiliatedEntities: Business[] = []

Expand Down
2 changes: 1 addition & 1 deletion business-registry-dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "business-registry-dashboard",
"private": true,
"type": "module",
"version": "0.0.14",
"version": "0.0.15",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down
Loading