<template lang="pug">
  .w-full.h-full
    medical-header.mb-2(
      v-model="currentMenuItem",
      :change-shown-remove-modal="changeShownRemoveModal",
    )
    component(
      v-if="currentMenuItem",
      v-bind:is="currentMenuItem",
    )
    base-modal(
      v-model="isShownRemoveModal",
      title="Удаление медкарты"
    )
      medical-remove-modal(:change-shown-remove-modal="changeShownRemoveModal")
</template>

<script>
import MedicalHeader from "@/pages/newMedicalCard/components/MedicalHeader.vue";
import MedicalBaseInfo from "@/pages/newMedicalCard/components/MedicalBaseInfo.vue";
import BaseModal from "@/components/base/BaseModal.vue";
import MedicalRemoveModal from "@/pages/newMedicalCard/components/MedicalRemoveModal.vue";
import { mapState } from "vuex";
export default {
  name: "TheMedicalCard",
  components: {
    MedicalHeader,
    MedicalBaseInfo,
    BaseModal,
    MedicalRemoveModal,
  },
  data() {
    return {
      currentMenuItem: "MedicalBaseInfo",
      isShownRemoveModal: false,
    };
  },
  methods: {
    changeShownRemoveModal(value) {
      this.isShownRemoveModal = value;
    },
  },
  computed: mapState({
    medical: (state) => state.medical.medicalCard,
  }),
  created() {
    this.$store.dispatch("getMedicalCardData");
  },
};
</script>
