<?php defined('ALTUMCODE') || die() ?>

<div class="container">
    <?= \Altum\Alerts::output_alerts() ?>

    <div class="d-flex flex-column align-items-center justify-content-center text-center">
        <?php if($data->status == 0): ?>
        <img src="<?= ASSETS_FULL_URL . 'images/error.svg' ?>" class="col-10 col-md-6 col-lg-4 mb-4"  />
        <?php else :?>
        <img src="<?= ASSETS_FULL_URL . 'images/success.svg' ?>" class="col-10 col-md-6 col-lg-4 mb-4"  />
        <?php endif ?>

        <p class="text-muted"><?=  $data->msg ?></p>
        <?php if($data->status == 1): ?>
        <p class="text-muted">کد رهگیری:<?=  $data->refId ?></p>
        
        <a href="<?= url('dashboard') ?>" class="btn btn-outline-primary mt-4"><?= l('pay_thank_you.button') ?></a>
        
        <?php else :?>
        <a href="<?= url('pay/'.$_GET['plan_id']) ?>" class="btn btn-outline-primary mt-4"><?= l('pay.custom_plan.pay') ?></a>
        
        
        
        <?php endif ?>

        
    </div>
</div>

<?php ob_start() ?>
<script>
    let current_url = new URL(window.location.href);

    /* Here you could add your thank you page affiliate tracker code and use the already ready variables from below */
    let plan_id = current_url.searchParams.get('plan_id');

    /* The payment gateway name (ex: stripe) */
    let payment_processor = current_url.searchParams.get('payment_processor');

    /* The payment frequency (monthly, annual, lifetime) */
    let payment_frequency = current_url.searchParams.get('payment_frequency');

    /* The payment type (one_time, recurring) */
    let payment_type = current_url.searchParams.get('payment_type');

    /* Discount code, if any */
    let code = current_url.searchParams.get('code');

    /* Paid amount */
    let total_amount = current_url.searchParams.get('total_amount');

    /* Unique random identifier for this transaction */
    let unique_transaction_identifier = current_url.searchParams.get('unique_transaction_identifier');

    /* User id of the current logged in user */
    let user_id = current_url.searchParams.get('user_id');

</script>
<?php \Altum\Event::add_content(ob_get_clean(), 'javascript') ?>
