<?php if (isset($component)) { $__componentOriginale0f1cdd055772eb1d4a99981c240763e = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale0f1cdd055772eb1d4a99981c240763e = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin-layout','data' => ['title' => 'Transfer Antar Cabang','subtitle' => 'Buat transfer stok retail, approval cabang penerima / owner, dan mutasi stok terpusat.']] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('admin-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Transfer Antar Cabang','subtitle' => 'Buat transfer stok retail, approval cabang penerima / owner, dan mutasi stok terpusat.']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

    <div class="grid gap-5 xl:grid-cols-[420px_1fr]">
        <section class="rounded-lg bg-white p-5 shadow-sm">
            <h2 class="font-semibold">Buat Transfer Stok</h2>
            <form method="post" action="<?php echo e(route('stock-transfers.store')); ?>" class="mt-4 space-y-3">
                <?php echo csrf_field(); ?>
                <?php if (isset($component)) { $__componentOriginal5c4d796b9262c7fe90fe74103bb75dfa = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal5c4d796b9262c7fe90fe74103bb75dfa = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.master.select','data' => ['name' => 'from_branch_id','label' => 'Cabang asal','value' => $selectedBranchId,'options' => $branches->pluck('name', 'id')->all()]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('master.select'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'from_branch_id','label' => 'Cabang asal','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($selectedBranchId),'options' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($branches->pluck('name', 'id')->all())]); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal5c4d796b9262c7fe90fe74103bb75dfa)): ?>
<?php $attributes = $__attributesOriginal5c4d796b9262c7fe90fe74103bb75dfa; ?>
<?php unset($__attributesOriginal5c4d796b9262c7fe90fe74103bb75dfa); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal5c4d796b9262c7fe90fe74103bb75dfa)): ?>
<?php $component = $__componentOriginal5c4d796b9262c7fe90fe74103bb75dfa; ?>
<?php unset($__componentOriginal5c4d796b9262c7fe90fe74103bb75dfa); ?>
<?php endif; ?>
                <?php if (isset($component)) { $__componentOriginal5c4d796b9262c7fe90fe74103bb75dfa = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal5c4d796b9262c7fe90fe74103bb75dfa = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.master.select','data' => ['name' => 'to_branch_id','label' => 'Cabang tujuan','value' => old('to_branch_id'),'options' => $branches->pluck('name', 'id')->all()]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('master.select'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\Illuminate\View\AnonymousComponent::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes(['name' => 'to_branch_id','label' => 'Cabang tujuan','value' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute(old('to_branch_id')),'options' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($branches->pluck('name', 'id')->all())]); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal5c4d796b9262c7fe90fe74103bb75dfa)): ?>
<?php $attributes = $__attributesOriginal5c4d796b9262c7fe90fe74103bb75dfa; ?>
<?php unset($__attributesOriginal5c4d796b9262c7fe90fe74103bb75dfa); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal5c4d796b9262c7fe90fe74103bb75dfa)): ?>
<?php $component = $__componentOriginal5c4d796b9262c7fe90fe74103bb75dfa; ?>
<?php unset($__componentOriginal5c4d796b9262c7fe90fe74103bb75dfa); ?>
<?php endif; ?>

                <div class="rounded-md border bg-slate-50 p-3">
                    <div class="mb-3 text-sm font-medium">Item transfer</div>
                    <div class="space-y-2">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $products->take(8); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i => $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                            <div class="grid grid-cols-[1fr_90px] gap-2">
                                <input type="hidden" name="items[<?php echo e($i); ?>][product_id]" value="<?php echo e($product->id); ?>">
                                <div class="rounded-md border bg-white px-3 py-2 text-sm">
                                    <div class="font-medium"><?php echo e($product->name); ?></div>
                                    <div class="text-xs text-slate-500"><?php echo e($product->sku); ?></div>
                                </div>
                                <input name="items[<?php echo e($i); ?>][quantity]" type="number" step="0.001" min="0" placeholder="Qty" class="rounded-md border px-2 py-2 text-sm">
                            </div>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                    </div>
                </div>

                <textarea name="note" placeholder="Catatan transfer" class="w-full rounded-md border px-3 py-2 text-sm"></textarea>
                <button class="w-full rounded-md bg-slate-900 px-4 py-2 font-medium text-white">Buat Transfer</button>
            </form>

            <div class="mt-5 rounded-md border p-3">
                <div class="text-sm font-medium">Stok tersedia</div>
                <div class="mt-2 max-h-56 space-y-2 overflow-y-auto text-xs text-slate-600">
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $stocks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $branchStocks): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                        <div class="font-semibold text-slate-900"><?php echo e($branchStocks->first()->branch?->name); ?></div>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $branchStocks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $stock): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                            <div class="flex justify-between gap-2"><span><?php echo e($stock->product?->name); ?></span><span><?php echo e(rtrim(rtrim(number_format((float) $stock->quantity, 3, ',', '.'), '0'), ',')); ?></span></div>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                        <div>Tidak ada stok retail.</div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </div>
            </div>
        </section>

        <section class="space-y-4">
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $transfers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transfer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                <article class="rounded-lg bg-white p-5 shadow-sm">
                    <div class="flex flex-col gap-3 md:flex-row md:items-start md:justify-between">
                        <div>
                            <div class="font-semibold"><?php echo e($transfer->transfer_no); ?></div>
                            <div class="mt-1 text-sm text-slate-500"><?php echo e($transfer->fromBranch?->name); ?> -> <?php echo e($transfer->toBranch?->name); ?></div>
                            <div class="text-sm text-slate-500">Dibuat oleh <?php echo e($transfer->requester?->name ?? '-'); ?> pada <?php echo e($transfer->created_at->format('d/m/Y H:i')); ?></div>
                        </div>
                        <span class="w-fit rounded-full border px-3 py-1 text-xs <?php echo e($transfer->status === 'approved' ? 'border-emerald-200 bg-emerald-50 text-emerald-700' : ($transfer->status === 'pending' ? 'border-amber-200 bg-amber-50 text-amber-700' : 'border-slate-200 bg-slate-50 text-slate-700')); ?>"><?php echo e($transfer->status); ?></span>
                    </div>

                    <div class="mt-4 divide-y rounded-md border text-sm">
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $transfer->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                            <div class="flex justify-between gap-3 px-3 py-2"><span><?php echo e($item->product?->name); ?></span><strong><?php echo e(rtrim(rtrim(number_format((float) $item->quantity, 3, ',', '.'), '0'), ',')); ?></strong></div>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                    </div>

                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($transfer->note): ?>
                        <div class="mt-3 rounded-md bg-slate-50 px-3 py-2 text-sm text-slate-600"><?php echo e($transfer->note); ?></div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

                    <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($transfer->status === 'pending'): ?>
                        <div class="mt-4 flex flex-wrap gap-2">
                            <form method="post" action="<?php echo e(route('stock-transfers.approve', $transfer)); ?>">
                                <?php echo csrf_field(); ?>
                                <button class="rounded-md bg-slate-900 px-4 py-2 text-sm font-medium text-white">Approve</button>
                            </form>
                            <form method="post" action="<?php echo e(route('stock-transfers.reject', $transfer)); ?>">
                                <?php echo csrf_field(); ?>
                                <button class="rounded-md border px-4 py-2 text-sm">Reject</button>
                            </form>
                            <form method="post" action="<?php echo e(route('stock-transfers.cancel', $transfer)); ?>">
                                <?php echo csrf_field(); ?>
                                <button class="rounded-md border border-red-200 px-4 py-2 text-sm text-red-700">Cancel</button>
                            </form>
                        </div>
                    <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                </article>
            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::endLoop(); ?><?php endif; ?><?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::closeLoop(); ?><?php endif; ?>
                <div class="rounded-lg bg-white p-8 text-center text-sm text-slate-500 shadow-sm">Belum ada transfer stok.</div>
            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>

            <?php echo e($transfers->links()); ?>

        </section>
    </div>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginale0f1cdd055772eb1d4a99981c240763e)): ?>
<?php $attributes = $__attributesOriginale0f1cdd055772eb1d4a99981c240763e; ?>
<?php unset($__attributesOriginale0f1cdd055772eb1d4a99981c240763e); ?>
<?php endif; ?>
<?php if (isset($__componentOriginale0f1cdd055772eb1d4a99981c240763e)): ?>
<?php $component = $__componentOriginale0f1cdd055772eb1d4a99981c240763e; ?>
<?php unset($__componentOriginale0f1cdd055772eb1d4a99981c240763e); ?>
<?php endif; ?>
<?php /**PATH /Users/dedehermawan/Dokumen/project/laundry/resources/views/stock-transfers/index.blade.php ENDPATH**/ ?>