<?php require view('theme/header'); ?>
<div class="app-content">
    <div class="container-fluid">

        <div class="d-card dc-dash">
            <div class="row">
                <div class="col-lg-6 col-md-8 col-12">
                    <div class="py-3 px-5">
                        <div class="dch-title">
                            Bakiye Yükle
                        </div>
                        <div class="dch-text">
                            Bakiye yükleyebilir ve geçmiş yüklemelerinizi görebilirsiniz.
                        </div>
                    </div>
                </div>
                <?php
                if (@$error) : ?>
                    <div class="col-md-<?= ($bankpayment['status'] == 1) ? "12" : "8 offset-md--2";
                    ?>">
                        <div class="alert alert-dismissible alert-danger">
                            <b>Hata!</b>
                            <p style="margin:0"><?= $errorText ?></p>
                        </div>
                    </div>
                <?php
                endif;
                ?> <?php
                if (@$success) : ?>
                    <div class="col-md-<?= ($bankpayment['status'] == 1) ? "12" : "8 offset-md-2";
                    ?>">
                        <div class="alert alert-dismissible alert-success">
                            <b>Başarılı!</b>
                            <p style="margin:0"><?= $successText ?></p>
                        </div>
                    </div>
                <?php
                endif;
                ?>
            </div>
        </div>

        <section class="neworder">

            <div class="row">
                <?php
                if ($payments) : ?>
                    <div class="col-lg-7 col-12 mb-5 mb-lg-0">
                        <div class="d-card">

                            <div class="d-card-head">
                                <div class="dch-body">
                                    <i class="icon far fa-credit-card me-3"></i>
                                    <span class="ml-3">Güvenli Ödeme Yap</span>
                                </div>
                            </div>

                            <div class="d-card-body" id="dc-body">

                                <form method="post" action="<?= $siteLinks['add-funds']['url'] ?>">
                                    <div class="form-group">
                                        <label for="method" class="control-label">{ADD_FUNDS_METHOD}:</label>
                                        <select class="form-control" id="method" name="method"
                                                id="order_type">
                                            <?php
                                            foreach ($payments as $payment) : ?>
                                                <option value="<?= $payment['method_id'] ?>"><?= $payment['name'] ?></option>
                                            <?php
                                            endforeach;
                                            ?>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label for="method" class="control-label">{ADD_FUNDS_AMOUNT}:</label>
                                        <input type="number" class="form-control" name="amount"
                                               id="amount">
                                    </div>
                                    <div class="form-group">
                                        <label for="method" class="control-label">{ADD_FUNDS_PHONE}:</label>
                                        <input type="number" class="form-control" name="phone"
                                               id="phone">
                                    </div>
                                    <!--<input type="hidden" name="_csrf" value="{{ csrftoken }}"> -->
                                    <button type="submit" class="btn btn-primary btn-block">Güvenli Ödeme Yap
                                    </button>

                                </form>

                            </div>
                        </div>
                    </div>
                <?php
                else : ?>
                    <div class="col-md-<?= ($bankpayment['status'] == 1) ? "6" : "8 offset-md-2";
                    ?>">
                        <div class="alert alert-dismissible alert-success">
                            <b>Opps!</b>
                            <p style="margin:0">Online Ödeme alımı kapalı.</p>
                        </div>
                    </div>
                <?php
                endif;
                ?>
                <?php
                if ($bankpayment['status'] == 1) : ?>
                <div class="col-lg-5 col-12 mb-5 mb-lg-0">
                    <div class="d-card">

                        <div class="d-card-head">
                            <div class="dch-body">
                                <i class="icon far fa-credit-card me-3"></i>
                                <span class="ml-3">Güvenli Ödeme Yap</span>
                            </div>
                        </div>

                        <div class="d-card-body" id="dc-body">

                            <form id="add_bank_funds" onsubmit="return false;">
                                <div class="form-group">
                                    <label for="method" class="control-label">{ADD_FUNDS_ACCOUNT_TITLE}:</label>
                                    <select class="form-control" id="bank_account" name="bank_account"
                                            id="bank_account">
                                        <?php
                                        foreach ($accounts as $row) : ?>
                                            <option value="<?= $row['id'] ?>"><?= $row['account_title'] ?></option>
                                        <?php
                                        endforeach;
                                        ?>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="method" class="control-label">{ADD_FUNDS_BANK_AMOUNT}:</label>
                                    <input type="number" class="form-control" name="amount"
                                           id="amount" required>
                                </div>
                                <div class="form-group">
                                    <label for="method" class="control-label">Ödeme Yapanın Adı:</label>
                                    <input type="number" class="form-control">
                                </div>
                                <!--<input type="hidden" name="_csrf" value="{{ csrftoken }}"> -->
                                <button type="submit" class="btn btn-primary btn-block">Güvenli Ödeme Yap
                                </button>

                            </form>

                        </div>
                    </div>
                </div>
                <br>
            </div>
            <div class="row">
                <div class="col-lg-12 col-12 mb-12 mb-lg-0" style="margin-top:20px;">
                    <div class="d-card">

                        <div class="d-card-head">
                            <div class="dch-body">
                                <i class="icon far fa-comment-dollar me-3"></i>
                                <span class="ml-3">Banka Hesapları</span>
                            </div>
                        </div>
                        <div class="d-card-body">
                            <table class="table table-hover">
                                <thead class="white">
                                <tr>
                                    <th>{ADD_FUNDS_ACCOUNT_TITLE}</th>
                                    <th>{ADD_FUNDS_ACCOUNT_NAME}</th>
                                    <th>{ADD_FUNDS_ACCOUNT_IBAN}</th>
                                    <th>{ADD_FUNDS_ACCOUNT_NUMBER}</th>
                                    <th>{ADD_FUNDS_ACCOUNT_BRANCH}</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php
                                foreach ($accounts as $row) : ?>
                                    <tr>
                                        <td><?= $row['account_title'] ?></td>
                                        <td><?= $row['account_name'] ?></td>
                                        <td><?= $row['account_iban'] ?></td>
                                        <td><?= $row['account_number'] ?></td>
                                        <td><?= $row['account_branch'] ?></td>
                                    </tr>
                                <?php
                                endforeach;
                                ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <?php
                endif;
                ?>
                <div class="col-lg-12 col-12 mb-5 mb-lg-0" style="margin-top:20px;">
                    <div class="d-card">
                        <div class="d-card-head">
                            <div class="dch-body">
                                <i class="icon far fa-comment-dollar me-3"></i>
                                <span class="ml-3">Geçmiş Ödemelerim</span>
                            </div>
                        </div>
                        <div class="d-card-body">

                            {BALANCE_HISTORY}

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

        </section>

    </div>
</div>
<?php require view('theme/footer'); ?>
<script>
    $('#table thead').addClass('white'); // <-- add this line

</script>
