<?php echo csrf_field(); ?>
<div class="row g-3">
    <div class="col-md-4">
        <label class="form-label">First Name</label>
        <input type="text" name="first_name" value="<?php echo e(old('first_name', $user->first_name)); ?>" class="form-control" required>
    </div>
    <div class="col-md-4">
        <label class="form-label">Middle Name</label>
        <input type="text" name="middle_name" value="<?php echo e(old('middle_name', $user->middle_name)); ?>" class="form-control">
    </div>
    <div class="col-md-4">
        <label class="form-label">Last Name</label>
        <input type="text" name="last_name" value="<?php echo e(old('last_name', $user->last_name)); ?>" class="form-control" required>
    </div>
    <div class="col-md-4">
        <label class="form-label">Email</label>
        <input type="email" name="email" value="<?php echo e(old('email', $user->email)); ?>" class="form-control" required>
    </div>
    <div class="col-md-4">
        <label class="form-label">Phone</label>
        <div class="input-icon">
            <i data-lucide="phone"></i>
            <input type="text" name="phone" value="<?php echo e(old('phone', $user->phone)); ?>" class="form-control" data-phone-input placeholder="+255 700 000 000">
        </div>
    </div>
    <div class="col-md-4">
        <label class="form-label">Username</label>
        <input type="text" name="username" value="<?php echo e(old('username', $user->username)); ?>" class="form-control">
    </div>
    <div class="col-md-4">
        <label class="form-label">Password</label>
        <input type="password" name="password" class="form-control" <?php echo e($user->exists ? '' : 'required'); ?>>
    </div>
    <div class="col-md-4">
        <label class="form-label">Role</label>
        <select name="role_id" class="form-select">
            <option value="">No 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 if((string) old('role_id', $user->role_id) === (string) $role->id): echo 'selected'; endif; ?>><?php echo e($role->name); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
    </div>
    <div class="col-md-4">
        <label class="form-label">User Position</label>
        <select name="user_position_id" class="form-select">
            <option value="">No position</option>
            <?php $__currentLoopData = $positions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $position): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option value="<?php echo e($position->id); ?>" <?php if((string) old('user_position_id', $user->user_position_id) === (string) $position->id): echo 'selected'; endif; ?>><?php echo e($position->name); ?></option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </select>
    </div>
    <div class="col-md-4">
        <label class="form-label">Status</label>
        <select name="status" class="form-select" required>
            <option value="active" <?php if(old('status', $user->status ?: 'active') === 'active'): echo 'selected'; endif; ?>>Active</option>
            <option value="inactive" <?php if(old('status', $user->status) === 'inactive'): echo 'selected'; endif; ?>>Inactive</option>
        </select>
    </div>
</div>
<div class="<?php echo e(($modal ?? false) ? 'modal-footer px-0 pb-0' : 'mt-4 d-flex gap-2'); ?>">
    <?php if($modal ?? false): ?>
        <button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal"><i data-lucide="x"></i><span>Cancel</span></button>
    <?php else: ?>
        <a href="<?php echo e(route('users.index')); ?>" class="btn btn-outline-secondary"><i data-lucide="x"></i><span>Cancel</span></a>
    <?php endif; ?>
    <button class="btn btn-primary"><i data-lucide="save"></i><span>Save User</span></button>
</div>
<?php /**PATH /var/www/html/anglican/resources/views/system-users/_form.blade.php ENDPATH**/ ?>