<!--
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 moduleStore from "@/store/moduleStore";
import { router } from "@/main";
import AdditionalModuleTable from "@/components/AdditionalModuleTable.vue";
import { useI18n } from "vue-i18n";
const { t } = useI18n({ useScope: "global" });

const store = moduleStore();

function topFunction() {
  window.scrollTo({ top: 0, behavior: "smooth" });
}

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

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