new.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <LayoutContainer>
  3. <div>
  4. <h2>{{ $t("new_attendance_booking_reason")}}</h2>
  5. <UiFormCreation
  6. :model="AttendanceBookingReason"
  7. go-back-route="/parameters/attendances"
  8. :pre-process="preProcess"
  9. >
  10. <template v-slot="{ entity }">
  11. <v-container :fluid="true" class="container">
  12. <v-row>
  13. <v-col cols="12" sm="6"> </v-col>
  14. </v-row>
  15. <v-row>
  16. <v-col cols="12" sm="6">
  17. <UiInputText
  18. v-model="entity.reason"
  19. field="reason"
  20. :rules="rules()"
  21. />
  22. </v-col>
  23. </v-row>
  24. </v-container>
  25. </template>
  26. </UiFormCreation>
  27. </div>
  28. </LayoutContainer>
  29. </template>
  30. <script setup lang="ts">
  31. import { useI18n } from 'vue-i18n'
  32. import AttendanceBookingReason from "~/models/Booking/AttendanceBookingReason";
  33. import {useOrganizationProfileStore} from "#imports";
  34. const i18n = useI18n()
  35. const organizationProfile = useOrganizationProfileStore()
  36. const preProcess = (entity: AttendanceBookingReason) => {
  37. entity.organization = organizationProfile.id
  38. return entity
  39. }
  40. const rules = () => [
  41. (reason: string | null) =>
  42. (reason !== null && reason.length > 0) || i18n.t('please_enter_a_value'),
  43. ]
  44. </script>