

<?php $__env->startSection('content'); ?>
<div class="container mt-2">
    <h2 class="mb-4 text-center text-success">Stock Categories</h2>

    <div class="stock-tree">
        <?php $__currentLoopData = $tree; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item => $particulars): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="tree-item">
                <div class="tree-header" onclick="toggleTree(this)">
                    <strong><?php echo e($item); ?></strong>
                </div>
                <div class="tree-children">
                    <?php $__currentLoopData = $particulars; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $part => $specs): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                        <div class="tree-item">
                            <div class="tree-header" onclick="toggleTree(this)">
                                <?php echo e($part); ?>

                            </div>
                            <div class="tree-children">
                                <?php $__currentLoopData = $specs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $spec => $models): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <div class="tree-item">
                                        <div class="tree-header" onclick="toggleTree(this)">
                                            <?php echo e($spec); ?>

                                        </div>
                                        <div class="tree-children">
                                            <?php $__currentLoopData = $models; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <div class="tree-leaf">
                                                    <?php echo e($m['model']); ?>

                                                    <?php if($m['available'] > 0): ?>
                                                        <span class="text-success">(Available: <?php echo e($m['available']); ?>)</span>
                                                    <?php else: ?>
                                                        <span class="text-danger">(Available: <?php echo e($m['available']); ?>)</span>
                                                    <?php endif; ?>
                                                </div>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </div>
                                    </div>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </div>
                        </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </div>
            </div>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    </div>
</div>

<style>
.stock-tree .tree-item {
    margin-left: 1rem;
    border-left: 2px solid #ddd;
    padding-left: 0.5rem;
    margin-bottom: 0.3rem;
}
.stock-tree .tree-header {
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    background: #f1f1f1;
    border-radius: 4px;
    margin-bottom: 0.2rem;
}
.stock-tree .tree-header:hover { background: #e0e0e0; }
.stock-tree .tree-children { display: none; margin-left: 1rem; }
.stock-tree .tree-leaf { padding: 0.1rem 0.5rem; }
.text-success { color: green; font-weight: bold; }
.text-danger { color: red; font-weight: bold; }
</style>

<script>
function toggleTree(header) {
    const children = header.nextElementSibling;
    if(children){
        children.style.display = children.style.display === 'block' ? 'none' : 'block';
    }
}
</script>

 <footer class="text-center py-3  bg-white" style="margin-top: 450px;" >
        Powered By <img src="<?php echo e(asset('assets/logo.png')); ?>" alt="Logo" style="height:22px; vertical-align:middle;">
    </footer>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\Inventorypage\stockapp\resources\views/categories.blade.php ENDPATH**/ ?>