<template>
  <div class="masthead">
    <div class="row details-bar q-px-md q-pt-md">
      <div class="q-pr-xs">
        <q-btn
          class="back-button q-px-xs"
          dense
          icon="pgs-arrow-left"
          size="sm"
          @click="returnToParentViews('recruits')"
        />
      </div>
      <div>
        <div class="row header-details">
          <div class="col-shrink source">
            <span>Сведения о гражданине</span>
          </div>
          <template v-if="loading">
            <div class="col-shrink badge">
              <q-skeleton size="32px" type="circle" />
            </div>
          </template>
          <template v-else>
            <div
              v-for="el in callbackForIcon(data)"
              :key="el.id"
              class="col-shrink badge"
            >
              <div v-if="Array.isArray(el)" class="iconField">
                <q-icon
                  v-for="child in el"
                  :key="child.id"
                  :name="child.icon"
                  :style="child.style"
                >
                  <q-tooltip>{{ child.tooltip }}</q-tooltip></q-icon
                >
              </div>
              <q-icon v-else :name="el.icon" :style="el.style">
                <q-tooltip v-if="el.tooltip">{{
                  el.tooltip
                }}</q-tooltip></q-icon
              >
            </div>
          </template>
          <div class="col-shrink status">
            <status-box
              :loading="loading"
              descriptionPath="ervuDictionaries/recruitStatusDescription"
              :status="(data && data.status) || ''"
            />
          </div>

          <div v-if="showCalendarBlock" class="col-grow row assignee no-wrap">
            <div v-if="data.status === '3'">
              <div class="calendar__title">Расчетная дата вручения:</div>
              <div class="calendar__value">
                <q-icon name="pgs-calendar" size="20px" />
                {{
                  moment(data.recruitSystemInfo.automaticServiceSubpoena)
                    .add(7, 'days')
                    .format('DD.MM.YYYY')
                }}
              </div>
            </div>
            <div v-if="data.status === '5'">
              <div class="calendar__title">Дата применения мер:</div>
              <div class="calendar__value">
                <q-icon name="pgs-calendar" size="20px" />
                {{
                  moment(data.recruitSystemInfo.automaticApplicationMeasures)
                    .add(20, 'days')
                    .format('DD.MM.YYYY')
                }}
              </div>
            </div>
          </div>
        </div>
      </div>
      <div style="flex-grow: 1" />
      <div>
        <div
          v-if="recruitHaveIdErn"
          class="row action-buttons justify-end q-gutter-sm"
        >
          <confirmation-changes
            v-if="updateInfo"
            :model="data.updateInfo"
            title="Внесенные изменения"
            textSuccessBtn="Сохранить"
            @action="$emit('send-data', $event)"
          />
          <task-buttons
            v-if="!updateInfo"
            :business-key="businessKey"
            :buttons="buttons"
            :model="data"
            @reload="refresh"
          >
          </task-buttons>
        </div>
      </div>
    </div>
    <div class="row q-px-md q-pb-sm">
      <div class="col">
        <div class="masthead">
          <span class="fio q-pt-xs q-pb-xs q-pr-sm">
            <q-skeleton v-if="loading" height="32px" />
            <template v-else>
              {{ fio }}
            </template>
          </span>
        </div>
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.masthead {
  background-color: rgb(237, 243, 247);
  .action-buttons {
    .refresh-button {
      height: 34px;
      &::v-deep i {
        margin-top: -2px;
        transform: scaleX(-1);
      }
    }
  }
}

.details-bar {
  display: flex;
  flex-flow: row;

  .back-button {
    border: 1px solid rgba(1, 72, 116, 0.18) !important;
    border-radius: 24px !important;
    color: #1491cf !important;
  }

  .header-details {
    gap: 8px;

    > div {
      overflow-x: hidden;
      font-family: 'Golos Text', sans-serif;
      font-style: normal;
      font-weight: 600;
      font-size: 12px;
      line-height: 16px;

      &.badge {
        max-height: 32px;
        overflow: hidden;
        font-size: 32px;
        .iconField {
          background: #dbe3f1;
          border-radius: 80px 80px 80px 80px;
        }
        i {
          background: #dbe3f1;
          border-radius: 50%;
        }
      }

      &.source {
        display: inline-flex;
        text-align: center;
        padding-left: 4px;
        font-family: 'Golos Text', sans-serif;
        font-style: normal;
        font-weight: 600;
        font-size: 12px;
        line-height: 26px;
        color: rgba(2, 12, 18, 0.58);
      }

      &.status {
        padding: 0;
        display: flex;
        flex-flow: column;
        width: 12em;
        min-height: 30px;
      }

      &.assignee {
        align-items: center;
      }
    }
  }
}

.masthead {
  display: flex;
  flex-flow: column;
  span.fio {
    font-family: 'Golos Text', sans-serif;
    font-style: normal;
    font-weight: 500;
    font-size: 28px;
    line-height: 32px;
    letter-spacing: -0.02em;
    color: rgba(2, 12, 18, 0.9);
  }
}
.calendar__title {
  font-weight: 400;
  color: #cf5f14;
}
.calendar__value {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #cf5f14;
}
</style>

<script lang="ts">
import { Component, Prop, Mixins } from 'vue-property-decorator';
import moment from 'moment';

import {
  RecruitMainInfoV3,
  StateRecruitV3,
} from '@/recruits/openapi/person-registry';
import { DecisionDocuments } from '@/recruits/openapi/decision-document';
import { GetUpdateResponse } from '@/recruits/openapi/data-update-controller';
import { DataForRecruit } from '@/recruits/components/recruit-card/masthead/interfaces';
import ReturnToParentView from '@mixins/ReturnToParentView';
import StatusBox from '@/recruits/components/common/status-box/index.vue';
import { Button } from '@/recruits/components/taskButtons/types';
import ProcessStarter from '@/mixins/ProcessStarter';
import RefreshKeyInterceptor from '@/recruits/mixins/refresh-key-interceptor';
import ConfirmationChanges from '@/recruits/components/dialogs/ConfirmationChanges.vue';
import TaskButtons from '@/recruits/components/taskButtons/index.vue';
import { get } from 'lodash';

type RecruitIcon = {
  id: string;
  icon: string;
  tooltip: string;
  style: string;
};

@Component({
  components: { ConfirmationChanges, StatusBox, TaskButtons },
  methods: {
    moment,
  },
})
export default class Masthead extends Mixins(
  ReturnToParentView,
  ProcessStarter,
  RefreshKeyInterceptor
) {
  @Prop({
    default: () => ({
      mainInfo: {} as RecruitMainInfoV3,
      updateInfo: {} as GetUpdateResponse,
      stateRecruit: {} as StateRecruitV3,
      decisions: {} as DecisionDocuments,
    }),
  })
  data: DataForRecruit;

  @Prop({ default: false })
  loading: boolean;

  public readonly recruitId: string = this.$route.params.id;
  recruitIcons = {
    REGISTERED: {
      id: 'Badges_RegisteredNot',
      icon: 'pgs-army',
      tooltip: 'Состоит на учёте',
      style: 'color: #41ff00;',
    },
    NOT_REGISTERED: {
      id: 'Badges_inProgress',
      icon: 'pgs-army',
      tooltip: 'Не состоит на учёте',
      style: 'color: gray;',
    },
    REMOVED_REGISTERED: {
      id: 'Badges_RegisteredNo',
      icon: 'pgs-army',
      tooltip: 'Снят с учёта',
      style: 'color: red;',
    },
    Personal: {
      id: 'Badges_Personal',
      icon: 'pgs-house-no',
      tooltip: 'Поставлен без явки',
      style: 'color: #41ff00;',
    },
    ChangeVK: (e = 0): RecruitIcon => ({
      id: 'Badges_ChangeVK',
      icon: 'pgs-organizations',
      tooltip: ['В процессе', 'Смена ВК'][e],
      style: ['color: #1487CF;', 'color: #41ff00;'][e],
    }),
    Subpoena: (e = 0): RecruitIcon => ({
      id: 'Badges_Subpoena',
      icon: 'pgs-mail',
      tooltip: ['Отсутствует', 'Повестка сформирована', 'Повестка направлена'][e],
      style: ['color: grey;', 'color: #1487CF;', 'color: #1487CF;'][e],
    }),
    Measures: (e = 0): RecruitIcon => ({
      id: 'Badges_Measures',
      icon: 'pgs-time',
      tooltip: ['Ограничений нет', 'Есть ограничения'][e],
      style: ['color: gray;', 'color: red;'][e],
    }),
    Conversion: (e = 0): RecruitIcon => ({
      id: 'Badges_Conversion',
      icon: 'pgs-army-dashed',
      tooltip: 'На конвертации',
      style: ['color: gray;', 'color: #41ff00;'][e],
    }),
    Application: (e = 0): RecruitIcon => ({
      id: 'Badges_Application',
      icon: 'pgs-statements',
      tooltip: ['Нет активных заявлений', 'Есть активные заявления'][e],
      style: ['color: gray;', 'color: #41ff00;'][e],
    }),
    Incident: (e = 0): RecruitIcon => ({
      id: 'Badges_Incident',
      icon: 'pgs-stop',
      tooltip: ['Нет инцидентов', 'Есть инциденты'][e],
      style: ['color: gray;', 'color: red;'][e],
    }),
  };

  get updateInfo(): any {
    return this.data.updateInfo.presenceChanges;
  }

  get businessKey(): string | undefined {
    return this.data.recruitSystemInfo?.processIdMain;
  }

  get userDomainId(): string {
    return this.$store.getters['oidcClient/currentUser'].domain_id;
  }

  get isDocIdExist(): boolean {
    return !!this.data?.systemInfo?.docId;
  }

  get showCalendarBlock(): boolean {
    return (
      (this.data?.status === '3' &&
        !!this.data?.recruitSystemInfo?.automaticServiceSubpoena) ||
      (this.data?.status === '5' &&
        !!this.data?.recruitSystemInfo?.automaticApplicationMeasures)
    );
  }

  get recruitInfoRecord(): Record<string, string> {
    return {
      id: this.data.id || '',
      idERN: this.data.systemInfo?.idERN || '',
      fio: this.data.mainInfo?.fullName || '',
    };
  }

  get userTaskActions(): string[] {
    return get(
      this.$store.getters['wfActions/userTasks/userTask'],
      'outData.actions',
      []
    );
  }

  // Проверяем наличие экшна в userTaskActions
  private actionIsPresented(action: string): boolean {
    return this.userTaskActions.includes(action);
  }

  isRecruitStatusIn(...statuses: string[]): boolean {
    const status = this.data.status;
    if (!status) return false;
    return statuses.includes(status);
  }

  get buttons(): Button[] {
    return [
      {
        id: 'init',
        label: 'Поставить на учёт',
        componentPath: 'multi_init',
        componentProps: {
          title: 'Решение о первоначальной постановке на воинский учёт',
          sign: false,
          actionType: this.data.stateRecruit?.recruitmentSeventeenYear
            ? 'initPersonYoung'
            : 'initPersonAdult',
        },
        onBeforeAction: (buttonCode, data) => {
          this.$recordActivity({
            buttonCode: buttonCode || 'register_military',
            extraInfo: {
              type: 'recruit',
              ...this.recruitInfoRecord,
              ...data,
            },
          });
        },
        visible: !!this.data.stateRecruit?.isInitButtonVisible,
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'personalFileRequest',
        label: 'Запросить личное дело',
        componentPath: 'PersonalFileRequestSingle',
        visible: !!this.data.stateRecruit?.privateFileRequestVisible,
        scopes: [
          this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST,
          this.$AC.scopes.SYSTEM_ADMINISTRATOR,
        ],
      },
      {
        id: 'changeVK',
        label: 'Корректировка ВК',
        componentPath: 'change_vk',
        componentProps: {
          title: 'Смена военного комиссариата',
          sign: false,
        },
        visible: this.isRecruitStatusIn('12.2', '12.5', '12.7', '12.8'),
        scopes: [this.$AC.scopes.GOMU_SPECIALIST],
      },
      {
        id: 'changeVKregisteredButtonVisible',
        label: 'Поставить на учёт',
        componentPath: 'change_vk_dialog',
        componentProps: {
          title: 'Решение о постановке на воинский учёт по новому адресу',
          sign: false,
          documentCode: 'ResultNotificationRegistrationChangeAddress',
        },
        onBeforeAction: (buttonCode, data) => {
          this.$recordActivity({
            buttonCode: buttonCode || 'register_military',
            extraInfo: {
              type: 'recruit',
              ...this.recruitInfoRecord,
              ...data,
            },
          });
        },
        visible: !!this.data?.stateRecruit?.changeVKregisteredButtonVisible,
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'sendConvertation',
        label: 'Отказать в постановке на учёт',
        componentPath: 'SendConvertation',
        componentProps: {
          actionType: 'sendConvertation',
          processKey: 'milBaseRouteProcess',
          title: 'Отказ в постановке на воинский учёт',
          sign: true,
        },
        visible: !!this.data.stateRecruit?.isSendConvertationButtonVisible,
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'summon_not_required',
        label: 'Вызов не требуется',
        visible: this.actionIsPresented('summon_not_required'),
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'register',
        label: 'Поставить на учёт',
        componentPath: 'register_new_recruit',
        componentProps: {
          title:
            'Решение о постановке на воинский учёт по новому адресу места жительства',
          sign: false,
          documentCode: 'ResultNotificationRegistrationChangeAddress',
        },
        visible: this.actionIsPresented('register'),
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'cancel_registration',
        label: 'Снять с учёта',
        componentPath: 'MultiCancel',
        componentProps: {
          title: 'Решение о снятии с воинского учёта',
          documentCode: 'CancelRegistration',
        },
        visible: !!this.data.stateRecruit?.isCancelRegistrationButtonVisible,
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'sign_registration',
        label: 'Подписать',
        tooltip: 'Подписание',
        componentPath: 'single_sign',
        componentProps: {
          title: 'Подписание',
          sign: true,
        },
        onBeforeAction: (buttonCode, data) => {
          this.$recordActivity({
            buttonCode: buttonCode,
            extraInfo: {
              type: 'recruit',
              ...this.recruitInfoRecord,
              ...data,
            },
          });
        },
        visible: !!this.data.signEntity,
        scopes: [this.$AC.scopes.MILITARY_COMMISSAR],
      },
      {
        id: 'notConfirmRecruit',
        label: 'Отклонить',
        tooltip: 'Отклонить',
        componentPath: 'multi_not_confirm',
        componentProps: {
          sign: true,
          actionType: 'notConfirmRecruit',
          processKey: 'milBaseRouteProcess',
        },
        visible:
          this.isDocIdExist &&
          !this.data.stateRecruit?.registrationDecisionInProgress &&
          this.isRecruitStatusIn('12'),
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'confirmRecruit',
        label: 'Подтвердить',
        tooltip: 'Подтвердить',
        componentPath: 'multi_confirm',
        componentProps: {
          sign: true,
          actionType: 'confirmRecruit',
          processKey: 'milBaseRouteProcess',
        },
        visible:
          this.isDocIdExist &&
          !this.data.stateRecruit?.registrationDecisionInProgress &&
          this.isRecruitStatusIn('12'),
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'summon',
        label: 'Индивидуальная повестка',
        componentPath: 'summon',
        componentProps: {
          title: 'Формирование повестки:',
          sign: false,
          icon: 'pgs-rol',
          defaultTime: '09:00',
          disabled: !!this.data.stateRecruit?.recruitmentCommercialInfo,
        },
        visible:
          this.isDocIdExist &&
          this.isRecruitStatusIn('1', '1.2', '2', '2.1', '14', '15') &&
          !this.data.stateRecruit?.recruitmentSeventeen,
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'summon_init',
        label: 'Индивидуальная повестка',
        componentPath: 'summon',
        componentProps: {
          title: 'Формирование повестки:',
          sign: false,
          icon: 'pgs-rol',
          defaultTime: '09:00',
          startProcessId: 'summon_init',
        },
        visible: this.actionIsPresented('summon_init'),
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'summon_required',
        label: 'Вызов требуется',
        componentPath: 'summon_edit',
        componentProps: {
          title: 'Редактирование повестки:',
          sign: false,
          icon: 'pgs-rol',
          defaultTime: '09:00',
        },
        visible: this.actionIsPresented('summon_required'),
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'delivery_not_required',
        label: 'Вручение не требуется',
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
        props: {
          icon: 'pgs-stop',
          negative: true,
          noWrap: true,
        },
        visible: this.actionIsPresented('delivery_not_required'),
      },
      {
        id: 'attendance_not_required',
        label: 'Явка не требуется',
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
        props: {
          icon: 'pgs-stop',
          negative: true,
          noWrap: true,
        },
        visible:
          this.actionIsPresented('attendance_not_required') &&
          this.isDocIdExist,
      },
      {
        id: 'reason_not_attendance',
        label: 'Не явился по причине',
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
        componentPath: 'reason_not_attendance',
        componentProps: {
          title: 'Фиксация решения о признании причины неявки уважительной',
        },
        visible: this.actionIsPresented('reason_not_attendance'),
      },
      {
        id: 'subpoena_awarded',
        label: 'Повестка вручена',
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
        componentPath: 'subpoena_awarded',
        componentProps: {
          title: 'Подтверждение вручения повестки',
        },
        visible: this.actionIsPresented('subpoena_awarded'),
      },
      {
        id: 'confirm_attendance',
        label: 'Явился',
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
        props: {
          icon: 'pgs-ok',
          positive: true,
          noWrap: true,
          awaitSocketMessageForRefresh: 'finish',
        },
        visible: this.actionIsPresented('confirm_attendance'),
      },
      {
        id: 'init_submit',
        label: 'Поставить на учёт',
        componentPath: 'multi_init',
        componentProps: {
          title: 'Решение о первоначальной постановке на воинский учёт',
          sign: false,
          actionType: this.data.stateRecruit?.recruitmentSeventeenYear
            ? 'initPersonYoung'
            : 'initPersonAdult',
        },
        props: {
          icon: 'pgs-ok',
          positive: true,
          noWrap: true,
        },
        visible: this.actionIsPresented('init_submit'),
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'cancel_registration_submit',
        label: 'Снять с учёта',
        props: {
          icon: 'pgs-ok',
          positive: true,
          noWrap: true,
        },
        visible: this.actionIsPresented('cancel_registration_submit'),
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
      },
      {
        id: 'send_registration',
        label: 'Направить',
        componentPath: 'send_registration',
        componentProps: {
          title: 'Вы уверены?',
          tooltip: this.checkDateForSendRegistration
            ? 'Наступило время и дата явки по ненаправленной повестке. Необходимо отклонить повестку '
            : '',
        },
        scopes: [this.$AC.scopes.MILITARY_RECRUIT_SPECIALIST],
        props: {
          icon: 'pgs-ok',
          positive: true,
          noWrap: true,
          disable: this.checkDateForSendRegistration,
        },
        onBeforeAction: (buttonCode, data) => {
          this.$recordActivity({
            buttonCode: buttonCode || 'summons_send',
            extraInfo: {
              type: 'recruit',
              ...this.recruitInfoRecord,
              ...data,
            },
          });
        },
        visible: this.actionIsPresented('send_registration'),
      },
      {
        id: 'decline_registration',
        label: 'Отклонить',
        tooltip: 'Отклонить',
        componentPath: 'multi_decline_sign',
        componentProps: {
          title: 'Отклонить',
          sign: true,
        },
        props: {
          noWrap: true,
        },
        visible: this.isDocIdExist && this.isRecruitStatusIn('3.14'),
        scopes: [this.$AC.scopes.MILITARY_COMMISSAR],
      },
    ];
  }

  // FIXME PGSRUSH-8033 - для карточек граждан с инцидентом - не должны быть доступны кнопки
  get recruitHaveIdErn(): boolean {
    return this.data?.systemInfo?.idERN !== 'Отсутствует';
  }

  get fio(): string {
    return this.data?.mainInfo?.fullName;
  }

  get checkDateForSendRegistration() {
    const subpoena = this.data?.subpoenas?.find(
      (subpoena) => !subpoena?.sendingDate
    );
    return (
      moment(subpoena?.turnoutDate).format('YYYY/MM/DD') <=
      moment().format('YYYY/MM/DD')
    );
  }

  callbackForIcon(
    data: DataForRecruit
  ): (RecruitIcon | RecruitIcon[] | ((i: number) => RecruitIcon))[] {
    const iconsArray: (
      | RecruitIcon
      | RecruitIcon[]
      | ((i: number) => RecruitIcon)
    )[] = [];
    if (data.stateRecruit?.recruitmentRegistered) {
      // recruitmentConversion
      // FIXME после соглосования нужно будет выпилить тернарники и лишние объекты
      if (
        data.stateRecruit?.recruitmentConversion ||
        data.stateRecruit?.recruitmentRegistered === 'REMOVED_REGISTERED'
      ) {
        data.stateRecruit?.recruitmentConversion &&
          iconsArray.push(this.recruitIcons.Conversion(1));
        if (data.stateRecruit?.recruitmentRegistered === 'REMOVED_REGISTERED') {
          iconsArray.push([this.recruitIcons.REMOVED_REGISTERED]);
          // recruitmentSubpoena
          data.stateRecruit?.recruitmentSubpoena
            ? iconsArray.push(this.recruitIcons.Subpoena(1))
            : iconsArray.push(this.recruitIcons.Subpoena(0));
          // recruitmentMeasures
          data.stateRecruit?.recruitmentMeasures
            ? iconsArray.push(this.recruitIcons.Measures(1))
            : iconsArray.push(this.recruitIcons.Measures(0));
        }
      } else {
        Object.entries(this.recruitIcons)
          .slice(0, 3)
          .forEach(([key, value]) =>
            key === data.stateRecruit?.recruitmentRegistered
              ? iconsArray.push([value as RecruitIcon])
              : ''
          );
        if (
          data.stateRecruit?.recruitmentNotPersonal ||
          data.stateRecruit?.recruitmentChangeVK ||
          data.stateRecruit?.changeVkInProgress
        ) {
          // recruitmentNotPersonal
          data.stateRecruit?.recruitmentNotPersonal &&
            (iconsArray[0] as RecruitIcon[]).push(
              this.recruitIcons.Personal as RecruitIcon
            );
          // recruitmentChangeVK
          data.stateRecruit?.changeVkInProgress
            ? (iconsArray[0] as RecruitIcon[]).push(
                this.recruitIcons.ChangeVK(0) as RecruitIcon
              )
            : data.stateRecruit?.recruitmentChangeVK &&
              (iconsArray[0] as RecruitIcon[]).push(
                this.recruitIcons.ChangeVK(1) as RecruitIcon
              );
        }
        // recruitmentSubpoena
        if (
          data.stateRecruit?.recruitmentSubpoena &&
          data?.subpoenas?.[0]?.subpoenaDirected &&
          !data?.subpoenas?.[0]?.recruitAttendanceConfirm
        ) {
          iconsArray.push(this.recruitIcons.Subpoena(2));
        } else {
          data.stateRecruit?.recruitmentSubpoena
            ? iconsArray.push(this.recruitIcons.Subpoena(1))
            : iconsArray.push(this.recruitIcons.Subpoena(0));
        }
        // recruitmentMeasures
        data.stateRecruit?.recruitmentMeasures
          ? iconsArray.push(this.recruitIcons.Measures(1))
          : iconsArray.push(this.recruitIcons.Measures(0));
      }
      if (data.stateRecruit?.recruitmentRegistered !== 'REMOVED_REGISTERED') {
        // recruitmentApplication
        data.stateRecruit?.recruitmentApplication
          ? iconsArray.push(this.recruitIcons.Application(1))
          : iconsArray.push(this.recruitIcons.Application(0));
      }
      data.stateRecruit?.recruitmentIncident
        ? iconsArray.push(this.recruitIcons.Incident(1))
        : iconsArray.push(this.recruitIcons.Incident(0));
    }
    return iconsArray;
  }

  refresh(): void {
    this.$emit('refresh');
  }
}
</script>
