|
|
@@ -13,34 +13,39 @@
|
|
|
<div class="flex gap-sm q-mt-md">
|
|
|
<q-btn
|
|
|
unelevated
|
|
|
+ dense
|
|
|
+ no-caps
|
|
|
class="btn-gradient"
|
|
|
:label="$t('associado.import_afastamentos')"
|
|
|
icon="mdi-upload"
|
|
|
- padding="8px 12px"
|
|
|
+ padding="6px 10px"
|
|
|
/>
|
|
|
<q-btn
|
|
|
unelevated
|
|
|
+ dense
|
|
|
+ no-caps
|
|
|
class="btn-gradient"
|
|
|
:label="$t('associado.import_associados')"
|
|
|
icon="mdi-upload"
|
|
|
- padding="8px 12px"
|
|
|
+ padding="6px 10px"
|
|
|
:loading="importing"
|
|
|
@click="onImportClick"
|
|
|
/>
|
|
|
<q-btn
|
|
|
unelevated
|
|
|
+ dense
|
|
|
class="btn-gradient"
|
|
|
icon="mdi-clock-outline"
|
|
|
- padding="8px 12px"
|
|
|
+ padding="6px 10px"
|
|
|
:title="$t('import_log.history_title')"
|
|
|
@click="onOpenImportHistory"
|
|
|
/>
|
|
|
<q-btn
|
|
|
unelevated
|
|
|
+ dense
|
|
|
class="btn-gradient"
|
|
|
- :label="$t('common.actions.new')"
|
|
|
icon="mdi-plus"
|
|
|
- padding="8px 12px"
|
|
|
+ padding="6px 10px"
|
|
|
@click="onAddItem"
|
|
|
/>
|
|
|
</div>
|
|
|
@@ -52,11 +57,36 @@
|
|
|
:columns="columns"
|
|
|
:api-call="getAssociadosPaginated"
|
|
|
:add-item="false"
|
|
|
+ :extra-filters="extraFilters"
|
|
|
+ align-actions-left
|
|
|
open-item
|
|
|
@on-row-click="onRowClick"
|
|
|
>
|
|
|
+ <template #filters>
|
|
|
+ <PositionSelect
|
|
|
+ v-model="selectedPosition"
|
|
|
+ clearable
|
|
|
+ dense
|
|
|
+ outlined
|
|
|
+ color="violet-normal"
|
|
|
+ class="col-xs-12 col-sm-6 col-md-auto"
|
|
|
+ style="min-width: 180px"
|
|
|
+ :placeholder="$t('associado.filter_by_position')"
|
|
|
+ />
|
|
|
+ <SectorSelect
|
|
|
+ v-model="selectedSector"
|
|
|
+ clearable
|
|
|
+ dense
|
|
|
+ outlined
|
|
|
+ color="violet-normal"
|
|
|
+ class="col-xs-12 col-sm-6 col-md-auto"
|
|
|
+ style="min-width: 180px"
|
|
|
+ :placeholder="$t('associado.filter_by_sector')"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+
|
|
|
<template #body-cell-actions="{ row }">
|
|
|
- <div class="row no-wrap items-center" style="gap: 4px">
|
|
|
+ <div class="row no-wrap justify-start items-center" style="gap: 4px">
|
|
|
<q-btn flat round dense color="violet-normal" icon="mdi-pencil" @click.stop="onRowClick({ row })" />
|
|
|
<q-btn
|
|
|
flat round dense
|
|
|
@@ -67,6 +97,16 @@
|
|
|
/>
|
|
|
<q-btn flat round dense color="violet-normal" icon="mdi-calendar" @click.stop />
|
|
|
<q-btn flat round dense color="violet-normal" icon="mdi-sofa" @click.stop />
|
|
|
+ <q-btn
|
|
|
+ v-if="row.status === 'pending' || row.status?.value === 'pending'"
|
|
|
+ flat
|
|
|
+ round
|
|
|
+ dense
|
|
|
+ color="violet-normal"
|
|
|
+ icon="mdi-check-circle-outline"
|
|
|
+ :title="$t('associado.approve_confirm')"
|
|
|
+ @click.stop="onApprove(row)"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -92,11 +132,13 @@ import { ref, computed, defineAsyncComponent, useTemplateRef } from "vue";
|
|
|
import { useQuasar } from "quasar";
|
|
|
import { useI18n } from "vue-i18n";
|
|
|
import { permissionStore } from "src/stores/permission";
|
|
|
-import { getAssociadosPaginated, importAssociados, setUserOnLeave } from "src/api/user";
|
|
|
+import { getAssociadosPaginated, importAssociados, setUserOnLeave, approveUser } from "src/api/user";
|
|
|
import { getStatusColor, getStatusI18nKey } from "src/helpers/utils";
|
|
|
import { useImportPoller } from "src/composables/useImportPoller";
|
|
|
import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
|
|
|
import DefaultTableServerSide from "src/components/defaults/DefaultTableServerSide.vue";
|
|
|
+import PositionSelect from "src/components/selects/PositionSelect.vue";
|
|
|
+import SectorSelect from "src/components/selects/SectorSelect.vue";
|
|
|
import AccessLogsTable from "./components/AccessLogsTable.vue";
|
|
|
|
|
|
const AddEditAssociadoDialog = defineAsyncComponent(
|
|
|
@@ -113,6 +155,13 @@ const tableRef = ref(null);
|
|
|
const importFileInput = useTemplateRef("importFileInput");
|
|
|
const { polling: importing, start: startPolling } = useImportPoller();
|
|
|
|
|
|
+const selectedPosition = ref(null);
|
|
|
+const selectedSector = ref(null);
|
|
|
+const extraFilters = computed(() => ({
|
|
|
+ position_id: selectedPosition.value?.value,
|
|
|
+ sector_id: selectedSector.value?.value,
|
|
|
+}));
|
|
|
+
|
|
|
const columns = computed(() => [
|
|
|
{
|
|
|
name: "registration",
|
|
|
@@ -157,7 +206,7 @@ const columns = computed(() => [
|
|
|
{
|
|
|
name: "actions",
|
|
|
label: t("common.terms.actions"),
|
|
|
- align: "right",
|
|
|
+ align: "center",
|
|
|
required: true,
|
|
|
width: "15%",
|
|
|
},
|
|
|
@@ -219,6 +268,28 @@ const onSetOnLeave = (row) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+const onApprove = (row) => {
|
|
|
+ if (!permission_store.getAccess("associado", "edit")) {
|
|
|
+ $q.notify({ type: "negative", message: t("validation.permissions.edit") });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ $q.dialog({
|
|
|
+ title: t("associado.approve_title"),
|
|
|
+ message: t("associado.approve_message", { name: row.name }),
|
|
|
+ cancel: { flat: true, label: t("common.actions.cancel"), color: "grey-7" },
|
|
|
+ ok: { unelevated: true, label: t("associado.approve_confirm"), color: "violet-normal" },
|
|
|
+ persistent: true,
|
|
|
+ }).onOk(async () => {
|
|
|
+ try {
|
|
|
+ await approveUser(row.id);
|
|
|
+ tableRef.value?.refresh();
|
|
|
+ } catch {
|
|
|
+ // silent
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
const onOpenImportHistory = () => {
|
|
|
$q.dialog({ component: ImportHistoryDialog, componentProps: { type: 'associado' } });
|
|
|
};
|