<?php

require APP_PATH
    . '/Views/public/layouts/header.php';

$isPending =
    ($registration['status'] ?? '')
    === 'pending';
?>

<section class="registration-success-section">

    <div class="registration-success-pattern"></div>

    <div class="container registration-success-container">

        <div class="registration-success-card">

            <div class="success-checkmark">
                <svg
                    viewBox="0 0 24 24"
                    aria-hidden="true"
                >
                    <path d="m9 16.2-4.2-4.2L3.4 13.4 9 19 21 7l-1.4-1.4z"/>
                </svg>
            </div>

            <span class="success-kicker">
                Registration received
            </span>

            <h1>
                Thank you,
                <?= e(
                    $registration['full_names']
                ) ?>.
            </h1>

            <p class="success-lead">
                <?php if ($isPending): ?>

                    Your registration has been received
                    and is awaiting approval by the
                    conference organisers.

                <?php else: ?>

                    Your place at the conference has
                    been successfully registered.

                <?php endif; ?>
            </p>

            <div class="registration-reference">
                <span>
                    Registration number
                </span>

                <strong>
                    <?= e(
                        $registration[
                            'registration_number'
                        ]
                    ) ?>
                </strong>
            </div>

            <?php if (
                !empty(
                    $registration[
                        'qr_code_path'
                    ]
                )
            ): ?>

                <div class="success-qr">

                    <img
                        src="<?= e(
                            upload_url(
                                $registration[
                                    'qr_code_path'
                                ]
                            )
                        ) ?>"
                        alt="Delegate registration QR code"
                    >

                    <p>
                        Present this QR code at the
                        conference registration desk
                        for faster check-in.
                    </p>

                </div>

            <?php endif; ?>

            <div class="success-notice">
    <strong>
        Confirmation email
    </strong>

    <?php if (!empty($registration['email_sent'])): ?>
        <p>
            A registration confirmation containing your
            QR code has been sent to

            <strong>
                <?= e($registration['email']) ?>
            </strong>.
        </p>
    <?php else: ?>
        <p>
            Your registration is complete, but the confirmation
            email could not be delivered immediately. Please save
            your registration number and QR code displayed above.
        </p>
    <?php endif; ?>
</div>

            <div class="success-actions">

                <a
                    href="<?= e(base_url('/')) ?>"
                    class="btn btn-primary"
                >
                    Return to Conference Website
                </a>

                <a
                    href="mailto:charley@linkagegroup.co.za"
                    class="btn btn-outline"
                >
                    Contact Organiser
                </a>

            </div>

        </div>
    </div>
</section>

<?php

require APP_PATH
    . '/Views/public/layouts/footer.php';
?>