<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a href="view_branch_user_role.php">Roles</a></li>
	    <li><a class="active" href="#" >Add</a></li>
	</ul>

<div class="page-heading">
	<h1>Add Role</h1>
</div>

<div class="form-container">
<?php 
    $branch = new branch();
    $all_branch = $branch->get_branches();
    $branch_user_role = new branch_user_role();
    $ID = isset($_GET['id']) ? $_GET['id'] : NULL;
    if (isset($_POST['add_branch_user_role'])) {
        // Update old record
        if (isset($ID)) {
            $results = $branch_user_role->update_branch_user_role($_POST, $ID);
        } else {
            // Insert new
            $results = $branch_user_role->insert_branch_user_role($_POST);
        }
        if ($results) {
            echo '<div class="alert alert-success" role="alert">';
            echo isset($_GET['id']) ? 'Updated ' : 'Added ';
            echo 'branch user role Sucessfully </div>';
        } else {
            echo '<div class="alert alert-danger" role="alert"> Error </div>';
	
	<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a href="view_branch_user.php">Branch Users</a></li>
	    <li><a class="active" href="#" >Add</a></li>
	</ul>

<div class="page-heading">
	<h1>Add Branch Users</h1>
</div>

<div class="form-container">
<?php 
    $branch = new branch();
    $all_branch = $branch->get_branches();
    $branch_user_role = new branch_user_role();
    $all_branch_user_role = $branch_user_role->get_branch_user_role();
    $branch_user = new branch_user();
    $ID = isset($_GET['id']) ? $_GET['id'] : NULL;
    if (isset($_POST['add_branch_user'])) {
        // Update old record
        if (isset($ID)) {
            $results = $branch_user->update_branch_user($_POST, $ID);
        } else {
            // Insert new
            $results = $branch_user->insert_branch_user($_POST);
        }
        if ($results) {
            echo '<div class="alert alert-success" role="alert">';
            echo isset($_GET['id']) ? 'Updated ' : 'Added ';
            echo 'branch user Sucessfully </div>';
<?php 
if (isset($_SESSION['company_id'])) {
    ?>
	<ul class="breadcrumb">
	    <li><a href="#">Home</a></li>
	    <li><a class="active" href="#">Branch User Roles</a></li>
	</ul>

<div class="page-heading">
	<h1>View Categories</h1>
</div>

	<div class="table-responsive custom-table">
		<?php 
    $branch = new branch();
    $branch_user_role = new branch_user_role();
    $results = $branch_user_role->get_branch_user_role();
    ?>
		<table id="myTable">  
	        <thead>  
	          <tr>  
	            <th>Name</th>  
	            <th>Status</th> 
	            <th></th>  
	          </tr>  
	        </thead>  
	        <tbody>  

	        <?php 
    foreach ($results as $res) {
        if ($res->branch_user_role_company == $_SESSION['company_id']) {