You've already forked isop-mirror
feat: enhance InternshipListView to support events
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Internship } from '~/types/internships';
|
import type { Internship, InternshipFilter } from '~/types/internships';
|
||||||
import type { Paginated } from '~/types/pagination';
|
import type { Paginated } from '~/types/pagination';
|
||||||
import { prettyInternshipStatus } from '~/types/internship_status';
|
import { prettyInternshipStatus } from '~/types/internship_status';
|
||||||
import { FetchError } from 'ofetch';
|
import { FetchError } from 'ofetch';
|
||||||
@@ -7,8 +7,12 @@ import { FetchError } from 'ofetch';
|
|||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
mode: 'admin' | 'company' | 'student';
|
mode: 'admin' | 'company' | 'student';
|
||||||
}>();
|
}>();
|
||||||
|
const emit = defineEmits<{
|
||||||
|
filterApplied: [value: InternshipFilter],
|
||||||
|
itemsAvailable: [value: boolean]
|
||||||
|
}>();
|
||||||
|
|
||||||
const filters = ref({
|
const filters = ref<InternshipFilter>({
|
||||||
year: null,
|
year: null,
|
||||||
company: null,
|
company: null,
|
||||||
study_programe: null,
|
study_programe: null,
|
||||||
@@ -50,10 +54,12 @@ const { data, error, pending, refresh } = await useLazySanctumFetch<Paginated<In
|
|||||||
|
|
||||||
watch(data, (newData) => {
|
watch(data, (newData) => {
|
||||||
totalItems.value = newData?.total ?? 0;
|
totalItems.value = newData?.total ?? 0;
|
||||||
|
emit('itemsAvailable', totalItems.value > 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(filters, async () => {
|
watch(filters, async () => {
|
||||||
page.value = 1;
|
page.value = 1;
|
||||||
|
emit('filterApplied', filters.value);
|
||||||
}, { deep: true });
|
}, { deep: true });
|
||||||
|
|
||||||
async function delteInternship(internship: Internship) {
|
async function delteInternship(internship: Internship) {
|
||||||
|
|||||||
Reference in New Issue
Block a user