<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\AppLayout::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('header', null, []); ?> 
        <?php echo e(__('Dealer Provisioning Summary')); ?>

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

    <div class="p-6 space-y-6">
        <div class="bg-white border border-gray-200 rounded-xl shadow-sm p-6 space-y-3">
            <?php
                $counts = $summary['counts'] ?? null;
                $users = $summary['users'] ?? $summary;
                $created = $users['created'] ?? [];
                $existing = $users['existing'] ?? [];
                $runType = $summary['run_type'] ?? null;
                $showPasswords = $runType !== 'reprovision' && !empty($created) && isset($created[0]['temp_password']);
            ?>

            <div>
                <h1 class="text-xl font-semibold text-gray-900">
                    Provisioning Summary for <?php echo e($dealer->name); ?>

                </h1>
                <p class="mt-0.5 text-xs text-gray-500">
                    Domain: <?php echo e($dealer->domain ?? 'n/a'); ?>

                </p>
                <p class="mt-1 text-sm text-gray-600">
                    <?php if($runType === 'reprovision'): ?>
                        This summary reflects the latest re-provisioning run. Existing user passwords are never reset and are not displayed here.
                    <?php else: ?>
                        These details are shown once after provisioning. Temporary passwords will not be displayed again.
                    <?php endif; ?>
                </p>
            </div>

            <?php if(! $summary): ?>
                <p class="text-sm text-gray-600">
                    No recent provisioning summary available for this dealer. Temporary passwords are only shown immediately after initial provisioning.
                </p>
            <?php else: ?>
                <?php if($counts): ?>
                    <div class="mt-4">
                        <h2 class="text-sm font-semibold text-gray-900">Provisioning Counts</h2>
                        <dl class="mt-2 grid grid-cols-1 sm:grid-cols-3 gap-3 text-xs text-gray-700">
                            <div class="bg-gray-50 rounded-lg px-3 py-2">
                                <dt class="font-medium text-gray-900">Departments created</dt>
                                <dd class="mt-0.5"><?php echo e($counts['departments_created'] ?? 0); ?></dd>
                            </div>
                            <div class="bg-gray-50 rounded-lg px-3 py-2">
                                <dt class="font-medium text-gray-900">Roles created</dt>
                                <dd class="mt-0.5"><?php echo e($counts['roles_created'] ?? 0); ?></dd>
                            </div>
                            <div class="bg-gray-50 rounded-lg px-3 py-2">
                                <dt class="font-medium text-gray-900">Permissions created</dt>
                                <dd class="mt-0.5"><?php echo e($counts['permissions_created'] ?? 0); ?></dd>
                            </div>
                            <div class="bg-gray-50 rounded-lg px-3 py-2">
                                <dt class="font-medium text-gray-900">Users created</dt>
                                <dd class="mt-0.5"><?php echo e($counts['users_created'] ?? 0); ?></dd>
                            </div>
                            <div class="bg-gray-50 rounded-lg px-3 py-2">
                                <dt class="font-medium text-gray-900">Existing users aligned</dt>
                                <dd class="mt-0.5"><?php echo e($counts['users_existing'] ?? 0); ?></dd>
                            </div>
                        </dl>
                    </div>
                <?php endif; ?>

                <?php if(!empty($created)): ?>
                    <div class="mt-4">
                        <h2 class="text-sm font-semibold text-gray-900">Newly Created Users</h2>
                        <?php if($showPasswords): ?>
                            <p class="mt-1 text-xs text-gray-500">
                                Share these temporary passwords securely with each user and ask them to change on first login.
                            </p>
                        <?php else: ?>
                            <p class="mt-1 text-xs text-gray-500">
                                Temporary passwords are not displayed for this run.
                            </p>
                        <?php endif; ?>
                        <div class="mt-3 overflow-x-auto">
                            <table class="min-w-full text-sm divide-y divide-gray-200">
                                <thead class="bg-gray-50">
                                    <tr>
                                        <th class="px-3 py-2 text-left font-semibold text-gray-700">Name</th>
                                        <th class="px-3 py-2 text-left font-semibold text-gray-700">Email</th>
                                        <th class="px-3 py-2 text-left font-semibold text-gray-700">Role</th>
                                        <?php if($showPasswords): ?>
                                            <th class="px-3 py-2 text-left font-semibold text-gray-700">Temporary Password</th>
                                        <?php endif; ?>
                                    </tr>
                                </thead>
                                <tbody class="divide-y divide-gray-100">
                                    <?php $__currentLoopData = $created; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td class="px-3 py-2 text-gray-900"><?php echo e($user['name']); ?></td>
                                            <td class="px-3 py-2 text-gray-800 font-mono text-xs"><?php echo e($user['email']); ?></td>
                                            <td class="px-3 py-2 text-gray-800"><?php echo e($user['role']); ?></td>
                                            <?php if($showPasswords): ?>
                                                <td class="px-3 py-2 font-mono text-xs text-gray-900">
                                                    <?php echo e($user['temp_password']); ?>

                                                </td>
                                            <?php endif; ?>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                <?php endif; ?>

                <?php if(!empty($existing)): ?>
                    <div class="mt-6">
                        <h2 class="text-sm font-semibold text-gray-900">Existing Users (updated)</h2>
                        <p class="mt-1 text-xs text-gray-500">
                            These users already existed. Their roles and departments were aligned with the dealer baseline.
                        </p>
                        <div class="mt-3 overflow-x-auto">
                            <table class="min-w-full text-sm divide-y divide-gray-200">
                                <thead class="bg-gray-50">
                                    <tr>
                                        <th class="px-3 py-2 text-left font-semibold text-gray-700">Name</th>
                                        <th class="px-3 py-2 text-left font-semibold text-gray-700">Email</th>
                                        <th class="px-3 py-2 text-left font-semibold text-gray-700">Role</th>
                                    </tr>
                                </thead>
                                <tbody class="divide-y divide-gray-100">
                                    <?php $__currentLoopData = $existing; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td class="px-3 py-2 text-gray-900"><?php echo e($user['name']); ?></td>
                                            <td class="px-3 py-2 text-gray-800 font-mono text-xs"><?php echo e($user['email']); ?></td>
                                            <td class="px-3 py-2 text-gray-800"><?php echo e($user['role']); ?></td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                <?php endif; ?>
            <?php endif; ?>

            <div class="pt-4">
                <a
                    href="<?php echo e(route('settings.dealers.index')); ?>"
                    class="inline-flex items-center rounded-md border border-gray-200 px-4 py-2 text-sm text-gray-700 hover:bg-gray-50"
                >
                    Back to Dealers
                </a>
            </div>
        </div>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>

<?php /**PATH C:\Projects\mtt-os\resources\views\settings\dealers\provisioning-summary.blade.php ENDPATH**/ ?>