v-sistec-features 1.31.12 → 1.31.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v-sistec-features.css +1 -1
- package/dist/vDataAgenda.d.ts +591 -17
- package/dist/vDataAgenda.js +3382 -3469
- package/package.json +1 -1
- package/src/DataAgenda/VDataAgenda.vue +122 -285
- package/src/DataAgenda/components/AgendaMatrix.vue +27 -18
- package/src/DataAgenda/components/AgendaMatrixBase.vue +93 -501
- package/src/DataAgenda/components/AgendaMatrixUnico.vue +18 -28
- package/src/DataAgenda/components/AgendaTabelaHorario.vue +105 -515
- package/src/DataAgenda/components/AgendaVueCal.vue +118 -199
- package/src/DataAgenda/components/ModalReserva.vue +200 -291
- package/src/DataAgenda/composables/useGradeCompartilhada.ts +216 -0
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
========
|
|
3
3
|
Este arquivo representa o componente de modal para criação e edição de reservas em uma agenda.
|
|
4
4
|
Ele gerencia o formulário de reserva, valida a disponibilidade de horários baseando-se na grade
|
|
5
|
-
do recurso selecionado, permite ativar repetição semanal até uma data limite
|
|
5
|
+
do recurso selecionado, permite ativar repetição semanal até uma data limite, disponibiliza slots
|
|
6
|
+
individuais para cada seção do formulário e salva os dados na API.
|
|
6
7
|
========
|
|
7
8
|
-->
|
|
8
9
|
<script setup lang="ts">
|
|
9
10
|
import { ref, computed, watch, inject } from 'vue';
|
|
10
11
|
import { useAgenda } from '../composables/useAgenda';
|
|
12
|
+
import { criarDataLocal } from '../composables/useGradeCompartilhada';
|
|
11
13
|
|
|
12
14
|
const api = inject('api-instance-agenda') as any;
|
|
13
15
|
const props = defineProps({
|
|
@@ -24,25 +26,13 @@ const {
|
|
|
24
26
|
criarReserva, criarReservaRecorrente, converterParaUtc, reservasBrutas
|
|
25
27
|
} = useAgenda(api);
|
|
26
28
|
|
|
27
|
-
// Indica se o formulário está em processo de salvamento na API.
|
|
28
29
|
const salvando = ref(false);
|
|
29
|
-
|
|
30
|
-
// Indica se o usuário alterou manualmente algum horário e precisa revalidar contra a grade.
|
|
31
30
|
const precisaValidar = ref(false);
|
|
32
|
-
|
|
33
|
-
// Controla se os inputs manuais de data/hora (Início e Fim) estão visíveis na tela.
|
|
34
31
|
const mostrarAjusteHorario = ref(false);
|
|
35
|
-
|
|
36
|
-
// Controla se a reserva será repetida semanalmente até uma data limite.
|
|
37
32
|
const repetirReserva = ref(false);
|
|
38
|
-
|
|
39
|
-
// Controla a exibição da sobreposição que lista os blocos disponíveis do dia.
|
|
40
33
|
const exibirHorariosModal = ref(false);
|
|
41
|
-
|
|
42
|
-
// Armazena as strings de blocos disponíveis para exibição ao usuário.
|
|
43
34
|
const horariosDisponiveisFormatados = ref<string[]>([]);
|
|
44
35
|
|
|
45
|
-
// Armazena o estado dos campos do formulário do modal.
|
|
46
36
|
const formReserva = ref({
|
|
47
37
|
id_recurso: '',
|
|
48
38
|
titulo_reserva: '',
|
|
@@ -53,38 +43,31 @@ const formReserva = ref({
|
|
|
53
43
|
data_limite_repeticao: ''
|
|
54
44
|
});
|
|
55
45
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const dt = new Date(partes[0]!, partes[1]! - 1, partes[2]!);
|
|
62
|
-
if (isNaN(dt.getTime())) return formReserva.value.data_inicio;
|
|
46
|
+
const dataInicioLocal = computed(() => {
|
|
47
|
+
if (!formReserva.value.data_inicio || formReserva.value.data_inicio.split('-').length !== 3) return null;
|
|
48
|
+
const dt = criarDataLocal(formReserva.value.data_inicio);
|
|
49
|
+
return isNaN(dt.getTime()) ? null : dt;
|
|
50
|
+
});
|
|
63
51
|
|
|
64
|
-
|
|
52
|
+
const textoDiaSelecionado = computed(() => {
|
|
53
|
+
if (!dataInicioLocal.value) return formReserva.value.data_inicio || 'Data não definida';
|
|
54
|
+
const diaSemana = dataInicioLocal.value.toLocaleDateString('pt-BR', { weekday: 'long' });
|
|
65
55
|
const diaSemanaCap = diaSemana.charAt(0).toUpperCase() + diaSemana.slice(1);
|
|
66
|
-
const dataBr =
|
|
56
|
+
const dataBr = dataInicioLocal.value.toLocaleDateString('pt-BR', { day: '2-digit', month: '2-digit', year: 'numeric' });
|
|
67
57
|
return `${diaSemanaCap}, ${dataBr}`;
|
|
68
58
|
});
|
|
69
59
|
|
|
70
|
-
// Devolve apenas o nome do dia da semana atual para exibir na dica de recorrência.
|
|
71
60
|
const nomeDiaSemana = computed(() => {
|
|
72
|
-
|
|
73
|
-
const partes = formReserva.value.data_inicio.split('-').map(Number);
|
|
74
|
-
if (partes.length !== 3) return 'semana';
|
|
75
|
-
const dt = new Date(partes[0]!, partes[1]! - 1, partes[2]!);
|
|
76
|
-
if (isNaN(dt.getTime())) return 'semana';
|
|
77
|
-
return dt.toLocaleDateString('pt-BR', { weekday: 'long' });
|
|
61
|
+
return dataInicioLocal.value ? dataInicioLocal.value.toLocaleDateString('pt-BR', { weekday: 'long' }) : 'semana';
|
|
78
62
|
});
|
|
79
63
|
|
|
80
|
-
// Devolve a frase amigável explicando de qual horário até qual horário o agendamento vai.
|
|
81
64
|
const textoIntervaloHorario = computed(() => {
|
|
82
|
-
|
|
83
|
-
const hFim = formReserva.value.hora_fim || '--:--';
|
|
84
|
-
return `Das ${hIni} até as ${hFim}`;
|
|
65
|
+
return `Das ${formReserva.value.hora_inicio || '--:--'} até as ${formReserva.value.hora_fim || '--:--'}`;
|
|
85
66
|
});
|
|
86
67
|
|
|
87
|
-
|
|
68
|
+
const alternarAjusteHorario = () => { mostrarAjusteHorario.value = !mostrarAjusteHorario.value; };
|
|
69
|
+
const definirRepetirReserva = (valor: boolean) => { repetirReserva.value = valor; };
|
|
70
|
+
|
|
88
71
|
const marcarComoAlterado = () => {
|
|
89
72
|
if (formReserva.value.data_inicio) {
|
|
90
73
|
formReserva.value.data_fim = formReserva.value.data_inicio;
|
|
@@ -95,34 +78,45 @@ const marcarComoAlterado = () => {
|
|
|
95
78
|
precisaValidar.value = true;
|
|
96
79
|
};
|
|
97
80
|
|
|
98
|
-
|
|
81
|
+
const converterHoraParaMinutos = (horaStr: string) => {
|
|
82
|
+
const [h, m] = horaStr.split(':').map(Number) as [number, number];
|
|
83
|
+
return h * 60 + m;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Localiza e ordena os períodos reserváveis do dia selecionado na agenda vinculada ao recurso.
|
|
87
|
+
const obterPeriodosReservaveisDoDia = () => {
|
|
88
|
+
if (!formReserva.value.id_recurso || !dataInicioLocal.value) return null;
|
|
89
|
+
|
|
90
|
+
const recurso = recursosDisponiveis.value.find((r: any) => Number(r.id_recurso) === Number(formReserva.value.id_recurso));
|
|
91
|
+
const agenda = agendasDisponiveis.value.find((a: any) => Number(a.id_agenda) === Number(recurso?.id_agenda));
|
|
92
|
+
const periodosAgenda = agenda?.detalhes?.periodos_agenda;
|
|
93
|
+
if (!periodosAgenda) return null;
|
|
94
|
+
|
|
95
|
+
const diaDaSemanaPython = (dataInicioLocal.value.getDay() + 6) % 7;
|
|
96
|
+
const periodosDoDia = periodosAgenda[diaDaSemanaPython] || [];
|
|
97
|
+
|
|
98
|
+
return periodosDoDia
|
|
99
|
+
.filter((s: any) => s.reservavel_periodo)
|
|
100
|
+
.map((s: any) => ({
|
|
101
|
+
...s,
|
|
102
|
+
inicioMin: converterHoraParaMinutos(s.hora_inicio_periodo),
|
|
103
|
+
fimMin: converterHoraParaMinutos(s.hora_fim_periodo)
|
|
104
|
+
}))
|
|
105
|
+
.sort((a: any, b: any) => a.inicioMin - b.inicioMin);
|
|
106
|
+
};
|
|
107
|
+
|
|
99
108
|
const mostrarHorariosPossiveis = () => {
|
|
100
109
|
if (!formReserva.value.id_recurso || !formReserva.value.data_inicio) {
|
|
101
110
|
alert("Selecione um recurso e uma data para ver os horários possíveis.");
|
|
102
111
|
return;
|
|
103
112
|
}
|
|
104
113
|
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const agenda = agendasDisponiveis.value.find((a: any) => Number(a.id_agenda) === Number(idAg));
|
|
108
|
-
|
|
109
|
-
if (!agenda || !agenda.detalhes || !agenda.detalhes.periodos_agenda) {
|
|
114
|
+
const slotsReservaveis = obterPeriodosReservaveisDoDia();
|
|
115
|
+
if (!slotsReservaveis) {
|
|
110
116
|
alert("Nenhuma grade de horários encontrada.");
|
|
111
117
|
return;
|
|
112
118
|
}
|
|
113
119
|
|
|
114
|
-
const inicioDate = new Date(`${formReserva.value.data_inicio}T00:00:00`);
|
|
115
|
-
const diaDaSemanaPython = (inicioDate.getDay() + 6) % 7;
|
|
116
|
-
const periodosDoDia = agenda.detalhes.periodos_agenda[diaDaSemanaPython] || [];
|
|
117
|
-
|
|
118
|
-
const slotsReservaveis = periodosDoDia
|
|
119
|
-
.filter((s: any) => s.reservavel_periodo)
|
|
120
|
-
.sort((a: any, b: any) => {
|
|
121
|
-
const [hA, mA] = a.hora_inicio_periodo.split(':').map(Number) as [number, number];
|
|
122
|
-
const [hB, mB] = b.hora_inicio_periodo.split(':').map(Number) as [number, number];
|
|
123
|
-
return (hA * 60 + mA) - (hB * 60 + mB);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
120
|
if (slotsReservaveis.length === 0) {
|
|
127
121
|
alert("Nenhum horário disponível para este dia na grade.");
|
|
128
122
|
return;
|
|
@@ -132,57 +126,32 @@ const mostrarHorariosPossiveis = () => {
|
|
|
132
126
|
exibirHorariosModal.value = true;
|
|
133
127
|
};
|
|
134
128
|
|
|
135
|
-
// Ajusta os horários de início e fim informados para que englobem o bloco reservável completo da agenda.
|
|
136
129
|
const ajustarHorarios = (silencioso = false) => {
|
|
137
130
|
if (!formReserva.value.id_recurso || !formReserva.value.data_inicio || !formReserva.value.hora_inicio || !formReserva.value.hora_fim) return;
|
|
138
131
|
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
const agenda = agendasDisponiveis.value.find((a: any) => Number(a.id_agenda) === Number(idAg));
|
|
142
|
-
|
|
143
|
-
if (!agenda || !agenda.detalhes || !agenda.detalhes.periodos_agenda) return;
|
|
144
|
-
|
|
145
|
-
const inicioDate = new Date(`${formReserva.value.data_inicio}T00:00:00`);
|
|
146
|
-
const diaDaSemanaPython = (inicioDate.getDay() + 6) % 7;
|
|
147
|
-
const periodosDoDia = agenda.detalhes.periodos_agenda[diaDaSemanaPython] || [];
|
|
148
|
-
|
|
149
|
-
const slotsReservaveis = periodosDoDia
|
|
150
|
-
.filter((s: any) => s.reservavel_periodo)
|
|
151
|
-
.map((s: any) => {
|
|
152
|
-
const [hI, mI] = s.hora_inicio_periodo.split(':').map(Number) as [number, number];
|
|
153
|
-
const [hF, mF] = s.hora_fim_periodo.split(':').map(Number) as [number, number];
|
|
154
|
-
return { inicio: hI * 60 + mI, fim: hF * 60 + mF };
|
|
155
|
-
})
|
|
156
|
-
.sort((a: any, b: any) => a.inicio - b.inicio);
|
|
132
|
+
const slotsReservaveis = obterPeriodosReservaveisDoDia();
|
|
133
|
+
if (!slotsReservaveis) return;
|
|
157
134
|
|
|
158
135
|
if (slotsReservaveis.length === 0) {
|
|
159
136
|
if (!silencioso) alert("Nenhum horário disponível para este dia na grade.");
|
|
160
137
|
return;
|
|
161
138
|
}
|
|
162
139
|
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
const minInicio = hI * 60 + mI;
|
|
166
|
-
const minFim = hF * 60 + mF;
|
|
140
|
+
const minInicio = converterHoraParaMinutos(formReserva.value.hora_inicio);
|
|
141
|
+
const minFim = converterHoraParaMinutos(formReserva.value.hora_fim);
|
|
167
142
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const
|
|
143
|
+
const invertidos = [...slotsReservaveis].reverse();
|
|
144
|
+
const blocoInicio = invertidos.find(b => b.inicioMin <= minInicio) || slotsReservaveis[0];
|
|
145
|
+
const blocoFim = invertidos.find(b => b.inicioMin < minFim) || slotsReservaveis[0];
|
|
171
146
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
let novoFimMin = blocoFim.fim;
|
|
175
|
-
|
|
176
|
-
if (novoFimMin <= novoInicioMin) {
|
|
177
|
-
novoFimMin = blocoInicio.fim;
|
|
178
|
-
}
|
|
147
|
+
const novoInicioMin = blocoInicio.inicioMin;
|
|
148
|
+
const novoFimMin = blocoFim.fimMin <= novoInicioMin ? blocoInicio.fimMin : blocoFim.fimMin;
|
|
179
149
|
|
|
180
150
|
const formatarMin = (m: number) => `${String(Math.floor(m / 60)).padStart(2, '0')}:${String(m % 60).padStart(2, '0')}`;
|
|
181
151
|
|
|
182
152
|
formReserva.value.hora_inicio = formatarMin(novoInicioMin);
|
|
183
153
|
formReserva.value.hora_fim = formatarMin(novoFimMin);
|
|
184
154
|
formReserva.value.data_fim = formReserva.value.data_inicio;
|
|
185
|
-
|
|
186
155
|
precisaValidar.value = false;
|
|
187
156
|
|
|
188
157
|
if (!silencioso) {
|
|
@@ -210,13 +179,11 @@ watch(() => props.modelValue, (aberto) => {
|
|
|
210
179
|
}
|
|
211
180
|
});
|
|
212
181
|
|
|
213
|
-
// Emite os eventos para fechar o modal.
|
|
214
182
|
const fecharModal = () => {
|
|
215
183
|
emit('update:modelValue', false);
|
|
216
184
|
emit('cancelado');
|
|
217
185
|
};
|
|
218
186
|
|
|
219
|
-
// Envia o payload de criação (única ou recorrente) para a API e trata possíveis erros HTTP retornados pelo backend.
|
|
220
187
|
const executarCriacaoAPI = async (payloadParaEnviar: any) => {
|
|
221
188
|
try {
|
|
222
189
|
if (repetirReserva.value) {
|
|
@@ -241,7 +208,6 @@ const executarCriacaoAPI = async (payloadParaEnviar: any) => {
|
|
|
241
208
|
}
|
|
242
209
|
};
|
|
243
210
|
|
|
244
|
-
// Valida os campos, checa colisões locais e dispara a gravação da reserva com o contrato em português.
|
|
245
211
|
const salvarReserva = async () => {
|
|
246
212
|
if (precisaValidar.value) return;
|
|
247
213
|
|
|
@@ -301,16 +267,14 @@ const salvarReserva = async () => {
|
|
|
301
267
|
|
|
302
268
|
if (props.usaInterceptador) {
|
|
303
269
|
emit('before-save', {
|
|
304
|
-
payloadBase
|
|
270
|
+
payloadBase,
|
|
305
271
|
dadosReserva: { ...formReserva.value, repetir_reserva: repetirReserva.value },
|
|
306
272
|
proceed: (novoPayloadModificado: any) => {
|
|
307
273
|
executarCriacaoAPI(novoPayloadModificado || payloadBase);
|
|
308
274
|
},
|
|
309
275
|
abort: (callbackAcaoCustomizada?: Function) => {
|
|
310
276
|
salvando.value = false;
|
|
311
|
-
if (typeof callbackAcaoCustomizada === 'function')
|
|
312
|
-
callbackAcaoCustomizada();
|
|
313
|
-
}
|
|
277
|
+
if (typeof callbackAcaoCustomizada === 'function') callbackAcaoCustomizada();
|
|
314
278
|
}
|
|
315
279
|
});
|
|
316
280
|
} else {
|
|
@@ -328,82 +292,134 @@ const salvarReserva = async () => {
|
|
|
328
292
|
</div>
|
|
329
293
|
|
|
330
294
|
<div class="modal-body">
|
|
331
|
-
<
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
<
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
295
|
+
<slot
|
|
296
|
+
name="topo-modal"
|
|
297
|
+
:dados-reserva="formReserva"
|
|
298
|
+
:texto-dia-selecionado="textoDiaSelecionado"
|
|
299
|
+
:texto-intervalo-horario="textoIntervaloHorario"
|
|
300
|
+
></slot>
|
|
301
|
+
|
|
302
|
+
<slot
|
|
303
|
+
name="visualizacao-dados"
|
|
304
|
+
:dados-reserva="formReserva"
|
|
305
|
+
:recursos-disponiveis="recursosDisponiveis"
|
|
306
|
+
:texto-dia-selecionado="textoDiaSelecionado"
|
|
307
|
+
:texto-intervalo-horario="textoIntervaloHorario"
|
|
308
|
+
:nome-dia-semana="nomeDiaSemana"
|
|
309
|
+
:repetir-reserva="repetirReserva"
|
|
310
|
+
:definir-repetir-reserva="definirRepetirReserva"
|
|
311
|
+
:mostrar-ajuste-horario="mostrarAjusteHorario"
|
|
312
|
+
:alternar-ajuste-horario="alternarAjusteHorario"
|
|
313
|
+
:precisa-validar="precisaValidar"
|
|
314
|
+
:marcar-como-alterado="marcarComoAlterado"
|
|
315
|
+
:ajustar-horarios="ajustarHorarios"
|
|
316
|
+
>
|
|
317
|
+
<slot
|
|
318
|
+
name="campo-nome"
|
|
319
|
+
:dados-reserva="formReserva"
|
|
320
|
+
:recursos-disponiveis="recursosDisponiveis"
|
|
321
|
+
:ocultar-titulo-modal="props.ocultarTituloModal"
|
|
357
322
|
>
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
<!-- Seção expansível com Início e Fim lado a lado -->
|
|
363
|
-
<div class="painel-ajuste-horario" v-if="mostrarAjusteHorario">
|
|
364
|
-
<div class="form-group">
|
|
365
|
-
<label>Data do Agendamento</label>
|
|
366
|
-
<input type="date" v-model="formReserva.data_inicio" @input="marcarComoAlterado" />
|
|
367
|
-
</div>
|
|
368
|
-
|
|
369
|
-
<div class="form-row-lado-a-lado">
|
|
370
|
-
<div class="form-group metade">
|
|
371
|
-
<label>Início</label>
|
|
372
|
-
<input type="time" v-model="formReserva.hora_inicio" @input="marcarComoAlterado" />
|
|
323
|
+
<div class="form-group" v-if="!props.ocultarTituloModal">
|
|
324
|
+
<label>Nome da Reserva (opcional)</label>
|
|
325
|
+
<input type="text" v-model="formReserva.titulo_reserva" placeholder="Ex: Treinamento" autofocus />
|
|
373
326
|
</div>
|
|
374
327
|
|
|
375
|
-
<div class="form-group
|
|
376
|
-
<label>
|
|
377
|
-
<
|
|
328
|
+
<div class="form-group">
|
|
329
|
+
<label>Calendário / Recurso</label>
|
|
330
|
+
<select v-model="formReserva.id_recurso" disabled>
|
|
331
|
+
<option v-for="rec in recursosDisponiveis" :key="rec.id_recurso" :value="rec.id_recurso">
|
|
332
|
+
{{ rec.nome_recurso }}
|
|
333
|
+
</option>
|
|
334
|
+
</select>
|
|
335
|
+
</div>
|
|
336
|
+
</slot>
|
|
337
|
+
|
|
338
|
+
<slot
|
|
339
|
+
name="campo-horario"
|
|
340
|
+
:dados-reserva="formReserva"
|
|
341
|
+
:texto-dia-selecionado="textoDiaSelecionado"
|
|
342
|
+
:texto-intervalo-horario="textoIntervaloHorario"
|
|
343
|
+
:mostrar-ajuste-horario="mostrarAjusteHorario"
|
|
344
|
+
:alternar-ajuste-horario="alternarAjusteHorario"
|
|
345
|
+
:precisa-validar="precisaValidar"
|
|
346
|
+
:marcar-como-alterado="marcarComoAlterado"
|
|
347
|
+
:ajustar-horarios="ajustarHorarios"
|
|
348
|
+
>
|
|
349
|
+
<div class="resumo-horario-box">
|
|
350
|
+
<div class="resumo-horario-textos">
|
|
351
|
+
<span class="resumo-label">Período selecionado</span>
|
|
352
|
+
<div class="resumo-dia">{{ textoDiaSelecionado }}</div>
|
|
353
|
+
<div class="resumo-horas">{{ textoIntervaloHorario }}</div>
|
|
354
|
+
</div>
|
|
355
|
+
|
|
356
|
+
<button
|
|
357
|
+
type="button"
|
|
358
|
+
class="btn-toggle-ajuste"
|
|
359
|
+
@click="alternarAjusteHorario"
|
|
360
|
+
>
|
|
361
|
+
{{ mostrarAjusteHorario ? 'Ocultar ajuste' : 'Ajustar horário' }}
|
|
362
|
+
</button>
|
|
378
363
|
</div>
|
|
379
|
-
</div>
|
|
380
|
-
</div>
|
|
381
|
-
|
|
382
|
-
<!-- Opção de Agendamento Recorrente -->
|
|
383
|
-
<div class="recorrencia-box">
|
|
384
|
-
<label class="recorrencia-toggle">
|
|
385
|
-
<input type="checkbox" v-model="repetirReserva" />
|
|
386
|
-
<span class="recorrencia-titulo">Repetir agendamento semanalmente</span>
|
|
387
|
-
</label>
|
|
388
364
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
365
|
+
<div class="painel-ajuste-horario" v-if="mostrarAjusteHorario">
|
|
366
|
+
<div class="form-group">
|
|
367
|
+
<label>Data do Agendamento</label>
|
|
368
|
+
<input type="date" v-model="formReserva.data_inicio" @input="marcarComoAlterado" />
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
<div class="form-row-lado-a-lado">
|
|
372
|
+
<div class="form-group metade">
|
|
373
|
+
<label>Início</label>
|
|
374
|
+
<input type="time" v-model="formReserva.hora_inicio" @input="marcarComoAlterado" />
|
|
375
|
+
</div>
|
|
376
|
+
|
|
377
|
+
<div class="form-group metade">
|
|
378
|
+
<label>Fim</label>
|
|
379
|
+
<input type="time" v-model="formReserva.hora_fim" @input="marcarComoAlterado" />
|
|
380
|
+
</div>
|
|
381
|
+
</div>
|
|
397
382
|
</div>
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
383
|
+
</slot>
|
|
384
|
+
|
|
385
|
+
<slot
|
|
386
|
+
name="campo-recorrencia"
|
|
387
|
+
:dados-reserva="formReserva"
|
|
388
|
+
:repetir-reserva="repetirReserva"
|
|
389
|
+
:definir-repetir-reserva="definirRepetirReserva"
|
|
390
|
+
:nome-dia-semana="nomeDiaSemana"
|
|
391
|
+
>
|
|
392
|
+
<div class="recorrencia-box">
|
|
393
|
+
<label class="recorrencia-toggle">
|
|
394
|
+
<input type="checkbox" v-model="repetirReserva" />
|
|
395
|
+
<span class="recorrencia-titulo">Repetir agendamento semanalmente</span>
|
|
396
|
+
</label>
|
|
397
|
+
|
|
398
|
+
<div class="recorrencia-detalhes" v-if="repetirReserva">
|
|
399
|
+
<div class="form-group">
|
|
400
|
+
<label>Repetir até o dia:</label>
|
|
401
|
+
<input
|
|
402
|
+
type="date"
|
|
403
|
+
v-model="formReserva.data_limite_repeticao"
|
|
404
|
+
:min="formReserva.data_inicio"
|
|
405
|
+
/>
|
|
406
|
+
</div>
|
|
407
|
+
<span class="recorrencia-dica">
|
|
408
|
+
O agendamento será replicado toda <strong>{{ nomeDiaSemana }}</strong> das
|
|
409
|
+
<strong>{{ formReserva.hora_inicio }}</strong> às <strong>{{ formReserva.hora_fim }}</strong> até a data selecionada.
|
|
410
|
+
</span>
|
|
411
|
+
</div>
|
|
412
|
+
</div>
|
|
413
|
+
</slot>
|
|
414
|
+
</slot>
|
|
404
415
|
|
|
405
416
|
<div class="area-customizada">
|
|
406
|
-
<slot
|
|
417
|
+
<slot
|
|
418
|
+
name="campos-extras"
|
|
419
|
+
:dados-reserva="formReserva"
|
|
420
|
+
:texto-dia-selecionado="textoDiaSelecionado"
|
|
421
|
+
:texto-intervalo-horario="textoIntervaloHorario"
|
|
422
|
+
></slot>
|
|
407
423
|
</div>
|
|
408
424
|
</div>
|
|
409
425
|
|
|
@@ -443,13 +459,13 @@ const salvarReserva = async () => {
|
|
|
443
459
|
</template>
|
|
444
460
|
|
|
445
461
|
<style scoped>
|
|
446
|
-
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.4); display: flex; align-items: center; justify-content: center; z-index: 1050; backdrop-filter: blur(2px); }
|
|
447
|
-
.modal-card { background: var(--bg-modal); width: 100%; max-width: 500px; border-radius: 12px; box-shadow: var(--shadow-float); display: flex; flex-direction: column; overflow: hidden; position: relative; }
|
|
448
|
-
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border-light); background: var(--bg-primary); }
|
|
462
|
+
.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; padding: 16px; box-sizing: border-box; background: rgba(0, 0, 0, 0.4); display: flex; align-items: center; justify-content: center; z-index: 1050; backdrop-filter: blur(2px); }
|
|
463
|
+
.modal-card { background: var(--bg-modal); width: 100%; max-width: 500px; max-height: calc(100vh - 32px); border-radius: 12px; box-shadow: var(--shadow-float); display: flex; flex-direction: column; overflow: hidden; position: relative; }
|
|
464
|
+
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border-light); background: var(--bg-primary); flex-shrink: 0; }
|
|
449
465
|
.modal-header h3 { margin: 0; font-size: 16px; color: var(--text-primary); font-weight: 600; }
|
|
450
466
|
.btn-fechar { background: transparent; border: none; font-size: 24px; color: var(--text-secondary); cursor: pointer; line-height: 1; transition: color 0.2s; }
|
|
451
467
|
.btn-fechar:hover { color: var(--text-primary); }
|
|
452
|
-
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--bg-primary); }
|
|
468
|
+
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--bg-primary); flex: 1 1 auto; min-height: 0; overflow-y: auto; }
|
|
453
469
|
.form-group { display: flex; flex-direction: column; gap: 6px; }
|
|
454
470
|
.form-group label { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
|
|
455
471
|
.form-group input[type="text"],
|
|
@@ -458,130 +474,23 @@ const salvarReserva = async () => {
|
|
|
458
474
|
.form-group select { width: 100%; padding: 10px; border: 1px solid var(--border-light); background: var(--bg-primary); border-radius: 6px; font-size: 14px; color: var(--text-primary); box-sizing: border-box; transition: border-color 0.2s; }
|
|
459
475
|
.form-group input:focus { border-color: var(--color-brand); outline: none; }
|
|
460
476
|
.form-group select:disabled { background-color: var(--bg-secondary); color: var(--text-secondary); cursor: not-allowed; opacity: 1; }
|
|
461
|
-
|
|
462
|
-
.resumo-horario-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
.
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
.resumo-label {
|
|
480
|
-
font-size: 11px;
|
|
481
|
-
font-weight: 700;
|
|
482
|
-
text-transform: uppercase;
|
|
483
|
-
letter-spacing: 0.4px;
|
|
484
|
-
color: var(--text-secondary);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
.resumo-dia {
|
|
488
|
-
font-size: 14px;
|
|
489
|
-
font-weight: 700;
|
|
490
|
-
color: var(--text-primary);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
.resumo-horas {
|
|
494
|
-
font-size: 13px;
|
|
495
|
-
font-weight: 600;
|
|
496
|
-
color: var(--color-brand);
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
.btn-toggle-ajuste {
|
|
500
|
-
background: var(--bg-primary);
|
|
501
|
-
border: 1px solid var(--border-light);
|
|
502
|
-
color: var(--text-primary);
|
|
503
|
-
font-weight: 600;
|
|
504
|
-
font-size: 12.5px;
|
|
505
|
-
padding: 7px 12px;
|
|
506
|
-
border-radius: 6px;
|
|
507
|
-
cursor: pointer;
|
|
508
|
-
white-space: nowrap;
|
|
509
|
-
transition: all 0.2s;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
.btn-toggle-ajuste:hover {
|
|
513
|
-
background: var(--bg-hover);
|
|
514
|
-
border-color: var(--color-brand);
|
|
515
|
-
color: var(--color-brand);
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
.painel-ajuste-horario {
|
|
519
|
-
display: flex;
|
|
520
|
-
flex-direction: column;
|
|
521
|
-
gap: 12px;
|
|
522
|
-
padding: 12px 14px;
|
|
523
|
-
border-radius: 8px;
|
|
524
|
-
background: var(--bg-secondary);
|
|
525
|
-
border: 1px dashed var(--border-light);
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
.form-row-lado-a-lado {
|
|
529
|
-
display: flex;
|
|
530
|
-
flex-direction: row;
|
|
531
|
-
gap: 12px;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
.metade {
|
|
535
|
-
flex: 1;
|
|
536
|
-
min-width: 0;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
.recorrencia-box {
|
|
540
|
-
display: flex;
|
|
541
|
-
flex-direction: column;
|
|
542
|
-
gap: 10px;
|
|
543
|
-
padding: 12px 14px;
|
|
544
|
-
border-radius: 8px;
|
|
545
|
-
background: var(--bg-secondary);
|
|
546
|
-
border: 1px solid var(--border-light);
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
.recorrencia-toggle {
|
|
550
|
-
display: flex;
|
|
551
|
-
align-items: center;
|
|
552
|
-
gap: 10px;
|
|
553
|
-
cursor: pointer;
|
|
554
|
-
user-select: none;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
.recorrencia-toggle input[type="checkbox"] {
|
|
558
|
-
width: 16px;
|
|
559
|
-
height: 16px;
|
|
560
|
-
accent-color: var(--color-brand);
|
|
561
|
-
cursor: pointer;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
.recorrencia-titulo {
|
|
565
|
-
font-size: 13.5px;
|
|
566
|
-
font-weight: 600;
|
|
567
|
-
color: var(--text-primary);
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
.recorrencia-detalhes {
|
|
571
|
-
display: flex;
|
|
572
|
-
flex-direction: column;
|
|
573
|
-
gap: 8px;
|
|
574
|
-
padding-top: 6px;
|
|
575
|
-
border-top: 1px solid var(--border-light);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
.recorrencia-dica {
|
|
579
|
-
font-size: 12px;
|
|
580
|
-
color: var(--text-secondary);
|
|
581
|
-
line-height: 1.4;
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
.modal-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-top: 1px solid var(--border-light); background: var(--bg-secondary); }
|
|
477
|
+
.resumo-horario-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 8px; background: var(--bg-secondary); border: 1px solid var(--border-light); flex-shrink: 0; }
|
|
478
|
+
.resumo-horario-textos { display: flex; flex-direction: column; gap: 2px; }
|
|
479
|
+
.resumo-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-secondary); }
|
|
480
|
+
.resumo-dia { font-size: 14px; font-weight: 700; color: var(--text-primary); }
|
|
481
|
+
.resumo-horas { font-size: 13px; font-weight: 600; color: var(--color-brand); }
|
|
482
|
+
.btn-toggle-ajuste { background: var(--bg-primary); border: 1px solid var(--border-light); color: var(--text-primary); font-weight: 600; font-size: 12.5px; padding: 7px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; transition: all 0.2s; }
|
|
483
|
+
.btn-toggle-ajuste:hover { background: var(--bg-hover); border-color: var(--color-brand); color: var(--color-brand); }
|
|
484
|
+
.painel-ajuste-horario { display: flex; flex-direction: column; gap: 12px; padding: 12px 14px; border-radius: 8px; background: var(--bg-secondary); border: 1px dashed var(--border-light); flex-shrink: 0; }
|
|
485
|
+
.form-row-lado-a-lado { display: flex; flex-direction: row; gap: 12px; }
|
|
486
|
+
.metade { flex: 1; min-width: 0; }
|
|
487
|
+
.recorrencia-box { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--bg-secondary); border: 1px solid var(--border-light); flex-shrink: 0; }
|
|
488
|
+
.recorrencia-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
|
|
489
|
+
.recorrencia-toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-brand); cursor: pointer; }
|
|
490
|
+
.recorrencia-titulo { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
|
|
491
|
+
.recorrencia-detalhes { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; border-top: 1px solid var(--border-light); }
|
|
492
|
+
.recorrencia-dica { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
|
|
493
|
+
.modal-footer { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-top: 1px solid var(--border-light); background: var(--bg-secondary); flex-shrink: 0; }
|
|
585
494
|
.acoes-validacao { display: flex; align-items: center; gap: 10px; }
|
|
586
495
|
.acoes-salvar { display: flex; gap: 12px; }
|
|
587
496
|
.aviso-validar { font-size: 12px; color: var(--color-danger); font-weight: 600; }
|
|
@@ -594,8 +503,8 @@ const salvarReserva = async () => {
|
|
|
594
503
|
.btn-salvar { background: var(--color-brand); border: none; color: var(--text-inverse); font-weight: 600; font-size: 14px; cursor: pointer; padding: 8px 24px; border-radius: 6px; transition: background 0.2s; }
|
|
595
504
|
.btn-salvar:hover:not(:disabled) { filter: brightness(0.9); }
|
|
596
505
|
.btn-salvar:disabled { opacity: 0.6; cursor: not-allowed; }
|
|
597
|
-
.horarios-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-primary); z-index: 10; display: flex; flex-direction: column; }
|
|
598
|
-
.horarios-lista-container { flex: 1; overflow-y: auto; padding: 20px; margin: 0; }
|
|
506
|
+
.horarios-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-primary); z-index: 10; display: flex; flex-direction: column; overflow: hidden; }
|
|
507
|
+
.horarios-lista-container { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px; margin: 0; }
|
|
599
508
|
.horarios-lista { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
|
|
600
509
|
.horarios-lista li { background: var(--bg-secondary); padding: 12px 16px; border-radius: 8px; color: var(--text-primary); font-weight: 500; font-size: 14px; text-align: center; border: 1px solid var(--border-light); }
|
|
601
510
|
</style>
|