index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <!--
  2. Page Paramètres
  3. -->
  4. <template>
  5. <LayoutContainer>
  6. <v-col cols="12" sm="12" md="12">
  7. <v-tabs
  8. :model-value="currentTab"
  9. bg-color="primary"
  10. color="on-primary"
  11. :grow="true"
  12. density="default"
  13. @update:model-value="onTabUpdate"
  14. >
  15. <v-tab v-for="tab in tabs" :value="tab">
  16. {{ $t(tab) }}
  17. </v-tab>
  18. </v-tabs>
  19. <v-card-text>
  20. <v-window v-model="currentTab">
  21. <v-window-item value="general_parameters">
  22. <LayoutParametersGeneral />
  23. </v-window-item>
  24. <v-window-item value="website">
  25. <LayoutParametersWebsite />
  26. </v-window-item>
  27. <v-window-item v-if="organizationProfile.isSchool" value="teaching">
  28. <LayoutParametersTeaching />
  29. </v-window-item>
  30. <v-window-item v-if="organizationProfile.isSchool" value="intranet_access">
  31. <LayoutParametersIntranet />
  32. </v-window-item>
  33. <v-window-item v-if="organizationProfile.isSchool" value="educationNotations">
  34. <LayoutParametersEducationNotation />
  35. </v-window-item>
  36. <v-window-item v-if="organizationProfile.isSchool" value="bulletin">
  37. <LayoutParametersBulletin />
  38. </v-window-item>
  39. <v-window-item v-if="organizationProfile.isSchool" value="educationTimings">
  40. <LayoutParametersEducationTimings />
  41. </v-window-item>
  42. <v-window-item v-if="organizationProfile.isSchool" value="attendances">
  43. <LayoutParametersAttendances />
  44. </v-window-item>
  45. <v-window-item v-if="organizationProfile.isSchool" value="residenceAreas">
  46. <LayoutParametersResidenceAreas />
  47. </v-window-item>
  48. <v-window-item v-if="organizationProfile.hasModule('Sms')" value="sms_option">
  49. <LayoutParametersSms />
  50. </v-window-item>
  51. <v-window-item value="super_admin">
  52. <LayoutParametersSuperAdmin/>
  53. </v-window-item>
  54. </v-window>
  55. </v-card-text>
  56. </v-col>
  57. </LayoutContainer>
  58. </template>
  59. <script setup lang="ts">
  60. import {useOrganizationProfileStore} from "~/stores/organizationProfile";
  61. const organizationProfile = useOrganizationProfileStore()
  62. const tabs = [
  63. 'general_parameters',
  64. 'website',
  65. organizationProfile.isSchool ? 'teaching' : null,
  66. organizationProfile.isSchool ? 'intranet_access' : null,
  67. organizationProfile.isSchool ? 'educationNotations': null,
  68. organizationProfile.isSchool ? 'bulletin' : null,
  69. organizationProfile.isSchool ? 'educationTimings' : null,
  70. organizationProfile.isSchool ? 'attendances' : null,
  71. organizationProfile.isSchool ? 'residenceAreas' : null,
  72. organizationProfile.hasModule('Sms') ? 'sms_option' : null,
  73. 'super_admin',
  74. ].filter((v) => v !== null)
  75. const router = useRouter()
  76. const route = useRoute()
  77. let mounted = false
  78. /**
  79. * Update the current route's query with a new value for 'tab' parameter
  80. * @param tab
  81. */
  82. const updateQuery = (tab: string) => {
  83. router.replace({ query: { ...route.query, tab } })
  84. }
  85. const currentTab: Ref<string | null> = ref(null)
  86. onMounted(() => {
  87. if (!route.query || !route.query.tab || !tabs.includes(route.query.tab as string)) {
  88. updateQuery(tabs[0] ?? 'general_parameters')
  89. }
  90. currentTab.value = route.query.tab as string
  91. mounted = true
  92. })
  93. const onTabUpdate = (tab: string) => {
  94. if (!mounted) {
  95. return
  96. }
  97. updateQuery(tab)
  98. currentTab.value = tab
  99. }
  100. </script>
  101. <style scoped lang="scss">
  102. :deep(.v-tabs .v-btn__content) {
  103. text-transform: capitalize;
  104. letter-spacing: 0.04em;
  105. }
  106. </style>