|
@@ -79,6 +79,7 @@
|
|
|
:extra-filters="extraFilters"
|
|
:extra-filters="extraFilters"
|
|
|
align-actions-left
|
|
align-actions-left
|
|
|
open-item
|
|
open-item
|
|
|
|
|
+ stack-filters
|
|
|
@on-row-click="onRowClick"
|
|
@on-row-click="onRowClick"
|
|
|
>
|
|
>
|
|
|
<template #filters>
|
|
<template #filters>
|
|
@@ -102,6 +103,42 @@
|
|
|
style="min-width: 180px"
|
|
style="min-width: 180px"
|
|
|
:placeholder="$t('associado.filter_by_sector')"
|
|
:placeholder="$t('associado.filter_by_sector')"
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <DefaultSelect
|
|
|
|
|
+ v-model="selectedStatus"
|
|
|
|
|
+ :label="$t('common.terms.status')"
|
|
|
|
|
+ :options="filteredStatusOptions"
|
|
|
|
|
+ use-input
|
|
|
|
|
+ hide-selected
|
|
|
|
|
+ fill-input
|
|
|
|
|
+ clearable
|
|
|
|
|
+ dense
|
|
|
|
|
+ outlined
|
|
|
|
|
+ emit-value
|
|
|
|
|
+ map-options
|
|
|
|
|
+ color="violet-normal"
|
|
|
|
|
+ class="col-xs-12 col-sm-6 col-md-auto"
|
|
|
|
|
+ style="min-width: 180px"
|
|
|
|
|
+ :placeholder="$t('associado.filter_by_status')"
|
|
|
|
|
+ @filter="filterStatusOptions"
|
|
|
|
|
+ />
|
|
|
|
|
+ <DefaultSelect
|
|
|
|
|
+ v-model="selectedFirstAccess"
|
|
|
|
|
+ :label="$t('associado.primeiro_acesso')"
|
|
|
|
|
+ :options="filteredFirstAccessOptions"
|
|
|
|
|
+ use-input
|
|
|
|
|
+ hide-selected
|
|
|
|
|
+ fill-input
|
|
|
|
|
+ clearable
|
|
|
|
|
+ dense
|
|
|
|
|
+ outlined
|
|
|
|
|
+ emit-value
|
|
|
|
|
+ map-options
|
|
|
|
|
+ color="violet-normal"
|
|
|
|
|
+ class="col-xs-12 col-sm-6 col-md-auto"
|
|
|
|
|
+ style="min-width: 180px"
|
|
|
|
|
+ :placeholder="$t('associado.filter_by_first_access')"
|
|
|
|
|
+ @filter="filterFirstAccessOptions"
|
|
|
|
|
+ />
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #body-cell-actions="{ row }">
|
|
<template #body-cell-actions="{ row }">
|
|
@@ -163,10 +200,12 @@ import { useQuasar } from "quasar";
|
|
|
import { useI18n } from "vue-i18n";
|
|
import { useI18n } from "vue-i18n";
|
|
|
import { permissionStore } from "src/stores/permission";
|
|
import { permissionStore } from "src/stores/permission";
|
|
|
import { getAssociadosPaginated, importAssociados, importAfastamentos, setUserOnLeave, approveUser } from "src/api/user";
|
|
import { getAssociadosPaginated, importAssociados, importAfastamentos, setUserOnLeave, approveUser } from "src/api/user";
|
|
|
-import { getStatusColor, getStatusI18nKey } from "src/helpers/utils";
|
|
|
|
|
|
|
+import { getStatusColor, getStatusI18nKey, normalizeString } from "src/helpers/utils";
|
|
|
import { useImportPoller } from "src/composables/useImportPoller";
|
|
import { useImportPoller } from "src/composables/useImportPoller";
|
|
|
|
|
+import { useUserStatusOptions } from "src/composables/useUserStatusOptions";
|
|
|
import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
|
|
import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
|
|
|
import DefaultTableServerSide from "src/components/defaults/DefaultTableServerSide.vue";
|
|
import DefaultTableServerSide from "src/components/defaults/DefaultTableServerSide.vue";
|
|
|
|
|
+import DefaultSelect from "src/components/defaults/DefaultSelect.vue";
|
|
|
import PositionSelect from "src/components/selects/PositionSelect.vue";
|
|
import PositionSelect from "src/components/selects/PositionSelect.vue";
|
|
|
import SectorSelect from "src/components/selects/SectorSelect.vue";
|
|
import SectorSelect from "src/components/selects/SectorSelect.vue";
|
|
|
import AccessLogsTable from "./components/AccessLogsTable.vue";
|
|
import AccessLogsTable from "./components/AccessLogsTable.vue";
|
|
@@ -191,11 +230,41 @@ const { polling: importing, start: startPolling } = useImportPoller();
|
|
|
const importAfastamentosFileInput = useTemplateRef("importAfastamentosFileInput");
|
|
const importAfastamentosFileInput = useTemplateRef("importAfastamentosFileInput");
|
|
|
const { polling: importingAfastamentos, start: startAfastamentosPolling } = useImportPoller();
|
|
const { polling: importingAfastamentos, start: startAfastamentosPolling } = useImportPoller();
|
|
|
|
|
|
|
|
|
|
+const { userStatusOptions } = useUserStatusOptions();
|
|
|
|
|
+
|
|
|
|
|
+const firstAccessOptions = computed(() => [
|
|
|
|
|
+ { label: t("common.status.yes"), value: "true" },
|
|
|
|
|
+ { label: t("common.status.no"), value: "false" },
|
|
|
|
|
+]);
|
|
|
|
|
+
|
|
|
|
|
+const filteredStatusOptions = ref(userStatusOptions.value);
|
|
|
|
|
+const filteredFirstAccessOptions = ref(firstAccessOptions.value);
|
|
|
|
|
+
|
|
|
|
|
+const filterStatusOptions = (val, update) => {
|
|
|
|
|
+ const needle = normalizeString(val);
|
|
|
|
|
+ filteredStatusOptions.value = userStatusOptions.value.filter((o) =>
|
|
|
|
|
+ normalizeString(o.label).includes(needle),
|
|
|
|
|
+ );
|
|
|
|
|
+ update();
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+const filterFirstAccessOptions = (val, update) => {
|
|
|
|
|
+ const needle = normalizeString(val);
|
|
|
|
|
+ filteredFirstAccessOptions.value = firstAccessOptions.value.filter((o) =>
|
|
|
|
|
+ normalizeString(o.label).includes(needle),
|
|
|
|
|
+ );
|
|
|
|
|
+ update();
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const selectedPosition = ref(null);
|
|
const selectedPosition = ref(null);
|
|
|
const selectedSector = ref(null);
|
|
const selectedSector = ref(null);
|
|
|
|
|
+const selectedStatus = ref(null);
|
|
|
|
|
+const selectedFirstAccess = ref(null);
|
|
|
const extraFilters = computed(() => ({
|
|
const extraFilters = computed(() => ({
|
|
|
position_id: selectedPosition.value?.value,
|
|
position_id: selectedPosition.value?.value,
|
|
|
sector_id: selectedSector.value?.value,
|
|
sector_id: selectedSector.value?.value,
|
|
|
|
|
+ status: selectedStatus.value,
|
|
|
|
|
+ first_access: selectedFirstAccess.value === null ? null : selectedFirstAccess.value === "true",
|
|
|
}));
|
|
}));
|
|
|
|
|
|
|
|
const columns = computed(() => [
|
|
const columns = computed(() => [
|
|
@@ -204,7 +273,6 @@ const columns = computed(() => [
|
|
|
label: t("associado.cracha"),
|
|
label: t("associado.cracha"),
|
|
|
field: "registration",
|
|
field: "registration",
|
|
|
align: "left",
|
|
align: "left",
|
|
|
- sortable: true,
|
|
|
|
|
width: "10%",
|
|
width: "10%",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -212,7 +280,6 @@ const columns = computed(() => [
|
|
|
label: t("common.terms.name"),
|
|
label: t("common.terms.name"),
|
|
|
field: "name",
|
|
field: "name",
|
|
|
align: "left",
|
|
align: "left",
|
|
|
- sortable: true,
|
|
|
|
|
width: "25%",
|
|
width: "25%",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -220,7 +287,6 @@ const columns = computed(() => [
|
|
|
label: t("associado.position"),
|
|
label: t("associado.position"),
|
|
|
field: (row) => row.position?.name ?? "—",
|
|
field: (row) => row.position?.name ?? "—",
|
|
|
align: "left",
|
|
align: "left",
|
|
|
- sortable: true,
|
|
|
|
|
width: "25%",
|
|
width: "25%",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -228,7 +294,6 @@ const columns = computed(() => [
|
|
|
label: t("associado.admission"),
|
|
label: t("associado.admission"),
|
|
|
field: (row) => (row.admission_date ? row.admission_date : "—"),
|
|
field: (row) => (row.admission_date ? row.admission_date : "—"),
|
|
|
align: "left",
|
|
align: "left",
|
|
|
- sortable: true,
|
|
|
|
|
width: "10%",
|
|
width: "10%",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -236,7 +301,6 @@ const columns = computed(() => [
|
|
|
label: t("associado.validity"),
|
|
label: t("associado.validity"),
|
|
|
field: (row) => (row.expiry_date ? row.expiry_date : "—"),
|
|
field: (row) => (row.expiry_date ? row.expiry_date : "—"),
|
|
|
align: "left",
|
|
align: "left",
|
|
|
- sortable: true,
|
|
|
|
|
width: "10%",
|
|
width: "10%",
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -258,7 +322,6 @@ const columns = computed(() => [
|
|
|
label: t("common.terms.status"),
|
|
label: t("common.terms.status"),
|
|
|
field: "status",
|
|
field: "status",
|
|
|
align: "center",
|
|
align: "center",
|
|
|
- sortable: true,
|
|
|
|
|
width: "5%",
|
|
width: "5%",
|
|
|
},
|
|
},
|
|
|
]);
|
|
]);
|