_id.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!-- Page de détails d'un point de contact -->
  2. <template>
  3. <main>
  4. <v-skeleton-loader
  5. v-if="loading"
  6. type="text"
  7. />
  8. <LayoutContainer v-else>
  9. <v-card class="margin-bottom-20">
  10. <v-toolbar flat class="ot_light_grey toolbarForm" dark dense rounded>
  11. <v-toolbar-title class="ot_dark_grey--text form_main_title">
  12. <v-icon class="ot_white--text ot_green icon">
  13. fa-globe-europe
  14. </v-icon>
  15. {{ $t('contact_point') }}
  16. </v-toolbar-title>
  17. </v-toolbar>
  18. <UiForm :id="id" :model="model" :query="query()">
  19. <template v-slot:form.input="{entry, updateRepository}">
  20. <v-skeleton-loader
  21. v-if="loading"
  22. type="text"
  23. />
  24. <v-container v-else fluid class="container">
  25. <v-row>
  26. <v-col cols="12" sm="12">
  27. <UiInputEnum
  28. field="contactType"
  29. label="contactpoint_type"
  30. :data="entry['contactType']"
  31. enum-type="contact_point_type"
  32. @update="updateRepository"
  33. />
  34. </v-col>
  35. <v-col cols="12" sm="6">
  36. <UiInputText
  37. field="email"
  38. label="email"
  39. :data="entry['email']"
  40. @update="updateRepository"
  41. />
  42. </v-col>
  43. <v-col cols="12" sm="6">
  44. <UiInputText
  45. field="telphone"
  46. label="telphone"
  47. :data="entry['telphone']"
  48. @update="updateRepository"
  49. />
  50. </v-col>
  51. <v-col cols="12" sm="6">
  52. <UiInputText
  53. field="faxNumber"
  54. label="faxNumber"
  55. :data="entry['faxNumber']"
  56. @update="updateRepository"
  57. />
  58. </v-col>
  59. <v-col cols="12" sm="6">
  60. <UiInputText
  61. field="mobilPhone"
  62. label="mobilPhone"
  63. :data="entry['mobilPhone']"
  64. @update="updateRepository"
  65. />
  66. </v-col>
  67. </v-row>
  68. </v-container>
  69. </template>
  70. <template v-slot:form.button>
  71. <NuxtLink :to="{ path: '/organization', query: { accordion: 'contact_point' }}" class="no-decoration">
  72. <v-btn class="mr-4 ot_light_grey ot_grey--text">
  73. {{ $t('back') }}
  74. </v-btn>
  75. </NuxtLink>
  76. </template>
  77. </UiForm>
  78. </v-card>
  79. </LayoutContainer>
  80. </main>
  81. </template>
  82. <script lang="ts">
  83. import { defineComponent, useContext, useFetch, ref, Ref } from '@nuxtjs/composition-api'
  84. import { Repository as VuexRepository } from '@vuex-orm/core/dist/src/repository/Repository'
  85. import { Model, Query } from '@vuex-orm/core'
  86. import { QUERY_TYPE } from '~/types/enums'
  87. import { repositoryHelper } from '~/services/store/repository'
  88. import { ContactPoint } from '~/models/Core/ContactPoint'
  89. export default defineComponent({
  90. name: 'ContactPoint',
  91. setup () {
  92. const { route, $dataProvider } = useContext()
  93. const id: number = parseInt(route.value.params.id)
  94. const loading: Ref<boolean> = ref(true)
  95. const repository: VuexRepository<Model> = repositoryHelper.getRepository(ContactPoint)
  96. const query: Query = repository.query()
  97. useFetch(async () => {
  98. await $dataProvider.invoke({
  99. type: QUERY_TYPE.MODEL,
  100. model: ContactPoint,
  101. id
  102. })
  103. loading.value = false
  104. })
  105. return {
  106. model: ContactPoint,
  107. query: () => query,
  108. id,
  109. loading
  110. }
  111. }
  112. })
  113. </script>
  114. <style>
  115. .toolbarForm .v-toolbar__content{
  116. padding-left: 0 !important;
  117. }
  118. .toolbarForm .v-toolbar__title .v-icon{
  119. height: 46px;
  120. width: 46px;
  121. }
  122. </style>