<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag;

$__newAttributes = [];
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames((['type', 'defaults', 'level' => 0]));

foreach ($attributes->all() as $__key => $__value) {
    if (in_array($__key, $__propNames)) {
        $$__key = $$__key ?? $__value;
    } else {
        $__newAttributes[$__key] = $__value;
    }
}

$attributes = new \Illuminate\View\ComponentAttributeBag($__newAttributes);

unset($__propNames);
unset($__newAttributes);

foreach (array_filter((['type', 'defaults', 'level' => 0]), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
    $$__key = $$__key ?? $__value;
}

$__defined_vars = get_defined_vars();

foreach ($attributes->all() as $__key => $__value) {
    if (array_key_exists($__key, $__defined_vars)) unset($$__key);
}

unset($__defined_vars); ?>

<?php if($type->childrenRecursive->isNotEmpty()): ?>
	<div class="hs-accordion" id="accordion-<?php echo e($type->id); ?>" >
		<div class="flex justify-between items-center">
			<button
				class="hs-accordion-toggle py-0 inline-flex items-center gap-x-3 font-semibold text-start text-gray-800 transition hover:text-gray-500 dark:text-gray-200 dark:hover:text-white/80"
				aria-controls="accordion-collapse-<?php echo e($type->id); ?>" type="button" aria-expanded="false">
				<code class="plus-icon mb-2 block w-3 h-3 text-gray-600">+</code>
				<code class="minus-icon mb-2 hidden w-3 h-3 text-gray-600">-</code>
				<code class="text-gray-800 dark:text-white"><?php echo e($type->code); ?> - <?php echo e($type->description); ?></code>
			</button>
			<!-- Use old() helper and check if defaults exist for this insurance type -->
			<input type="text" name="commission_defaults[<?php echo e($type->id); ?>]" class="branch-input p-1 border rounded w-1/3"
				data-children-container="#accordion-collapse-<?php echo e($type->id); ?>" placeholder="vrednost za <?php echo e($type->code); ?>"
				value="<?php echo e(old('commission_defaults.' . $type->id, $defaults[$type->id]->commission_rate ?? '')); ?>" />
		</div>
		<div id="accordion-collapse-<?php echo e($type->id); ?>"
			class="hs-accordion-content hidden w-full overflow-hidden transition-[height] duration-300"
			aria-labelledby="accordion-<?php echo e($type->id); ?>">
			<div class="hs-accordion-group ltr:pl-6 rtl:pr-6">
				<?php $__currentLoopData = $type->childrenRecursive; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $child): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
					<?php echo $__env->make('backend.insurance.insurance-types.partials.insurance_type', [
						'type' => $child,
						'defaults' => $defaults,
						'level' => $level + 1,
					], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
				<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
			</div>
		</div>
	</div>
<?php else: ?>
	<div class="hs-accordion-item hover:bg-green-100">
		<div class="flex justify-between items-center">
			<div class="flex items-center gap-x-3 ">
				<code class="plus-icon mb-2 block w-3 h-3 text-gray-600">•</code>
				<code class="text-gray-800 dark:text-white"><?php echo e($type->code); ?> - <?php echo e($type->description); ?></code>
			</div>
			<input type="text" name="commission_defaults[<?php echo e($type->id); ?>]" class="branch-input p-1 border rounded w-1/3"
				placeholder="vrednost za <?php echo e($type->code); ?>"
				value="<?php echo e(old('commission_defaults.' . $type->id, $defaults[$type->id]->commission_rate ?? '')); ?>" />
		</div>
	</div>
<?php endif; ?>
<?php /**PATH C:\laragon\www\policypilot\resources\views/backend/insurance/insurance-types/partials/insurance_type.blade.php ENDPATH**/ ?>