feat: features 025-032 - favoritos, contatos, trabalhe-conosco, area-cliente, navbar, hero-light-dark, performance-homepage
- feat(025): favoritos locais com FavoritesContext, HeartButton, PublicFavoritesPage
- feat(026): central de contatos admin (leads/contatos unificados)
- feat(027): configuração da página de contato via admin
- feat(028): trabalhe conosco - candidaturas com upload e admin
- feat(029): UX área do cliente - visitas, comparação, perfil
- feat(030): navbar UX - menu mobile, ThemeToggle, useFavorites
- feat(031): hero light/dark - imagens separadas por tema, upload, preview, seed
- feat(032): performance homepage - Promise.all parallel fetches, sessionStorage cache,
preload hero image, loading=lazy nos cards, useInView hook, will-change carrossel,
keyframes em index.css, AgentsCarousel e HomeScrollScene via props
- fix: light mode HomeScrollScene - gradiente, cores de texto, scroll hint
migrations: g1h2i3j4k5l6 (source em leads), h1i2j3k4l5m6 (contact_config),
i1j2k3l4m5n6 (job_applications), j2k3l4m5n6o7 (hero theme images)
This commit is contained in:
parent
6ef5a7a17e
commit
cf5603243c
106 changed files with 11927 additions and 1367 deletions
|
|
@ -146,6 +146,7 @@ class PhotoAdminOut(BaseModel):
|
|||
|
||||
class PropertyAdminOut(BaseModel):
|
||||
id: str
|
||||
slug: str
|
||||
title: str
|
||||
code: Optional[str] = None
|
||||
address: Optional[str] = None
|
||||
|
|
@ -172,6 +173,7 @@ class PropertyAdminOut(BaseModel):
|
|||
def from_prop(cls, p: Property) -> "PropertyAdminOut":
|
||||
return cls(
|
||||
id=str(p.id),
|
||||
slug=p.slug,
|
||||
title=p.title,
|
||||
code=p.code,
|
||||
address=p.address,
|
||||
|
|
@ -213,6 +215,8 @@ def admin_list_properties():
|
|||
q = request.args.get("q", "").strip()
|
||||
city_id = request.args.get("city_id", type=int)
|
||||
neighborhood_id = request.args.get("neighborhood_id", type=int)
|
||||
type_filter = request.args.get("type") # 'venda' | 'aluguel' | None
|
||||
is_active_raw = request.args.get("is_active") # 'true' | 'false' | None
|
||||
try:
|
||||
page = max(1, int(request.args.get("page", 1)))
|
||||
per_page = min(50, max(1, int(request.args.get("per_page", 12))))
|
||||
|
|
@ -231,6 +235,12 @@ def admin_list_properties():
|
|||
query = query.filter(Property.city_id == city_id)
|
||||
if neighborhood_id:
|
||||
query = query.filter(Property.neighborhood_id == neighborhood_id)
|
||||
if type_filter in ("venda", "aluguel"):
|
||||
query = query.filter(Property.type == type_filter)
|
||||
if is_active_raw == "true":
|
||||
query = query.filter(Property.is_active.is_(True))
|
||||
elif is_active_raw == "false":
|
||||
query = query.filter(Property.is_active.is_(False))
|
||||
|
||||
total = query.count()
|
||||
props = (
|
||||
|
|
@ -973,17 +983,16 @@ def list_leads():
|
|||
page = max(1, request.args.get("page", 1, type=int))
|
||||
per_page = min(100, max(1, request.args.get("per_page", 20, type=int)))
|
||||
property_id = request.args.get("property_id")
|
||||
source = request.args.get("source")
|
||||
|
||||
q = db.select(ContactLead).order_by(ContactLead.created_at.desc())
|
||||
if property_id:
|
||||
q = q.where(ContactLead.property_id == property_id)
|
||||
if source:
|
||||
q = q.where(ContactLead.source == source)
|
||||
|
||||
total = db.session.scalar(
|
||||
db.select(db.func.count()).select_from(q.subquery())
|
||||
)
|
||||
leads = db.session.scalars(
|
||||
q.limit(per_page).offset((page - 1) * per_page)
|
||||
).all()
|
||||
total = db.session.scalar(db.select(db.func.count()).select_from(q.subquery()))
|
||||
leads = db.session.scalars(q.limit(per_page).offset((page - 1) * per_page)).all()
|
||||
|
||||
return jsonify(
|
||||
{
|
||||
|
|
@ -995,6 +1004,8 @@ def list_leads():
|
|||
"email": lead.email,
|
||||
"phone": lead.phone,
|
||||
"message": lead.message,
|
||||
"source": lead.source,
|
||||
"source_detail": lead.source_detail,
|
||||
"created_at": lead.created_at.isoformat(),
|
||||
}
|
||||
for lead in leads
|
||||
|
|
@ -1005,3 +1016,46 @@ def list_leads():
|
|||
"pages": max(1, -(-total // per_page)),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
# ─── Contact config ───────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
@admin_bp.get("/contact-config")
|
||||
@require_admin
|
||||
def get_contact_config_admin():
|
||||
from app.models.contact_config import ContactConfig
|
||||
from app.schemas.contact_config import ContactConfigOut
|
||||
|
||||
config = ContactConfig.query.first()
|
||||
if config is None:
|
||||
return jsonify({}), 200
|
||||
return jsonify(ContactConfigOut.model_validate(config).model_dump())
|
||||
|
||||
|
||||
@admin_bp.put("/contact-config")
|
||||
@require_admin
|
||||
def update_contact_config():
|
||||
from app.models.contact_config import ContactConfig
|
||||
from app.schemas.contact_config import ContactConfigIn, ContactConfigOut
|
||||
|
||||
data = request.get_json(silent=True) or {}
|
||||
try:
|
||||
cfg_in = ContactConfigIn.model_validate(data)
|
||||
except ValidationError as exc:
|
||||
return jsonify({"error": "Dados inválidos", "details": exc.errors()}), 422
|
||||
|
||||
config = ContactConfig.query.first()
|
||||
if config is None:
|
||||
config = ContactConfig(id=1)
|
||||
db.session.add(config)
|
||||
|
||||
config.address_street = cfg_in.address_street
|
||||
config.address_neighborhood_city = cfg_in.address_neighborhood_city
|
||||
config.address_zip = cfg_in.address_zip
|
||||
config.phone = cfg_in.phone
|
||||
config.email = cfg_in.email
|
||||
config.business_hours = cfg_in.business_hours
|
||||
db.session.commit()
|
||||
|
||||
return jsonify(ContactConfigOut.model_validate(config).model_dump())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue