|
@@ -27,6 +27,21 @@
|
|
|
:rules="[inputRules.required]"
|
|
:rules="[inputRules.required]"
|
|
|
class="col-12 input-violet"
|
|
class="col-12 input-violet"
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <div class="col-12">
|
|
|
|
|
+ <q-checkbox
|
|
|
|
|
+ v-model="form.forDependent"
|
|
|
|
|
+ color="primary"
|
|
|
|
|
+ :disable="!form.associado"
|
|
|
|
|
+ :label="$t('agendamento.for_dependent')"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <DependenteSelect
|
|
|
|
|
+ v-if="form.forDependent"
|
|
|
|
|
+ v-model="form.dependent"
|
|
|
|
|
+ :user-id="form.associado?.value ?? null"
|
|
|
|
|
+ :rules="[inputRules.required]"
|
|
|
|
|
+ class="col-12 input-violet"
|
|
|
|
|
+ />
|
|
|
<PartnerAgreementSelect
|
|
<PartnerAgreementSelect
|
|
|
v-model="form.partner"
|
|
v-model="form.partner"
|
|
|
:label="$t('ui.navigation.convenios')"
|
|
:label="$t('ui.navigation.convenios')"
|
|
@@ -134,6 +149,9 @@
|
|
|
/>
|
|
/>
|
|
|
</q-td>
|
|
</q-td>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <template #body-cell-dependent_name="{ row }">
|
|
|
|
|
+ <q-td>{{ row.dependent_name || '—' }}</q-td>
|
|
|
|
|
+ </template>
|
|
|
<template #body-cell-acoes="{ row }">
|
|
<template #body-cell-acoes="{ row }">
|
|
|
<q-td auto-width>
|
|
<q-td auto-width>
|
|
|
<div class="row no-wrap items-center" style="gap: 4px">
|
|
<div class="row no-wrap items-center" style="gap: 4px">
|
|
@@ -159,6 +177,19 @@
|
|
|
:loading="actionId === row.id && actionType === 'reject'"
|
|
:loading="actionId === row.id && actionType === 'reject'"
|
|
|
@click.prevent.stop="onReject(row)"
|
|
@click.prevent.stop="onReject(row)"
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <q-btn
|
|
|
|
|
+ dense
|
|
|
|
|
+ round
|
|
|
|
|
+ outline
|
|
|
|
|
+ icon="mdi-file-document-outline"
|
|
|
|
|
+ color="primary"
|
|
|
|
|
+ size="sm"
|
|
|
|
|
+ :disable="!row.can_issue_guide"
|
|
|
|
|
+ :loading="actionId === row.id && actionType === 'guide'"
|
|
|
|
|
+ @click.prevent.stop="onDownloadGuide(row)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <q-tooltip>{{ $t('agendamento.gerar_guia') }}</q-tooltip>
|
|
|
|
|
+ </q-btn>
|
|
|
</div>
|
|
</div>
|
|
|
</q-td>
|
|
</q-td>
|
|
|
</template>
|
|
</template>
|
|
@@ -179,6 +210,26 @@
|
|
|
<q-tooltip v-if="row.service_name">{{ row.service_name }}</q-tooltip>
|
|
<q-tooltip v-if="row.service_name">{{ row.service_name }}</q-tooltip>
|
|
|
</q-td>
|
|
</q-td>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <template #body-cell-dependent_name="{ row }">
|
|
|
|
|
+ <q-td>{{ row.dependent_name || '—' }}</q-td>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #body-cell-guia="{ row }">
|
|
|
|
|
+ <q-td auto-width class="text-center">
|
|
|
|
|
+ <q-btn
|
|
|
|
|
+ dense
|
|
|
|
|
+ round
|
|
|
|
|
+ outline
|
|
|
|
|
+ icon="mdi-file-document-outline"
|
|
|
|
|
+ color="primary"
|
|
|
|
|
+ size="sm"
|
|
|
|
|
+ :disable="!row.can_issue_guide"
|
|
|
|
|
+ :loading="actionId === row.id && actionType === 'guide'"
|
|
|
|
|
+ @click.prevent.stop="onDownloadGuide(row)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <q-tooltip>{{ $t('agendamento.gerar_guia') }}</q-tooltip>
|
|
|
|
|
+ </q-btn>
|
|
|
|
|
+ </q-td>
|
|
|
|
|
+ </template>
|
|
|
<template #body-cell-status>
|
|
<template #body-cell-status>
|
|
|
<q-td class="text-center">
|
|
<q-td class="text-center">
|
|
|
<q-chip
|
|
<q-chip
|
|
@@ -195,7 +246,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { ref, computed, onMounted, useTemplateRef, nextTick } from "vue";
|
|
|
|
|
|
|
+import { ref, computed, onMounted, useTemplateRef, nextTick, watch } from "vue";
|
|
|
import { useQuasar } from "quasar";
|
|
import { useQuasar } from "quasar";
|
|
|
import { useI18n } from "vue-i18n";
|
|
import { useI18n } from "vue-i18n";
|
|
|
import { useInputRules } from "src/composables/useInputRules";
|
|
import { useInputRules } from "src/composables/useInputRules";
|
|
@@ -206,6 +257,7 @@ import DefaultTableServerSide from "src/components/defaults/DefaultTableServerSi
|
|
|
import DefaultInput from "src/components/defaults/DefaultInput.vue";
|
|
import DefaultInput from "src/components/defaults/DefaultInput.vue";
|
|
|
import DefaultInputDatePicker from "src/components/defaults/DefaultInputDatePicker.vue";
|
|
import DefaultInputDatePicker from "src/components/defaults/DefaultInputDatePicker.vue";
|
|
|
import AssociadoSelect from "src/components/selects/AssociadoSelect.vue";
|
|
import AssociadoSelect from "src/components/selects/AssociadoSelect.vue";
|
|
|
|
|
+import DependenteSelect from "src/components/selects/DependenteSelect.vue";
|
|
|
import PartnerAgreementSelect from "src/components/selects/PartnerAgreementSelect.vue";
|
|
import PartnerAgreementSelect from "src/components/selects/PartnerAgreementSelect.vue";
|
|
|
import PartnerAgreementServiceSelect from "src/components/selects/PartnerAgreementServiceSelect.vue";
|
|
import PartnerAgreementServiceSelect from "src/components/selects/PartnerAgreementServiceSelect.vue";
|
|
|
import ApproveAppointmentDialog from "src/components/ApproveAppointmentDialog.vue";
|
|
import ApproveAppointmentDialog from "src/components/ApproveAppointmentDialog.vue";
|
|
@@ -216,6 +268,7 @@ import {
|
|
|
createAppointment,
|
|
createAppointment,
|
|
|
approveAppointment,
|
|
approveAppointment,
|
|
|
rejectAppointment,
|
|
rejectAppointment,
|
|
|
|
|
+ downloadAppointmentGuide,
|
|
|
} from "src/api/appointment";
|
|
} from "src/api/appointment";
|
|
|
|
|
|
|
|
const $q = useQuasar();
|
|
const $q = useQuasar();
|
|
@@ -237,6 +290,8 @@ const counters = ref({
|
|
|
|
|
|
|
|
const form = ref({
|
|
const form = ref({
|
|
|
associado: null,
|
|
associado: null,
|
|
|
|
|
+ forDependent: false,
|
|
|
|
|
+ dependent: null,
|
|
|
partner: null,
|
|
partner: null,
|
|
|
service: null,
|
|
service: null,
|
|
|
date: "",
|
|
date: "",
|
|
@@ -244,6 +299,21 @@ const form = ref({
|
|
|
observations: "",
|
|
observations: "",
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+watch(
|
|
|
|
|
+ () => form.value.forDependent,
|
|
|
|
|
+ (forDependent) => {
|
|
|
|
|
+ if (!forDependent) form.value.dependent = null;
|
|
|
|
|
+ },
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
|
|
+watch(
|
|
|
|
|
+ () => form.value.associado,
|
|
|
|
|
+ () => {
|
|
|
|
|
+ form.value.forDependent = false;
|
|
|
|
|
+ form.value.dependent = null;
|
|
|
|
|
+ },
|
|
|
|
|
+);
|
|
|
|
|
+
|
|
|
const tabs = computed(() => [
|
|
const tabs = computed(() => [
|
|
|
{
|
|
{
|
|
|
name: "nova-solicitacao",
|
|
name: "nova-solicitacao",
|
|
@@ -269,6 +339,7 @@ const columnsVisaoGeral = computed(() => [
|
|
|
{ name: "order_number", label: t("agendamento.col.pedido"), field: "order_number", align: "left" },
|
|
{ name: "order_number", label: t("agendamento.col.pedido"), field: "order_number", align: "left" },
|
|
|
{ name: "cracha", label: t("associado.cracha"), field: "registration", align: "left" },
|
|
{ name: "cracha", label: t("associado.cracha"), field: "registration", align: "left" },
|
|
|
{ name: "user_name", label: t("common.terms.name"), field: "user_name", align: "left" },
|
|
{ name: "user_name", label: t("common.terms.name"), field: "user_name", align: "left" },
|
|
|
|
|
+ { name: "dependent_name", label: t("associado.dependent"), field: "dependent_name", align: "left" },
|
|
|
{ name: "partner_name", label: t("agendamento.col.parceiro"), field: "partner_name", align: "left" },
|
|
{ name: "partner_name", label: t("agendamento.col.parceiro"), field: "partner_name", align: "left" },
|
|
|
{ name: "service_name", label: t("agendamento.col.servico"), field: "service_name", align: "left" },
|
|
{ name: "service_name", label: t("agendamento.col.servico"), field: "service_name", align: "left" },
|
|
|
{ name: "requested_at", label: t("agendamento.col.solicitacao"), field: "requested_at", align: "left" },
|
|
{ name: "requested_at", label: t("agendamento.col.solicitacao"), field: "requested_at", align: "left" },
|
|
@@ -279,9 +350,11 @@ const columnsVisaoGeral = computed(() => [
|
|
|
const columnsAprovados = computed(() => [
|
|
const columnsAprovados = computed(() => [
|
|
|
{ name: "order_number", label: t("agendamento.col.pedido"), field: "order_number", align: "left" },
|
|
{ name: "order_number", label: t("agendamento.col.pedido"), field: "order_number", align: "left" },
|
|
|
{ name: "user_name", label: t("common.terms.name"), field: "user_name", align: "left" },
|
|
{ name: "user_name", label: t("common.terms.name"), field: "user_name", align: "left" },
|
|
|
|
|
+ { name: "dependent_name", label: t("associado.dependent"), field: "dependent_name", align: "left" },
|
|
|
{ name: "partner_name", label: t("agendamento.col.parceiro"), field: "partner_name", align: "left" },
|
|
{ name: "partner_name", label: t("agendamento.col.parceiro"), field: "partner_name", align: "left" },
|
|
|
{ name: "service_name", label: t("agendamento.col.servico"), field: "service_name", align: "left" },
|
|
{ name: "service_name", label: t("agendamento.col.servico"), field: "service_name", align: "left" },
|
|
|
{ name: "requested_at", label: t("agendamento.col.solicitacao"), field: "requested_at", align: "left" },
|
|
{ name: "requested_at", label: t("agendamento.col.solicitacao"), field: "requested_at", align: "left" },
|
|
|
|
|
+ { name: "guia", label: t("agendamento.guia"), field: "guia", align: "center" },
|
|
|
{ name: "status", label: t("common.terms.status"), field: "status", align: "center" },
|
|
{ name: "status", label: t("common.terms.status"), field: "status", align: "center" },
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
@@ -316,6 +389,8 @@ const loadCounters = async () => {
|
|
|
const resetForm = async () => {
|
|
const resetForm = async () => {
|
|
|
form.value = {
|
|
form.value = {
|
|
|
associado: null,
|
|
associado: null,
|
|
|
|
|
+ forDependent: false,
|
|
|
|
|
+ dependent: null,
|
|
|
partner: null,
|
|
partner: null,
|
|
|
service: null,
|
|
service: null,
|
|
|
date: "",
|
|
date: "",
|
|
@@ -333,6 +408,7 @@ const submitAppointment = async () => {
|
|
|
try {
|
|
try {
|
|
|
await createAppointment({
|
|
await createAppointment({
|
|
|
user_id: form.value.associado.value,
|
|
user_id: form.value.associado.value,
|
|
|
|
|
+ user_dependent_id: form.value.dependent?.value ?? null,
|
|
|
partner_agreement_id: form.value.partner.value,
|
|
partner_agreement_id: form.value.partner.value,
|
|
|
partner_agreement_service_id: form.value.service.value,
|
|
partner_agreement_service_id: form.value.service.value,
|
|
|
time: form.value.time,
|
|
time: form.value.time,
|
|
@@ -390,6 +466,20 @@ const onReject = (row) => {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+const onDownloadGuide = async (row) => {
|
|
|
|
|
+ if (!row.can_issue_guide) return;
|
|
|
|
|
+ actionId.value = row.id;
|
|
|
|
|
+ actionType.value = "guide";
|
|
|
|
|
+ try {
|
|
|
|
|
+ await downloadAppointmentGuide(row.id, row.order_number);
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ $q.notify({ type: "negative", message: e?.message || t("http.errors.failed") });
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ actionId.value = null;
|
|
|
|
|
+ actionType.value = null;
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
loadCounters();
|
|
loadCounters();
|
|
|
});
|
|
});
|