

<?php $__env->startSection('title', isset($user) ? 'Edit User' : 'Add User'); ?>

<?php $__env->startSection('breadcrumb'); ?>
    <a href="<?php echo e(route('admin.users.index')); ?>">Users</a>
    <span class="separator">/</span>
    <span class="current"><?php echo e(isset($user) ? 'Edit' : 'Add'); ?></span>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>

<div class="page-header">
    <h1 class="page-title">
        <span class="title-icon">
            <i data-lucide="<?php echo e(isset($user) ? 'user-cog' : 'user-plus'); ?>" style="width:20px;height:20px;"></i>
        </span>
        <?php echo e(isset($user) ? 'Edit User' : 'Add New User'); ?>

    </h1>
    <p class="page-subtitle"><?php echo e(isset($user) ? 'Update user information and permissions' : 'Create a new system user'); ?></p>
</div>

<div style="max-width:640px;">
    <div class="glass-card" style="padding:24px;">

        <?php if($errors->any()): ?>
            <div class="alert alert-error">
                <i data-lucide="alert-circle" class="alert-icon" style="width:15px;height:15px;"></i>
                <div>
                    <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div><?php echo e($error); ?></div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        <?php endif; ?>

        <form method="POST"
              action="<?php echo e(isset($user) ? route('admin.users.update', $user) : route('admin.users.store')); ?>">
            <?php echo csrf_field(); ?>
            <?php if(isset($user)): ?> <?php echo method_field('PUT'); ?> <?php endif; ?>

            <div style="display:grid;grid-template-columns:1fr 1fr;gap:16px;">

                <div class="form-group" style="grid-column:1/-1;">
                    <label class="form-label" for="name">Full Name</label>
                    <input type="text" id="name" name="name"
                           value="<?php echo e(old('name', $user->name ?? '')); ?>"
                           class="form-control <?php echo e($errors->has('name') ? 'border-red-500' : ''); ?>"
                           placeholder="John Doe" required>
                </div>

                <div class="form-group">
                    <label class="form-label" for="email">Email Address</label>
                    <input type="email" id="email" name="email"
                           value="<?php echo e(old('email', $user->email ?? '')); ?>"
                           class="form-control <?php echo e($errors->has('email') ? 'border-red-500' : ''); ?>"
                           placeholder="user@example.com" required>
                </div>

                <div class="form-group">
                    <label class="form-label" for="role_id">Role</label>
                    <select id="role_id" name="role_id" class="form-control">
                        <option value="">Select Role</option>
                        <?php $__currentLoopData = $roles ?? []; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $role): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($role->id); ?>"
                                <?php echo e(old('role_id', $user->role_id ?? '') == $role->id ? 'selected' : ''); ?>>
                                <?php echo e($role->name); ?>

                            </option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

                <div class="form-group">
                    <label class="form-label" for="password">
                        Password <?php echo e(isset($user) ? '(leave blank to keep current)' : ''); ?>

                    </label>
                    <input type="password" id="password" name="password"
                           class="form-control <?php echo e($errors->has('password') ? 'border-red-500' : ''); ?>"
                           placeholder="<?php echo e(isset($user) ? 'New password...' : '••••••••'); ?>"
                           <?php echo e(isset($user) ? '' : 'required'); ?>>
                </div>

                <div class="form-group">
                    <label class="form-label" for="password_confirmation">Confirm Password</label>
                    <input type="password" id="password_confirmation" name="password_confirmation"
                           class="form-control"
                           placeholder="Repeat password"
                           <?php echo e(isset($user) ? '' : 'required'); ?>>
                </div>

                <?php if(isset($user)): ?>
                    <div class="form-group" style="grid-column:1/-1;">
                        <label class="form-label">Status</label>
                        <div style="display:flex;gap:16px;align-items:center;">
                            <label style="display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;color:var(--vsc-text-primary);">
                                <input type="radio" name="is_active" value="1"
                                       <?php echo e(old('is_active', $user->is_active ?? 1) == 1 ? 'checked' : ''); ?>

                                       style="accent-color:var(--vsc-blue);">
                                <span class="badge badge-green">Active</span>
                            </label>
                            <label style="display:flex;align-items:center;gap:8px;cursor:pointer;font-size:13px;color:var(--vsc-text-primary);">
                                <input type="radio" name="is_active" value="0"
                                       <?php echo e(old('is_active', $user->is_active ?? 1) == 0 ? 'checked' : ''); ?>

                                       style="accent-color:var(--vsc-blue);">
                                <span class="badge badge-gray">Inactive</span>
                            </label>
                        </div>
                    </div>
                <?php endif; ?>

            </div>

            <div class="divider"></div>

            <div style="display:flex;gap:10px;justify-content:flex-end;">
                <a href="<?php echo e(route('admin.users.index')); ?>" class="btn btn-secondary">
                    <i data-lucide="x" style="width:13px;height:13px;"></i>
                    Cancel
                </a>
                <button type="submit" class="btn btn-primary">
                    <i data-lucide="<?php echo e(isset($user) ? 'save' : 'user-plus'); ?>" style="width:13px;height:13px;"></i>
                    <?php echo e(isset($user) ? 'Save Changes' : 'Create User'); ?>

                </button>
            </div>

        </form>
    </div>
</div>

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

<?php echo $__env->make('admin.layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp_lite_8_4\www\landfeasibility\resources\views/admin/users/form.blade.php ENDPATH**/ ?>