develop #83
@ -74,6 +74,20 @@ const capitalize = (s: string) => {
|
||||
return s.charAt(0).toUpperCase() + s.slice(1);
|
||||
};
|
||||
|
||||
const translateStatus = (status: string) => {
|
||||
const statusMap: { [key: string]: string } = {
|
||||
'requested': 'Solicitado',
|
||||
'confirmed': 'Confirmado',
|
||||
'checked_in': 'Check-in',
|
||||
'in_progress': 'Em Andamento',
|
||||
'completed': 'Concluído',
|
||||
'cancelled': 'Cancelado',
|
||||
'no_show': 'Não Compareceu',
|
||||
'pending': 'Pendente',
|
||||
};
|
||||
return statusMap[status?.toLowerCase()] || capitalize(status || '');
|
||||
};
|
||||
|
||||
export default function ConsultasPage() {
|
||||
const [appointments, setAppointments] = useState<any[]>([]);
|
||||
const [originalAppointments, setOriginalAppointments] = useState<any[]>([]);
|
||||
@ -197,7 +211,7 @@ export default function ConsultasPage() {
|
||||
const payload: any = {
|
||||
scheduled_at,
|
||||
duration_minutes,
|
||||
status: formData.status || undefined,
|
||||
status: 'confirmed',
|
||||
notes: formData.notes ?? null,
|
||||
chief_complaint: formData.chief_complaint ?? null,
|
||||
patient_notes: formData.patient_notes ?? null,
|
||||
@ -561,7 +575,7 @@ export default function ConsultasPage() {
|
||||
}
|
||||
className={appointment.status === "confirmed" ? "bg-green-600" : ""}
|
||||
>
|
||||
{capitalize(appointment.status)}
|
||||
{translateStatus(appointment.status)}
|
||||
</Badge>
|
||||
</TableCell>
|
||||
<TableCell className="text-xs sm:text-sm">{formatDate(appointment.scheduled_at ?? appointment.time)}</TableCell>
|
||||
@ -652,7 +666,7 @@ export default function ConsultasPage() {
|
||||
}
|
||||
className={`text-[10px] sm:text-xs ${appointment.status === "confirmed" ? "bg-green-600" : ""}`}
|
||||
>
|
||||
{capitalize(appointment.status)}
|
||||
{translateStatus(appointment.status)}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
@ -771,7 +785,7 @@ export default function ConsultasPage() {
|
||||
}
|
||||
className={viewingAppointment?.status === "confirmed" ? "bg-green-600" : ""}
|
||||
>
|
||||
{capitalize(viewingAppointment?.status || "")}
|
||||
{translateStatus(viewingAppointment?.status || "")}
|
||||
</Badge>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@ -812,7 +812,7 @@ export default function PacientePage() {
|
||||
<div className="flex items-start gap-3 sm:gap-4 min-w-0">
|
||||
<span
|
||||
className="mt-1 sm:mt-2 h-3 w-3 sm:h-4 sm:w-4 shrink-0 rounded-full shadow-sm"
|
||||
style={{ backgroundColor: consulta.status === 'Confirmada' ? '#10b981' : consulta.status === 'Pendente' ? '#f59e0b' : '#ef4444' }}
|
||||
style={{ backgroundColor: (consulta.status === 'Confirmada' || consulta.status === 'confirmed') ? '#10b981' : '#ef4444' }}
|
||||
aria-hidden
|
||||
/>
|
||||
<div className="space-y-2 sm:space-y-3 min-w-0">
|
||||
@ -837,10 +837,8 @@ export default function PacientePage() {
|
||||
{/* Status Badge */}
|
||||
<div className="flex items-center justify-start">
|
||||
<span className={`px-2 sm:px-3 md:px-4 py-1.5 sm:py-2 md:py-2.5 rounded-full text-xs font-bold text-white shadow-md transition-all ${
|
||||
consulta.status === 'Confirmada'
|
||||
? 'bg-linear-to-r from-emerald-500 to-emerald-600 shadow-emerald-500/20'
|
||||
: consulta.status === 'Pendente'
|
||||
? 'bg-linear-to-r from-amber-500 to-amber-600 shadow-amber-500/20'
|
||||
consulta.status === 'Confirmada' || consulta.status === 'confirmed'
|
||||
? 'bg-linear-to-r from-green-500 to-green-600 shadow-green-500/20'
|
||||
: 'bg-linear-to-r from-red-500 to-red-600 shadow-red-500/20'
|
||||
}`}>
|
||||
{statusLabel(consulta.status)}
|
||||
@ -858,7 +856,7 @@ export default function PacientePage() {
|
||||
Detalhes
|
||||
</Button>
|
||||
{/* Reagendar removed by request */}
|
||||
{consulta.status !== 'Cancelada' && (
|
||||
{consulta.status !== 'Cancelada' && consulta.status !== 'cancelled' && (
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
|
||||
@ -1178,15 +1178,8 @@ export function CalendarRegistrationForm({ formData, onFormChange, createMode =
|
||||
<div className="grid grid-cols-3 gap-3">
|
||||
<div className="space-y-1">
|
||||
<Label className="text-[13px]">Status</Label>
|
||||
<select name="status" className="h-11 w-full rounded-md border border-gray-300 dark:border-input bg-background text-foreground pr-3 text-[13px]" value={formData.status || ''} onChange={handleChange}>
|
||||
<option value="">Selecione</option>
|
||||
<option value="requested">Solicitado</option>
|
||||
<select name="status" className="h-11 w-full rounded-md border border-gray-300 dark:border-input bg-background text-foreground pr-3 text-[13px]" value="confirmed" onChange={handleChange} disabled>
|
||||
<option value="confirmed">Confirmado</option>
|
||||
<option value="checked_in">Check-in</option>
|
||||
<option value="in_progress">Em andamento</option>
|
||||
<option value="completed">Concluído</option>
|
||||
<option value="cancelled">Cancelado</option>
|
||||
<option value="no_show">Não compareceu</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
|
||||
@ -1175,6 +1175,7 @@ export async function criarAgendamento(input: AppointmentCreate): Promise<Appoin
|
||||
scheduled_at: new Date(scheduledDate).toISOString(),
|
||||
duration_minutes: input.duration_minutes ?? 30,
|
||||
appointment_type: input.appointment_type ?? 'presencial',
|
||||
status: 'confirmed',
|
||||
chief_complaint: input.chief_complaint ?? null,
|
||||
patient_notes: input.patient_notes ?? null,
|
||||
insurance_provider: input.insurance_provider ?? null,
|
||||
@ -1229,6 +1230,7 @@ export async function criarAgendamentoDireto(input: AppointmentCreate & { create
|
||||
scheduled_at: new Date(input.scheduled_at).toISOString(),
|
||||
duration_minutes: input.duration_minutes ?? 30,
|
||||
appointment_type: input.appointment_type ?? 'presencial',
|
||||
status: 'confirmed',
|
||||
chief_complaint: input.chief_complaint ?? null,
|
||||
patient_notes: input.patient_notes ?? null,
|
||||
insurance_provider: input.insurance_provider ?? null,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user