<script setup lang="ts">
import { EmployeeOtherCreate } from 'stores/employee/types';
import {
  AddButton,
  EditButton,
  DeleteButton,
  SaveButton,
  UndoButton,
} from 'components/button';

defineProps<{
  dense?: boolean;
  outlined?: boolean;
  readonly?: boolean;
  separator?: boolean;
  employee?: boolean;
  prefixId: string;
  hideAction?: boolean;
}>();

const employeeOther = defineModel<EmployeeOtherCreate>('employeeOther');
</script>
<template>
  <div class="col-12" v-if="employeeOther">
    <div class="col-12 row items-center q-pb-sm text-weight-bold text-body1">
      <q-icon
        flat
        size="xs"
        class="q-pa-sm rounded q-mr-xs"
        color="info"
        name="mdi-human-male-female-child"
        style="background-color: var(--surface-3)"
      />
      {{ $t('customerEmployee.form.group.family') }}
      <div class="row q-ml-auto" v-if="!hideAction">
        <UndoButton
          v-if="!readonly && !!employeeOther.id && !employeeOther.statusSave"
          id="btn-info-health-undo"
          icon-only
          @click="$emit('undo')"
          type="button"
        />
        <SaveButton
          icon-only
          type="submit"
          id="btn-info-health-save"
          v-if="!readonly && !employeeOther.statusSave"
          @click="$emit('save')"
        />
        <EditButton
          icon-only
          id="btn-info-health-edit"
          v-if="!readonly && employeeOther.statusSave"
          @click="$emit('edit')"
          type="button"
        />
        <DeleteButton
          icon-only
          id="btn-info-health-delete"
          v-if="readonly"
          @click="$emit('delete')"
          type="button"
        />
      </div>
    </div>

    <div class="col-12 row q-col-gutter-y-sm">
      <div class="col-12 row q-col-gutter-sm">
        <q-input
          :for="`${prefixId}-input-citizen-id`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          :label="$t('customerEmployee.formFamily.citizenId')"
          class="col"
          v-model="employeeOther.citizenId"
        />
      </div>
      <div class="col-12 app-text-muted-2">
        <q-icon size="xs" class="q-mr-xs" name="mdi-human-male" />
        {{ $t('customerEmployee.formFamily.father') }}
      </div>
      <div class="col-12 row q-col-gutter-sm">
        <q-input
          :for="`${prefixId}-input-father-first-name`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          class="col-md-3 col-6"
          :label="$t('form.firstName')"
          v-model="employeeOther.fatherFirstName"
        />
        <q-input
          :for="`${prefixId}-input-father-last-name`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          class="col-md-3 col-6"
          :label="$t('form.lastName')"
          v-model="employeeOther.fatherLastName"
        />
        <q-input
          :for="`${prefixId}-input-father-first-name-en`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          class="col-md-3 col-6"
          :label="$t('form.firstNameEN')"
          v-model="employeeOther.fatherFirstNameEN"
        />
        <q-input
          :for="`${prefixId}-input-father-last-name-en`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          class="col-md-3 col-6"
          :label="$t('form.lastNameEN')"
          v-model="employeeOther.fatherLastNameEN"
        />
        <q-input
          :for="`${prefixId}-input-father-birthplace`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          class="col-6"
          :label="$t('customerEmployee.formFamily.fatherBirthPlace')"
          v-model="employeeOther.fatherBirthPlace"
        />
      </div>

      <div class="col-12 app-text-muted-2">
        <q-icon size="xs" class="q-mr-xs" name="mdi-human-female" />
        {{ $t('customerEmployee.formFamily.mother') }}
      </div>
      <div class="col-12 row q-col-gutter-sm">
        <q-input
          :for="`${prefixId}-input-mother-first-name`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          class="col-md-3 col-6"
          :label="$t('form.firstName')"
          v-model="employeeOther.motherFirstName"
        />
        <q-input
          :for="`${prefixId}-input-mother-last-name`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          class="col-md-3 col-6"
          :label="$t('form.lastName')"
          v-model="employeeOther.motherLastName"
        />
        <q-input
          :for="`${prefixId}-input-mother-first-name-en`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          class="col-md-3 col-6"
          :label="$t('form.firstNameEN')"
          v-model="employeeOther.motherFirstNameEN"
        />
        <q-input
          :for="`${prefixId}-input-mother-last-name-en`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          class="col-md-3 col-6"
          :label="$t('form.lastNameEN')"
          v-model="employeeOther.motherLastNameEN"
        />
        <q-input
          :for="`${prefixId}-input-mother-birthplace`"
          :dense="dense"
          outlined
          :readonly="readonly || employeeOther.statusSave"
          hide-bottom-space
          class="col-6"
          :label="$t('customerEmployee.formFamily.motherBirthPlace')"
          v-model="employeeOther.motherBirthPlace"
        />
      </div>
    </div>
  </div>
</template>
