<?php session_start();

if($_SESSION[invcox] == ""){

header("location:login.php?action=need");

}else{



include("config.php");?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Accounting Software</title>

<link href="style.css" rel="stylesheet" type="text/css" />
 
<style>
 
.permission-container {
max-width: 1000px;
margin: 0 auto;
}

.permission-title {
font-size: 28px;
font-weight: bold;
margin-bottom: 25px;
text-align: center;
color: #222;
}

.login-fields {
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 3px 6px rgba(0,0,0,0.05);
margin-bottom: 25px;
}

.login-fields input {
width: 100%;
padding: 10px 12px;
margin-bottom: 15px;
border-radius: 6px;
border: 1px solid #ccc;
font-size: 16px;
}

.login-fields label {
font-weight: 600;
margin-bottom: 5px;
display: block;
}

.menun {
list-style: none;
padding: 0;
margin: 0;
}

.menun li {
background: #fff;
border-radius: 8px;
margin-bottom: 12px;
box-shadow: 0 3px 6px rgba(0,0,0,0.05);
}

.menun .parent-label {
display: flex;
align-items: center;
cursor: pointer;
padding: 12px 20px;
font-weight: 600;
font-size: 18px;
color: #222;
}

.menun .parent-label input[type=checkbox] {
margin-right: 10px;
transform: scale(1.2);
}

.child-menu {
list-style: none;
padding-left: 30px;
display: none;
padding-bottom: 10px;
}

.child-menu li {
padding: 8px 0;
font-size: 16px;
display: flex;
align-items: center;
}

.child-menu li input[type=checkbox] {
margin-right: 10px;
transform: scale(1.1);
}

/* Accordion toggle icon */
.menun .toggle-icon {
margin-left: auto;
transition: transform 0.3s;
font-weight: bold;
color: #555;
}

/* Rotate when open */
.menun .parent.open .toggle-icon {
transform: rotate(90deg);
}

/* Submit Button */
.submit-btn {
background-color: #28a745;
color: #fff;
font-weight: bold;
padding: 15px 25px;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 18px;
margin-top: 20px;
display: block;
width: 100%;
max-width: 300px;
margin-left: auto;
margin-right: auto;
}

.submit-btn:hover {
background-color: #218838;
}

/* Responsive */
@media(max-width: 768px) {
.menun .parent-label {
font-size: 16px;
}
.child-menu li {
font-size: 14px;
}
} </style>
</head>



<body>

<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="box-wrap">

  <tr>

    <td><?php include("top.php")?></td>

  </tr>

  <tr>

    <td><table width="100%" border="0" cellspacing="1" cellpadding="0">

      <tr>

        <td height="350" align="center" valign="top"><br />

          <table width="100%" border="0" cellpadding="2" cellspacing="1">

            <tr>

              <td align="center"><table width="100%" border="0" cellspacing="0" cellpadding="0">

                <tr>

                  <td height="30" align="center" background="images/place_bg.jpg" class="location"><strong>&nbsp;&nbsp;</strong><strong class="red style7">User Submited Successfully</strong></td>

                </tr>

              </table></td>

            </tr>  <?php if($_GET[info] == "yes"){?>

            <?php }?>

            <?php if($_GET[info] == "error"){?>

            <?php }?>

            <tr>

              <td align="center" valign="top">
				  <div class="permission-container">
 
<div class="permission-title">User Permission Manager</div>

<form action="save_permissions.php" method="post">
    <!-- UserID & Password -->
    <div class="login-fields">
        <label for="userid">User ID</label>
        <input type="text" id="userid" name="userid" placeholder="Enter User ID" required>

        <label for="password">Password</label>
        <input type="password" id="password" name="password" placeholder="Enter Password" required>
    </div>

    <ul class="menun">

        <!-- Room Booking -->
        <li>
            <div class="parent-label parent" data-target="rb">
                <input type="checkbox">
                Room Booking
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="rb">
                <li><input type="checkbox" name="hotel_new"> Room Booking</li>
                <li><input type="checkbox" name="hotel_new_confirm"> Room Status</li>
                <li><input type="checkbox" name="hotel_new_due_payment"> Due Payment</li>
                <li><input type="checkbox" name="hotel_bill_list"> All Booking List</li>
                <li><input type="checkbox" name="customer_profile"> Customer Profile</li>
            </ul>
        </li>

        <!-- Income -->
        <li>
            <div class="parent-label parent" data-target="inc">
                <input type="checkbox">
                Income
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="inc">
                <li><input type="checkbox" name="add_income"> Add Income</li>
                <li><input type="checkbox" name="income_summary"> Income Summary</li>
                <li><input type="checkbox" name="income_view"> Income View Details</li>
            </ul>
        </li>

        <!-- Cost -->
        <li>
            <div class="parent-label parent" data-target="cost">
                <input type="checkbox">
                Cost
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="cost">
                <li><input type="checkbox" name="add_cost"> Add Cost</li>
                <li><input type="checkbox" name="cost_summary"> Cost Summary</li>
                <li><input type="checkbox" name="cost_view"> Cost View Details</li>
            </ul>
        </li>
		
		 <li>
            <div class="parent-label parent" data-target="invest">
                <input type="checkbox">
                invest
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="invest">
                <li><input type="checkbox" name="add_invest"> Add invest</li>
				<li><input type="checkbox" name="invest_view">Invest View</li>
            </ul>
        </li>

        <!-- Payable & Receivable -->
        <li>
            <div class="parent-label parent" data-target="pr">
                <input type="checkbox">
                Payable & Receivable
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="pr">
                <li><input type="checkbox" name="payable"> Add Payable</li>
                <li><input type="checkbox" name="receivable"> Add Receivable</li>
                <li><input type="checkbox" name="payable_summary"> P&R Summary</li>
                <li><input type="checkbox" name="payable_view"> P&R Details</li>
                <li><input type="checkbox" name="payable_type"> P&R Type</li>
            </ul>
        </li>

        <!-- Accounts -->
        <li>
            <div class="parent-label parent" data-target="acc">
                <input type="checkbox">
                Accounts
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="acc">
                <li><input type="checkbox" name="cash_book"> Cash Book</li>
                <li><input type="checkbox" name="profit_loss"> Profit and Loss</li>
            </ul>
        </li>

        <!-- Entry -->
        <li>
            <div class="parent-label parent" data-target="ent">
                <input type="checkbox">
                Entry
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="ent">
                <li><input type="checkbox" name="add_room"> Room</li>
                <li><input type="checkbox" name="add_service"> Additional Service</li>
                <li><input type="checkbox" name="add_income_type"> Income Type</li>
                <li><input type="checkbox" name="add_cost_type"> Cost Type</li>
                <li><input type="checkbox" name="add_client"> Customer</li>
                <li><input type="checkbox" name="add_bank"> Add Pay methode</li>
            </ul>
        </li>

        <!-- HR -->
        <li>
            <div class="parent-label parent" data-target="hr">
                <input type="checkbox">
                HR
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="hr">
                <li><input type="checkbox" name="hr_employee"> Add Employee</li>
                <li><input type="checkbox" name="hr_salary"> Add Salary</li>
				<li><input type="checkbox" name="hr_salary_paid"> Salary Paid</li>
                <li><input type="checkbox" name="hr_salary_register"> Salary Register</li>
                <li><input type="checkbox" name="hr_salary_edit">Salary Edit</li>
            </ul>
        </li>
 <!-- resturent -->
        <li>
            <div class="parent-label parent" data-target="restaurant">
                <input type="checkbox">
                Restaurant
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="restaurant">
                <li><input type="checkbox" name="restaurant_chalan_entry"> Create invoice</li>
                <li><input type="checkbox" name="restaurant_add_product"> product entry</li>
				<li><input type="checkbox" name="restaurant_invoice_list-custom"> Total Sale [item wise]</li>
                <li><input type="checkbox" name="restaurant_bill_list">Bill list</li>
				<li><input type="checkbox" name="restaurant_due_list"> Due list</li> 
				<li><input type="checkbox" name="restaurant_due_payment"> Due Payment</li>
				<li><input type="checkbox" name="restaurant_cash_book"> Resturent Cash Book</li> 
				<li><input type="checkbox" name="restaurant_add_cost"> Add Cost</li>
				<li><input type="checkbox" name="restaurant_cost_summary"> Cost Summary</li>
				<li><input type="checkbox" name="restaurant_cost_view"> Cost View</li>
				<li><input type="checkbox" name="restaurant_cost_type"> Cost Type</li>
		
            </ul>
        </li>
        <!-- Stock -->
        <li>
            <div class="parent-label parent" data-target="stock">
                <input type="checkbox">
                Stock
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="stock">
                <li><input type="checkbox" name="stock_in"> Stock In</li>
                <li><input type="checkbox" name="stock_out"> Stock Out</li>
                <li><input type="checkbox" name="bac_stock_category"> Stock Category</li>
                <li><input type="checkbox" name="current_stock"> Current Stock</li>
            </ul>
        </li>

        <!-- User -->
        <li>
            <div class="parent-label parent" data-target="usr">
                <input type="checkbox">
                User
                <span class="toggle-icon">&#9654;</span>
            </div>
            <ul class="child-menu" id="usr">
                <li><input type="checkbox" name="admin_user"> Add User</li>
				<li><input type="checkbox" name="bill_verify">Bill Verify / Cancel Booking </li> 
            </ul>
        </li>

      

    </ul>

    <!-- Submit Button -->
    <button type="submit" class="submit-btn">Save Permissions</button>
</form>
 

</div><script>
// Toggle accordion submenu
document.querySelectorAll(".parent").forEach(function(parent) {
    parent.addEventListener("click", function(e) {
        if (e.target.tagName === "INPUT") return;
        let targetId = parent.getAttribute("data-target");
        if (!targetId) return;
        let submenu = document.getElementById(targetId);
        if (!submenu) return;
        submenu.style.display = (submenu.style.display === "block") ? "none" : "block";
        parent.classList.toggle("open");
    });
});

// Parent checkbox selects all children
document.querySelectorAll(".parent input[type=checkbox]").forEach(function(parentCheckbox) {
    parentCheckbox.addEventListener("change", function() {
        let parentDiv = this.closest(".parent");
        let targetId = parentDiv.getAttribute("data-target");
        if (!targetId) return;
        let childs = document.querySelectorAll("#" + targetId + " input[type=checkbox]");
        childs.forEach(c => c.checked = this.checked);
    });
});
</script></td>

            </tr>

          </table>

            <br /></td>

      </tr>

      <tr>

        <td align="center" valign="top" class="round_box"><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">

          <tr>

            <td colspan="5" bgcolor="#EFEFEF" class="location"><strong>User's List </strong></td>
            </tr>

          <tr>

            <td width="62" bgcolor="#EFEFEF"><strong>Sr.</strong></td>

            <td width="818" bgcolor="#EFEFEF"><strong>User Id </strong></td>

            <th bgcolor="#EFEFEF" class="list_table" >User</th>
            <td width="269" align="center" bgcolor="#EFEFEF"><strong>Edit</strong></td>

            <td width="269" align="center" bgcolor="#EFEFEF"><strong>Delete</strong></td>
          </tr>

          <?php 

			$result=mysql_query("select * from user order by id asc");

			$row=mysql_fetch_array($result);

			$sr=0;

			do{

			?>

          <tr>

            <td bgcolor="#FFFFFF"><?php $sr=$sr+1; echo $sr; ?></td>

            <td bgcolor="#FFFFFF"><?php echo $row[userid]; ?></td>

            <td width="276" align="center" bgcolor="#FFFFFF" class="link"><?php  
			  
$eresult=mysql_query("SELECT  userid FROM user WHERE id = '$row[suser]'  limit 1");
$erow=mysql_fetch_array($eresult);
				
			  echo $erow[userid];
				?>
                <span class="info-icon" onclick="openPopup('show_ip_info.php?ip=<?php echo $row[user_ip]; ?>&amp;time=<?php $date = "$row[created_at]";
echo date("d-m-Y H:i:s", strtotime($date));?>')">i</span></td>
            <td align="center" bgcolor="#FFFFFF" class="link"><a href="edit_adminuser.php?userid=<?php echo $row[userid]; ?>">Edit</a></td>

            <td align="center" bgcolor="#FFFFFF" class="link"><a href="delete_adminuser.php?id=<?php echo $row[id]; ?>">Delete</a></td>
          </tr>

          <?php 

			}while($row=mysql_fetch_array($result));

			?>

        </table></td>

      </tr>

    </table></td>

  </tr>

  <tr>

    <td><?php include("bot.php")?></td>

  </tr>

</table>

</body>

</html>

<?php }?>