<!--
Calendar implementation for the HTWK Leipzig timetable. Evaluation and display of the individual dates in iCal format.
Copyright (C) 2024 HTWKalender support@htwkalender.de

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
-->

<script lang="ts" setup>
import { defineAsyncComponent } from "vue";
import moduleStore from "@/store/moduleStore";
import { router } from "@/main";
import { useI18n } from "vue-i18n";
const { t } = useI18n({ useScope: "global" });

const store = moduleStore();
const AdditionalModuleTable = defineAsyncComponent(
  () => import("@/components/AdditionalModuleTable.vue"),
);

async function nextStep() {
  await router.push("/edit-calendar");
}
</script>

<template>
  <div class="flex flex-column align-items-center w-full mb-7">
    <div class="flex align-items-center justify-content-center m-2">
      <h3>
        {{ t("additionalModules.subTitle") }}
      </h3>
    </div>
    <AdditionalModuleTable />
    <div
      class="flex align-items-center justify-content-end h-4rem m-2 w-full lg:w-10"
    >
      <Button
        :disabled="store.isEmpty()"
        class="col-12 md:col-4 mb-3 align-self-end"
        icon="pi pi-arrow-right"
        :label="t('additionalModules.nextStep')"
        @click="nextStep()"
      />
    </div>
  </div>
</template>
