{% extends "emails/expat_life/base_expat_email.html" %}

{% block email_title %}Payment Confirmation{% endblock %}

{% block brand_title %}Payment Confirmation{% endblock %}

{% block brand_subtitle %}
Your Live in Sri Lanka payment has been recorded successfully
{% endblock %}

{% block email_content %}

<h2>Hello {{ guest_name|default:user.get_username }},</h2>

<p>
    Thank you. We have successfully recorded your payment for your
    <strong>Live in Sri Lanka</strong> Guest account.
</p>

<div class="email-note">
    <strong>Transaction No:</strong> #{{ payment_transaction.id }}<br>
    <strong>Payment Method:</strong> {{ payment_transaction.get_payment_method_display }}<br>
    <strong>Status:</strong> {{ payment_transaction.get_status_display }}<br>
    {% if payment_transaction.paid_at %}
        <strong>Paid Date:</strong> {{ payment_transaction.paid_at|date:"M d, Y H:i" }}<br>
    {% endif %}
</div>

<h3>Payment Summary</h3>

<div class="email-note">
    <strong>Total Selected Amount:</strong> ${{ payment_transaction.total_amount_usd }}<br>
    <strong>Wallet Used:</strong> ${{ payment_transaction.wallet_deduction_usd }}<br>
    <strong>Gateway Paid:</strong> ${{ payment_transaction.gateway_amount_usd }}<br>
    {% if payment_transaction.gateway_transaction_id %}
        <strong>Gateway Reference:</strong> {{ payment_transaction.gateway_transaction_id }}<br>
    {% endif %}
</div>

<h3>Paid Items</h3>

<table width="100%" cellpadding="0" cellspacing="0"
       style="border-collapse:collapse; margin:16px 0; font-size:14px;">
    <thead>
        <tr>
            <th align="left"
                style="padding:10px; border:1px solid #e5e7eb; background:#f8fafc;">
                Item
            </th>
            <th align="right"
                style="padding:10px; border:1px solid #e5e7eb; background:#f8fafc;">
                Amount
            </th>
        </tr>
    </thead>

    <tbody>
        {% for item in items %}
            <tr>
                <td style="padding:10px; border:1px solid #e5e7eb;">
                    {{ item.payable_item.title }}
                </td>
                <td align="right" style="padding:10px; border:1px solid #e5e7eb;">
                    ${{ item.amount_usd }}
                </td>
            </tr>
        {% empty %}
            <tr>
                <td colspan="2" style="padding:10px; border:1px solid #e5e7eb;">
                    No payment items found.
                </td>
            </tr>
        {% endfor %}
    </tbody>
</table>

<p>
    Please keep this email as your payment confirmation. If you contact support,
    please mention your transaction number:
    <strong>#{{ payment_transaction.id }}</strong>.
</p>

{% if payment_center_url %}
<p>
    <a href="{{ payment_center_url }}" class="email-button">
        View My Payment Center
    </a>
</p>
{% endif %}

{% if dashboard_url %}
<p>
    <a href="{{ dashboard_url }}" class="email-button">
        Go to My Guest Dashboard
    </a>
</p>
{% endif %}

<div class="email-note">
    <strong>Important:</strong><br>
    This email confirms that your payment has been recorded in our system.
    If you believe any payment detail is incorrect, please contact our support team.
</div>

<p>
    Thank you,<br>
    <strong>Live in Sri Lanka Team</strong>
</p>

{% endblock %}