diff --git a/src/i18n/en-ca/index.ts b/src/i18n/en-ca/index.ts index 4ffc1e4..5bcf060 100644 --- a/src/i18n/en-ca/index.ts +++ b/src/i18n/en-ca/index.ts @@ -5,7 +5,9 @@ export default { help: { label: "Centre d'aide", tutorial: { - dashboard: "Home Page", + dashboard: { + title: "Home Page", + }, personal_profile: { title: "Section << Personnal Profile >>", personal_info: "Personal informations", diff --git a/src/i18n/fr-ca/index.ts b/src/i18n/fr-ca/index.ts index e98740d..34fcb38 100644 --- a/src/i18n/fr-ca/index.ts +++ b/src/i18n/fr-ca/index.ts @@ -5,7 +5,9 @@ export default { help: { label: "Centre d'aide", tutorial: { - dashboard: "Page d'accueil", + dashboard: { + title: "Page d'accueil", + }, personal_profile: { title: "Section << Profil >>", personal_info: "Informations personnelles", diff --git a/src/modules/help/components/help-module.vue b/src/modules/help/components/help-module.vue index ac0fcbb..fd0be29 100644 --- a/src/modules/help/components/help-module.vue +++ b/src/modules/help/components/help-module.vue @@ -1,53 +1,87 @@ - + - {{ $t(`${module}`) }} + {{ ($t(`help.tutorial.${module}.title`)).toUpperCase() }} - + + + + + + + + - description goes here + {{ ($t(`${option.description}`)) }} - - - needs to check with v-if to show only the right img - - + + + - + \ No newline at end of file diff --git a/src/modules/help/models/help-module.model.ts b/src/modules/help/models/help-module.model.ts index 298932f..a2dc459 100644 --- a/src/modules/help/models/help-module.model.ts +++ b/src/modules/help/models/help-module.model.ts @@ -1,55 +1,65 @@ -export interface HelpModule { - dashboard: string; - personal_profile: string; - timesheet: string; - employee_list: string; - employee_management: string; - timesheets_approval: string; +import approvalsBanner from 'src/assets/approvals-banner.png'; + + +export type HelpModuleOptions = { + label: string; + path: string; + description: string; }; -export const module_access_help: string[] = [ - 'help.tutorial.personal_profile.title', - 'help.tutorial.timesheets.title', - 'help.tutorial.employee_list.title', - 'help.tutorial.employee_management.title', - 'help.tutorial.timesheets_approval.title', +export type HelpModuleKey = + | 'dashboard' + | 'personal_profile' + | 'timesheets' + | 'employee_list' + | 'employee_management' + | 'timesheets_approval'; + +export type Options = Record; + +const personal_infos = "bonjour"; +const professional_info = "Are you chinese?"; + +export const dashboard_options: HelpModuleOptions[] = [ + { label: 'help.tutorial.personal_profile.personal_info', path: approvalsBanner, description: personal_infos }, + { label: 'help.tutorial.personal_profile.professional_info', path: approvalsBanner, description: professional_info }, ]; -export const profile_options = [ - { label: 'help.tutorial.personal_profile.personal_info', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.personal_profile.professional_info', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.shared.display', path: "https://picsum.photos/500/300" }, +export const profile_options: HelpModuleOptions[] = [ + { label: 'help.tutorial.personal_profile.personal_info', path: approvalsBanner, description: personal_infos }, + { label: 'help.tutorial.personal_profile.professional_info', path: approvalsBanner, description: professional_info }, + { label: 'help.tutorial.shared.display', path: approvalsBanner, description: '' }, ]; -export const timesheet_options = [ - { label: 'help.tutorial.timesheet.create_shift', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.timesheet.update_shift', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.timesheet.delete_shift', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.timesheet.create_shift', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.timesheet.update_shift', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.timesheet.delete_shift', path: "https://picsum.photos/500/300" }, +export const timesheets_options: HelpModuleOptions[] = [ + { label: 'help.tutorial.timesheets.create_shift', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.timesheets.update_shift', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.timesheets.delete_shift', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.timesheets.create_shift', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.timesheets.update_shift', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.timesheets.delete_shift', path: approvalsBanner, description: '' }, ]; -export const employee_list_options = [ - { label: 'help.tutorial.employee_list.terminated_employees', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.shared.display', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.shared.search', path: "https://picsum.photos/500/300" }, +export const employee_list_options: HelpModuleOptions[] = [ + { label: 'help.tutorial.employee_list.terminated_employees', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.shared.display', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.shared.search', path: approvalsBanner, description: '' }, ]; -export const employee_management_options = [ - { label: 'help.tutorial.employee_list.terminated_employees', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.employee_management.create_employee', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.employee_management.update_employee', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.employee_management.module_access', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.employee_management.schedule_preset', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.employee_management.terminate_employee', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.shared.display', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.shared.search', path: "https://picsum.photos/500/300" }, +export const employee_management_options: HelpModuleOptions[] = [ + { label: 'help.tutorial.employee_list.terminated_employees', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.employee_management.create_employee', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.employee_management.update_employee', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.employee_management.module_access', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.employee_management.schedule_preset', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.employee_management.terminate_employee', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.shared.display', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.shared.search', path: approvalsBanner, description: '' }, ]; -export const timesheets_approval = [ - { label: 'help.tutorial.timesheets_approval.approval', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.timesheets_approval.inspect', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.shared.display', path: "https://picsum.photos/500/300" }, - { label: 'help.tutorial.shared.search', path: "https://picsum.photos/500/300" }, +export const timesheets_approval_options: HelpModuleOptions[] = [ + { label: 'help.tutorial.timesheets_approval.approval', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.timesheets_approval.inspect', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.shared.display', path: approvalsBanner, description: '' }, + { label: 'help.tutorial.shared.search', path: approvalsBanner, description: '' }, ] \ No newline at end of file diff --git a/src/modules/help/services/help.service.ts b/src/modules/help/services/help.service.ts index 1ee6919..ff4eb4d 100644 --- a/src/modules/help/services/help.service.ts +++ b/src/modules/help/services/help.service.ts @@ -1,10 +1,10 @@ import { api } from "src/boot/axios"; -import type { HelpModule } from "src/modules/help/models/help-module.model"; +import type { HelpModuleKey } from "src/modules/help/models/help-module.model"; import type { BackendResponse } from "src/modules/shared/models/backend-response.models"; export const HelpService = { - getHelpModules: async (): Promise> => { - const response = await api.get>(`/help`); + getHelpModules: async (): Promise> => { + const response = await api.get>(`/help`); return response.data; } } \ No newline at end of file diff --git a/src/pages/help-page.vue b/src/pages/help-page.vue index ef8563f..ccc834e 100644 --- a/src/pages/help-page.vue +++ b/src/pages/help-page.vue @@ -13,12 +13,19 @@ onMounted(async () => { - - + + + + \ No newline at end of file diff --git a/src/stores/help-store.ts b/src/stores/help-store.ts index 1141b66..091ee83 100644 --- a/src/stores/help-store.ts +++ b/src/stores/help-store.ts @@ -1,47 +1,43 @@ import { defineStore } from "pinia"; import { ref } from "vue"; import { HelpService } from "src/modules/help/services/help.service"; -import type { HelpModule } from "src/modules/help/models/help-module.model"; +import { type Options, type HelpModuleKey, profile_options, timesheets_options, employee_list_options, employee_management_options, timesheets_approval_options, dashboard_options } from "src/modules/help/models/help-module.model"; export const useHelpStore = defineStore('help', () => { const is_loading = ref(false); - const help_modules = ref([]); - const custom_help_module_options: string[] = []; - const options: { label: string, path: string }[] = []; + const help_modules = ref([]); + const help_module_options = ref({ + dashboard: dashboard_options, + personal_profile: profile_options, + timesheets: timesheets_options, + employee_list: employee_list_options, + employee_management: employee_management_options, + timesheets_approval: timesheets_approval_options, + }); const getHelpModules = async (): Promise => { + is_loading.value = true; try { const response = await HelpService.getHelpModules(); if (response.success && response.data) help_modules.value = response.data; - for (const module in help_modules) { - if (module === 'personal_profile') { - custom_help_module_options.push(module); - } - if (module === 'timesheet') { - custom_help_module_options.push(module); - } - if (module === 'employee_list') { - custom_help_module_options.push(module); - } - if (module === 'employee_management') { - custom_help_module_options.push(module); - } - if (module === 'timesheets_approval') { - custom_help_module_options.push(module); - } - } + is_loading.value = false; return response.success; } catch (error) { console.error('An error occured while fetching Help modules', error); + return false; } }; + const buildHelpModuleOptions = () => { + //todo: build a custom versions of help_module_options with only the module the employee has access + } + return { is_loading, help_modules, - options, - custom_help_module_options, + help_module_options, getHelpModules, + buildHelpModuleOptions, } }); \ No newline at end of file