05/08 Phase 4

This commit is contained in:
2026-05-08 10:15:40 -04:00
parent 959f54ed84
commit bf9b54f6b5
26 changed files with 1509 additions and 42 deletions
+16
View File
@@ -115,6 +115,22 @@ def create():
log_tenant_action("appointment.create", "appointment", appt.id,
{"customer": customer_id, "staff": staff_id,
"start": start_raw})
# Schedule 24h and 2h email reminders
from app.models.salon import AppointmentReminder as AR
for hours, rtype in [(24, "24h"), (2, "2h")]:
remind_at = start_time - timedelta(hours=hours)
if remind_at > datetime.now(timezone.utc):
db.session.add(AR(
tenant_id=g.tenant.id,
location_id=g.location.id,
appointment_id=appt.id,
reminder_type=rtype,
scheduled_for=remind_at,
channel="email",
status="pending",
))
db.session.commit()
flash("Appointment created.", "success")
return redirect(url_for("appointments.index",