<?php $__env->startSection('title'); ?>
<?php echo $variables['header_routes']; ?>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-header">
                        <h3 class="card-title"><?php echo $variables['judul']; ?></h3>
                        <div class="float-right">
                            <a href="<?php echo e(route('users.index')); ?>" class="btn btn-warning btn-sm button-cek-permission" data-permission="users.index">
                                <i class="fas fa-list"></i> Daftar
                            </a>
                            <a href="<?php echo e(route('users.edit',$data->id)); ?>" class="btn btn-warning btn-sm button-cek-permission" data-permission="users.edit">
                                <i class="fas fa-edit"></i> Ubah
                            </a>
                            <?php if($data->id == $logged_user_id): ?>
                            <a href="<?php echo e(route('users.edit-my-account',$data->id)); ?>" class="btn btn-warning btn-sm button-cek-permission" data-permission="users.edit">
                                <i class="fas fa-user-edit"></i> Ubah Akun Saya
                            </a>
                            <a href="<?php echo e(route('users.change-password', $data->id)); ?>" class="btn btn-warning btn-sm button-cek-permission" data-permission="users.edit">
                                <i class="fas fa-key"></i> Ubah Password
                            </a>
                            <?php else: ?>
                            <a href="<?php echo e(route('users.reset-password', $data->id)); ?>" class="btn btn-warning btn-sm button-cek-permission" data-permission="users.edit">
                                <i class="fas fa-redo"></i> Reset Password
                            </a>
                            <a href="<?php echo e(route('users.destroy',$data->id)); ?>" onclick="notificationBeforeDelete(event, this)" class="btn btn-warning btn-sm button-cek-permission" data-permission="users.destroy">
                                <i class="fas fa-trash"></i> Hapus
                            </a>
                            <?php endif; ?>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <!-- Single Card with All Information -->
                            <div class="col-12">
                                <div class="card card-outline card-info">
                                    <div class="card-body">
                                        <div class="row">
                                            <!-- Role -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Role</label>
                                                    <div class="mt-1">
                                                        <?php if($data->roles && $data->roles->count() > 0): ?>
                                                            <?php $__currentLoopData = $data->roles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                <span class="badge badge-info mr-1"><?php echo e($role->name); ?></span>
                                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                        <?php else: ?>
                                                            <span class="badge badge-secondary">Tidak Ada Role</span>
                                                        <?php endif; ?>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            <!-- Username -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Username</label>
                                                    <div class="mt-1">
                                                        <span class="badge badge-info"><?php echo e($data->username); ?></span>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            <!-- Fullname -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Nama Lengkap</label>
                                                    <div class="mt-1"><?php echo e($data->fullname); ?></div>
                                                </div>
                                            </div> 
                                            
                                            <!-- Email -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Email</label>
                                                    <div class="mt-1">
                                                        <?php if($data->email): ?>
                                                            <a href="mailto:<?php echo e($data->email); ?>" class="text-decoration-none">
                                                                <?php echo e($data->email); ?>

                                                            </a>
                                                        <?php else: ?>
                                                            -
                                                        <?php endif; ?>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            <!-- Telephone -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Telepon</label>
                                                    <div class="mt-1">
                                                        <?php if($data->telephone): ?>
                                                            <a href="tel:<?php echo e($data->telephone); ?>" class="text-decoration-none">
                                                                <?php echo e($data->telephone); ?>

                                                            </a>
                                                        <?php else: ?>
                                                            -
                                                        <?php endif; ?>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            <!-- Backdate SO Flag -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Backdate SO</label>
                                                    <div class="mt-1">
                                                        <?php if($data->flag_backdate_so): ?>
                                                            <span class="badge badge-success">
                                                                <i class="fas fa-check-circle"></i> Diizinkan
                                                            </span>
                                                        <?php else: ?>
                                                            <span class="badge badge-secondary">
                                                                <i class="fas fa-times-circle"></i> Tidak Diizinkan
                                                            </span>
                                                        <?php endif; ?>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            <!-- Created By -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Dibuat Oleh</label>
                                                    <div class="mt-1">
                                                        <small class="text-muted">
                                                            <?php echo e($data->creator->fullname ?? 'System'); ?><br>
                                                            <?php echo e($data->created_at->format('d M Y, H:i')); ?>

                                                        </small>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            <!-- Updated By -->
                                            <?php if($data->modificator): ?>
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Diubah Oleh</label>
                                                    <div class="mt-1">
                                                        <small class="text-muted">
                                                            <?php echo e($data->modificator->fullname); ?><br>
                                                            <?php echo e($data->updated_at->format('d M Y, H:i')); ?>

                                                        </small>
                                                    </div>
                                                </div>
                                            </div>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <!-- User Access Stores -->
                        <?php if(isset($variables['stores']) && count($variables['stores']) > 0): ?>
                        <div class="row">
                            <div class="col-12">
                                <div class="card card-outline card-info">
                                    <div class="card-header">
                                        <h5 class="mb-0">Akses Toko User (<?php echo e(count($variables['stores'])); ?> toko)</h5>
                                        <div class="ml-auto card-tools">
                                            <button type="button" class="btn btn-tool" data-card-widget="collapse" title="Collapse">
                                                <i class="fas fa-minus"></i>
                                            </button>
                                        </div>
                                    </div>
                                    <div class="card-body">
                                        <div class="table-responsive">
                                            <table class="table table-hover table-sm">
                                                <thead class="bg-light">
                                                    <tr>
                                                        <th width="5%">No</th>
                                                        <th width="15%">Kode Toko</th>
                                                        <th width="40%">Nama Toko</th>
                                                        <th width="20%">PIC</th>
                                                        <th width="20%">Status</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <?php $__currentLoopData = $variables['stores']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $store): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <tr>
                                                        <td><?php echo e($key + 1); ?></td>
                                                        <td>
                                                            <span class="badge badge-info"><?php echo e($store->code); ?></span>
                                                        </td>
                                                        <td>
                                                            <a href="<?php echo e(route('stores.show', $store->id)); ?>" class="text-decoration-none">
                                                                <?php echo e($store->name); ?>

                                                            </a>
                                                        </td>
                                                        <td><?php echo e($store->pic ?: '-'); ?></td>
                                                        <td>
                                                            <?php if($store->status == 'Active'): ?>
                                                                <span class="badge badge-success"><?php echo e($store->status); ?></span>
                                                            <?php else: ?>
                                                                <span class="badge badge-secondary"><?php echo e($store->status); ?></span>
                                                            <?php endif; ?>
                                                        </td>
                                                    </tr>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

<form action="" id="delete-form" method="post">
    <?php echo method_field('delete'); ?>
    <?php echo csrf_field(); ?>
</form>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts/base_view', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\LSM\resources\views/users/show.blade.php ENDPATH**/ ?>