<?php
session_start();
include_once('../../config/#Config.php');
if(!$_SESSION['UserName']){
die('<script>window.location.href=\''.$config['site']['url'].'index.php\';</script>');
}
$get_AD = mysqli_query($conn, "Select * From config_admin WHERE Account = '".$_SESSION['UserName']."'");
if(!mysqli_num_rows($get_AD)){
	die('Không đủ quyền.');
}
					  $get_AA = mysqli_query($conn, "Select * From config_setting WHERE ID = 1");
					  if(mysqli_num_rows($get_AA)){
						  $row = mysqli_fetch_array($get_AA, MYSQLI_ASSOC);
					  }
?>
<?php include 'menu.php'; ?>
<div class="row">
                <div class="card-body">
                  <h4 class="card-title">Quản lý Gói Nạp Phúc Lợi</h4>
				  <button type="button" class="btn btn-outline-primary" style="float:right" onClick="$('#addboxnap').modal();">Thêm Gói Nạp</button>
				  <br/><br/>
                  <div class="table-responsive">
                    <table class="table table-dark">
                      <thead>
                        <tr>
                          <th>
                            #
                          </th>
                          <th>
                            szProductId
                          </th>
                          <th>
                            Tên
                          </th>
                          <th>
                            Giá
                          </th>
						  <th>
                            Quản lý
                          </th>
                        </tr>
                      </thead>
                      <tbody>
					  <?php
					  $gpp_CON = mysqli_query($conn, "Select * From boxcard");
					  
					  if(mysqli_num_rows($gpp_CON)){
						  $i=0;
						  while($row = mysqli_fetch_array($gpp_CON, MYSQLI_ASSOC)){
							  $i++;
							  echo '<tr id="goinap-'.$row['ID'].'">
                          <td>
                            '.$i.'
                          </td>
                          <td>
                           '.$row['szProductId'].'
                          </td>
                          <td>
                           '.$row['Name'].'
                          </td>
                          <td>
                          '.number_format($row['Money']).'
                          </td>		
                          <td>
                          <a href="javascript:editgoinap(\''.$row['ID'].'\');"><label class="badge badge-success">Sửa</label></a>
                          <a href="javascript:xoaGoiNap(\''.$row['ID'].'\');"><label class="badge badge-danger">Xóa</label></a>
                          </td>						  
                        </tr>';
						  }
					  }
					  ?>


                      </tbody>
                    </table>
                </div>
              </div>
  <div class="modal fade" id="addboxnap">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-body">
			<label>szProductId</label>
            <div class="form-group pass_show"> 
                <input type="text" value=""  id="add_box_a" class="form-control"> 
            </div> 
        </div>
		<div class="modal-body">
			<label>Ten Goi</label>
            <div class="form-group pass_show"> 
                <input type="text" value=""  id="add_box_b" class="form-control"> 
            </div> 
        </div>
		<div class="modal-body">
			<label>Giá [Số Dư]</label>
            <div class="form-group pass_show"> 
                <input type="text" value=""  id="add_box_c" class="form-control"> 
            </div> 
        </div>	
        <div class="modal-footer">
          <button type="button" class="btn btn-danger" onClick="add_box();">Thêm Ngay</button>
        </div>		
      </div>
    </div>
  </div>
 <div class="modal fade" id="goinap_nap">
    <div class="modal-dialog">
      <div class="modal-content" id="id-goinap">		
      </div>
    </div>
  </div>
		   