ContactPoint.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <main>
  3. <LayoutContainer>
  4. <v-card class="mb-5">
  5. <FormToolbar title="contact_point" icon="fa-phone"/>
  6. <UiForm
  7. :id="id"
  8. :model="model"
  9. :query="query()"
  10. :submitActions="submitActions">
  11. >
  12. <template #form.input="{entry, updateRepository}">
  13. <v-container fluid class="container">
  14. <v-row>
  15. <v-col cols="12" sm="12">
  16. <UiInputEnum
  17. field="contactType"
  18. label="contactpoint_type"
  19. :data="entry['contactType']"
  20. enum-type="contact_point_type"
  21. @update="updateRepository"
  22. />
  23. </v-col>
  24. <v-col cols="12" sm="6">
  25. <UiInputEmail
  26. field="email"
  27. label="email"
  28. :data="entry['email']"
  29. @update="updateRepository"
  30. />
  31. </v-col>
  32. <v-col cols="12" sm="6">
  33. <UiInputPhone
  34. field="telphone"
  35. :label="$t('telphone')"
  36. :data="entry['telphone']"
  37. @update="updateRepository"
  38. />
  39. </v-col>
  40. <v-col cols="12" sm="6">
  41. <UiInputPhone
  42. field="faxNumber"
  43. :label="$t('faxNumber')"
  44. :data="entry['faxNumber']"
  45. @update="updateRepository"
  46. />
  47. </v-col>
  48. <v-col cols="12" sm="6">
  49. <UiInputPhone
  50. field="mobilPhone"
  51. :label="$t('mobilPhone')"
  52. :data="entry['mobilPhone']"
  53. @update="updateRepository"
  54. />
  55. </v-col>
  56. </v-row>
  57. </v-container>
  58. </template>
  59. <template #form.button>
  60. <NuxtLink :to="{ path: '/organization', query: { accordion: 'contact_point' }}" class="no-decoration">
  61. <v-btn class="mr-4 ot_light_grey ot_grey--text">
  62. {{ $t('back') }}
  63. </v-btn>
  64. </NuxtLink>
  65. </template>
  66. </UiForm>
  67. </v-card>
  68. </LayoutContainer>
  69. </main>
  70. </template>
  71. <script lang="ts">
  72. import {computed, defineComponent} from "@nuxtjs/composition-api";
  73. import {repositoryHelper} from "~/services/store/repository";
  74. import {ContactPoint} from "~/models/Core/ContactPoint";
  75. import {Repository as VuexRepository} from "@vuex-orm/core/dist/src/repository/Repository";
  76. import {Model, Query} from "@vuex-orm/core";
  77. import {AnyJson} from "~/types/interfaces";
  78. import {SUBMIT_TYPE} from "~/types/enums";
  79. export default defineComponent({
  80. props: {
  81. id:{
  82. type: [Number, String],
  83. required: true
  84. }
  85. },
  86. setup () {
  87. const repository: VuexRepository<Model> = repositoryHelper.getRepository(ContactPoint)
  88. const query: Query = repository.query()
  89. const submitActions = computed(() => {
  90. let actions:AnyJson = {}
  91. actions[SUBMIT_TYPE.SAVE_AND_BACK] = { path: `/organization`, query: { accordion: 'contact_point' } }
  92. actions[SUBMIT_TYPE.SAVE] = { path: `/organization/contact_points/` }
  93. return actions
  94. })
  95. return {
  96. model: ContactPoint,
  97. query: () => query,
  98. submitActions
  99. }
  100. },
  101. beforeDestroy() {
  102. repositoryHelper.cleanRepository(ContactPoint)
  103. },
  104. })
  105. </script>
  106. <style scoped>
  107. </style>