<div class="col-sm-10 form-group">
    <div class="row">
        <div class="col-sm-12 ">
            <div class="col-sm-3">
                <a href="#" class="btn btn-success text-right" id="addForbidden"><i class="fa fa-plus-circle" title="Add Forbidden"></i></a>        
                <?php
                switch ($sort_by) {
                    case 'asc':
                        ?>
                        <a href="<?php echo base_url() . 'admin/forbidden-decending' ?>" class="btn btn-sm btn-success" ><i class="fa fa-sort-alpha-desc" title="Sort forbidden by name"></i></a>
                        <?php
                        break;
                    case 'desc':
                        ?>
                        <a href="<?php echo base_url() . 'admin/forbidden-acending' ?>" class="btn btn-sm btn-success" ><i class="fa fa-sort-alpha-asc" title="Sort forbidden by name"></i></a>
                        <?php
                        break;

                    default:
                        ?>
                        <a href="<?php echo base_url() . 'admin/forbidden-acending' ?>" class="btn btn-sm btn-success" ><i class="fa fa-sort-alpha-asc" title="Sort forbidden by name"></i></a>
                        <?php
                        break;
                }
                ?>
                
            </div>
            
                
            
            <div class="col-sm-5 col-sm-offset-1">
                <div class="input-group search_forbidden">
                    <input type="text"
                           name="search_forbidden"
                           id="search_forbidden"
                           oninput="getforbiddenSearchValue(this.value,'<?php echo base_url() . 'search-forbidden' ?>')"
                           class="form-control"
                           placeholder="Search ..." 
                           aria-describedby="basic-addon1">
                    <span class="input-group-addon" id="basic-addon1"><i class="fa fa-search"></i></span>
                </div>
            </div>

            <div class="col-sm-3">
                <select class="form-control search_type_forbidden"
                        name=""
                        id="searchForbiddenType"
                        onchange="getSearchforbiddenType(this.value, '<?php echo base_url() . 'get-forbidden-value-by-type' ?>')">
                    <option value=''> Select search type....</option>
                    <option value='1'>URL</option>
                    <option value='2'>Name</option>
                    <option value='3'> Organization</option>
                    <option value='4'> Email</option>
                </select>
            </div>
            <script>
                document.getElementById('searchForbiddenType').value = '<?php echo $type; ?>';
            </script>
        </div>
    </div>

    <div class="row gray_ttc">
        <div class="col-sm-12 form-group" style="padding: 0">
            <div class="col-sm-12 white form-group" >
                <div class="col-sm-12 gray_ttc" style="margin-left: 5px">
                    <div class="col-sm-12 form-group" style="border-bottom: 1px solid #80c12c;">
                        <span class=" col-sm-6  form-group">
                            <h3 style="margin: 0">Add Forbidden</h3>
                        </span> 
                    </div>

                    <div class="col-sm-12 form-group" id="addForbiddenForm" style="display: none">
                        <?php
                        $url = 'admin/add-forbidden';
                        echo form_open_multipart($url, 'class="cmxform" id="formID2" name="forbiddewnFORM"');
                        ?>
                        <div class="form-group col-sm-4 ">
                            <select name="forbidden_type"
                                    id="forbidden_type"
                                    onChange="selectForbiddenType(this.value)"
                                    class="form-control validate[required  , custom[requiredForbidden]]" >
                                <option value="0"> -Select Forbidden Type - </option>
                                <option value="1">URL</option>
                                <option value="2">Name</option>
                                <option value="3">Organization</option>
                                <option value='4'> Email</option>
                            </select>
                        </div>

                        <div class="form-group col-sm-6" id="common_input" style="display: block">
                            <div class="input-group">
                                <input type="text"
                                       id="forbidden_name"
                                       name="forbidden_name" 
                                       oninput="checkForbiddenExist(this.value, forbidden_type.value, '<?php echo base_url(); ?>admin/check-forbidden' )"
                                       class="form-control validate[required]"
                                       placeholder="Enter type forbidden.."
                                       readonly=""
                                       aria-describedby="basic-addon1">
                                <span class="input-group-addon" id="basic-addon1"><i class="fa  fa-link"></i></span>
                            </div>
                            <input type="hidden" id="forbidden_exists" value="">
                        </div>

                        <div class="form-group col-sm-2 ">
                            <a href="#" class="btn btn-success" id="CancelForbiddenForm"><i class="fa fa-times"></i></a>
                            <button type="submit" class="btn btn-success"><i class="fa fa-save"></i></button>
                        </div>

                        <?php echo form_close(); ?>

                        <div class="form-group col-sm-12"><br></div>

                    </div>
                </div>

                <!--Update forbidden form start-->

                <div class="col-sm-12 gray_ttc" style="margin-left: 5px;display: block" id="EditForbiddenForm">                                                                            
                </div>

                <!--Update forbidden form end-->

            </div>

            <div class="col-sm-12 white form-group"  id="manageForbiddenForm" >
                <div class="col-sm-12 gray_ttc" style="margin-left: 5px" >
                    <div class="col-sm-12 form-group" style="border-bottom: 1px solid #80c12c;">
                        <span class=" col-sm-12  form-group">
                            <h3 style="margin: 0">Manage Forbidden</h3>
                        </span> 
                    </div>

                    <div class="col-sm-12 form-group white" id="editManage">
                        <div class="col-sm-12 gray_ttc form-group" style="margin-left: 5px;border-bottom: 1px solid #80c12c">
                            <div class="form-group col-sm-6 ">
                                <strong> Name</strong>
                            </div>
                            <div class="form-group col-sm-4 ">
                                <strong> Type</strong>
                            </div>
                            <?php if ($manamge_forbidden_person_role->person_role == 6) { ?>
                                <div class="form-group col-sm-2 ">
                                    <strong> Action</strong>
                                </div>
                            <?php } ?>
                        </div>

                        <div class="col-sm-12  form-group"> </div>
                        <?php
                        foreach ($all_forbidden as $all_forbidden_info) {
                            ?>
                            <div class="col-sm-12  form-group" style="margin-left: 5px;background: #ededed">
                                <div class=" col-sm-6 " style="padding-top: 5px;padding-bottom: 5px">
                                    <?php echo $all_forbidden_info->forbidden_name ?>
                                </div>
                                <div class="col-sm-4" style="padding-top: 5px;padding-bottom: 5px">
                                    <?php
                                    if ($all_forbidden_info->forbidden_type == 1) {
                                        echo "URL";
                                    } else if ($all_forbidden_info->forbidden_type == 2) {
                                        echo "Name";
                                    } else if($all_forbidden_info->forbidden_type == 3){
                                        echo "Organization";
                                    }else if($all_forbidden_info->forbidden_type == 4){
                                        echo "Email";
                                    }
                                    ?>
                                </div>
                                <?php if ($manamge_forbidden_person_role->person_role == 6) { ?>
                                    <div class="col-sm-2 " style="padding-top: 5px;padding-bottom: 5px">
                                        <a href="javascript:void(0)" onclick="editForbidden('<?php echo base_url(); ?>admin/edit-forbidden', '<?php echo base_url(); ?>forbidden/edit-manage', '<?php echo $all_forbidden_info->forbidden_id ?>')" id="EditBtn"><i class="fa fa-edit" title="Edit"></i></a>
                                        <span>&nbsp;&nbsp;</span>
                                        <a href="javascript:void(0)"  data-toggle="modal" data-target="#deleteForbiddenAlert<?php echo $all_forbidden_info->forbidden_id; ?>" ><i class="fa fa-trash" title="Delete"></i></a>                                           
                                    </div>
                                <?php } ?>
                            </div>

                            <div class="modal" style="" id="deleteForbiddenAlert<?php echo $all_forbidden_info->forbidden_id ?>" tabindex="-1" role="dialog" aria-labelledby="changeRole" aria-hidden="true">
                                <div class="modal-dialog">
                                    <div class="modal-content" style="top: 180px;border: 5px solid #80c12c;border-top: 20px solid #80c12c !important;margin: 0 auto;width: 450px">           
                                        <div class="modal-body">
                                            <h4 class="text-center">Are you sure you want to Delete this Forbidden?</h4>
                                        </div>
                                        <div class="modal-footer">
                                            <div  class="col-sm-12">               
                                                <button onclick="deleteForbidden('<?php echo base_url(); ?>admin/delete-forbidden', '<?php echo base_url(); ?>forbidden', '<?php echo $all_forbidden_info->forbidden_id ?>')" style="margin-left: 90px" type="button" class="btn btn-success  col-sm-2" data-dismiss="modal">Yes</button>
                                                <button type="button" style="margin-left: 20px" class="btn btn-danger col-sm-2 col-sm-offset-4" data-dismiss="modal">No</button>
                                            </div>
                                        </div>            
                                    </div>
                                </div>
                            </div>                    
                        <?php } ?>
                    </div>
                </div>
                <div class="col-sm-12  text-center" >
                    <?php
                    $total_page = ceil($total_forbidden->total_forbidden / 10);
                    if ($total_page > 1) {
                        ?>
                        <nav class="course-pagination">
                            <ul class="pagination">
                                <?php
                                if ($page > 2) {
                                    ?>
                                    <li>
                                        <a href="<?php echo base_url() . 'forbidden/'; ?>" aria-label="Previous">
                                            <span aria-hidden="true" title="First Page">&laquo;&laquo;</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="<?php echo base_url() . 'forbidden/' . ($page - 1); ?>" aria-label="Previous">
                                            <span aria-hidden="true" title="Previous Page">&laquo;</span>
                                        </a>
                                    </li>
                                <?php } elseif ($page > 1) { ?>
                                    <li>
                                        <a href="<?php echo base_url() . 'forbidden/' . ($page - 1); ?>" aria-label="Previous">
                                            <span aria-hidden="true" title="Previous Page">&laquo;</span>
                                        </a>
                                    </li>
                                    <?php
                                }
                                for ($i = 0; $total_page > $i; $i++) {
                                    echo '<li><a href="' . base_url() . 'forbidden/' . ($i + 1) . '">' . ($i + 1) . '</a></li>';
                                }
                                if ($total_page != $page) {
                                    ?>                              
                                    <li>
                                        <a href="<?php echo base_url() . 'forbidden/' . ($page + 1); ?>" aria-label="Next">
                                            <span aria-hidden="true" title="Next Page">&raquo;</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="<?php echo base_url() . 'forbidden/' . $total_page; ?>" aria-label="Next">
                                            <span aria-hidden="true" title="Last Page">&raquo;&raquo;</span>
                                        </a>
                                    </li>
                                <?php }
                                ?>
                            </ul>
                        </nav>
                        <?php
                    }
                    ?>
                </div>
            </div>
        </div>
    </div>
</div>


<div class="col-sm-10 form-group ">
    <div class="col-sm-12 gray">
        <label>&nbsp;&nbsp;<a href="<?php echo base_url() ?>">Dashboard </a>->> Forbidden</label>
    </div>
</div>

<style>
    @media only screen and (max-width: 768px) {
    .search_forbidden {
        margin-top: 5px;
    }
    .search_type_forbidden {
        margin-top: 10px;
    }
}
</style>

<!--add forbidden form script start-->


<script type="text/javascript" src="<?php echo base_url() ?>back_end_resource/forbidden/forbidden.js"></script>

