<?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ý Mốc Nạp Tháng</h4>
				  <button type="button" class="btn btn-outline-primary" style="float:right" onClick="$('#addMocNap').modal();">Thêm Mốc Nạp</button>
				  <br/><br/>
                  <div class="table-responsive">
                    <table class="table table-dark">
                      <thead>
                        <tr>
                          <th>
                            #
                          </th>
                          <th>
                            Tên Gói
                          </th>
                          <th>
                            Giá
                          </th>
						  <th>
                            Vật phẩm
                          </th>
						  <th>
                            Quản lý
                          </th>
                        </tr>
                      </thead>
                      <tbody>
					  <?php
					  $gpp_CON = mysqli_query($conn, "Select * From box_mocnap order by ID asc");
					  
					  if(mysqli_num_rows($gpp_CON)){
						  $i=0;
						  while($row = mysqli_fetch_array($gpp_CON, MYSQLI_ASSOC)){
							  $i++;
							  echo '<tr id="boxnapthang-'.$row['ID'].'">
                          <td>
                            '.$i.'
                          </td>
                          <td>
                           '.$row['NameBox'].'
                          </td>
                          <td>
                           '.number_format($row['MoneyBox']).'
                          </td>	
                          <td>
                          <a href="javascript:editboxthang(\''.$row['BoxID'].'\');"><label class="badge badge-success">Sửa Vật phẩm</label></a>
                          </td>
						  <td>
                          <a href="javascript:XoabOxNap(\''.$row['ID'].'\');"><label class="badge badge-danger">Xóa</label></a>
                          </td>						  
                        </tr>';
						  }
					  }
					  ?>

                      </tbody>
                    </table>
                </div>
              </div>
  <div class="modal fade" id="addMocNap">
    <div class="modal-dialog">
      <div class="modal-content">	
        <div class="modal-body">
			<label>ID Xếp hạng</label>
            <div class="form-group pass_show"> 
                <input type="text" value=""  id="moc_a" class="form-control"> 
            </div> 
        </div>	  
        <div class="modal-body">
			<label>Tên Gói</label>
            <div class="form-group pass_show"> 
                <input type="text" value=""  id="moc_b" class="form-control"> 
            </div> 
        </div>
		<div class="modal-body">
			<label>Mệnh Giá Gói</label>
            <div class="form-group pass_show"> 
                <input type="text" value=""  id="moc_c" class="form-control"> 
            </div> 
        </div>	
        <div class="modal-footer">
          <button type="button" class="btn btn-danger" onClick="add_mocnapthang();">Thêm Ngay</button>
        </div>		  
      </div>
    </div>
  </div>
  <div class="modal fade" id="mocnap_nap">
    <div class="modal-dialog">
      <div class="modal-content" id="id-mocnap-thang">	
      </div>
    </div>
  </div>
  		   