Files
pleno-vue/src/components/displays/pagination/models/DepartmentPos/NotificationsPhonePagination.vue
T

57 lines
1.9 KiB
Vue

<script setup>
import { SessionUser } from "@/components/session/token/SessionUser.vue";
import { useRouter } from "vue-router";
import {
usePaginatedList,
PaginatedListKey
} from "@/components/pagination/paginatedList.vue";
import { provide } from "vue";
import { useI18n } from 'vue-i18n';
const paginatedList = usePaginatedList();
provide(PaginatedListKey, paginatedList);
const {
list,
loadList,
setEndpoint,
setFilter,
} = paginatedList;
import TableLabeledPagination from "@/components/displays/pagination/TableLabeledPagination.vue";
import DepartmentNotificationsPhoneTable
from "@/components/displays/department/notifications/departmentNotificationsPhoneTable.vue";
const router = useRouter();
const { t } = useI18n();
// If the departmentId is set, in the route, filter the orders by the departmentId
if (router.currentRoute.value.params.departmentId) {
setEndpoint(SessionUser.objects.department_notification_sms.meta.endpoint, false);
setFilter("department", router.currentRoute.value.params.departmentId);
} else {
setEndpoint(SessionUser.objects.department_notification_sms.meta.endpoint, true);
}
</script>
<template>
<TableLabeledPagination :label="SessionUser.objects.department_notification_sms.meta.title">
<template #buttons="{ loadList }">
<button
class="button is-info is-small"
@click="SessionUser.objects.department_notification_sms.showCreateObjectForm(() => loadList(), {department: parseInt(router.currentRoute.value.params.departmentId)})"
>
<span class="icon is-small">
<i class="fas fa-plus"></i>
</span>
<span>{{ t('common.add') }} {{ SessionUser.objects.department_notification_sms.meta.labels.single }}</span>
</button>
</template>
<DepartmentNotificationsPhoneTable :objects="list" />
</TableLabeledPagination>
</template>
<style scoped>
</style>