<?php
session_start();
require_once(__DIR__ . "/../config/db.php");
require_once(__DIR__."/../session.php");
include(__DIR__ . "/layouts/header.php");
?>

    <link href="/Content/zelma-v2-beta-mobile-css" rel="stylesheet"/>
    <link href="/Content/Profile/zelma-v2-beta-mobile-css" rel="stylesheet"/>
    <link href="/Content/Theme/zelma-v2-beta-mobile-<?= $config['theme']; ?>-css" rel="stylesheet"/>

</head>
<body data-online-id="ieMfKSE6HwtuUuG0k9xIh0peSoPwiCF2AS/dC5W7L6Totas4mp8Zjg=="
      data-route="account-summary" style="--expand-icon-src: url(//d33egg70nrp50s.cloudfront.net/Images/icons/expand.gif?v=20241125);
      --collapse-icon-src: url(//d33egg70nrp50s.cloudfront.net/Images/icons/collapse.gif?v=20241125);
      --play-icon-src: url(//d33egg70nrp50s.cloudfront.net/Images/icons/play.png?v=20241125);
      --desktop-icon-src: url(//d33egg70nrp50s.cloudfront.net/Images/icons/desktop-white.png?v=20241125);
      --jquery-ui-444444-src: url(//d33egg70nrp50s.cloudfront.net/Images/jquery-ui/ui-icons_444444_256x240.png?v=20241125);
      --jquery-ui-555555-src: url(//d33egg70nrp50s.cloudfront.net/Images/jquery-ui/ui-icons_555555_256x240.png?v=20241125);
      --jquery-ui-ffffff-src: url(//d33egg70nrp50s.cloudfront.net/Images/jquery-ui/ui-icons_ffffff_256x240.png?v=20241125);
      --jquery-ui-777620-src: url(//d33egg70nrp50s.cloudfront.net/Images/jquery-ui/ui-icons_777620_256x240.png?v=20241125);
      --jquery-ui-cc0000-src: url(//d33egg70nrp50s.cloudfront.net/Images/jquery-ui/ui-icons_cc0000_256x240.png?v=20241125);
      --jquery-ui-777777-src: url(//d33egg70nrp50s.cloudfront.net/Images/jquery-ui/ui-icons_777777_256x240.png?v=20241125);">


<?php include(__DIR__ . "/layouts/navbar.php");
?>

        <div class="profile-container">
          <div class="standard-form-container">
            <div class="container">
              <div class="row">
                <div class="col-sm-12">
                  <div class="tab-menu-background-container">
                    <div class="tab-menu-container" data-style="vertical">
                      <a href="/mobile/account-summary" data-active="true">
                        <i data-icon="profile" style="--image-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/tabs/profile.svg?v=20241125);--active-image-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/tabs/profile-active.svg?v=20241125);"></i>
                        Akun Saya
                      </a>
                      <a href="/mobile/password" data-active="false">
                        <i data-icon="password" style="--image-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/tabs/password.svg?v=20241125);--active-image-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/tabs/password-active.svg?v=20241125);"></i>
                        Ubah Kata Sandi
                      </a>
                      <a href="/mobile/profile" data-active="false">
                        <i data-icon="bank-account" style="--image-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/tabs/edit.svg?v=20241125);--active-image-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/tabs/edit-active.svg?v=20241125);"></i>
                        Profil Saya
                      </a>
                      <a href="/download-apk" data-active="false" target="_blank">
                        <i data-icon="redemption-history" style="--image-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/tabs/redemption-history.svg?v=20241125);--active-image-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/tabs/redemption-history-active.svg?v=20241125);"></i>
                        Riwayat Penukaran
                      </a>
                    </div>
                  </div>
                  <div class="standard-form-title">INFORMASI AKUN</div>
                  <div class="standard-content-info">
                    <div class="standard-content-block">
                      <table class="table profile-summary-table">
                        <tbody>
                          <tr>
                            <th>Nama Lengkap</th>
                            <td>:</td>
                            <td><?= $user['fullname']; ?></td>
                          </tr>
                          <tr>
                            <th>Email</th>
                            <td>:</td>
                            <td>
                              <a href="/mobile/profile">
                                <span class="warning">
                                  <img loading="lazy" src="//dsuown9evwz4y.cloudfront.net/Images/icons/exclamation.svg?v=20240813" />
                                    Alamat email belum di buat
                                </span>
                              </a>
                            </td>
                          </tr>
                          <tr>
                            <th>Nama Pengguna</th>
                            <td>:</td>
                            <td><?= $user['username']; ?></td>
                          </tr>
                          <tr>
                            <th>ID Pengguna Aplikasi Mobile</th>
                            <td>:</td>
                            <td><?= $user['username']; ?>@AGS</td>
                          </tr>
                          <tr>
                            <th>Mata Uang</th>
                            <td>:</td>
                            <td>IDR</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                    <div class="standard-content-block">
                      <div class="banking-details-header">
                        <label>Detail Perbankan</label>
                        <a href="/mobile/bank-account">
                          <img loading="lazy" src="//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/tabs/edit.svg?v=20241125" />
                        </a>
                      </div>
                      <div id="bank_account_carousel" class="carousel slide bank-info-container" data-interval="false" data-ride="carousel">
                        <ol class="carousel-indicators">
                          <li data-target="#bank_account_carousel" data-slide-to="0" class="active"></li>
                        </ol>
                        <div class="carousel-inner">
                          <div class="bank-info-block item active">
                            <div class="account-name">
                              <?= $user['BankHolder']; ?>
                              <img class="bank-icon" loading="lazy" onerror="this.style.display='none'" src="//d33egg70nrp50s.cloudfront.net/Images/banks/dana.svg?v=20241125" />
                            </div>
                            <div class="account-number"><?= $user['BankNumber']; ?></div>
                            <hr />
                            <div class="bank-name"><?= $user['BankName']; ?></div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="standard-form-title">STATUS DEPOSIT / PENARIKAN</div>
                  <div class="standard-content-info">
                    <div>
                      <h2>Status Deposit Terakhir</h2>
                      <table class="table last-transaction-table">
                        <thead>
                          <tr>
                            <th scope="col">Jumlah</th>
                            <th scope="col">Tanggal/Waktu (WIB)</th>
                            <th scope="col" class="text-center">Status</th>
                          </tr>
                        </thead>
                        <tbody>
                          <?php
                           $info_deposit = "SELECT id, Amount, updated_at, status FROM transaction WHERE user_id = :user_id AND type = 'deposit' ORDER BY updated_at DESC LIMIT 3";
                           $stmt = $db->prepare($info_deposit);
                           $stmt->bindParam(':user_id', $user_id, PDO::PARAM_INT);
                           $stmt->execute();
                           $transaction = $stmt->fetchAll(PDO::FETCH_ASSOC);
                           ?>
                           <?php foreach ($transaction as $trx): ?>
                          <tr>
                            <td><?= $trx['Amount']; ?></td>
                            <td><?= htmlspecialchars((new DateTime($trx['updated_at']))->setTimezone(new DateTimeZone('Asia/Jakarta'))->format('d-M-Y H:i:s'));
                            ?></td>
                            <td>
                                <?php
                                if ($trx['status'] == '0') {
                                    echo '<label data-ticket-status="PEN">Pending</label>';
                                } elseif ($trx['status'] == '1') {
                                    echo '<label data-ticket-status="SUC">Success</label>';
                                } else {
                                    echo '<label data-ticket-status="REJ">Ditolak</label>';
                                }
                                ?>
                            </td>
                          </tr>
                          <?php endforeach; ?>
                        </tbody>
                      </table>
                    </div>
                    <div>
                      <h2>Status Penarikan Terakhir</h2>
                      <table class="table last-transaction-table">
                        <thead>
                          <tr>
                            <th scope="col">Jumlah</th>
                            <th scope="col">Tanggal/Waktu (WIB)</th>
                            <th scope="col" class="text-center">Status</th>
                          </tr>
                        </thead>
                        <tbody>
                          <?php
                           $info_withdraw = "SELECT id, Amount, updated_at, status FROM transaction WHERE user_id = :user_id AND type = 'withdraw' ORDER BY updated_at DESC LIMIT 3";
                           $stmt = $db->prepare($info_withdraw);
                           $stmt->bindParam(':user_id', $user_id, PDO::PARAM_INT);
                           $stmt->execute();
                           $transaction = $stmt->fetchAll(PDO::FETCH_ASSOC);
                           ?>
                          
                            <?php foreach ($transaction as $trx): ?>
                            <tr>
                            <td><?= $trx['Amount']; ?></td>
                            <td><?= htmlspecialchars((new DateTime($trx['updated_at']))->setTimezone(new DateTimeZone('Asia/Jakarta'))->format('d-M-Y H:i:s'));
                            ?></td>
                            <td>
                                <?php
                                if ($trx['status'] == '0') {
                                    echo '<label data-ticket-status="PEN">Pending</label>';
                                } elseif ($trx['status'] == '1') {
                                    echo '<label data-ticket-status="SUC">Success</label>';
                                } else {
                                    echo '<label data-ticket-status="REJ">Ditolak</label>';
                                }
                                ?>
                            </td>
                          </tr>
                         <?php endforeach; ?>
                        </tbody>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>

<?php
include(__DIR__.'/layouts/footer.php');
include(__DIR__.'/layouts/sidebar.php');
?>

<div id="popup_modal" class="modal popup-modal" role="dialog" data-title="" aria-label="Popup Modal">
    <div class="modal-dialog">
        <div class="modal-content" style="--desktop-popup-alert-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/desktop/layout/popup/alert.png?v=20241125);;--desktop-popup-notification-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/desktop/layout/popup/notification.png?v=20241125);;--mobile-popup-alert-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/layout/popup/alert.png?v=20241125);;--mobile-popup-notification-src: url(//d33egg70nrp50s.cloudfront.net/Images/v-zelma-v2-beta/<?= $config['theme']; ?>/mobile/layout/popup/notification.png?v=20241125);;--event-giveaway-popper-src: url(//d33egg70nrp50s.cloudfront.net/Images/giveaway/popper.png?v=20241125);">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span>
                </button>
                <h4 class="modal-title" id="popup_modal_title">
                    
                </h4>
            </div>
            <div class="modal-body" id="popup_modal_body">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal" id="popup_modal_dismiss_button">
                    OK
                </button>
                <button type="button" class="btn btn-secondary" data-dismiss="modal" id="popup_modal_cancel_button" style="display: none">
                    Tidak
                </button>
                <button type="button" class="btn btn-primary" id="popup_modal_confirm_button" style="display: none">
                    Ya
                </button>
            </div>
        </div>
    </div>
</div>


<script data-cfasync="false" src="/bundles/email-decode.min.js"></script>
<script src='/bundles/zelma-v2-beta-mobile-js' defer></script>

<script type="text/javascript">
  navigator.serviceWorker.getRegistrations().then(registrations => {
    for (const registration of registrations) {
      registration.unregister();
    }
  });
</script>

<div class="search-popup-container" id="search_popup_container"></div>
<script src='/bundles/reserve-js' defer></script>

</body>
</html>
