new.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <template>
  2. <LayoutContainer>
  3. <UiLoadingPanel v-if="pending" />
  4. <div v-else>
  5. <h2>Créer Nouvelle Résidence Area</h2>
  6. <UiForm
  7. ref="form"
  8. :model="ResidenceArea"
  9. :entity="residence_areas"
  10. :submitActions="submitActions"
  11. >
  12. <v-container :fluid="true" class="container">
  13. <v-row>
  14. <v-col cols="12" sm="6">
  15. <div>{{ $t('pleaseEnterYourNewSubdomain')}} :</div>
  16. </v-col>
  17. </v-row>
  18. <v-row>
  19. <v-col cols="12" sm="6">
  20. <UiInputText
  21. v-model="residence_areas.label"
  22. field="residence Areas"
  23. type="string"
  24. :rules="rules()"
  25. />
  26. </v-col>
  27. </v-row>
  28. </v-container>
  29. </UiForm>
  30. </div>
  31. </LayoutContainer>
  32. </template>
  33. <script setup lang="ts">
  34. import { ref, onMounted, computed } from 'vue'
  35. import {Ref} from "@vue/reactivity";
  36. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  37. import {AnyJson} from "~/types/data";
  38. import {SUBMIT_TYPE} from "~/types/enum/enums";
  39. import ResidenceArea from '~/models/Billing/ResidenceArea'
  40. import { useI18n } from 'vue-i18n'
  41. import { useEntityManager } from '~/composables/data/useEntityManager'
  42. const i18n = useI18n()
  43. const { em } = useEntityManager()
  44. const residence_areas: Ref<ResidenceArea> = ref(em.newInstance(ResidenceArea) as ResidenceArea)
  45. const goBackRoute = { path: `/parameters`, query: { tab: 'residenceAreas' } }
  46. const submitActions = computed(() => {
  47. let actions: AnyJson = {}
  48. actions[SUBMIT_TYPE.SAVE_AND_BACK] = goBackRoute
  49. return actions
  50. })
  51. const rules = () => [
  52. (label: string | null) => (label !== null && label.length > 0) || i18n.t('please_enter_a_value'),
  53. ]
  54. </script>