You've already forked isop-mirror
feat: add basic default agreement generator
This commit is contained in:
39
frontend/app/components/InternshipAgreementDownloader.vue
Normal file
39
frontend/app/components/InternshipAgreementDownloader.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<script setup lang="ts">
|
||||
import { FetchError } from 'ofetch';
|
||||
|
||||
const props = defineProps<{
|
||||
internship_id: number
|
||||
}>();
|
||||
|
||||
const client = useSanctumClient();
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
async function requestDownload() {
|
||||
loading.value = true;
|
||||
|
||||
try {
|
||||
const agreement = await client(`/api/internships/${props.internship_id}/default-agreement`);
|
||||
// todo...
|
||||
|
||||
} catch (e) {
|
||||
if (e instanceof FetchError) {
|
||||
alert(`Nepodarilo sa vygenerovať zmluvu: ${e.statusMessage}`);
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-btn prepend-icon="mdi-download" color="blue" class="mr-2 mt-2" block :disabled="loading"
|
||||
@click="requestDownload">
|
||||
<span v-show="!loading">Stiahnuť originálnu zmluvu</span>
|
||||
<span v-show="loading">Prosím čakajte...</span>
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped></style>
|
||||
@@ -30,15 +30,17 @@ async function downloadReport() {
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-row>
|
||||
<v-row class="d-flex">
|
||||
<!-- Podpísaná zmluva -->
|
||||
<v-col cols="12" md="6">
|
||||
<v-card variant="outlined">
|
||||
<v-card variant="outlined" class="h-100">
|
||||
<v-card-title class="d-flex align-center ga-2">
|
||||
<v-icon icon="mdi mdi-file-document-outline" />
|
||||
Podpísaná zmluva / dohoda
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<InternshipAgreementDownloader :internship_id="internship.id" />
|
||||
|
||||
<WarningAlert v-if="!props.internship.agreement" title="Neodovzdané"
|
||||
text="Zmluva zatiaľ nebola nahratá." />
|
||||
|
||||
@@ -56,7 +58,7 @@ async function downloadReport() {
|
||||
|
||||
<!-- Výkaz -->
|
||||
<v-col cols="12" md="6">
|
||||
<v-card variant="outlined">
|
||||
<v-card variant="outlined" class="h-100">
|
||||
<v-card-title class="d-flex align-center ga-2">
|
||||
<v-icon icon="mdi-file-clock-outline" />
|
||||
Výkaz
|
||||
|
||||
Reference in New Issue
Block a user