360 lines
11 KiB
Vue
360 lines
11 KiB
Vue
<!-- src/layout/ConfiguracoesPage.vue -->
|
|
<script setup>
|
|
import { computed, ref, onMounted, onBeforeUnmount } from 'vue'
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
|
const route = useRoute()
|
|
const router = useRouter()
|
|
|
|
// ── Hero sticky ────────────────────────────────────────────
|
|
const headerEl = ref(null)
|
|
const headerSentinelRef = ref(null)
|
|
const headerStuck = ref(false)
|
|
let _observer = null
|
|
|
|
const secoes = [
|
|
{
|
|
key: 'agenda',
|
|
label: 'Agenda',
|
|
desc: 'Horários semanais, exceções, duração e intervalo padrão.',
|
|
icon: 'pi pi-calendar',
|
|
to: '/configuracoes/agenda',
|
|
tags: ['Horários', 'Exceções', 'Duração']
|
|
},
|
|
{
|
|
key: 'bloqueios',
|
|
label: 'Bloqueios',
|
|
desc: 'Feriados nacionais, municipais e períodos bloqueados.',
|
|
icon: 'pi pi-ban',
|
|
to: '/configuracoes/bloqueios',
|
|
tags: ['Feriados', 'Períodos', 'Recorrentes']
|
|
},
|
|
{
|
|
key: 'agendador',
|
|
label: 'Agendador Online',
|
|
desc: 'Link público para pacientes solicitarem horários.',
|
|
icon: 'pi pi-calendar-clock',
|
|
to: '/configuracoes/agendador',
|
|
tags: ['PRO', 'Link', 'Pix', 'LGPD']
|
|
},
|
|
{
|
|
key: 'pagamento',
|
|
label: 'Pagamento',
|
|
desc: 'Formas de pagamento: Pix, depósito, dinheiro, cartão, convênio.',
|
|
icon: 'pi pi-wallet',
|
|
to: '/configuracoes/pagamento',
|
|
tags: ['Pix', 'TED', 'Cartão', 'Convênio']
|
|
},
|
|
{
|
|
key: 'precificacao',
|
|
label: 'Precificação',
|
|
desc: 'Valor padrão da sessão e preços por tipo de compromisso.',
|
|
icon: 'pi pi-tag',
|
|
to: '/configuracoes/precificacao',
|
|
tags: ['Valores', 'Sessão', 'Compromisso']
|
|
},
|
|
{
|
|
key: 'descontos',
|
|
label: 'Descontos por Paciente',
|
|
desc: 'Descontos recorrentes aplicados automaticamente.',
|
|
icon: 'pi pi-percentage',
|
|
to: '/configuracoes/descontos',
|
|
tags: ['Desconto', 'Paciente', 'Automático']
|
|
},
|
|
{
|
|
key: 'excecoes-financeiras',
|
|
label: 'Exceções Financeiras',
|
|
desc: 'O que cobrar em faltas, cancelamentos e situações excepcionais.',
|
|
icon: 'pi pi-exclamation-triangle',
|
|
to: '/configuracoes/excecoes-financeiras',
|
|
tags: ['Falta', 'Cancelamento', 'Cobrança']
|
|
},
|
|
{
|
|
key: 'convenios',
|
|
label: 'Convênios',
|
|
desc: 'Cadastre os convênios que você atende e seus valores.',
|
|
icon: 'pi pi-id-card',
|
|
to: '/configuracoes/convenios',
|
|
tags: ['Convênio', 'Plano de Saúde', 'Tabela']
|
|
},
|
|
]
|
|
|
|
const activeTo = computed(() => {
|
|
const p = route.path || ''
|
|
const hit = [...secoes]
|
|
.sort((a, b) => b.to.length - a.to.length)
|
|
.find(s => p === s.to || p.startsWith(s.to + '/'))
|
|
return hit?.to || '/configuracoes/agenda'
|
|
})
|
|
|
|
const activeSecao = computed(() => secoes.find(s => s.to === activeTo.value))
|
|
|
|
function ir(to) {
|
|
if (!to) return
|
|
if (route.path !== to) router.push(to)
|
|
}
|
|
|
|
onMounted(() => {
|
|
const rootMargin = `${document.querySelector('.l2-main') ? '0px' : '-56px'} 0px 0px 0px`
|
|
_observer = new IntersectionObserver(
|
|
([entry]) => { headerStuck.value = !entry.isIntersecting },
|
|
{ threshold: 0, rootMargin }
|
|
)
|
|
if (headerSentinelRef.value) _observer.observe(headerSentinelRef.value)
|
|
})
|
|
|
|
onBeforeUnmount(() => { _observer?.disconnect() })
|
|
</script>
|
|
|
|
<template>
|
|
<!-- Sentinel -->
|
|
<div ref="headerSentinelRef" class="cfg-sentinel" />
|
|
|
|
<!-- Hero compacto — padrão Compromissos -->
|
|
<div ref="headerEl" class="cfg-hero mx-3 md:mx-4 mb-3" :class="{ 'cfg-hero--stuck': headerStuck }">
|
|
<div class="cfg-hero__blobs" aria-hidden="true">
|
|
<div class="cfg-hero__blob cfg-hero__blob--1" />
|
|
<div class="cfg-hero__blob cfg-hero__blob--2" />
|
|
</div>
|
|
<div class="cfg-hero__inner">
|
|
<!-- Brand -->
|
|
<div class="cfg-hero__brand">
|
|
<div class="cfg-hero__icon"><i class="pi pi-cog text-base" /></div>
|
|
<div class="min-w-0 lg:block">
|
|
<div class="cfg-hero__title">Configurações</div>
|
|
<div class="cfg-hero__sub">
|
|
<span v-if="activeSecao">
|
|
<i :class="activeSecao.icon" class="text-xs mr-1 opacity-60" />{{ activeSecao.label }}
|
|
</span>
|
|
<span v-else>Configurações gerais</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Ações -->
|
|
<div class="cfg-hero__actions">
|
|
<Button icon="pi pi-arrow-left" severity="secondary" outlined class="h-9 w-9 rounded-full" v-tooltip.bottom="'Voltar'" @click="router.back()" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Stats: seções como cards clicáveis -->
|
|
<div class="flex flex-wrap gap-2 px-3 md:px-4 mb-3">
|
|
<button
|
|
v-for="s in secoes"
|
|
:key="s.key"
|
|
class="cfg-sec-card"
|
|
:class="{ 'cfg-sec-card--active': activeTo === s.to }"
|
|
@click="ir(s.to)"
|
|
>
|
|
<i :class="s.icon" class="cfg-sec-card__icon" />
|
|
<span class="cfg-sec-card__label">{{ s.label }}</span>
|
|
</button>
|
|
</div>
|
|
|
|
<!-- Layout: sidebar + conteúdo -->
|
|
<div class="flex flex-col xl:flex-row gap-3 px-3 md:px-4 pb-5 items-start">
|
|
|
|
<!-- Sidebar: lista de seções (oculto no mobile — já temos os cards acima) -->
|
|
<div class="hidden xl:flex flex-col gap-1 w-[260px] shrink-0">
|
|
<div class="cfg-sidebar-wrap">
|
|
<div class="cfg-sidebar-head">
|
|
<i class="pi pi-cog text-xs opacity-60" />
|
|
<span>Seções</span>
|
|
</div>
|
|
<div class="flex flex-col gap-0.5">
|
|
<button
|
|
v-for="s in secoes"
|
|
:key="s.key"
|
|
class="cfg-nav-item"
|
|
:class="{ 'cfg-nav-item--active': activeTo === s.to }"
|
|
@click="ir(s.to)"
|
|
>
|
|
<i :class="s.icon" class="cfg-nav-item__icon" />
|
|
<div class="cfg-nav-item__body">
|
|
<span class="cfg-nav-item__label">{{ s.label }}</span>
|
|
<span class="cfg-nav-item__desc">{{ s.desc }}</span>
|
|
</div>
|
|
<i class="pi pi-chevron-right cfg-nav-item__arrow" />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Conteúdo da seção -->
|
|
<div class="flex-1 min-w-0 w-full">
|
|
<router-view />
|
|
</div>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
/* ── Hero ─────────────────────────────────────────────── */
|
|
.cfg-sentinel { height: 1px; }
|
|
|
|
.cfg-hero {
|
|
position: sticky;
|
|
top: var(--layout-sticky-top, 56px);
|
|
z-index: 20;
|
|
overflow: hidden;
|
|
border-radius: 6px;
|
|
border: 1px solid var(--surface-border);
|
|
background: var(--surface-card);
|
|
padding: 10px 12px;
|
|
}
|
|
.cfg-hero--stuck {
|
|
border-top-left-radius: 0;
|
|
border-top-right-radius: 0;
|
|
}
|
|
.cfg-hero__blobs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
|
|
.cfg-hero__blob { position: absolute; border-radius: 50%; filter: blur(60px); }
|
|
.cfg-hero__blob--1 { width: 16rem; height: 16rem; top: -4rem; right: -2rem; background: rgba(52,211,153,0.10); }
|
|
.cfg-hero__blob--2 { width: 18rem; height: 18rem; top: 0; left: -4rem; background: rgba(99,102,241,0.09); }
|
|
|
|
.cfg-hero__inner {
|
|
position: relative; z-index: 1;
|
|
display: flex; align-items: center; gap: 0.75rem;
|
|
}
|
|
.cfg-hero__brand { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
|
|
.cfg-hero__icon {
|
|
display: grid; place-items: center;
|
|
width: 2.25rem; height: 2.25rem; border-radius: 6px; flex-shrink: 0;
|
|
background: color-mix(in srgb, var(--p-primary-500, #6366f1) 12%, transparent);
|
|
color: var(--p-primary-500, #6366f1);
|
|
}
|
|
.cfg-hero__title { font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text-color); }
|
|
.cfg-hero__sub { font-size: 0.75rem; color: var(--text-color-secondary); }
|
|
.cfg-hero__actions { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
|
|
|
|
/* Breadcrumb seção ativa */
|
|
.cfg-breadcrumb { display: flex; align-items: center; gap: 0.5rem; }
|
|
.cfg-breadcrumb__active {
|
|
display: inline-flex; align-items: center; gap: 0.4rem;
|
|
padding: 0.25rem 0.75rem; border-radius: 999px;
|
|
border: 1px solid var(--primary-color, #6366f1);
|
|
background: color-mix(in srgb, var(--primary-color) 8%, transparent);
|
|
color: var(--primary-color, #6366f1);
|
|
font-size: 0.8rem; font-weight: 600;
|
|
}
|
|
|
|
/* ── Cards de seção (stats row) ────────────────────────── */
|
|
.cfg-sec-card {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.4rem;
|
|
padding: 0.5rem 0.875rem;
|
|
border-radius: 6px;
|
|
border: 1px solid var(--surface-border);
|
|
background: var(--surface-card);
|
|
cursor: pointer;
|
|
transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
|
|
white-space: nowrap;
|
|
}
|
|
.cfg-sec-card:hover {
|
|
border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.06);
|
|
}
|
|
.cfg-sec-card--active {
|
|
border-color: var(--primary-color, #6366f1);
|
|
background: color-mix(in srgb, var(--primary-color) 8%, var(--surface-card));
|
|
box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 12%, transparent);
|
|
}
|
|
.cfg-sec-card__icon {
|
|
font-size: 0.78rem;
|
|
color: var(--text-color-secondary);
|
|
opacity: 0.75;
|
|
}
|
|
.cfg-sec-card--active .cfg-sec-card__icon {
|
|
color: var(--primary-color, #6366f1);
|
|
opacity: 1;
|
|
}
|
|
.cfg-sec-card__label {
|
|
font-size: 0.78rem;
|
|
font-weight: 600;
|
|
color: var(--text-color);
|
|
}
|
|
.cfg-sec-card--active .cfg-sec-card__label {
|
|
color: var(--primary-color, #6366f1);
|
|
}
|
|
|
|
/* ── Sidebar nav ──────────────────────────────────────── */
|
|
.cfg-sidebar-wrap {
|
|
border: 1px solid var(--surface-border);
|
|
border-radius: 6px;
|
|
background: var(--surface-card);
|
|
overflow: hidden;
|
|
}
|
|
.cfg-sidebar-head {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.4rem;
|
|
padding: 0.625rem 0.875rem;
|
|
border-bottom: 1px solid var(--surface-border);
|
|
font-size: 0.7rem;
|
|
font-weight: 700;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.06em;
|
|
color: var(--text-color-secondary);
|
|
opacity: 0.65;
|
|
}
|
|
.cfg-nav-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.625rem;
|
|
padding: 0.625rem 0.875rem;
|
|
border: none;
|
|
background: transparent;
|
|
cursor: pointer;
|
|
transition: background 0.12s;
|
|
width: 100%;
|
|
text-align: left;
|
|
border-bottom: 1px solid var(--surface-border);
|
|
}
|
|
.cfg-nav-item:last-child { border-bottom: none; }
|
|
.cfg-nav-item:hover { background: var(--surface-hover); }
|
|
.cfg-nav-item--active {
|
|
background: color-mix(in srgb, var(--primary-color) 6%, var(--surface-card));
|
|
}
|
|
.cfg-nav-item__icon {
|
|
font-size: 0.85rem;
|
|
color: var(--text-color-secondary);
|
|
opacity: 0.6;
|
|
flex-shrink: 0;
|
|
width: 16px;
|
|
text-align: center;
|
|
}
|
|
.cfg-nav-item--active .cfg-nav-item__icon {
|
|
color: var(--primary-color, #6366f1);
|
|
opacity: 1;
|
|
}
|
|
.cfg-nav-item__body {
|
|
flex: 1; min-width: 0;
|
|
display: flex; flex-direction: column; gap: 1px;
|
|
}
|
|
.cfg-nav-item__label {
|
|
font-size: 0.82rem;
|
|
font-weight: 600;
|
|
color: var(--text-color);
|
|
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
}
|
|
.cfg-nav-item--active .cfg-nav-item__label {
|
|
color: var(--primary-color, #6366f1);
|
|
}
|
|
.cfg-nav-item__desc {
|
|
font-size: 0.7rem;
|
|
color: var(--text-color-secondary);
|
|
opacity: 0.7;
|
|
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
|
|
}
|
|
.cfg-nav-item__arrow {
|
|
font-size: 0.6rem;
|
|
color: var(--text-color-secondary);
|
|
opacity: 0.3;
|
|
flex-shrink: 0;
|
|
}
|
|
.cfg-nav-item--active .cfg-nav-item__arrow {
|
|
color: var(--primary-color, #6366f1);
|
|
opacity: 0.6;
|
|
}
|
|
</style> |