|
@@ -11,7 +11,7 @@
|
|
|
"
|
|
"
|
|
|
:pagination-label="getPaginationLabel"
|
|
:pagination-label="getPaginationLabel"
|
|
|
:rows="rows"
|
|
:rows="rows"
|
|
|
- :rows-per-page-label="props.rowsPerPageLabel"
|
|
|
|
|
|
|
+ :rows-per-page-label="$t('general.rows_per_page')"
|
|
|
:columns="props.columns"
|
|
:columns="props.columns"
|
|
|
:visible-columns="visibleColumns"
|
|
:visible-columns="visibleColumns"
|
|
|
:filter="pagination.filter"
|
|
:filter="pagination.filter"
|
|
@@ -35,14 +35,14 @@
|
|
|
</template>
|
|
</template>
|
|
|
</q-input>
|
|
</q-input>
|
|
|
|
|
|
|
|
- <q-checkbox
|
|
|
|
|
|
|
+ <!-- <q-checkbox
|
|
|
v-if="props.mostrarToggleInativos"
|
|
v-if="props.mostrarToggleInativos"
|
|
|
v-model="pagination.showInativos"
|
|
v-model="pagination.showInativos"
|
|
|
class="q-ml-sm"
|
|
class="q-ml-sm"
|
|
|
:label="props.labelInativo"
|
|
:label="props.labelInativo"
|
|
|
dense
|
|
dense
|
|
|
color="secondary"
|
|
color="secondary"
|
|
|
- />
|
|
|
|
|
|
|
+ /> -->
|
|
|
|
|
|
|
|
<q-select
|
|
<q-select
|
|
|
v-if="mostrarSelecaoDeColunas"
|
|
v-if="mostrarSelecaoDeColunas"
|
|
@@ -96,10 +96,10 @@
|
|
|
<q-item-section>
|
|
<q-item-section>
|
|
|
<span class="text-center">
|
|
<span class="text-center">
|
|
|
<div v-if="row.status && value" class="ativo body2 text-positive">
|
|
<div v-if="row.status && value" class="ativo body2 text-positive">
|
|
|
- {{ $t("active") }}
|
|
|
|
|
|
|
+ {{ $t("general.active") }}
|
|
|
</div>
|
|
</div>
|
|
|
<div v-if="!row.status" class="inativo body2 text-accent">
|
|
<div v-if="!row.status" class="inativo body2 text-accent">
|
|
|
- {{ $t("inactive") }}
|
|
|
|
|
|
|
+ {{ $t("general.inactive") }}
|
|
|
</div>
|
|
</div>
|
|
|
</span>
|
|
</span>
|
|
|
</q-item-section>
|
|
</q-item-section>
|
|
@@ -111,57 +111,32 @@
|
|
|
<q-item-section>
|
|
<q-item-section>
|
|
|
<span class="text-center">
|
|
<span class="text-center">
|
|
|
<div v-if="row.ativo && value" class="ativo body2 text-positive">
|
|
<div v-if="row.ativo && value" class="ativo body2 text-positive">
|
|
|
- {{ $t("active") }}
|
|
|
|
|
|
|
+ {{ $t("general.active") }}
|
|
|
</div>
|
|
</div>
|
|
|
<div v-if="row.ativo && !value" class="ativo body2 text-positive">
|
|
<div v-if="row.ativo && !value" class="ativo body2 text-positive">
|
|
|
- {{ $t("active") }}
|
|
|
|
|
|
|
+ {{ $t("general.active") }}
|
|
|
</div>
|
|
</div>
|
|
|
<div v-if="!row.ativo" class="inativo body2 text-accent">
|
|
<div v-if="!row.ativo" class="inativo body2 text-accent">
|
|
|
- {{ $t("active") }}
|
|
|
|
|
|
|
+ {{ $t("general.active") }}
|
|
|
</div>
|
|
</div>
|
|
|
</span>
|
|
</span>
|
|
|
</q-item-section>
|
|
</q-item-section>
|
|
|
</q-td>
|
|
</q-td>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
- <template #body-cell-principal="{ value, row }">
|
|
|
|
|
- <q-td style="width: 1%">
|
|
|
|
|
- <q-item-section>
|
|
|
|
|
- <span class="text-center">
|
|
|
|
|
- <q-icon
|
|
|
|
|
- v-if="row.principal && value"
|
|
|
|
|
- name="mdi-star"
|
|
|
|
|
- size="1.5rem"
|
|
|
|
|
- style="color: #385873"
|
|
|
|
|
- onmouseover="this.style.color='#688FAF';"
|
|
|
|
|
- onmouseout="this.style.color='#385873';"
|
|
|
|
|
- @click.stop="togglePrincipal(row)"
|
|
|
|
|
- />
|
|
|
|
|
- <q-icon
|
|
|
|
|
- v-if="!row.principal"
|
|
|
|
|
- name="mdi-star-outline"
|
|
|
|
|
- size="1.5rem"
|
|
|
|
|
- style="color: #385873"
|
|
|
|
|
- onmouseover="this.style.color='#688FAF';"
|
|
|
|
|
- onmouseout="this.style.color='#385873';"
|
|
|
|
|
- @click.stop="togglePrincipal(row)"
|
|
|
|
|
- />
|
|
|
|
|
- </span>
|
|
|
|
|
- </q-item-section>
|
|
|
|
|
- </q-td>
|
|
|
|
|
- </template>
|
|
|
|
|
-
|
|
|
|
|
<template v-if="!props.hideNoDataLabel" #no-data>
|
|
<template v-if="!props.hideNoDataLabel" #no-data>
|
|
|
<div class="q-my-md row justify-center full-width">
|
|
<div class="q-my-md row justify-center full-width">
|
|
|
<q-spinner v-if="loading" color="primary" size="30px" />
|
|
<q-spinner v-if="loading" color="primary" size="30px" />
|
|
|
- <div v-else class="q-pa-md body2">{{ $t("no_records_found") }}</div>
|
|
|
|
|
|
|
+ <div v-else class="q-pa-md body2">
|
|
|
|
|
+ {{ $t("errors.no_records_found") }}
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template #bottom="scope">
|
|
<template #bottom="scope">
|
|
|
<div class="flex full-width justify-end">
|
|
<div class="flex full-width justify-end">
|
|
|
<div class="flex items-center">
|
|
<div class="flex items-center">
|
|
|
- {{ props.rowsPerPageLabel }}
|
|
|
|
|
|
|
+ {{ $t("general.rows_per_page") }}
|
|
|
<q-select
|
|
<q-select
|
|
|
v-model="pagination.rowsPerPage"
|
|
v-model="pagination.rowsPerPage"
|
|
|
class="q-mx-sm"
|
|
class="q-mx-sm"
|
|
@@ -173,7 +148,7 @@
|
|
|
<q-item v-bind="selectData.itemProps">
|
|
<q-item v-bind="selectData.itemProps">
|
|
|
<q-item-section>
|
|
<q-item-section>
|
|
|
<q-item-label>{{
|
|
<q-item-label>{{
|
|
|
- selectData.opt == 0 ? $t("all") : selectData.opt
|
|
|
|
|
|
|
+ selectData.opt == 0 ? $t("general.all") : selectData.opt
|
|
|
}}</q-item-label>
|
|
}}</q-item-label>
|
|
|
</q-item-section>
|
|
</q-item-section>
|
|
|
</q-item>
|
|
</q-item>
|
|
@@ -181,7 +156,7 @@
|
|
|
</q-select>
|
|
</q-select>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="flex items-center">
|
|
<div class="flex items-center">
|
|
|
- {{ pagination.from + "-" + pagination.to }} {{ $t("of") }}
|
|
|
|
|
|
|
+ {{ pagination.from + "-" + pagination.to }} {{ $t("labels.of") }}
|
|
|
{{ pagination.rowsNumber }}
|
|
{{ pagination.rowsNumber }}
|
|
|
</div>
|
|
</div>
|
|
|
<div class="flex items-center">
|
|
<div class="flex items-center">
|
|
@@ -216,7 +191,6 @@
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { ref, onMounted, toRaw, watch } from "vue";
|
|
import { ref, onMounted, toRaw, watch } from "vue";
|
|
|
import { useRouter } from "vue-router";
|
|
import { useRouter } from "vue-router";
|
|
|
-import { api } from "boot/axios";
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits([
|
|
const emit = defineEmits([
|
|
|
"onRowClick",
|
|
"onRowClick",
|
|
@@ -234,7 +208,7 @@ const props = defineProps({
|
|
|
|
|
|
|
|
// rota da api, ex: /clientes
|
|
// rota da api, ex: /clientes
|
|
|
apiRoute: {
|
|
apiRoute: {
|
|
|
- type: String,
|
|
|
|
|
|
|
+ type: Function,
|
|
|
required: true,
|
|
required: true,
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -299,10 +273,10 @@ const props = defineProps({
|
|
|
default: false,
|
|
default: false,
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- mostrarToggleInativos: {
|
|
|
|
|
- type: Boolean,
|
|
|
|
|
- default: false,
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // mostrarToggleInativos: {
|
|
|
|
|
+ // type: Boolean,
|
|
|
|
|
+ // default: false,
|
|
|
|
|
+ // },
|
|
|
|
|
|
|
|
mostrarCampoPesquisa: {
|
|
mostrarCampoPesquisa: {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
@@ -319,19 +293,15 @@ const props = defineProps({
|
|
|
default: false,
|
|
default: false,
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- rowsPerPageLabel: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: "Linhas por página",
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
hideNoDataLabel: {
|
|
hideNoDataLabel: {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
|
default: false,
|
|
default: false,
|
|
|
},
|
|
},
|
|
|
- labelInativo: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: "Exibir inativos",
|
|
|
|
|
- },
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // labelInativo: {
|
|
|
|
|
+ // type: String,
|
|
|
|
|
+ // default: "Exibir inativos",
|
|
|
|
|
+ // },
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
@@ -445,16 +415,9 @@ const onRequest = async () => {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
|
|
|
|
|
// pega os dados do servidor
|
|
// pega os dados do servidor
|
|
|
- const response = await api.get(`${props.apiRoute}`, {
|
|
|
|
|
- params: {
|
|
|
|
|
- filter: pagination.value.filter,
|
|
|
|
|
- page: pagination.value.page,
|
|
|
|
|
- rowsPerPage: pagination.value.rowsPerPage,
|
|
|
|
|
- exibirInativos: pagination.value.showInativos,
|
|
|
|
|
- },
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ const response = await props.apiRoute();
|
|
|
// limpa os dados atuais e adiciona os novos
|
|
// limpa os dados atuais e adiciona os novos
|
|
|
- rows.value.splice(0, rows.value.length, ...response.data.result.data);
|
|
|
|
|
|
|
+ rows.value.splice(0, rows.value.length, ...response);
|
|
|
|
|
|
|
|
pagination.value.rowsNumber = response.data.result.total;
|
|
pagination.value.rowsNumber = response.data.result.total;
|
|
|
pagination.value.from = response.data.result.from;
|
|
pagination.value.from = response.data.result.from;
|
|
@@ -467,11 +430,6 @@ const onRequest = async () => {
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-// funcao exclusiva para contatos table, para alterar o contato principal
|
|
|
|
|
-const togglePrincipal = async (row) => {
|
|
|
|
|
- emit("togglePrincipal", row);
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
|
await onRequest();
|
|
await onRequest();
|
|
|
if (props.comecarDesativado) {
|
|
if (props.comecarDesativado) {
|