system-prompts-and-models-o.../salesflow-saas/backend/app/utils/hijri.py
Claude f1852c1121
Add SalesMatic AI Sales SaaS Platform - Complete Foundation
Full-stack AI-powered sales automation platform for Saudi SMEs:

Backend (FastAPI + PostgreSQL):
- Multi-tenant architecture with row-level isolation
- JWT auth with RBAC (owner/manager/agent/admin)
- Lead, Customer, Deal, Pipeline, Activity, Message, Proposal models
- Dashboard analytics API (overview, pipeline, revenue)
- WhatsApp Business API, Email (SMTP/SendGrid), SMS (Unifonic) integrations
- Celery + Redis workers for automated follow-ups and scheduled messages
- Property model for Real Estate module (Riyadh districts)
- Hijri date utilities, Arabic/English localization

Frontend (Next.js + Tailwind):
- Professional Arabic RTL landing page with 10 sections
- Brand identity: SalesMatic (سيلزماتك) with custom SVG logo
- Color system: Trust Blue #0F4C81, Growth Teal #00BFA6, CTA Orange #FF6B35
- IBM Plex Sans Arabic + Inter typography
- Responsive design, dark hero section, pricing table, FAQ

Industry Templates:
- Healthcare/Clinics: pipeline stages, WhatsApp message templates, auto-workflows
- Real Estate Riyadh: 20 districts, property tours, payment plans, matching

Infrastructure:
- Docker Compose (PostgreSQL, Redis, Backend, Celery, Frontend, Nginx)
- Nginx reverse proxy config
- Makefile for common operations

https://claude.ai/code/session_01LLR7jzpyNRwDA9kojtT3CW
2026-03-28 03:06:53 +00:00

32 lines
1.2 KiB
Python

from datetime import date
def gregorian_to_hijri_approx(greg_date: date) -> str:
"""Approximate Gregorian to Hijri conversion for display purposes.
For production, use the hijri-converter package.
"""
# Approximate calculation
jd = _greg_to_jd(greg_date.year, greg_date.month, greg_date.day)
l = jd - 1948440 + 10632
n = (l - 1) // 10631
l = l - 10631 * n + 354
j = ((10985 - l) // 5316) * ((50 * l) // 17719) + (l // 5670) * ((43 * l) // 15238)
l = l - ((30 - j) // 15) * ((17719 * j) // 50) - (j // 16) * ((15238 * j) // 43) + 29
m = (24 * l) // 709
d = l - (709 * m) // 24
y = 30 * n + j - 30
months_ar = [
"", "محرم", "صفر", "ربيع الأول", "ربيع الآخر",
"جمادى الأولى", "جمادى الآخرة", "رجب", "شعبان",
"رمضان", "شوال", "ذو القعدة", "ذو الحجة"
]
if 1 <= m <= 12:
return f"{d} {months_ar[m]} {y}"
return f"{d}/{m}/{y}"
def _greg_to_jd(y: int, m: int, d: int) -> int:
return (1461 * (y + 4800 + (m - 14) // 12)) // 4 + (367 * (m - 2 - 12 * ((m - 14) // 12))) // 12 - (3 * ((y + 4900 + (m - 14) // 12) // 100)) // 4 + d - 32075