|
|
@@ -17,7 +17,12 @@
|
|
|
|
|
|
<!-- Tab: Nova Solicitação -->
|
|
|
<div v-if="activeTab === 'novo'">
|
|
|
- <q-card flat class="form-card">
|
|
|
+ <div v-if="isOnLeave" class="on-leave-notice">
|
|
|
+ <q-icon name="mdi-account-off-outline" size="32px" color="warning" />
|
|
|
+ <div class="on-leave-notice__text">{{ $t('associado.on_leave_appointment') }}</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <q-card v-else flat class="form-card">
|
|
|
<q-card-section>
|
|
|
<q-form ref="appointmentFormRef" class="form-column" @submit="submitAppointment">
|
|
|
<PartnerAgreementSelect
|
|
|
@@ -35,22 +40,6 @@
|
|
|
class="input-violet"
|
|
|
for-associado
|
|
|
/>
|
|
|
- <DefaultInputDatePicker
|
|
|
- v-model:untreated-date="appointmentForm.date"
|
|
|
- :label="$t('common.terms.date')"
|
|
|
- :rules="[inputRules.required]"
|
|
|
- class="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="input-violet"
|
|
|
- />
|
|
|
<DefaultInput
|
|
|
v-model="appointmentForm.observations"
|
|
|
:label="$t('associado.notes')"
|
|
|
@@ -159,7 +148,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";
|
|
|
@@ -170,6 +158,11 @@ 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);
|
|
|
@@ -181,7 +174,7 @@ const tabs = 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);
|
|
|
const appointments = ref([]);
|
|
|
@@ -231,12 +224,10 @@ watch(activeTab, (val) => {
|
|
|
});
|
|
|
|
|
|
const resetForm = () => {
|
|
|
- selectedPartner.value = null;
|
|
|
- selectedService.value = null;
|
|
|
- appointmentForm.date = "";
|
|
|
- appointmentForm.time = "";
|
|
|
+ selectedPartner.value = null;
|
|
|
+ selectedService.value = null;
|
|
|
appointmentForm.observations = "";
|
|
|
- editingId.value = null;
|
|
|
+ editingId.value = null;
|
|
|
};
|
|
|
|
|
|
const submitAppointment = async () => {
|
|
|
@@ -246,8 +237,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 {
|
|
|
@@ -268,13 +257,11 @@ const submitAppointment = async () => {
|
|
|
};
|
|
|
|
|
|
const onEditAppointment = (apt) => {
|
|
|
- editingId.value = apt.id;
|
|
|
- selectedPartner.value = { value: apt.partner_agreement_id, label: apt.partner_agreement?.trade_name || apt.partner_agreement?.company_name || "" };
|
|
|
- selectedService.value = { value: apt.partner_agreement_service_id, label: apt.partner_agreement_service?.name || "" };
|
|
|
- appointmentForm.date = apt.date ?? "";
|
|
|
- appointmentForm.time = apt.time ?? "";
|
|
|
+ editingId.value = apt.id;
|
|
|
+ selectedPartner.value = { value: apt.partner_agreement_id, label: apt.partner_agreement?.trade_name || apt.partner_agreement?.company_name || "" };
|
|
|
+ selectedService.value = { value: apt.partner_agreement_service_id, label: apt.partner_agreement_service?.name || "" };
|
|
|
appointmentForm.observations = apt.observations ?? "";
|
|
|
- activeTab.value = "novo";
|
|
|
+ activeTab.value = "novo";
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
@@ -312,6 +299,24 @@ const onEditAppointment = (apt) => {
|
|
|
&--selected { background: #4d1658; color: #fff; }
|
|
|
}
|
|
|
|
|
|
+.on-leave-notice {
|
|
|
+ background: white;
|
|
|
+ border-radius: 12px;
|
|
|
+ padding: 32px 20px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ gap: 12px;
|
|
|
+ text-align: center;
|
|
|
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
|
|
|
+
|
|
|
+ &__text {
|
|
|
+ font-size: 14px;
|
|
|
+ color: vars.$color-text-2;
|
|
|
+ line-height: 1.5;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
.form-card {
|
|
|
background: white !important;
|
|
|
border-radius: 12px;
|