|
@@ -55,6 +55,8 @@
|
|
|
<DefaultInputDatePicker
|
|
<DefaultInputDatePicker
|
|
|
v-model:untreated-date="form.date"
|
|
v-model:untreated-date="form.date"
|
|
|
:label="$t('agendamento.data_opcional')"
|
|
:label="$t('agendamento.data_opcional')"
|
|
|
|
|
+ :rules="[optionalExactAdvanceDaysRule]"
|
|
|
|
|
+ :hint="$t('agendamento.data_disponivel', { date: allowedDateLabel })"
|
|
|
:date-options="allowedDateOptions"
|
|
:date-options="allowedDateOptions"
|
|
|
placeholder="dd/mm/aaaa"
|
|
placeholder="dd/mm/aaaa"
|
|
|
class="col-12 col-md-6"
|
|
class="col-12 col-md-6"
|
|
@@ -99,7 +101,7 @@
|
|
|
import { ref, computed, onMounted, nextTick } from "vue";
|
|
import { ref, computed, onMounted, nextTick } from "vue";
|
|
|
import { createPartnerExam } from "src/api/appointment";
|
|
import { createPartnerExam } from "src/api/appointment";
|
|
|
import { getMyPartnerAgreement } from "src/api/partnerAgreement";
|
|
import { getMyPartnerAgreement } from "src/api/partnerAgreement";
|
|
|
-import { formatToBRLCurrency, addDaysToToday } from "src/helpers/utils";
|
|
|
|
|
|
|
+import { formatToBRLCurrency, addDaysToToday, formatDateBR } from "src/helpers/utils";
|
|
|
import { useInputRules } from "src/composables/useInputRules";
|
|
import { useInputRules } from "src/composables/useInputRules";
|
|
|
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";
|
|
@@ -117,6 +119,7 @@ const partnerAgreementId = ref(null);
|
|
|
|
|
|
|
|
const ADVANCE_DAYS = 2;
|
|
const ADVANCE_DAYS = 2;
|
|
|
|
|
|
|
|
|
|
+const allowedDateLabel = computed(() => formatDateBR(addDaysToToday(ADVANCE_DAYS)));
|
|
|
const allowedDateOptions = computed(() => {
|
|
const allowedDateOptions = computed(() => {
|
|
|
const date = addDaysToToday(ADVANCE_DAYS);
|
|
const date = addDaysToToday(ADVANCE_DAYS);
|
|
|
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
@@ -124,6 +127,9 @@ const allowedDateOptions = computed(() => {
|
|
|
return [`${date.getFullYear()}/${month}/${day}`];
|
|
return [`${date.getFullYear()}/${month}/${day}`];
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+const optionalExactAdvanceDaysRule = (value) =>
|
|
|
|
|
+ !value || inputRules.exactAdvanceDays(ADVANCE_DAYS)(value);
|
|
|
|
|
+
|
|
|
const emptyForm = () => ({
|
|
const emptyForm = () => ({
|
|
|
associado: null,
|
|
associado: null,
|
|
|
forDependent: false,
|
|
forDependent: false,
|