Correcao Sidebar Classico e Rail, Correcao Layout, Ajuste de Breakpoint para Tailwind, Ajuste AppTopbar, Ajuste Menu PopOver, Recriado Paleta de Cores, Inserido algumas animações leves, Reajuste Cor items NOVOS da tabela, Drawer Ajuda Corrigido no Logout, Whatsapp, sms, email, recursos extras
This commit is contained in:
@@ -14,47 +14,34 @@
|
||||
| © 2026 — Todos os direitos reservados
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
import { supabase } from '@/lib/supabase/client'
|
||||
import { supabase } from '@/lib/supabase/client';
|
||||
|
||||
export async function fetchSlotsBloqueados(ownerId, diaSemana) {
|
||||
const { data, error } = await supabase
|
||||
.from('agenda_slots_bloqueados_semanais')
|
||||
.select('*')
|
||||
.eq('owner_id', ownerId)
|
||||
.eq('dia_semana', diaSemana)
|
||||
.eq('ativo', true)
|
||||
.order('hora_inicio', { ascending: true })
|
||||
const { data, error } = await supabase.from('agenda_slots_bloqueados_semanais').select('*').eq('owner_id', ownerId).eq('dia_semana', diaSemana).eq('ativo', true).order('hora_inicio', { ascending: true });
|
||||
|
||||
if (error) throw error
|
||||
return data || []
|
||||
if (error) throw error;
|
||||
return data || [];
|
||||
}
|
||||
|
||||
export async function setSlotBloqueado(ownerId, diaSemana, horaInicio, isBloqueado, motivo = null) {
|
||||
if (isBloqueado) {
|
||||
const { error } = await supabase
|
||||
.from('agenda_slots_bloqueados_semanais')
|
||||
.upsert(
|
||||
{
|
||||
owner_id: ownerId,
|
||||
dia_semana: diaSemana,
|
||||
hora_inicio: horaInicio,
|
||||
motivo: motivo || null,
|
||||
ativo: true
|
||||
},
|
||||
{ onConflict: 'owner_id,dia_semana,hora_inicio' }
|
||||
)
|
||||
if (error) throw error
|
||||
return true
|
||||
}
|
||||
if (isBloqueado) {
|
||||
const { error } = await supabase.from('agenda_slots_bloqueados_semanais').upsert(
|
||||
{
|
||||
owner_id: ownerId,
|
||||
dia_semana: diaSemana,
|
||||
hora_inicio: horaInicio,
|
||||
motivo: motivo || null,
|
||||
ativo: true
|
||||
},
|
||||
{ onConflict: 'owner_id,dia_semana,hora_inicio' }
|
||||
);
|
||||
if (error) throw error;
|
||||
return true;
|
||||
}
|
||||
|
||||
// "desbloquear": deletar (ou marcar ativo=false; aqui vou deletar por simplicidade)
|
||||
const { error } = await supabase
|
||||
.from('agenda_slots_bloqueados_semanais')
|
||||
.delete()
|
||||
.eq('owner_id', ownerId)
|
||||
.eq('dia_semana', diaSemana)
|
||||
.eq('hora_inicio', horaInicio)
|
||||
// "desbloquear": deletar (ou marcar ativo=false; aqui vou deletar por simplicidade)
|
||||
const { error } = await supabase.from('agenda_slots_bloqueados_semanais').delete().eq('owner_id', ownerId).eq('dia_semana', diaSemana).eq('hora_inicio', horaInicio);
|
||||
|
||||
if (error) throw error
|
||||
return true
|
||||
if (error) throw error;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user