<?php  require_once('../auth/auth.php'); ?>
<section class="content">
  <div class="container-fluid">
    <div class="row">
      <div class="col-md-5 pr-0">
        <div class="card card-primary card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #969c9d;">
          <div class="card-header" style="padding: 3px 8px;">
            <h3 class="card-title"><i class="fa fa-plus"></i> Recharge Information</h3>
            <div class="card-tools m-0">
              <button type="button" class="btn btn-tool" data-card-widget="remove">
              <i class="fas fa-times"></i>
              </button>
            </div>
          </div>
          <div class="card-body">
            <div class="col-md-12 my-1">
              <table border="1" style="width: 100%;">
                <tr>
                  <td colspan="2" class="lanbn text-lg text-center p-1"><dt>পার্সোনাল একাউন্ট সেন্ড মানি করুন</dt></td>
                </tr>
                <tr>
                  <th class="text-center w-50 p-1 text-white text-md" style="background-color:rgb(240 0 125);">
                    bKash
                  </th>
                  <th class="text-center w-50 p-1 text-white text-md" style="background-color:rgb(170 0 185);">
                    Rocket
                  </th>
                </tr>                
                <tr>
                  <td class="text-center w-50 p-3">
                    <img src="../../dist/img/bkqr.png" style="width: 180px;">
                  </td>
                  <td class="text-center w-50 p-3">
                    <img src="../../dist/img/rkqr.png" style="width: 180px;">
                  </td>
                </tr>
                <tr>
                  <th class="text-center w-50 p-1 text-white text-md" style="background-color:rgb(240 0 125);">
                    01715541413
                  </th>
                  <th class="text-center w-50 p-1 text-white text-md" style="background-color:rgb(170 0 185);">
                    01715541413
                  </th>
                </tr>
                <tr>
                <td colspan="2" class="lanbn text-center p-2">
                  <dt>
                    সম্মানিত গ্রাহক আপনার ব্যালেন্সে টাকা যোগ করতে উপরোক্ত নাম্বারে টাকা পাঠিয়ে সঠিকভাবে রিকোয়েস্ট ফর্মটি পূরণ করুন। প্রদত্ত লেনদেন আইডি, টাকার পরিমান এবং সেন্ডার নাম্বার সঠিক থাকলে স্বয়ংক্রিয়ভাবে আপনার ব্যালেন্সে টাকা যোগ হয়ে যাবে।<br>
                    সাহায্যের জন্য কল করুন - 01715541413
                </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
      <div class="col-md-7">
        <div class="card card-primary card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #969c9d;">
          <div class="card-header" style="padding: 3px 8px;">
            <h3 class="card-title"><i class="fa fa-plus"></i> Balence Add</h3>
            <div class="card-tools m-0">
              <button type="button" class="btn btn-tool" data-card-widget="remove">
              <i class="fas fa-times"></i>
              </button>
            </div>
          </div>
          <div class="card-body">
            <form id="add_req_from" action="#" method="post" class="form mt-1"  autocomplete="off">
              <div class="col-md-12">
                <div class="row">
                  <div class="col-md-3">
                    <div class="form-group">
                      <label>Select Method <b class="text-danger"> *</b></label>
                      <select name="pay_method" class="form-control select2" style="width: 100%;" required="true">
                        <option></option>
                        <option value="bKash">Bkash</option>
                        <option value="16216">Rokect</option>
                        <option value="NAGAD">Nagad</option>
                      </select>
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                      <label>Sender Number <b class="text-danger"> *</b></label>
                      <input type="number" name="send_gsm" class="form-control form-control-sm inputselect text-center" required="true" maxlength="11">
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                      <label>TNX-Id <b class="text-danger"> *</b></label>
                      <input type="text" name="tnxid" class="form-control form-control-sm inputselect text-center" required="true">
                    </div>
                  </div>
                  <div class="col-md-3">
                    <div class="form-group">
                      <label>Amount <b class="text-danger"> *</b></label>
                      <input type="number" name="amount" class="form-control form-control-sm inputselect text-center" required="true">
                    </div>
                  </div>
                </div>
              </div>
              <center>
              <div class="card-footer" style="padding: 5px 5px;border-bottom:1px solid rgba(0, 0, 0, .125);">
                <button type="submit" id="saveb" class="btn btn-success btn-xs"><?php if (@$_GET['ptid']) {echo  language(25);}else{echo language(23);}?></button>
              </div>
              </center>
            </form>
            <div class="col-md-12 my-1">
              <table class="ttable table-sm table-head-fixed text-nowrap">
                <thead>
                  <tr>
                    <th class="text-center w-5"><?php echo language(15);?></th>
                    <th class="text-center w-15">Pay Method</th>
                    <th class="text-center w-15">Sender</th>
                    <th class="text-center w-20">TNX Id</th>
                    <th class="text-center w-15">Amount</th>
                    <th class="text-center w-15">Status</th>
                  </tr>
                </thead>
                <tbody>
                  <?php
                     $pqry = mysqli_query($conn,"SELECT * FROM add_balance WHERE coid='$coid' AND status=0")or die(mysqli_error($conn));
                     $i=1;
                     while($brw = mysqli_fetch_assoc($pqry)){
                  ?>
                  <tr class="tr-hover">
                    <td class="text-center"><?php echo $i++;?></td>
                    <td class="text-center"><?php echo $brw['pay_method'];?></td>
                    <td class="text-center"><?php echo $brw['send_gsm'];?></td>
                    <td class="text-center"><?php echo $brw['tnxid'];?></td>
                    <td class="text-center"><?php echo $brw['amount'];?></td>
                    <td class="text-center">
                    <?php if($brw['status']==1){
                        echo '<span class="badge bg-success" style="font-size:100%">Success</span>';
                      } else if($brw['status']==0){
                        echo '<span class="badge bg-danger" style="font-size:100%">Pending</span>';
                      }
                    ?>
                  </td>
                  </tr>
                <?php } ?>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

<script>
   $(document).ready(function() {
   $('select').select2();
   $('#add_req_from').on('submit', function(e){
   e.preventDefault(); 
   $('#saveb').prop('disabled', true);
   $('#saveb').html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> '+'Loading...'); 
        $.post("../bill_package/balance_db.php",$(this).serialize(),function(data){
        if(data==101){
          toastr.warning('This TNX ID Already Use...??', 'Warning');
          $('#saveb').prop('disabled', false);
          $('#saveb').html('<?php echo language(23)?>');
        } else {
          toastr.success(Successfully, yourdata);
          pagecall('../bill_package/balance_add.php','#packagegview');
        }
      });
     });
   });  
</script>


<style type="text/css">
  .text-red {
    color: red;
    background-color: lightgray;
  }
  .blink-hard {
    animation: blinker 1s step-end infinite;
  }
  .blink-soft {
    animation: blinker 1.5s linear infinite;
  }
  @keyframes blinker {
    50% {
      opacity: 0;
    }
  }
</style>