-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src/components: refactor dynamic labels in FormFieldSelectTable to a …
…composable (#700) * refactor label logic in FormFieldSelectTable * add subsidiary translations --------- Co-authored-by: Šimon Macek <[email protected]>
- Loading branch information
1 parent
fae4def
commit 2e45d6a
Showing
8 changed files
with
126 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// libraries | ||
import { computed } from 'vue'; | ||
|
||
// composables | ||
import { i18n } from '../boot/i18n'; | ||
|
||
// enums | ||
import { OrganizationLevel } from '../components/types/Organization'; | ||
|
||
export const useSelectTable = (organizationLevel: OrganizationLevel) => { | ||
const label = computed(() => { | ||
switch (organizationLevel) { | ||
case OrganizationLevel.team: | ||
return i18n.global.t('form.team.labelTeam'); | ||
case OrganizationLevel.subsidiary: | ||
return i18n.global.t('form.subsidiary.labelSubsidiary'); | ||
default: | ||
return i18n.global.t('form.company.labelCompany'); | ||
} | ||
}); | ||
|
||
const labelButton = computed(() => { | ||
switch (organizationLevel) { | ||
case OrganizationLevel.team: | ||
return i18n.global.t('form.team.buttonAddTeam'); | ||
case OrganizationLevel.subsidiary: | ||
return i18n.global.t('form.subsidiary.buttonAddSubsidiary'); | ||
default: | ||
return i18n.global.t('register.challenge.buttonAddCompany'); | ||
} | ||
}); | ||
|
||
const labelButtonDialog = computed(() => { | ||
switch (organizationLevel) { | ||
case OrganizationLevel.team: | ||
return i18n.global.t('form.team.buttonAddTeam'); | ||
case OrganizationLevel.subsidiary: | ||
return i18n.global.t('form.subsidiary.buttonAddSubsidiary'); | ||
default: | ||
return i18n.global.t('form.company.buttonAddCompany'); | ||
} | ||
}); | ||
|
||
const titleDialog = computed(() => { | ||
switch (organizationLevel) { | ||
case OrganizationLevel.team: | ||
return i18n.global.t('form.team.titleAddTeam'); | ||
case OrganizationLevel.subsidiary: | ||
return i18n.global.t('form.subsidiary.titleAddSubsidiary'); | ||
default: | ||
return i18n.global.t('form.company.titleAddCompany'); | ||
} | ||
}); | ||
|
||
return { | ||
label, | ||
labelButton, | ||
labelButtonDialog, | ||
titleDialog, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters