<?php 
include("conn.php"); 
if(isset($_POST["employee_idse"]))  
 {  
      $data=$_POST['employee_idse'];

      $query = "SELECT * FROM users WHERE id = '$data'";  
      $result = mysqli_query($conn, $query);  
      while ($row=mysqli_fetch_array($result)) {
        $sql2 = "SELECT * FROM `user_role` WHERE userid='".$row['id']."'";
$result2=$conn->query($sql2);
$row1=$result2->fetch_assoc();
$status=$row['status'];
$place_order=$row1['dashboard'];
$prepare_order_b=$row1['prepare_order_b'];
$prepare_order_r=$row1['prepare_order_r'];
$m_user=$row1['m_user'];
$m_menu_bar=$row1['m_menu_bar'];
$m_menu_rest=$row1['m_menu_rest'];
$analytics=$row1['analytics'];
$settings=$row1['settings'];
$customer=$row1['customer'];
$order=$row1['order'];
$facility=$row1['facility'];
$user_role=$row1['user_role'];
$inventory=$row1['inventory'];
$view_cash=$row1['view_amount'];
$hotel_m=$row1['hotel_m'];




if ($place_order=='1') {
    $place_order_fa='checked' ; 
   }
   else{
       $place_order_fa='';
   }
   if ($prepare_order_b=='1') {
       $prepare_order_b_fa='checked ' ; 
      }
      else{
          $prepare_order_b_fa='';
      }
   
      if ($prepare_order_r=='1') {
       $prepare_order_r_fa=' checked' ; 
      }
      else{
        $prepare_order_r_fa='';
      }
   
      if ($m_user=='1') {
       $m_user_fa='checked' ; 
      }
      else{
          $m_user_fa='';
      }
   
      if ($m_menu_bar=='1') {
       $m_menu_bar_fa='checked' ; 
      }
      else{
          $m_menu_bar_fa='';
      }
   
   
      if ($m_menu_rest=='1') {
       $m_menu_rest_fa='checked' ; 
      }
      else{
          $m_menu_rest_fa='';
      }
   
      if ($analytics=='1') {
       $analytics_fa='checked' ; 
      }
      else{
          $analytics_fa='';
      }
   
      if ($settings=='1') {
       $settings_fa='checked' ; 
      }
      else{
          $settings_fa='';
      }
   
      if ($customer=='1') {
       $customer_fa='checked' ; 
      }
      else{
          $customer_fa='';
      }
   
      if ($order=='1') {
       $order_fa='checked' ; 
      }
      else{
          $order_fa='';
      }
   
   
   
      if ($user_role=='1') {
       $user_role_fa='checked' ; 
      }
      else{
          $user_role_fa='';
      }
   
      if ($inventory=='1') {
       $inventory_fa=' checked' ; 
      }
      else{
          $inventory_fa='';
      }

      if ($view_cash=='1') {
        $view_cash_fa=' checked' ; 
       }
       else{
           $view_cash_fa='';
       }





 


 }  
}
 ?>
<?php include("common/head.php");?>


<button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
  <!-- Modal -->
  <form action="edit/user_role_update.php" method="post" class="m-2 w-100">
                   <div class="form-check form-switch">
                   <input class="form-check-input"name="p_order" <?php echo $place_order_fa?> type="checkbox" id="flexSwitchCheckChecked" >
                   <label class="form-check-label" for="flexSwitchCheckChecked">Place Order</label>
                 </div>

                  <div class="form-check form-switch">
                    <input class="form-check-input"name="p_o_b" type="checkbox" id="flexSwitchCheckChecked" <?php echo $prepare_order_b_fa?> >
                    <label class="form-check-label" for="flexSwitchCheckChecked">Prepare Order Bar</label>
                  </div>

                  <div class="form-check form-switch">
                    <input class="form-check-input"name="p_o_r" type="checkbox" id="flexSwitchCheckChecked" <?php echo $prepare_order_r_fa?>>
                    <label class="form-check-label" for="flexSwitchCheckChecked">Prepare Order Restaurant</label>
                  </div>

                  <div class="form-check form-switch">
                   <input class="form-check-input"name="m_user" type="checkbox" id="flexSwitchCheckChecked"<?php echo $m_user_fa?> >
                   <label class="form-check-label" for="flexSwitchCheckChecked">Manage Users</label>
                 </div>

                  <div class="form-check form-switch">
                    <input class="form-check-input"name="m_menu_bar" type="checkbox" id="flexSwitchCheckChecked"<?php echo $m_menu_bar_fa?> >
                    <label class="form-check-label" for="flexSwitchCheckChecked">Manage Menu bar</label>
                  </div>

                  <div class="form-check form-switch">
                    <input class="form-check-input"name="m_menu_rest" type="checkbox" id="flexSwitchCheckChecked"<?php echo $m_menu_rest_fa?> >
                    <label class="form-check-label" for="flexSwitchCheckChecked">Manage Menu restaurant</label>
                  </div>

                  <div class="form-check form-switch">
                    <input class="form-check-input"name="analytics" type="checkbox" id="flexSwitchCheckChecked" <?php echo $analytics_fa?>>
                    <label class="form-check-label" for="flexSwitchCheckChecked">Analytics</label>
                  </div>

                  <div class="form-check form-switch">
                    <input class="form-check-input"name="settings" type="checkbox" id="flexSwitchCheckChecked" <?php echo $settings_fa?>>
                    <label class="form-check-label" for="flexSwitchCheckChecked">Settings</label>
                  </div>

                  <div class="form-check form-switch">
                    <input class="form-check-input"name="customer" type="checkbox" id="flexSwitchCheckChecked" <?php echo $customer_fa?>>
                    <label class="form-check-label" for="flexSwitchCheckChecked">Customer</label>
                  </div>

                  <div class="form-check form-switch">
                    <input class="form-check-input"name="order" type="checkbox" id="flexSwitchCheckChecked" <?php echo $order_fa?>>
                    <label class="form-check-label" for="flexSwitchCheckChecked">Order</label>
                  </div>


                  <div class="form-check form-switch">
                    <input class="form-check-input"name="user_role" type="checkbox" id="flexSwitchCheckChecked" <?php echo $user_role_fa?>>
                    <label class="form-check-label" for="flexSwitchCheckChecked">User role</label>
                  </div>

                  <div class="form-check form-switch">
                    <input class="form-check-input"name="inventory" type="checkbox" id="flexSwitchCheckChecked" <?php echo $inventory_fa?>>
                    <label class="form-check-label" for="flexSwitchCheckChecked">Inventory</label>
                  </div>

                  <div class="form-check form-switch">
                    <input class="form-check-input"name="view_cash" type="checkbox" id="flexSwitchCheckChecked" <?php echo $view_cash_fa?>>
                    <label class="form-check-label" for="flexSwitchCheckChecked">View Cash</label>
                  </div>

                  <input type="hidden" name="id" value="<?php echo $data ?>">
                  <input type="hidden" name="by" value="<?php echo $id_user ?>">
                  <input type="hidden" name="date" value="<?php echo date("F j, Y") ?>">
                  <button class="btn btn-success btn-sm"  name="submit">Submit</button>
                  <a href="user_role" class="btn btn-danger btn-sm"  name="submit">Back Home</a>
                  </form>

     
        </div>
      </div>
    </div>
