{% extends "base.html" %}
{% block content %}
Guest portfolio: {{ g.get('canonical_name') or g.get('name') }} (#{{ g.get('id') }})
360° view: profile, trips/reservations, POS/activity, payments, invoices, and totals — all grounded in real app data.
How to use this portfolio
- Summary cards: lifetime stays/nights, charges, paid, outstanding, and POS/activities totals.
- Trips/Reservations: expand a stay to see folio (accommodation/POS/activities), itemized orders, payments, and invoice files. Click a reservation ID to manage it.
- POS & Payments: aggregated activity and payment history across all stays.
- Invoices: saved invoice files per stay (download when available).
- Edit profile: update name/contact/notes (requires unlock + super password).
{% set s = p.stats or {} %}
Stays / Trips
{{ s.stays_total or 0 }}
{{ s.completed_stays or 0 }} completed · {{ s.total_nights or 0 }} nights
Total charges
{{ '%.2f'|format(s.total_charges or 0) }}
POS total {{ '%.2f'|format(s.pos_gross_total or 0) }}
Total paid
{{ '%.2f'|format(s.total_paid or 0) }}
Across all reservations
Outstanding
{{ '%.2f'|format(s.total_outstanding or 0) }}
Due on active/checked-out stays
Profile & contact
| Name | {{ g.get('canonical_name') or g.get('name') }} |
| Phone | {{ g.get('phone') or '—' }} |
| Email | {{ g.get('email') or '—' }} |
| First visit | {{ s.first_visit or '—' }} |
| Last visit | {{ s.last_visit or '—' }} |
| Favorite room | {{ s.favorite_room or '—' }} |
| Notes | {{ g.get('notes') or '—' }} |
{% if p.top_items_overall %}
Top items overall (POS)
{% for it in p.top_items_overall %}- {{ it.item }} — {{ '%.2f'|format(it.gross) }}
{% endfor %}
{% endif %}
Edit guest (requires unlock + super password)
Trips / Reservations ({{ p.trips|length }})
All stays with room, dates, status, charges/balance, POS orders, payments, and invoices.
{% for t in p.trips %}
Res #{{t.id}} · {{ t.room_number or '—' }} {{ '(' ~ t.room_type ~ ')' if t.room_type else '' }} · {{ t.check_in_date }} → {{ t.check_out_date }} ({{ t.nights }} nights) · {{ t.status }}
· charges {{ '%.2f'|format((t.balance.total_charges if t.balance else 0) or 0) }}, paid {{ '%.2f'|format((t.balance.total_paid if t.balance else 0) or 0) }}, due {{ '%.2f'|format((t.balance.balance_due if t.balance else 0) or 0) }}
Source: {{ t.source or '—' }} · Plan: {{ t.rate_plan or '—' }} · Rate: {{ '%.2f'|format(t.agreed_nightly_rate or 0) }} · Tax: {{ '%.2f'|format(t.tax_amount or 0) }}{% if t.notes %} · Notes: {{ t.notes }}{% endif %}
Folio
| Total charges | {{ '%.2f'|format((t.balance.total_charges if t.balance else 0) or 0) }} |
| Accommodation | {{ '%.2f'|format((t.balance.accommodation_gross if t.balance else 0) or 0) }} |
| POS/Extras | {{ '%.2f'|format((t.balance.pos_gross if t.balance else 0) or 0) }} |
| Total paid | {{ '%.2f'|format((t.balance.total_paid if t.balance else 0) or 0) }} |
| Balance due | {{ '%.2f'|format((t.balance.balance_due if t.balance else 0) or 0) }} |
POS / Activity ({{ (t.pos_active or [])|length }} active)
| Item | Batch / Lot trace | Qty | Price | Tax |
{% for i in (t.pos_items or []) %}
| {{ i.item_description }} |
{{ i.get('lot_code') or i.get('batch_lot_code') or ('#' ~ i.get('batch_id') if i.get('batch_id') else '—') }}
{% if i.get('batch_id') %}batch #{{ i.get('batch_id') }}{% endif %}
{% if i.get('received_at') or i.get('batch_received_at') %}Received: {{ i.get('received_at') or i.get('batch_received_at') }}{% endif %}
{% if i.get('expiry_date') or i.get('batch_expiry_date') %}Expiry: {{ i.get('expiry_date') or i.get('batch_expiry_date') }}
{% if (i.get('expiry_state') or i.get('batch_expiry_state')) == 'expired' %}EXPIRED{% elif (i.get('expiry_state') or i.get('batch_expiry_state')) == 'expiring' %}EXPIRING{% endif %}
{% endif %}
|
{{ i.quantity }} | {{ '%.2f'|format(i.unit_price or 0) }} | {{ '%.2f'|format(i.tax_amount or 0) }} |
{% else %}| No POS items |
{% endfor %}
Payments
| When | Method | Type | Amount |
{% for pay in (t.payments or []) %}| {{ pay.at }} | {{ pay.method }} | {{ pay.payment_type }} | {{ '%.2f'|format(pay.amount or 0) }} |
{% else %}| No payments |
{% endfor %}
Invoices
{% if t.invoices %}
{% for inv in t.invoices %}- {{ inv.name }} ({{ inv.modified or '' }})
{% endfor %}
{% else %}
No invoice files saved for this reservation.
{% endif %}
{% else %}
No trips/reservations for this guest yet.
{% endfor %}
All POS / activity ({{ p.all_pos|length }})
| When | Res | Room | Item | Batch / Lot trace | Qty | Price |
{% for i in p.all_pos[:80] %}
| {{ i.created_at }} | #{{ i.reservation_id }} | {{ i.room_number or '' }} | {{ i.item_description }} |
{{ i.get('lot_code') or i.get('batch_lot_code') or ('#' ~ i.get('batch_id') if i.get('batch_id') else '—') }}
{% if i.get('batch_id') %}batch #{{ i.get('batch_id') }}{% endif %}
{% if i.get('received_at') or i.get('batch_received_at') %}Received: {{ i.get('received_at') or i.get('batch_received_at') }}{% endif %}
{% if i.get('expiry_date') or i.get('batch_expiry_date') %}Expiry: {{ i.get('expiry_date') or i.get('batch_expiry_date') }}
{% if (i.get('expiry_state') or i.get('batch_expiry_state')) == 'expired' %}EXPIRED{% elif (i.get('expiry_state') or i.get('batch_expiry_state')) == 'expiring' %}EXPIRING{% endif %}
{% endif %}
|
{{ i.quantity }} | {{ '%.2f'|format(i.unit_price or 0) }} |
{% else %}| No POS activity |
{% endfor %}
{% if p.all_pos|length > 80 %}
Showing latest 80 of {{ p.all_pos|length }}.
{% endif %}
All payments ({{ p.all_payments|length }})
| When | Res | Room | Method | Type | Amount |
{% for pay in p.all_payments[:80] %}| {{ pay.at }} | #{{ pay.reservation_id }} | {{ pay.room_number or '' }} | {{ pay.method }} | {{ pay.payment_type }} | {{ '%.2f'|format(pay.amount or 0) }} |
{% else %}| No payments |
{% endfor %}
{% if p.all_payments|length > 80 %}
Showing latest 80 of {{ p.all_payments|length }}.
{% endif %}
{% endblock %}