PreferencesTab.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <LayoutContainer>
  3. <v-col cols="12" sm="12" md="12">
  4. <UiLoadingPanel v-if="pending" />
  5. <UiForm
  6. v-else-if="parameters !== null"
  7. :model="Parameters"
  8. :entity="parameters"
  9. >
  10. <v-expansion-panels :multiple="true" v-model="openedPanels">
  11. <UiExpansionPanel title="general_parameters" icon="fas fa-info">
  12. <LayoutParametersPreferencesTabGeneralParameters :parameters="parameters" />
  13. </UiExpansionPanel>
  14. <UiExpansionPanel title="website" icon="fas fa-info">
  15. </UiExpansionPanel>
  16. <UiExpansionPanel title="teaching" icon="fas fa-info">
  17. </UiExpansionPanel>
  18. <UiExpansionPanel title="intranet_access" icon="fas fa-info">
  19. </UiExpansionPanel>
  20. <UiExpansionPanel title="educationNotations" icon="fas fa-info">
  21. </UiExpansionPanel>
  22. <UiExpansionPanel title="bulletin" icon="fas fa-info">
  23. </UiExpansionPanel>
  24. <UiExpansionPanel title="educationTimings" icon="fas fa-info">
  25. </UiExpansionPanel>
  26. <UiExpansionPanel title="attendances" icon="fas fa-info">
  27. </UiExpansionPanel>
  28. <UiExpansionPanel title="residenceAreas" icon="fas fa-info">
  29. </UiExpansionPanel>
  30. <UiExpansionPanel title="sms_option" icon="fas fa-info">
  31. </UiExpansionPanel>
  32. <UiExpansionPanel title="super_admin" icon="fas fa-info">
  33. </UiExpansionPanel>
  34. </v-expansion-panels>
  35. </UiForm>
  36. <span v-else>
  37. {{ $t('an_error_happened') }}
  38. </span>
  39. </v-col>
  40. </LayoutContainer>
  41. </template>
  42. <script setup lang="ts">
  43. // On déplie les expansion panels dans le onMounted en attendant la résolution du bug : https://github.com/vuetifyjs/vuetify/issues/16427#issuecomment-1380927133
  44. // TODO: quand le bug ci dessus est résolu, remplacer par `const openedPanels: Ref<Array<string>> = ref(['informations', 'bills', 'more_features'])`
  45. import {Ref} from "@vue/reactivity";
  46. import {useEntityFetch} from "~/composables/data/useEntityFetch";
  47. import {useOrganizationProfileStore} from "~/stores/organizationProfile";
  48. import Parameters from "~/models/Organization/Parameters";
  49. const openedPanels: Ref<Array<string>> = ref([])
  50. onMounted(() => {
  51. openedPanels.value = [
  52. 'general_parameters',
  53. 'website',
  54. 'teaching',
  55. 'intranet_access',
  56. 'educationNotations',
  57. 'bulletin',
  58. 'educationTimings',
  59. 'attendances',
  60. 'residenceAreas',
  61. 'sms_option',
  62. 'super_admin',
  63. ]
  64. })
  65. const { fetch } = useEntityFetch()
  66. const organizationProfile = useOrganizationProfileStore()
  67. if (organizationProfile.parametersId === null) {
  68. throw new Error('Missing organization parameters id')
  69. }
  70. const { data: parameters, pending } = fetch(Parameters, organizationProfile.parametersId)
  71. </script>
  72. <style scoped lang="scss">
  73. </style>