|
|
@@ -17,7 +17,14 @@
|
|
|
|
|
|
<!-- Tab: Nova Solicitação -->
|
|
|
<div v-if="activeTab === 'novo'" class="q-mt-md">
|
|
|
- <q-card flat bordered >
|
|
|
+ <q-banner v-if="isOnLeave" rounded class="bg-orange-1 text-orange-9 q-mb-md">
|
|
|
+ <template #avatar>
|
|
|
+ <q-icon name="mdi-account-off-outline" color="orange" />
|
|
|
+ </template>
|
|
|
+ {{ $t('associado.on_leave_appointment') }}
|
|
|
+ </q-banner>
|
|
|
+
|
|
|
+ <q-card v-if="!isOnLeave" flat bordered>
|
|
|
<q-card-section>
|
|
|
<q-form ref="appointmentFormRef" @submit="submitAppointment">
|
|
|
<div class="row q-col-gutter-sm">
|
|
|
@@ -36,22 +43,6 @@
|
|
|
class="col-12 input-violet"
|
|
|
for-associado
|
|
|
/>
|
|
|
- <DefaultInputDatePicker
|
|
|
- v-model:untreated-date="appointmentForm.date"
|
|
|
- :label="$t('common.terms.date')"
|
|
|
- :rules="[inputRules.required]"
|
|
|
- class="col-12 col-md-6 input-violet"
|
|
|
- placeholder="dd/mm/aaaa"
|
|
|
- lazy-rules
|
|
|
- />
|
|
|
- <DefaultInput
|
|
|
- v-model="appointmentForm.time"
|
|
|
- :label="$t('common.terms.hour')"
|
|
|
- :rules="[inputRules.required]"
|
|
|
- mask="##:##"
|
|
|
- placeholder="HH:MM"
|
|
|
- class="col-12 col-md-6 input-violet"
|
|
|
- />
|
|
|
<DefaultInput
|
|
|
v-model="appointmentForm.observations"
|
|
|
:label="$t('associado.notes')"
|
|
|
@@ -152,7 +143,6 @@ import { createAppointment, getMyAppointments, updateAppointment } from "src/api
|
|
|
import { useInputRules } from "src/composables/useInputRules";
|
|
|
import DefaultHeaderPage from "src/components/layout/DefaultHeaderPage.vue";
|
|
|
import DefaultInput from "src/components/defaults/DefaultInput.vue";
|
|
|
-import DefaultInputDatePicker from "src/components/defaults/DefaultInputDatePicker.vue";
|
|
|
import PartnerAgreementSelect from "src/components/selects/PartnerAgreementSelect.vue";
|
|
|
import PartnerAgreementServiceSelect from "src/components/selects/PartnerAgreementServiceSelect.vue";
|
|
|
import { userStore } from "src/stores/user";
|
|
|
@@ -160,6 +150,12 @@ const { t } = useI18n();
|
|
|
const { inputRules } = useInputRules();
|
|
|
const appointmentFormRef = useTemplateRef("appointmentFormRef");
|
|
|
const user = userStore();
|
|
|
+
|
|
|
+const isOnLeave = computed(() => {
|
|
|
+ const s = user.user?.status;
|
|
|
+ return s === "on_leave" || s?.value === "on_leave";
|
|
|
+});
|
|
|
+
|
|
|
const activeTab = ref("novo");
|
|
|
const PER_PAGE = 12;
|
|
|
const currentPage = ref(1);
|
|
|
@@ -180,7 +176,7 @@ const columns = computed(() => [
|
|
|
|
|
|
const selectedPartner = ref(null);
|
|
|
const selectedService = ref(null);
|
|
|
-const appointmentForm = reactive({ date: "", time: "", observations: "" });
|
|
|
+const appointmentForm = reactive({ observations: "" });
|
|
|
const submitting = ref(false);
|
|
|
const editingId = ref(null);
|
|
|
|
|
|
@@ -233,8 +229,6 @@ watch(activeTab, (val) => {
|
|
|
const resetForm = () => {
|
|
|
selectedPartner.value = null;
|
|
|
selectedService.value = null;
|
|
|
- appointmentForm.date = "";
|
|
|
- appointmentForm.time = "";
|
|
|
appointmentForm.observations = "";
|
|
|
editingId.value = null;
|
|
|
};
|
|
|
@@ -246,8 +240,6 @@ const submitAppointment = async () => {
|
|
|
const payload = {
|
|
|
partner_agreement_id: selectedPartner.value.value,
|
|
|
partner_agreement_service_id: selectedService.value.value,
|
|
|
- date: appointmentForm.date,
|
|
|
- time: appointmentForm.time,
|
|
|
observations: appointmentForm.observations,
|
|
|
};
|
|
|
try {
|
|
|
@@ -276,8 +268,6 @@ const onEditAppointment = (apt) => {
|
|
|
value: apt.partner_agreement_service_id,
|
|
|
label: apt.partner_agreement_service?.name || "",
|
|
|
};
|
|
|
- appointmentForm.date = apt.date ?? "";
|
|
|
- appointmentForm.time = apt.time ?? "";
|
|
|
appointmentForm.observations = apt.observations ?? "";
|
|
|
activeTab.value = "novo";
|
|
|
};
|