|
@@ -0,0 +1,112 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <DefaultHeaderPage />
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <DefaultTable
|
|
|
|
|
+ ref="tableRef"
|
|
|
|
|
+ :columns="columns"
|
|
|
|
|
+ :api-call="getSpecialities"
|
|
|
|
|
+ :delete-function="deleteSpeciality"
|
|
|
|
|
+ :mostrar-selecao-de-colunas="false"
|
|
|
|
|
+ :mostrar-botao-fullscreen="false"
|
|
|
|
|
+ :mostrar-toggle-inativos="false"
|
|
|
|
|
+ open-item
|
|
|
|
|
+ add-item
|
|
|
|
|
+ @on-row-click="onRowClick"
|
|
|
|
|
+ @on-add-item="onAddItem"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+<script setup>
|
|
|
|
|
+import { defineAsyncComponent, useTemplateRef } from "vue";
|
|
|
|
|
+import { useQuasar } from "quasar";
|
|
|
|
|
+import { useI18n } from "vue-i18n";
|
|
|
|
|
+import { permissionStore } from "src/stores/permission";
|
|
|
|
|
+import { getSpecialities, deleteSpeciality } from "src/api/speciality";
|
|
|
|
|
+
|
|
|
|
|
+import DefaultTable from "src/components/defaults/DefaultTable.vue";
|
|
|
|
|
+import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
|
|
|
|
|
+
|
|
|
|
|
+const AddEditSpecialityDialog = defineAsyncComponent(() =>
|
|
|
|
|
+ import("src/pages/speciality/components/AddEditSpecialityDialog.vue")
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+const permission_store = permissionStore();
|
|
|
|
|
+const $q = useQuasar();
|
|
|
|
|
+const tableRef = useTemplateRef("tableRef");
|
|
|
|
|
+const { t } = useI18n();
|
|
|
|
|
+
|
|
|
|
|
+const columns = [
|
|
|
|
|
+ {
|
|
|
|
|
+ name: "description",
|
|
|
|
|
+ label: t("speciality.fields.description"),
|
|
|
|
|
+ field: "description",
|
|
|
|
|
+ align: "left",
|
|
|
|
|
+ sortable: true,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: "active",
|
|
|
|
|
+ label: t("common.status.active"),
|
|
|
|
|
+ field: (row) => (row.active ? t("common.status.yes") : t("common.status.no")),
|
|
|
|
|
+ align: "left",
|
|
|
|
|
+ sortable: true,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: "created_at",
|
|
|
|
|
+ label: t("common.terms.created_at"),
|
|
|
|
|
+ field: "created_at",
|
|
|
|
|
+ align: "left",
|
|
|
|
|
+ sortable: true,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: "actions",
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ },
|
|
|
|
|
+];
|
|
|
|
|
+
|
|
|
|
|
+const onRowClick = ({ row }) => {
|
|
|
|
|
+ if (permission_store.getAccess("config.speciality", "edit") === false) {
|
|
|
|
|
+ $q.loading.hide();
|
|
|
|
|
+ $q.notify({
|
|
|
|
|
+ type: "negative",
|
|
|
|
|
+ message: t("validation.permissions.edit"),
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ $q.dialog({
|
|
|
|
|
+ component: AddEditSpecialityDialog,
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ speciality: row,
|
|
|
|
|
+ title: () =>
|
|
|
|
|
+ useI18n().t("common.actions.edit") + " " + useI18n().t("ui.navigation.speciality"),
|
|
|
|
|
+ },
|
|
|
|
|
+ }).onOk(async (success) => {
|
|
|
|
|
+ if (success) {
|
|
|
|
|
+ tableRef.value.refresh();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const onAddItem = () => {
|
|
|
|
|
+ if (permission_store.getAccess("config.speciality", "add") === false) {
|
|
|
|
|
+ $q.loading.hide();
|
|
|
|
|
+ $q.notify({
|
|
|
|
|
+ type: "negative",
|
|
|
|
|
+ message: t("validation.permissions.add"),
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ $q.dialog({
|
|
|
|
|
+ component: AddEditSpecialityDialog,
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ title: () =>
|
|
|
|
|
+ useI18n().t("common.actions.add") + " " + useI18n().t("ui.navigation.speciality"),
|
|
|
|
|
+ },
|
|
|
|
|
+ }).onOk(async (success) => {
|
|
|
|
|
+ if (success) {
|
|
|
|
|
+ tableRef.value.refresh();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+</script>
|