<?php $__env->startSection('content'); ?>
    <div
        class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
        <h1 class="h2">Siparişler</h1>
    </div>

    <div class="row">
        <form method="get" action="<?php echo e(route('orders')); ?>">
            <div class="row">
                <div class="col-6">
                    <select class="form-select" name="project">
                        <?php if(!request('project')): ?>
                            <option selected>Proje Seç</option>
                        <?php else: ?>
                            <option>Proje Seç</option>
                        <?php endif; ?>
                        <?php $__currentLoopData = $projects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $project): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if(request('project') == $project->id): ?>
                                <option value="<?php echo e($project->id); ?>" selected><?php echo e($project->project_name); ?></option>
                            <?php else: ?>
                                <option value="<?php echo e($project->id); ?>"><?php echo e($project->project_name); ?></option>
                            <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </select>
                </div>
                <div class="col-6">
                    <select class="form-select" name="nebim" id="filter">
                        <?php if(request('nebim') == null): ?>
                            <option selected value="0">Tüm Siparişler</option>
                        <?php else: ?>
                            <option value="0">Tüm Siparişler</option>
                        <?php endif; ?>
                        <?php if(request('nebim') == 2): ?>
                            <option value="2" selected>Nebim -> Bekliyor</option>
                        <?php else: ?>
                            <option value="2">Nebim -> Bekliyor</option>
                        <?php endif; ?>
                        <?php if(request('nebim') == 1): ?>
                            <option value="1" selected>Nebim -> Aktarıldı</option>
                        <?php else: ?>
                            <option value="1">Nebim -> Aktarıldı</option>
                        <?php endif; ?>
                    </select>
                </div>
            </div>
            <div class="col-4">
                <button type="submit" class="mt-4 btn btn-primary">Filtrele</button>
            </div>
        </form>
    </div>

    <div class="row mt-5">

        <table class="table table-hover">
            <tbody>
            <th>Sipariş No</th>
            <th>Alıcı</th>
            <th>Email</th>
            <th>Sipariş Durumu</th>
            <th>Toplam</th>
            <th>Nebim</th>
            </tbody>
            <?php $__currentLoopData = $orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <tr>
                    <td><?php echo e($order->order_id); ?></td>
                    <td><?php echo e($order->firsname); ?> <?php echo e($order->lastname); ?></td>
                    <td><?php echo e($order->email); ?></td>
                    <td><?php echo e(($order->status) ? $order->status->name : "-"); ?></td>
                    <td><?php echo e($order->total); ?> <?php echo e($order->currency_code); ?></td>
                    <td><?php echo e($order->nebim ? 'Aktarıldı' : 'Bekliyor'); ?></td>
                </tr>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </table>

        <div class="col-6 m-auto">
            <?php if($orders): ?>
                <?php echo e($orders->links()); ?>

            <?php endif; ?>
        </div>
    </div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>
    <script>
        $("#filter").change(function () {
            var value = $(this).val();
            var url = new URL(window.location.href);
            url.searchParams.set('nebim', value);
            window.location.href = url.href;
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/rstudors/public_html/nebim-entegrasyon/resources/views/orders.blade.php ENDPATH**/ ?>