<?php $__env->startSection('title', 'Create User Account'); ?>

<?php $__env->startSection('content'); ?>
<div class="max-w-4xl mx-auto space-y-6">

    <div class="flex items-center justify-between">
        <div>
            <h1 class="text-xl font-bold text-slate-900 dark:text-white">Create New ERP User Account</h1>
            <p class="text-xs text-slate-500 dark:text-slate-400">Configure login credentials, assign default role, branch access, and login permissions.</p>
        </div>
        <a href="<?php echo e(route('app.users.index')); ?>" class="px-4 py-2 bg-slate-200 dark:bg-slate-700 text-slate-700 dark:text-slate-200 font-semibold text-xs rounded-xl">Back to Users</a>
    </div>

    <form action="<?php echo e(route('app.users.store')); ?>" method="POST" class="space-y-6">
        <?php echo csrf_field(); ?>

        <div class="bg-white dark:bg-slate-800 rounded-3xl p-6 border border-slate-200 dark:border-slate-700/60 shadow-sm space-y-4">
            <h3 class="text-sm font-bold text-slate-900 dark:text-white uppercase tracking-wider">Account & Employee Link</h3>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs">

                <div class="md:col-span-2">
                    <label for="employee_id" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Link Existing Employee (Optional)</label>
                    <select name="employee_id" id="employee_id" class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                        <option value="">-- Direct User Account (No Linked Employee) --</option>
                        <?php $__currentLoopData = $employees; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $emp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($emp->id); ?>"><?php echo e($emp->full_name); ?> (<?php echo e($emp->employee_code); ?>) - <?php echo e($emp->designation); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

                <div>
                    <label for="name" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Full Name *</label>
                    <input type="text" name="name" id="name" required class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                </div>

                <div>
                    <label for="username" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Username *</label>
                    <input type="text" name="username" id="username" required class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                </div>

                <div>
                    <label for="email" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Email Address *</label>
                    <input type="email" name="email" id="email" required class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                </div>

                <div>
                    <label for="mobile" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Mobile Number</label>
                    <input type="text" name="mobile" id="mobile" placeholder="+971 50 123 4567" class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                </div>
            </div>
        </div>

        <div class="bg-white dark:bg-slate-800 rounded-3xl p-6 border border-slate-200 dark:border-slate-700/60 shadow-sm space-y-4">
            <h3 class="text-sm font-bold text-slate-900 dark:text-white uppercase tracking-wider">Role & Scope Assignments</h3>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs">
                <div>
                    <label for="role_id" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Role *</label>
                    <select name="role_id" id="role_id" required class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                        <?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($role->name); ?> (<?php echo e(strtoupper($role->data_scope)); ?>)</option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

                <div>
                    <label for="default_branch_id" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Default Branch *</label>
                    <select name="default_branch_id" id="default_branch_id" required class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                        <?php $__currentLoopData = $branches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $b): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($b->id); ?>"><?php echo e($b->name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

                <div>
                    <label for="department_id" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Department</label>
                    <select name="department_id" id="department_id" class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                        <option value="">-- Unassigned --</option>
                        <?php $__currentLoopData = $departments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $dept): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($dept->id); ?>"><?php echo e($dept->name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>

                <div>
                    <label for="counter_id" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Counter</label>
                    <select name="counter_id" id="counter_id" class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                        <option value="">-- Unassigned --</option>
                        <?php $__currentLoopData = $counters; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $counter): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($counter->id); ?>"><?php echo e($counter->name); ?></option>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
            </div>
        </div>

        <div class="bg-white dark:bg-slate-800 rounded-3xl p-6 border border-slate-200 dark:border-slate-700/60 shadow-sm space-y-4">
            <h3 class="text-sm font-bold text-slate-900 dark:text-white uppercase tracking-wider">Security & Passwords</h3>

            <div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-xs">
                <div>
                    <label for="password" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Password *</label>
                    <input type="password" name="password" id="password" required class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                </div>

                <div>
                    <label for="password_confirmation" class="block font-semibold text-slate-700 dark:text-slate-300 mb-1">Confirm Password *</label>
                    <input type="password" name="password_confirmation" id="password_confirmation" required class="w-full px-3 py-2 bg-slate-50 dark:bg-slate-900 border border-slate-300 dark:border-slate-700 rounded-xl text-slate-900 dark:text-white">
                </div>
            </div>

            <div class="space-y-2 pt-2 text-xs">
                <label class="flex items-center space-x-2 rtl:space-x-reverse cursor-pointer">
                    <input type="checkbox" name="must_change_password" value="1" checked class="w-4 h-4 text-sky-600 rounded">
                    <span class="text-slate-700 dark:text-slate-300 font-medium">Force password change on first login</span>
                </label>
                <label class="flex items-center space-x-2 rtl:space-x-reverse cursor-pointer">
                    <input type="checkbox" name="allow_web_login" value="1" checked class="w-4 h-4 text-sky-600 rounded">
                    <span class="text-slate-700 dark:text-slate-300 font-medium">Allow Web Browser Login</span>
                </label>
            </div>
        </div>

        <div class="flex justify-end space-x-3 rtl:space-x-reverse">
            <a href="<?php echo e(route('app.users.index')); ?>" class="px-5 py-2.5 bg-slate-200 dark:bg-slate-700 text-slate-700 dark:text-slate-200 font-bold text-xs rounded-xl">Cancel</a>
            <button type="submit" class="px-6 py-2.5 bg-sky-600 hover:bg-sky-700 text-white font-bold text-xs rounded-xl shadow-lg shadow-sky-600/25">
                Create User Account
            </button>
        </div>
    </form>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\typingcenter\resources\views\tenant\users\create.blade.php ENDPATH**/ ?>