<?php if (isset($component)) { $__componentOriginale0f1cdd055772eb1d4a99981c240763e = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginale0f1cdd055772eb1d4a99981c240763e = $attributes; } ?>
<?php $component = Illuminate\View\AnonymousComponent::resolve(['view' => 'components.admin-layout','data' => ['title' => 'Input Biaya','subtitle' => 'Catat biaya operasional cabang, ongkir, perlengkapan, maintenance, sampai marketing.']] + (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' => 'Input Biaya','subtitle' => 'Catat biaya operasional cabang, ongkir, perlengkapan, maintenance, sampai marketing.']); ?>
<?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::processComponentKey($component); ?>

    <div class="grid gap-5 lg:grid-cols-[380px_1fr]">
        <section class="rounded-lg bg-white p-5 shadow-sm">
            <h2 class="font-semibold">Tambah Biaya</h2>
            <form method="post" action="<?php echo e(route('expenses.store')); ?>" class="mt-4 space-y-4">
                <?php echo csrf_field(); ?>
                <label class="block text-sm">
                    Cabang
                    <select name="branch_id" class="mt-1 w-full rounded-md border px-3 py-2" required>
                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $branches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $branch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                            <option value="<?php echo e($branch->id); ?>" <?php if((int) old('branch_id', $filters['branch_id'] ?? auth()->user()->branch_id) === $branch->id): echo 'selected'; endif; ?>><?php echo e($branch->name); ?></option>
                        <?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; ?>
                    </select>
                </label>

                <label class="block text-sm">
                    Tanggal biaya
                    <input type="date" name="expense_date" value="<?php echo e(old('expense_date', now()->toDateString())); ?>" class="mt-1 w-full rounded-md border px-3 py-2" required>
                </label>

                <label class="block text-sm">
                    Nama biaya
                    <input name="name" value="<?php echo e(old('name')); ?>" placeholder="Contoh: Beli plastik laundry" class="mt-1 w-full rounded-md border px-3 py-2" required>
                </label>

                <div class="grid gap-3 sm:grid-cols-2 lg:grid-cols-1">
                    <label class="block text-sm">
                        Jenis biaya
                        <select name="type" class="mt-1 w-full rounded-md border px-3 py-2" required>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $types; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                <option value="<?php echo e($value); ?>" <?php if(old('type', 'operational') === $value): echo 'selected'; endif; ?>><?php echo e($label); ?></option>
                            <?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; ?>
                        </select>
                    </label>

                    <label class="block text-sm">
                        Nominal
                        <input type="number" name="amount" min="0" step="0.01" value="<?php echo e(old('amount')); ?>" placeholder="0" class="mt-1 w-full rounded-md border px-3 py-2" required>
                    </label>
                </div>

                <label class="block text-sm">
                    Keterangan
                    <textarea name="description" rows="3" placeholder="Catatan tambahan bila perlu" class="mt-1 w-full rounded-md border px-3 py-2"><?php echo e(old('description')); ?></textarea>
                </label>

                <button class="w-full rounded-md bg-slate-900 px-4 py-2 font-medium text-white">Simpan Biaya</button>
            </form>
        </section>

        <section class="space-y-5">
            <div class="rounded-lg bg-white p-5 shadow-sm">
                <form method="get" action="<?php echo e(route('expenses.index')); ?>" class="grid gap-3 md:grid-cols-5 md:items-end">
                    <label class="text-sm">
                        Cabang
                        <select name="branch_id" class="mt-1 w-full rounded-md border px-3 py-2">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(auth()->user()->isOwner()): ?>
                                <option value="">Semua cabang</option>
                            <?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 \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $branches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $branch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                <option value="<?php echo e($branch->id); ?>" <?php if((int) ($filters['branch_id'] ?? 0) === $branch->id): echo 'selected'; endif; ?>><?php echo e($branch->name); ?></option>
                            <?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; ?>
                        </select>
                    </label>
                    <label class="text-sm">
                        Dari
                        <input type="date" name="start" value="<?php echo e($filters['start']); ?>" class="mt-1 w-full rounded-md border px-3 py-2">
                    </label>
                    <label class="text-sm">
                        Sampai
                        <input type="date" name="end" value="<?php echo e($filters['end']); ?>" class="mt-1 w-full rounded-md border px-3 py-2">
                    </label>
                    <label class="text-sm">
                        Jenis
                        <select name="type" class="mt-1 w-full rounded-md border px-3 py-2">
                            <option value="">Semua jenis</option>
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $typeLabels; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                <option value="<?php echo e($value); ?>" <?php if(($filters['type'] ?? null) === $value): echo 'selected'; endif; ?>><?php echo e($label); ?></option>
                            <?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; ?>
                        </select>
                    </label>
                    <button class="rounded-md border px-4 py-2 text-sm font-medium">Filter</button>
                </form>
            </div>

            <div class="grid gap-4 md:grid-cols-3">
                <div class="rounded-lg bg-white p-5 shadow-sm">
                    <div class="text-sm text-slate-500">Total biaya periode ini</div>
                    <div class="mt-2 text-2xl font-bold">Rp <?php echo e(number_format($total, 0, ',', '.')); ?></div>
                </div>
                <div class="rounded-lg bg-white p-5 shadow-sm">
                    <div class="text-sm text-slate-500">Jumlah transaksi</div>
                    <div class="mt-2 text-2xl font-bold"><?php echo e(number_format($expenses->total(), 0, ',', '.')); ?></div>
                </div>
                <div class="rounded-lg bg-white p-5 shadow-sm">
                    <div class="text-sm text-slate-500">Periode</div>
                    <div class="mt-2 text-lg font-semibold"><?php echo e(\Illuminate\Support\Carbon::parse($filters['start'])->format('d/m/Y')); ?> - <?php echo e(\Illuminate\Support\Carbon::parse($filters['end'])->format('d/m/Y')); ?></div>
                </div>
            </div>

            <div class="overflow-hidden rounded-lg bg-white shadow-sm">
                <div class="overflow-x-auto">
                    <table class="w-full text-left text-sm">
                        <thead class="bg-slate-100 text-xs uppercase text-slate-500">
                            <tr>
                                <th class="px-4 py-3">Tanggal</th>
                                <th class="px-4 py-3">Biaya</th>
                                <th class="px-4 py-3">Cabang</th>
                                <th class="px-4 py-3">Jenis</th>
                                <th class="px-4 py-3 text-right">Nominal</th>
                                <th class="px-4 py-3">Input</th>
                                <th class="px-4 py-3"></th>
                            </tr>
                        </thead>
                        <tbody class="divide-y">
                            <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__empty_1 = true; $__currentLoopData = $expenses; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $expense): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                <tr class="align-top">
                                    <td class="whitespace-nowrap px-4 py-3"><?php echo e($expense->expense_date?->format('d/m/Y')); ?></td>
                                    <td class="px-4 py-3">
                                        <div class="font-medium"><?php echo e($expense->name); ?></div>
                                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($expense->description): ?>
                                            <div class="mt-1 max-w-md text-xs text-slate-500"><?php echo e($expense->description); ?></div>
                                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                    </td>
                                    <td class="px-4 py-3"><?php echo e($expense->branch?->name); ?></td>
                                    <td class="px-4 py-3">
                                        <span class="rounded-full bg-slate-100 px-2 py-1 text-xs font-medium"><?php echo e($typeLabels[$expense->type] ?? $expense->type); ?></span>
                                    </td>
                                    <td class="whitespace-nowrap px-4 py-3 text-right font-semibold">Rp <?php echo e(number_format((float) $expense->amount, 0, ',', '.')); ?></td>
                                    <td class="px-4 py-3 text-xs text-slate-500"><?php echo e($expense->user?->name ?? '-'); ?></td>
                                    <td class="px-4 py-3 text-right">
                                        <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($expense->type !== 'bonus_payout'): ?>
                                            <details class="relative">
                                                <summary class="cursor-pointer rounded-md border px-3 py-1 text-center text-xs font-medium">Edit</summary>
                                                <div class="absolute right-0 z-10 mt-2 w-80 rounded-lg border bg-white p-4 text-left shadow-xl">
                                                    <form method="post" action="<?php echo e(route('expenses.update', $expense)); ?>" class="space-y-3">
                                                        <?php echo csrf_field(); ?>
                                                        <?php echo method_field('put'); ?>
                                                        <label class="block text-xs">Cabang
                                                            <select name="branch_id" class="mt-1 w-full rounded-md border px-3 py-2">
                                                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $branches; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $branch): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                                                    <option value="<?php echo e($branch->id); ?>" <?php if($expense->branch_id === $branch->id): echo 'selected'; endif; ?>><?php echo e($branch->name); ?></option>
                                                                <?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; ?>
                                                            </select>
                                                        </label>
                                                        <label class="block text-xs">Tanggal
                                                            <input type="date" name="expense_date" value="<?php echo e($expense->expense_date?->toDateString()); ?>" class="mt-1 w-full rounded-md border px-3 py-2">
                                                        </label>
                                                        <label class="block text-xs">Nama biaya
                                                            <input name="name" value="<?php echo e($expense->name); ?>" class="mt-1 w-full rounded-md border px-3 py-2">
                                                        </label>
                                                        <label class="block text-xs">Jenis
                                                            <select name="type" class="mt-1 w-full rounded-md border px-3 py-2">
                                                                <?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::openLoop(); ?><?php endif; ?><?php $__currentLoopData = $types; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $value => $label): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><?php \Livewire\Features\SupportCompiledWireKeys\SupportCompiledWireKeys::startLoopIteration(); ?><?php endif; ?>
                                                                    <option value="<?php echo e($value); ?>" <?php if($expense->type === $value): echo 'selected'; endif; ?>><?php echo e($label); ?></option>
                                                                <?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; ?>
                                                            </select>
                                                        </label>
                                                        <label class="block text-xs">Nominal
                                                            <input type="number" name="amount" min="0" step="0.01" value="<?php echo e($expense->amount); ?>" class="mt-1 w-full rounded-md border px-3 py-2">
                                                        </label>
                                                        <label class="block text-xs">Keterangan
                                                            <textarea name="description" rows="2" class="mt-1 w-full rounded-md border px-3 py-2"><?php echo e($expense->description); ?></textarea>
                                                        </label>
                                                        <button class="rounded-md bg-slate-900 px-3 py-2 text-xs font-medium text-white">Update</button>
                                                    </form>
                                                    <form method="post" action="<?php echo e(route('expenses.destroy', $expense)); ?>" onsubmit="return confirm('Hapus biaya ini?')" class="mt-2">
                                                        <?php echo csrf_field(); ?>
                                                        <?php echo method_field('delete'); ?>
                                                        <button class="rounded-md border border-red-200 px-3 py-2 text-xs font-medium text-red-700">Hapus</button>
                                                    </form>
                                                </div>
                                            </details>
                                        <?php else: ?>
                                            <span class="text-xs text-slate-400">Otomatis</span>
                                        <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                                    </td>
                                </tr>
                            <?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; ?>
                                <tr>
                                    <td colspan="7" class="px-4 py-10 text-center text-slate-500">Belum ada biaya pada filter ini.</td>
                                </tr>
                            <?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
                        </tbody>
                    </table>
                </div>
                <div class="border-t px-4 py-3"><?php echo e($expenses->links()); ?></div>
            </div>
        </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/expenses/index.blade.php ENDPATH**/ ?>