index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 value="teaching">
  28. <LayoutParametersTeaching />
  29. </v-window-item>
  30. <v-window-item value="intranet_access">
  31. <LayoutParametersIntranet />
  32. </v-window-item>
  33. <v-window-item value="educationNotations">
  34. <LayoutParametersEducationNotation />
  35. </v-window-item>
  36. <v-window-item value="bulletin">
  37. </v-window-item>
  38. <v-window-item value="educationTimings">
  39. </v-window-item>
  40. <v-window-item value="attendances">
  41. </v-window-item>
  42. <v-window-item value="residenceAreas">
  43. </v-window-item>
  44. <v-window-item value="sms_option">
  45. </v-window-item>
  46. <v-window-item value="super_admin">
  47. </v-window-item>
  48. </v-window>
  49. </v-card-text>
  50. </v-col>
  51. </LayoutContainer>
  52. </template>
  53. <script setup lang="ts">
  54. const tabs = [
  55. 'general_parameters',
  56. 'website',
  57. 'teaching',
  58. 'intranet_access',
  59. 'educationNotations',
  60. 'bulletin',
  61. 'educationTimings',
  62. 'attendances',
  63. 'residenceAreas',
  64. 'sms_option',
  65. 'super_admin',
  66. ]
  67. const router = useRouter()
  68. const route = useRoute()
  69. let mounted = false
  70. /**
  71. * Update the current route's query with a new value for 'tab' parameter
  72. * @param tab
  73. */
  74. const updateQuery = (tab: string) => {
  75. router.replace({ query: { ...route.query, tab } })
  76. }
  77. const currentTab: Ref<string | null> = ref(null)
  78. onMounted(() => {
  79. if (!route.query || !route.query.tab || !tabs.includes(route.query.tab as string)) {
  80. updateQuery(tabs[0])
  81. }
  82. currentTab.value = route.query.tab as string
  83. mounted = true
  84. })
  85. const onTabUpdate = (tab: string) => {
  86. if (!mounted) {
  87. return
  88. }
  89. updateQuery(tab)
  90. currentTab.value = tab
  91. }
  92. </script>
  93. <style scoped lang="scss">
  94. :deep(.v-tabs .v-btn__content) {
  95. text-transform: capitalize;
  96. letter-spacing: 0.04em;
  97. }
  98. </style>