<?php $__env->startSection('title','Profession Management'); ?>
<?php $__env->startSection('subtitle','Manage professions, sub-professions, salutations, and visual identity.'); ?>
<?php $__env->startSection('content'); ?>
<div class="profession-toolbar">
    <form class="profession-filter" method="get">
        <div>
            <i data-lucide="search"></i>
            <input name="q" value="<?php echo e(request('q')); ?>" placeholder="Search professions">
        </div>
        <select name="type">
            <option value="">All types</option>
            <option value="parent" <?php if(request('type')==='parent' ): echo 'selected'; endif; ?>>Parent professions</option>
            <option value="sub" <?php if(request('type')==='sub' ): echo 'selected'; endif; ?>>Sub-professions</option>
        </select>
        <select name="status">
            <option value="">All statuses</option>
            <option value="1" <?php if(request('status')==='1' ): echo 'selected'; endif; ?>>Active</option>
            <option value="0" <?php if(request('status')==='0' ): echo 'selected'; endif; ?>>Inactive</option>
        </select>
        <button>Apply Filters</button>
    </form>
    <button class="new-profession-button" type="button" onclick="document.getElementById('create-profession').showModal()">
        <i data-lucide="plus"></i>Add Profession </button>
</div>
<div class="profession-stats">
    <article>
        <i data-lucide="briefcase-business"></i>
        <div>
            <span>Total</span>
            <strong><?php echo e(number_format($stats['total'])); ?></strong>
        </div>
    </article>
    <article>
        <i data-lucide="network"></i>
        <div>
            <span>Parent Professions</span>
            <strong><?php echo e(number_format($stats['parents'])); ?></strong>
        </div>
    </article>
    <article>
        <i data-lucide="git-branch"></i>
        <div>
            <span>Sub-professions</span>
            <strong><?php echo e(number_format($stats['sub'])); ?></strong>
        </div>
    </article>
    <article>
        <i data-lucide="circle-check"></i>
        <div>
            <span>Active</span>
            <strong><?php echo e(number_format($stats['active'])); ?></strong>
        </div>
    </article>
</div>
<div class="profession-grid"><?php $__empty_1 = true; $__currentLoopData = $professions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $profession): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?> <form class="profession-card" method="post" action="<?php echo e(route('professions.update',$profession)); ?>"><?php echo csrf_field(); ?> <?php echo method_field('put'); ?> <div class="profession-card-head">
            <span class="profession-swatch" style="--profession-color:<?php echo e($profession->color_hex); ?>">
                <i data-lucide="briefcase-business"></i>
            </span>
            <div>
                <small><?php echo e($profession->parent_id ? 'SUB-PROFESSION' : 'PARENT PROFESSION'); ?></small>
                <h2><?php echo e($profession->name); ?></h2>
            </div>
            <span class="profession-state <?php echo e($profession->status?'active':'inactive'); ?>"><?php echo e($profession->status?'Active':'Inactive'); ?></span>
        </div>
        <div class="profession-fields">
            <label>
                <span>Name</span>
                <input name="name" value="<?php echo e($profession->name); ?>" required>
            </label>
            <div class="field-row">
                <label>
                    <span>Salutation</span>
                    <input name="salutation" value="<?php echo e($profession->salutation); ?>" required>
                </label>
                <label class="color-field">
                    <span>Color</span>
                    <input name="color_hex" type="color" value="<?php echo e($profession->color_hex); ?>">
                    <b><?php echo e($profession->color_hex); ?></b>
                </label>
            </div>
            <label>
                <span>Parent Profession</span>
                <select name="parent_id">
                    <option value="0">None — top-level profession</option><?php $__currentLoopData = $parents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $parent): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if($parent->id!==$profession->id): ?> <option value="<?php echo e($parent->id); ?>" <?php if($profession->parent_id===$parent->id): echo 'selected'; endif; ?>><?php echo e($parent->name); ?></option><?php endif; ?> <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </label>
            <label class="status-toggle">
                <input type="hidden" name="status" value="0">
                <input type="checkbox" name="status" value="1" <?php if($profession->status): echo 'checked'; endif; ?>> <span></span>Available in the application </label>
        </div>
        <footer>
            <span><?php if($profession->parent_id): ?>Parent: <?php echo e($profession->parent?->name??'Unknown'); ?><?php else: ?><?php echo e($profession->children_count); ?> sub-profession<?php echo e($profession->children_count===1?'':'s'); ?> · <?php echo e($profession->professionals_count); ?> professional<?php echo e($profession->professionals_count===1?'':'s'); ?><?php endif; ?></span>
            <button>Save Changes</button>
        </footer>
    </form><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?> <div class="empty profession-empty">No professions match these filters.</div><?php endif; ?> </div>
<div class="profession-pagination"><?php echo e($professions->onEachSide(1)->links('vendor.pagination.default')); ?></div>
<dialog id="create-profession" class="profession-dialog">
    <form method="post" action="<?php echo e(route('professions.store')); ?>"><?php echo csrf_field(); ?> <div class="dialog-head">
            <div>
                <small>NEW RECORD</small>
                <h2>Add Profession</h2>
                <p>Create a parent profession or assign it beneath an existing profession.</p>
            </div>
            <button type="button" onclick="this.closest('dialog').close()" aria-label="Close">
                <i data-lucide="x"></i>
            </button>
        </div>
        <div class="dialog-fields">
            <label>
                <span>Name</span>
                <input name="name" value="<?php echo e(old('name')); ?>" required>
            </label>
            <label>
                <span>Salutation</span>
                <input name="salutation" value="<?php echo e(old('salutation')); ?>" placeholder="Dr., Atty., Mr. / Mrs." required>
            </label>
            <label>
                <span>Parent Profession</span>
                <select name="parent_id">
                    <option value="0">None — create a top-level profession</option><?php $__currentLoopData = $parents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $parent): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?> <option value="<?php echo e($parent->id); ?>"><?php echo e($parent->name); ?></option><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </label>
            <label class="dialog-color">
                <span>Profession Color</span>
                <input name="color_hex" type="color" value="#7bd300">
                <b>#7bd300</b>
            </label>
            <label class="status-toggle">
                <input type="hidden" name="status" value="0">
                <input type="checkbox" name="status" value="1" checked>
                <span></span>Active and available </label>
        </div>
        <footer>
            <button type="button" onclick="this.closest('dialog').close()">Cancel</button>
            <button class="create-button">Create Profession</button>
        </footer>
    </form>
</dialog>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.admin', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/dev/desxpert-admin/resources/views/admin/professions.blade.php ENDPATH**/ ?>