

<?php $__env->startSection('styles'); ?>
<style>
    .mr-table .table thead th { border-top: none; border-bottom: 2px solid #f1f2f7; font-size: 13px; font-weight: 700; text-transform: uppercase; color: #555; }
    .mr-table .table tbody td { vertical-align: middle; border-top: 1px solid #f1f2f7; font-size: 14px; padding: 15px; }
    .user-info-box { display: flex; align-items: center; gap: 10px; }
    .user-avatar { width: 40px; height: 40px; border-radius: 50%; background: #e0e7ff; color: #4338ca; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 16px; }
    .badge-status { padding: 6px 12px; border-radius: 30px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
    .badge-active { background: #d1fae5; color: #065f46; }
    .badge-pending { background: #fef3c7; color: #92400e; }
    .badge-suspended { background: #fee2e2; color: #991b1b; }
    .action-dropdown .dropdown-toggle::after { display: none; }
    .action-icon { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; transition: 0.2s; }
    .action-icon:hover { background: #f3f4f6; }
</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="content-area">
    <div class="mr-breadcrumb">
        <div class="row">
            <div class="col-lg-12">
                <h4 class="heading"><i class="fas fa-server"></i> <?php echo e(__('Hosting Management')); ?></h4>
                <ul class="links">
                    <li><a href="<?php echo e(route('admin.dashboard')); ?>"><?php echo e(__('Dashboard')); ?></a></li>
                    <li><?php echo e(__('Manage Hosting')); ?></li>
                    <li><?php echo e(__('Active Services')); ?></li>
                </ul>
            </div>
        </div>
    </div>

    <div class="product-area">
        <div class="row">
            <div class="col-lg-12">
                <div class="mr-table allproduct">
                    
                    
                    <?php if(session('success')): ?>
                        <div class="alert alert-success alert-dismissible fade show shadow-sm border-0 mb-4" role="alert">
                            <i class="fas fa-check-circle mr-2"></i> <?php echo e(session('success')); ?>

                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                    <?php endif; ?>

                    <div class="card shadow-sm border-0 rounded-lg">
                        <div class="card-header bg-white py-3 d-flex justify-content-between align-items-center">
                            <h5 class="m-0 font-weight-bold text-dark"><?php echo e(__('All Hosting Accounts')); ?></h5>
                            <span class="badge badge-primary px-3 py-2 rounded-pill"><?php echo e(count($hostings)); ?> Services</span>
                        </div>
                        <div class="card-body p-0">
                            <div class="table-responsive">
                                <table id="geniustable" class="table table-hover dt-responsive" cellspacing="0" width="100%">
                                    <thead class="bg-light">
                                        <tr>
                                            <th width="20%"><?php echo e(__('Customer Info')); ?></th>
                                            <th width="25%"><?php echo e(__('Domain & Package')); ?></th>
                                            <th width="15%"><?php echo e(__('Server')); ?></th>
                                            <th width="15%"><?php echo e(__('Pricing')); ?></th>
                                            <th width="10%"><?php echo e(__('Status')); ?></th>
                                            <th width="15%" class="text-right"><?php echo e(__('Options')); ?></th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $__currentLoopData = $hostings; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $hosting): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td>
                                                <div class="user-info-box">
                                                    <div class="user-avatar">
                                                        <?php echo e(strtoupper(substr($hosting->user->name ?? 'U', 0, 1))); ?>

                                                    </div>
                                                    <div>
                                                        <div class="font-weight-bold text-dark"><?php echo e($hosting->user->name ?? 'Guest'); ?></div>
                                                        <small class="text-muted"><?php echo e($hosting->user->phone ?? 'No Phone'); ?></small>
                                                    </div>
                                                </div>
                                            </td>
                                            <td>
                                                <a href="http://<?php echo e($hosting->domain); ?>" target="_blank" class="font-weight-bold text-primary text-decoration-none">
                                                    <?php echo e($hosting->domain); ?> <i class="fas fa-external-link-alt small ml-1"></i>
                                                </a>
                                                <div class="small text-muted mt-1">
                                                    <i class="fas fa-box-open mr-1"></i> <?php echo e($hosting->plan->name ?? 'Custom Plan'); ?>

                                                </div>
                                            </td>
                                            <td>
                                                <?php if($hosting->server): ?>
                                                    <span class="badge badge-light border"><i class="fas fa-hdd mr-1"></i> <?php echo e($hosting->server->name); ?></span>
                                                <?php else: ?>
                                                    <span class="text-muted small">--</span>
                                                <?php endif; ?>
                                            </td>
                                            <td>
                                                <div class="font-weight-bold text-dark">৳ <?php echo e(number_format($hosting->amount, 2)); ?></div>
                                                <small class="text-secondary"><?php echo e($hosting->billing_cycle); ?></small>
                                                <?php if($hosting->next_due_date): ?>
                                                    <div class="text-danger small mt-1" style="font-size: 10px;">Due: <?php echo e(\Carbon\Carbon::parse($hosting->next_due_date)->format('d M, Y')); ?></div>
                                                <?php endif; ?>
                                            </td>
                                            <td>
                                                <?php if($hosting->status == 'Active'): ?>
                                                    <span class="badge-status badge-active">Active</span>
                                                <?php elseif($hosting->status == 'Suspended'): ?>
                                                    <span class="badge-status badge-suspended">Suspended</span>
                                                <?php else: ?>
                                                    <span class="badge-status badge-pending"><?php echo e($hosting->status); ?></span>
                                                <?php endif; ?>
                                            </td>
                                            <td class="text-right">
                                                <div class="dropdown action-dropdown">
                                                    <button class="btn btn-light btn-sm dropdown-toggle shadow-sm border" type="button" data-toggle="dropdown">
                                                        Manage <i class="fas fa-chevron-down ml-1"></i>
                                                    </button>
                                                    <div class="dropdown-menu dropdown-menu-right border-0 shadow-lg">
                                                        <h6 class="dropdown-header">Service Actions</h6>
                                                        
                                                        
                                                        <a class="dropdown-item" href="#">
                                                            <i class="fas fa-sign-in-alt text-info mr-2"></i> Login to cPanel
                                                        </a>

                                                        <div class="dropdown-divider"></div>
                                                        
                                                        
                                                        <a class="dropdown-item" href="javascript:;" data-toggle="modal" data-target="#statusModal<?php echo e($hosting->id); ?>">
                                                            <i class="fas fa-exchange-alt text-warning mr-2"></i> Change Status
                                                        </a>

                                                        
                                                        <a class="dropdown-item text-danger" href="javascript:;" data-toggle="modal" data-target="#deleteModal<?php echo e($hosting->id); ?>">
                                                            <i class="fas fa-trash-alt mr-2"></i> Terminate
                                                        </a>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>

                                        
                                        <div class="modal fade" id="statusModal<?php echo e($hosting->id); ?>" tabindex="-1" role="dialog" aria-hidden="true">
                                            <div class="modal-dialog modal-dialog-centered" role="document">
                                                <div class="modal-content">
                                                    <div class="modal-header">
                                                        <h5 class="modal-title font-weight-bold"><?php echo e(__('Update Service Status')); ?></h5>
                                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                            <span aria-hidden="true">&times;</span>
                                                        </button>
                                                    </div>
                                                    
                                                    
                                                    <form action="<?php echo e(route('admin.user.hosting.status', $hosting->id)); ?>" method="POST">
                                                        <?php echo csrf_field(); ?>
                                                        <div class="modal-body">
                                                            <div class="form-group">
                                                                <label class="font-weight-bold">Select Status:</label>
                                                                <select name="status" class="form-control">
                                                                    <option value="Active" <?php echo e($hosting->status == 'Active' ? 'selected' : ''); ?>>Active</option>
                                                                    <option value="Pending" <?php echo e($hosting->status == 'Pending' ? 'selected' : ''); ?>>Pending</option>
                                                                    <option value="Suspended" <?php echo e($hosting->status == 'Suspended' ? 'selected' : ''); ?>>Suspended</option>
                                                                    <option value="Terminated" <?php echo e($hosting->status == 'Terminated' ? 'selected' : ''); ?>>Terminated</option>
                                                                </select>
                                                            </div>
                                                            <div class="alert alert-info small mb-0">
                                                                <i class="fas fa-info-circle"></i> Changing status to <strong>Active</strong> will enable the service for the user.
                                                            </div>
                                                        </div>
                                                        <div class="modal-footer">
                                                            <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo e(__('Close')); ?></button>
                                                            <button type="submit" class="btn btn-primary"><?php echo e(__('Save Changes')); ?></button>
                                                        </div>
                                                    </form>
                                                </div>
                                            </div>
                                        </div>

                                        
                                        <div class="modal fade" id="deleteModal<?php echo e($hosting->id); ?>" tabindex="-1" role="dialog" aria-hidden="true">
                                            <div class="modal-dialog modal-dialog-centered" role="document">
                                                <div class="modal-content">
                                                    <div class="modal-header bg-danger text-white">
                                                        <h5 class="modal-title font-weight-bold"><?php echo e(__('Confirm Termination')); ?></h5>
                                                        <button type="button" class="close text-white" data-dismiss="modal" aria-label="Close">
                                                            <span aria-hidden="true">&times;</span>
                                                        </button>
                                                    </div>
                                                    <div class="modal-body text-center p-4">
                                                        <i class="fas fa-exclamation-triangle fa-3x text-warning mb-3"></i>
                                                        <p class="font-weight-bold mb-1">Are you sure you want to terminate this hosting?</p>
                                                        <p class="text-muted small">Domain: <?php echo e($hosting->domain); ?></p>
                                                        <p class="text-danger small">This action cannot be undone.</p>
                                                    </div>
                                                    <div class="modal-footer justify-content-center">
                                                        <button type="button" class="btn btn-light border" data-dismiss="modal"><?php echo e(__('Cancel')); ?></button>
                                                        
                                                        
                                                        <a href="<?php echo e(route('admin.user.domains.delete', $hosting->id)); ?>" class="btn btn-danger"><?php echo e(__('Yes, Terminate')); ?></a>
                                                        
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\project\resources\views/admin/hosting/user_hostings.blade.php ENDPATH**/ ?>