<?= $this->extend('backend/layout/main'); ?>
<?= $this->section('css'); ?>
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>assets/backend/vendor/datatables/css/dataTables.bootstrap4.css">
<link rel="stylesheet" type="text/css" href="<?= base_url() ?>assets/backend/vendor/datatables/css/buttons.bootstrap4.css">
<?= $this->endSection(); ?>
<?= $this->section('title'); ?>User Profile<?= $this->endSection(); ?>
<?= $this->section('content'); ?>
<div class="dashboard-influence">
    <div class="container-fluid dashboard-content">
        <!-- ============================================================== -->
        <!-- pageheader  -->
        <!-- ============================================================== -->
        <div class="row">
            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                <div class="page-header">
                    <h3 class="mb-2">User Profile </h3>
                    <div class="page-breadcrumb">
                        <nav aria-label="breadcrumb">
                            <ol class="breadcrumb">
                                <li class="breadcrumb-item"><a href="<?= url_to('admin_home') ?>" class="breadcrumb-link">Dashboard</a></li>
                                <li class="breadcrumb-item"><a href="<?= url_to('users') ?>" class="breadcrumb-link">Users</a></li>
                                <li class="breadcrumb-item active" aria-current="page">User Profile</li>
                            </ol>
                        </nav>
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                <?= view_cell('AlertCell') ?>
                <div class="card influencer-profile-data">
                    <div class="card-body">
                        <div class="row">
                            <div class="col-xl-2 col-lg-4 col-md-4 col-sm-4 col-12">
                                <div class="text-center">
                                    <img src="<?= base_url() ?>assets/backend/images/profile.png" alt="User Avatar" class="rounded-circle user-avatar-xxl">
                                </div>
                            </div>
                            <div class="col-xl-10 col-lg-8 col-md-8 col-sm-8 col-12">
                                <div class="user-avatar-info">
                                    <div class="m-b-20">
                                        <div class="user-avatar-name">
                                            <h2 class="mb-1"><?= join(' ', [$user->first_name, $user->last_name]) ?> </h2>
                                        </div>
                                        <div class="rating-star  d-inline-block">

                                        </div>
                                    </div>
                                    <div class="user-avatar-address">
                                        <p class="border-bottom pb-3">
                                            <span class="d-xl-inline-block d-block mb-2"><i class="fa fa-envelope mr-2 text-primary "></i><?= $user->email ?></span>
                                            <span class="mb-2 ml-xl-4 d-xl-inline-block d-block">Joined date: <?= date('d M Y', strtotime($user->created_at)) ?> </span>
                                            <span class=" mb-2 d-xl-inline-block d-block ml-xl-4">Status: <?= $user->status ?>
                                            </span>
                                            <span class=" mb-2 d-xl-inline-block d-block ml-xl-4">Role: <?= $user->role ?> </span>
                                        </p>

                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer  p-0 text-center d-flex justify-content-center">
                        <?php if (get_user()->role == 'Admin'): ?>
                            <div class="card-footer-item card-footer-item-bordered">
                                <a href="<?= url_to('edit_profile', $user->id) ?>" class="card-link">Edit Profile</a>
                            </div>
                            <div class="card-footer-item card-footer-item-bordered">
                                <?php if ($user->status == 'Active'): ?>
                                    <a data-toggle="modal" data-target="#block-user" href="#" class="card-link">Block Profile</a>
                                    <!-- Modal -->
                                    <div class="modal fade" id="block-user" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                                        <div class="modal-dialog" role="document">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <h5 class="modal-title" id="exampleModalLabel">Deactivate User Profile</h5>
                                                    <a href="#" class="close" data-dismiss="modal" aria-label="Close">
                                                        <span aria-hidden="true">&times;</span>
                                                    </a>
                                                </div>
                                                <div class="modal-body text-left">
                                                    Deactivate user <?= join(' ', [$user->first_name, $user->last_name]) ?> ?
                                                </div>
                                                <div class="modal-footer">
                                                    <a href="<?= url_to('deactivate_profile', $user->id) ?>" class="btn btn-secondary">Yes Block</a>
                                                    <a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <?php else: ?>
                                    <a data-toggle="modal" data-target="#activate-user" href="<?= url_to('activate_profile', $user->id) ?>" class="card-link">Activate Profile</a>
                                    <!-- Modal -->
                                    <div class="modal fade" id="activate-user" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                                        <div class="modal-dialog" role="document">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <h5 class="modal-title" id="exampleModalLabel">Activate User Profile</h5>
                                                    <a href="#" class="close" data-dismiss="modal" aria-label="Close">
                                                        <span aria-hidden="true">&times;</span>
                                                    </a>
                                                </div>
                                                <div class="modal-body text-left">
                                                    Activate user <?= join(' ', [$user->first_name, $user->last_name]) ?> ?
                                                </div>
                                                <div class="modal-footer">
                                                    <a href="<?= url_to('activate_profile', $user->id) ?>" class="btn btn-secondary">Yes Activate</a>
                                                    <a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                <?php endif; ?>
                            </div>

                            <div class="card-footer-item card-footer-item-bordered">
                                <a href="#" data-toggle="modal" data-target="#delete-user" class="card-link">Delete</a>
                                <!-- Modal -->
                                <div class="modal fade" id="delete-user" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                                    <div class="modal-dialog" role="document">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <h5 class="modal-title" id="exampleModalLabel">Delete User Profile</h5>
                                                <a href="#" class="close" data-dismiss="modal" aria-label="Close">
                                                    <span aria-hidden="true">&times;</span>
                                                </a>
                                            </div>
                                            <div class="modal-body text-left">
                                                Delete user <?= join(' ', [$user->first_name, $user->last_name]) ?> permanently?
                                            </div>
                                            <div class="modal-footer">
                                                <a href="<?= url_to('delete_profile', $user->id) ?>" class="btn btn-secondary">Yes Delete</a>
                                                <a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>


    </div>
</div>
<?= $this->endSection(); ?>