<template>
  <LayoutContainer>
    <div>
      <h2>{{ $t('new_education_timing') }}</h2>
      <UiFormCreation
        :model="EducationTiming"
        go-back-route="/parameters/education_timings"
      >
        <template #default="{ entity }">
          <v-container :fluid="true" class="container">
            <v-row>
              <v-col cols="12" sm="6"> </v-col>
            </v-row>
            <v-row>
              <v-col cols="12" sm="6">
                <UiInputNumber
                  v-model="entity.timing"
                  field="new_education_timings"
                  :rules="rules()"
                />
              </v-col>
            </v-row>
          </v-container>
        </template>
      </UiFormCreation>
    </div>
  </LayoutContainer>
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import EducationTiming from '~/models/Education/EducationTiming'

const i18n = useI18n()

const rules = () => [
  (timing: number | null) =>
    (timing !== null && timing > 0) || i18n.t('please_enter_a_value'),
]
</script>
