|
@@ -183,7 +183,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { ref, computed, onMounted, useTemplateRef } from "vue";
|
|
|
|
|
|
|
+import { ref, computed, onMounted, useTemplateRef, nextTick } 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";
|
|
@@ -195,6 +195,7 @@ import DefaultInputDatePicker from "src/components/defaults/DefaultInputDatePick
|
|
|
import AssociadoSelect from "src/components/selects/AssociadoSelect.vue";
|
|
import AssociadoSelect from "src/components/selects/AssociadoSelect.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 {
|
|
import {
|
|
|
getAdminCounters,
|
|
getAdminCounters,
|
|
@@ -295,11 +296,11 @@ const loadCounters = async () => {
|
|
|
try {
|
|
try {
|
|
|
counters.value = await getAdminCounters();
|
|
counters.value = await getAdminCounters();
|
|
|
} catch {
|
|
} catch {
|
|
|
- // silent — counters show '—'
|
|
|
|
|
|
|
+ // silent
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const resetForm = () => {
|
|
|
|
|
|
|
+const resetForm = async () => {
|
|
|
form.value = {
|
|
form.value = {
|
|
|
associado: null,
|
|
associado: null,
|
|
|
partner: null,
|
|
partner: null,
|
|
@@ -308,6 +309,7 @@ const resetForm = () => {
|
|
|
time: "",
|
|
time: "",
|
|
|
observations: "",
|
|
observations: "",
|
|
|
};
|
|
};
|
|
|
|
|
+ await nextTick();
|
|
|
formRef.value?.resetValidation();
|
|
formRef.value?.resetValidation();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -324,11 +326,10 @@ const submitAppointment = async () => {
|
|
|
date: form.value.date,
|
|
date: form.value.date,
|
|
|
observations: form.value.observations || null,
|
|
observations: form.value.observations || null,
|
|
|
});
|
|
});
|
|
|
- $q.notify({ type: "positive", message: t("http.success") });
|
|
|
|
|
- resetForm();
|
|
|
|
|
|
|
+ await resetForm();
|
|
|
await loadCounters();
|
|
await loadCounters();
|
|
|
} catch {
|
|
} catch {
|
|
|
- $q.notify({ type: "negative", message: t("http.errors.failed") });
|
|
|
|
|
|
|
+ // silent
|
|
|
} finally {
|
|
} finally {
|
|
|
submitting.value = false;
|
|
submitting.value = false;
|
|
|
}
|
|
}
|
|
@@ -336,23 +337,17 @@ const submitAppointment = async () => {
|
|
|
|
|
|
|
|
const onApprove = (row) => {
|
|
const onApprove = (row) => {
|
|
|
if (row.status !== "pendente") return;
|
|
if (row.status !== "pendente") return;
|
|
|
- $q.dialog({
|
|
|
|
|
- title: t("common.ui.messages.confirm_action"),
|
|
|
|
|
- message: t("agendamento.confirm_approve"),
|
|
|
|
|
- cancel: true,
|
|
|
|
|
- persistent: true,
|
|
|
|
|
- }).onOk(async () => {
|
|
|
|
|
- actionId.value = row.id;
|
|
|
|
|
|
|
+ $q.dialog({ component: ApproveAppointmentDialog }).onOk(async ({ date, time }) => {
|
|
|
|
|
+ actionId.value = row.id;
|
|
|
actionType.value = "approve";
|
|
actionType.value = "approve";
|
|
|
try {
|
|
try {
|
|
|
- await approveAppointment(row.id);
|
|
|
|
|
|
|
+ await approveAppointment(row.id, { date, time });
|
|
|
tableKey.value++;
|
|
tableKey.value++;
|
|
|
await loadCounters();
|
|
await loadCounters();
|
|
|
- $q.notify({ type: "positive", message: t("http.success") });
|
|
|
|
|
} catch {
|
|
} catch {
|
|
|
- $q.notify({ type: "negative", message: t("http.errors.failed") });
|
|
|
|
|
|
|
+ // silent
|
|
|
} finally {
|
|
} finally {
|
|
|
- actionId.value = null;
|
|
|
|
|
|
|
+ actionId.value = null;
|
|
|
actionType.value = null;
|
|
actionType.value = null;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|