<?php $__env->startSection('title', 'الطلبات '); ?>

<?php $__env->startSection('content'); ?>

    <?php if(request('type') != null && request('type') == 'ads'): ?>
        <?php if (isset($component)) { $__componentOriginal342b33bfa6f7d125441314a0164864e25786c1fa = $component; } ?>
<?php $component = App\View\Components\Dashboard\LinksBar::resolve(['links' => [
            [
                'name' => 'استفسارات الاعلانات',
            ],
        ],'buttons' => [
            [
                'name' => 'عرض استفسارات العقارات',
                'class' => 'btn-success',
                'link' => '?type=real_estate',
            ],
        ]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('dashboard.links-bar'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Dashboard\LinksBar::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal342b33bfa6f7d125441314a0164864e25786c1fa)): ?>
<?php $component = $__componentOriginal342b33bfa6f7d125441314a0164864e25786c1fa; ?>
<?php unset($__componentOriginal342b33bfa6f7d125441314a0164864e25786c1fa); ?>
<?php endif; ?>
    <?php else: ?>
        <?php if (isset($component)) { $__componentOriginal342b33bfa6f7d125441314a0164864e25786c1fa = $component; } ?>
<?php $component = App\View\Components\Dashboard\LinksBar::resolve(['links' => [
            [
                'name' => 'الطلبات',
            ],
        ],'buttons' => [
            [
                'name' => 'عرض استفسارات الاعلانات',
                'class' => 'btn-success',
                'link' => '?type=ads',
            ],
        ]] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('dashboard.links-bar'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\Dashboard\LinksBar::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal342b33bfa6f7d125441314a0164864e25786c1fa)): ?>
<?php $component = $__componentOriginal342b33bfa6f7d125441314a0164864e25786c1fa; ?>
<?php unset($__componentOriginal342b33bfa6f7d125441314a0164864e25786c1fa); ?>
<?php endif; ?>
    <?php endif; ?>

    <section id="mailbox">

        <?php if(count($rows) != 0): ?>

            <?php if(request('type') != null && request('type') == 'ads'): ?>
                <div class="box table-responsive">

                    <table width="100%" id="myTable" class="table text-center table-modern  table-inverse mb-0 border-0">

                        <thead class="thead-inverse">
                            <tr>
                                <th>التفاصيل</th>
                                <th>الاسم</th>
                                <th>رقم الهاتف</th>
                                <th>الرسالة</th>
                                <th>توقيت الإستلام</th>
                            </tr>
                        </thead>

                        <tbody>
                            <?php $__currentLoopData = $rows; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr style="<?php if($row['read'] == '0'): ?> <?php echo e('background-color:#007fff21;'); ?> <?php endif; ?>"
                                    class="parents ">

                                    <td>
                                        <?php if($row['read'] == '1'): ?>
                                            <a style="width:34px" title="مقروء"
                                                class="btn btn-success d-inline-block tip btn-sm pb-0">
                                                <i class="fa-solid fa-check"></i>
                                            </a>
                                        <?php else: ?>
                                            <a title="تمييز كمقروء" href="<?php echo e(adminUrl('requests/show/' . $row->id)); ?>"
                                                class="btn btn-primary tip btn-sm pb-0"><i class="fa-regular fa-eye"></i>
                                            </a>
                                        <?php endif; ?>
                                        <span class=" px-1">-</span>
                                        <form class="ajax-delete d-inline-block" action="<?php echo e(route('requests-destroy')); ?>"
                                            method="POST">
                                            <?php echo method_field('DELETE'); ?>
                                            <?php echo csrf_field(); ?>
                                            <input type="hidden" class="id" name="id" value="<?php echo e($row['id']); ?>">
                                            <button type="submit" data-delete="<?php echo e('هل انت متأكد من عملية الحذف ؟'); ?>"
                                                class="btn btn-sm btn-soft-danger"><i
                                                    class="fa-solid fa-trash"></i></button>
                                        </form>
                                    </td><!-- control -->

                                    <td>
                                        <?php echo e($row->name); ?>

                                    </td><!--  -->

                                    <td>
                                        <?php echo e($row->phone); ?>

                                    </td><!--  -->



                                    <td>
                                        <?php echo e($row->message); ?>

                                    </td><!--  -->

                                    <td>
                                        <?php echo e(parseTime($row->created_at)); ?>

                                    </td><!--  -->
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>

                    </table>
                </div>
            <?php else: ?>
                <div class="box table-responsive">

                    <table width="100%" id="myTable"
                        class="table text-center table-modern  table-inverse mb-0 border-0">

                        <thead class="thead-inverse">
                            <tr>
                                <th>التفاصيل</th>
                                <th>الاسم</th>
                                <th>رقم الهاتف</th>
                                <th>طرق التواصل</th>
                                <th>المنطقة</th>
                                <th>المطلوب</th>
                                <th>عدد الغرف</th>
                                <th>المساحة</th>
                                <th>السعر</th>
                                <th>طريقة الدفع</th>
                                <th>توقيت الإستلام</th>
                            </tr>
                        </thead>

                        <tbody>
                            <?php $__currentLoopData = $rows; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr style="<?php if($row['read'] == '0'): ?> <?php echo e('background-color:#007fff21;'); ?> <?php endif; ?>"
                                    class="parents ">

                                    <td>
                                        <?php if($row['read'] == '1'): ?>
                                            <a style="width:34px" title="مقروء"
                                                class="btn btn-success d-inline-block tip btn-sm pb-0">
                                                <i class="fa-solid fa-check"></i>
                                            </a>
                                        <?php else: ?>
                                            <a title="تمييز كمقروء" href="<?php echo e(adminUrl('requests/show/' . $row->id)); ?>"
                                                class="btn btn-primary tip btn-sm pb-0"><i class="fa-regular fa-eye"></i>
                                            </a>
                                        <?php endif; ?>
                                        <span class=" px-1">-</span>
                                        <form class="ajax-delete d-inline-block" action="<?php echo e(route('requests-destroy')); ?>"
                                            method="POST">
                                            <?php echo method_field('DELETE'); ?>
                                            <?php echo csrf_field(); ?>
                                            <input type="hidden" class="id" name="id"
                                                value="<?php echo e($row['id']); ?>">
                                            <button type="submit" data-delete="<?php echo e('هل انت متأكد من عملية الحذف ؟'); ?>"
                                                class="btn btn-sm btn-soft-danger"><i
                                                    class="fa-solid fa-trash"></i></button>
                                        </form>
                                    </td><!-- control -->

                                    <td>
                                        <?php echo e($row->name); ?>

                                    </td><!--  -->

                                    <td>
                                        <?php echo e($row->phone); ?>

                                    </td><!--  -->

                                    <td>

                                        <?php if($row->call_type == 'كلاهما'): ?>
                                            <span class="badge badge-light">واتساب</span>
                                            <span class="badge badge-light">اتصال هاتفي</span>
                                        <?php else: ?>
                                            <span class="badge badge-light"><?php echo e($row->call_type); ?></span>
                                        <?php endif; ?>

                                    </td><!-- call type -->

                                    <td>
                                        <?php echo e($row->city); ?> ,
                                        <?php echo e($row->region); ?>

                                    </td><!--  -->

                                    <td>
                                        <?php echo e($row->deal_type); ?> ,
                                        <?php echo e($row->build_type); ?>

                                    </td><!--  -->

                                    <td>
                                        <?php echo e($row->room_numbers); ?>

                                    </td><!--  -->


                                    <td>
                                        <?php echo e($row->area_in_metres); ?> متر
                                    </td><!--  -->

                                    <td>
                                        <?php echo e($row->price); ?> ريال
                                    </td><!--  -->

                                    <td>
                                        <?php echo e($row->payment_type); ?>

                                    </td><!--  -->

                                    <td>
                                        <?php echo e(parseTime($row->created_at)); ?>

                                    </td><!--  -->
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>

                    </table>
                </div>
            <?php endif; ?>
        <?php else: ?>
            <div class="box py-5 text-center">
                <img class="w128" src="<?php echo e(asset('dashboard/images/empty-folder.png')); ?>" alt="">
                <h4 class=" text-center my-3">لم يتم إرسال طلبات اسعار حتى الان !</h4>
            </div>

        <?php endif; ?>


    </section><!-- end section -->

    <button id="export" class="btn btn-success mb-5">إستخراج Excel</button>

<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
    <script src="https://cdn.jsdelivr.net/gh/rainabba/jquery-table2excel@1.1.0/dist/jquery.table2excel.min.js"></script>
    <script>
        $("#export").click(function() {
            $("#myTable").table2excel({
                // exclude CSS class
                exclude: ".noExl",
                name: "Worksheet Name",
                filename: "DataFile", //do not include extension
                fileext: ".xlsx" // file extension
            });
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('dashboard.layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\wjhatna\resources\views/dashboard/requests/index.blade.php ENDPATH**/ ?>