<?php
require view('theme/header');
?>
<div class="row">
   <div class="col-md-<?= ($bankpayment['status'] == 1) ? "12" : "8 offset-md-2";
                        ?>">
      <div class="card mt">
         <div class="card-body"> <?= htmlspecialchars_decode($page_content['page_content']) ?> </div>
      </div>
   </div>
   <div class="col-md-<?= ($bankpayment['status'] == 1) ? "12" : "8 offset-2"; ?>">
      <button style="margin-bottom: 20px;" class="btn btn-primary" data-toggle="modal" data-toggle="modal" data-target="#modalBalanceHist">
         Bakiye Yükleme Geçmişim
      </button>
   </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;
   ?> <?php
         if ($payments) : ?>
      <div class="col-md-<?= ($bankpayment['status'] == 1) ? "6" : "8 offset-md-2";
                           ?>">
         <div class="card">
            <div class="card-body">
               <form method="post" action="<?= $siteLinks['add-funds']['url'] ?>">
                  <div class="form-loader"> <span class="intro-banner-vdo-play-btn pinkBg"> <span class="ripple pinkBg"></span> <span class="ripple pinkBg"></span> <span class="ripple pinkBg"></span> </span> </div>
                  <div class="form-group mb-3">
                     <label><b>{ADD_FUNDS_METHOD}:</b></label>
                     <select name="method" class="form-control">
                        <?php
                        foreach ($payments as $payment) : ?>
                           <option value="<?= $payment['method_id'] ?>"><?= $payment['name'] ?></option>
                        <?php
                        endforeach;
                        ?>
                     </select>
                  </div>
                  <div class="form-group mb-3"> <label><b>{ADD_FUNDS_AMOUNT}:</b></label> <input type="double" name="amount" class="form-control" min="5" autocomplete="off" value="10" /required> </div>
                  <div class="form-group mb-3"> <label><b>{ADD_FUNDS_PHONE}:</b></label> <input type="text" id="phone" name="phone" class="form-control" /required> </div>
                  <div class="form-group"> <button type="submit" class="btn btn-primary">{ADD_FUNDS_SUBMIT}</button> </div>
               </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-md-6">
         <div class="card">
            <div class="card-body">
               <form id="add_bank_funds" onsubmit="return false;">
                  <div class="form-loader"> <span class="intro-banner-vdo-play-btn pinkBg"> <span class="ripple pinkBg"></span> <span class="ripple pinkBg"></span> <span class="ripple pinkBg"></span> </span> </div>
                  <div class="form-group mb-3">
                     <label><b>{ADD_FUNDS_ACCOUNT_TITLE}:</b></label>
                     <select class="form-control" name="bank_account">
                        <?php
                        foreach ($accounts as $row) : ?>
                           <option value="<?= $row['id'] ?>"><?= $row['account_title'] ?></option>
                        <?php
                        endforeach;
                        ?>
                     </select>
                  </div>
                  <div class="form-group mb-3"> <label><b>{ADD_FUNDS_BANK_AMOUNT}:</b></label> <input type="double" name="amount" class="form-control" autocomplete="off" required> </div>
                  <div class="form-group mb-3"> <label><b>Ödeme Yapanın Adı:</b></label> <input class="form-control" autocomplete="off" required> </div>
                  <div class="form-group"> <button type="submit" class="btn btn-primary">{ADD_FUNDS_BANK_SUBMIT}</button> </div>
               </form>
            </div>
         </div>
      </div>
      <div class="col-md-12">
         <div class="card">
            <table class="table table-hover">
               <thead>
                  <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>
   <?php
         endif;
   ?>
</div>
<div class="modal fade in" id="modalBalanceHist" tabindex="-1" aria-hidden="true">
	<div class="modal-dialog modal-lg modal-dialog-centered">
		<div class="modal-content">
			<div class="modal-header">
				<h4 class="modal-title" id="modal-title">Yükleme Geçmişi</h4>
			</div>
			<div class="modal-body">
				<div id="modal-content">{BALANCE_HISTORY}</div>
			</div>
		</div>
	</div>
</div>

<?php
require view('theme/footer');
