<?php
$person_id = $this->session->userdata('person_id');
$person_role = $this->session->userdata('person_role');
$role_name = $this->session->userdata('role_name');
?>
<span>&nbsp;&nbsp;</span>
<?php
if ($person_info->person_status == 2 && $person_role == 6) {
    ?>
    <a href="javascript:void(0)" onclick="checkForAction('<?php echo base_url() . 'make-user-active/' . $person_info->person_id; ?>', 'Active', '<?php echo $person_info->person_id; ?>')"><i class="fa fa-archive" title="Archive"></i></a>
    <a href="javascript:void(0)"><i onclick="checkForDelete('<?php echo base_url() . 'delete-user/' . $person_info->url; ?>', 'Delete', '<?php echo $person_info->person_id; ?>')" class="fa fa-trash-o" title="Delete"></i></a>
    <?php
} else if ($person_info->person_status == 2 && $person_role == 1) {
    ?>
    <a href="javascript:void(0)" onclick="checkForAction('<?php echo base_url() . 'make-user-active/' . $person_info->person_id; ?>', 'Active', '<?php echo $person_info->person_id; ?>')"><i class="fa fa-archive" title="Archive"></i></a>
    <?php
} else {
    switch ($person_role) {
        case 6:
            if ($person_info->person_id == $person_id) {
                ?>
                <a href="<?php echo base_url(); ?>super-admin/edit-user-information/<?php echo $person_info->url; ?>"><i title="Edit" class="fa fa-edit"></i></a>
                <a href="<?php echo base_url(); ?>super-admin/view-detail/<?php echo $person_info->url; ?>"><i title="View Details" class="fa fa-th"></i></a>
                <?php
            } else {
                if ($person_info->person_status != 1) {
                    ?>
                    <a href="javascript:void(0)" onclick="checkForAction('<?php echo base_url() . 'make-user-active/' . $person_info->person_id; ?>', 'Active', '<?php echo $person_info->person_id; ?>')"><i title="Active" class="fa fa-user-plus"></i></a>
                <?php } else {
                    ?>
                    <a href="javascript:void(0)" onclick="checkForAction('<?php echo base_url() . 'make-user-inactive/' . $person_info->person_id; ?>', 'Inactive', '<?php echo $person_info->person_id; ?>')"><i title="Inactive" class="fa fa-user-times"></i></a>
                    <?php
                }
                if ($person_info->person_role != 6 && $person_info->person_role != 4) {
                    ?>
                    <a href="javascript:void(0)" class="" 
                       data-toggle="modal" 
                       data-target="#changeRole1<?php echo $person_info->person_id ?>">
                        <i title="Change Role" class="fa fa-street-view"></i>
                    </a>
                <?php } ?>
                <a href="<?php echo base_url(); ?>super-admin/edit-user-information/<?php echo $person_info->url; ?>"><i title="Edit" class="fa fa-edit"></i></a>
                <a href="javascript:void(0)"><i onclick="checkForAction('<?php echo base_url() . 'make-user-archive/' . $person_info->person_id; ?>', 'Archive', '<?php echo $person_info->person_id; ?>')" class="fa fa-archive" title="Archive"></i></a>
                <a href="javascript:void(0)"><i onclick="checkForDelete('<?php echo base_url() . 'delete-user/' . $person_info->url; ?>', 'Delete', '<?php echo $person_info->person_id; ?>')" class="fa fa-trash-o" title="Delete"></i></a>
                <?php
                if (in_array($person_info->person_role, [3, 4])) {
                    ?>
                    <a href="<?php echo base_url(); ?>admin/view-payment-method/<?php echo $person_info->url; ?>"><i title="Pyment Details" class="fa fa-money"></i></a>
                <?php } ?>
                <a href="<?php echo base_url(); ?>super-admin/view-detail/<?php echo $person_info->url; ?>"><i title="View Details" class="fa fa-th"></i></a>
                <?php
            }
            break;
        case 1:
            if ($person_info->person_id == $person_id) {
                ?>
                <a href="<?php echo base_url(); ?>super-admin/edit-user-information/<?php echo $person_info->url; ?>"><i title="Edit" class="fa fa-edit"></i></a>
                <a href="<?php echo base_url(); ?>super-admin/view-detail/<?php echo $person_info->url; ?>"><i title="View Details" class="fa fa-th"></i></a>
                <?php
            } else {
                if ($person_info->person_role == 6) {
                    ?>
                    <a href="<?php echo base_url(); ?>super-admin/view-detail/<?php echo $person_info->url; ?>"><i title="View Details" class="fa fa-th"></i></a>
                    <?php
                } else {
                    if ($person_info->person_status != 1) {
                        ?>
                        <a href="javascript:void(0)" onclick="checkForAction('<?php echo base_url() . 'make-user-active/' . $person_info->person_id; ?>', 'Active', '<?php echo $person_info->person_id; ?>')"><i title="Active" class="fa fa-user-plus"></i></a>
                    <?php } else {
                        ?>
                        <a href="javascript:void(0)" onclick="checkForAction('<?php echo base_url() . 'make-user-inactive/' . $person_info->person_id; ?>', 'Inactive', '<?php echo $person_info->person_id; ?>')"><i title="Inactive" class="fa fa-user-times"></i></a>
                        <?php
                    }
                    if ($person_info->person_role != 6 && $person_info->person_role != 1 && $person_info->person_role != 4) {
                        ?>
                        <a href="javascript:void(0)" class="" data-toggle="modal" 
                           data-target="#changeRole1<?php echo $person_info->person_id ?>">
                            <i title="Change Role" class="fa fa-street-view"></i>
                        </a>
                    <?php } ?>
                    <a href="<?php echo base_url(); ?>super-admin/edit-user-information/<?php echo $person_info->url; ?>"><i title="Edit" class="fa fa-edit"></i></a>
                    <a href="javascript:void(0)"><i onclick="checkForAction('<?php echo base_url() . 'make-user-archive/' . $person_info->person_id; ?>', 'Archive', '<?php echo $person_info->person_id; ?>')" class="fa fa-archive" title="Archive"></i></a>
                    <?php
                    if (in_array($person_info->person_role, [3, 4])) {
                        ?>
                        <a href="<?php echo base_url(); ?>admin/view-payment-method/<?php echo $person_info->url; ?>"><i title="Pyment Details" class="fa fa-money"></i></a>
                    <?php } ?>
                    <a href="<?php echo base_url(); ?>super-admin/view-detail/<?php echo $person_info->url; ?>"><i title="View Details" class="fa fa-th"></i></a>
                    <?php
                }
            }
            break;
    }
}