<?php if (isset($component)) { $__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\MasterLayout::class, []); ?>
<?php $component->withName('master-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <div class="card card-block card-stretch card-height">
                <div class="card-header d-flex justify-content-between">
                    <div class="header-title">
                        <h4 class="card-title mb-0"><?php echo e($pageTitle ?? ''); ?></h4>

                    </div>
                    <?php echo $__env->make('report.reportofdeliverymanfilter', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                </div>
                <div class="card-body">
                    <?php if(count($orders) > 0): ?>
                        <table id="basic-table" class="table mb-1 border-1 text-center" role="grid" style="display: none;">
                            <thead>
                                <tr>
                                    <th scope='col'><?php echo e(__('message.id')); ?></th>
                                    <th scope='col'><?php echo e(__('message.order_id')); ?></th>
                                    <th scope='col'><?php echo e(__('message.client')); ?></th>
                                    <th scope='col'><?php echo e(__('message.delivery_man')); ?></th>
                                    <th scope='col'><?php echo e(__('message.total_amount')); ?></th>
                                    <th scope='col'><?php echo e(__('message.pickup_date_time')); ?></th>
                                    <th scope='col'><?php echo e(__('message.delivery_date_time')); ?></th>
                                    <th scope='col'><?php echo e(__('message.commission_type')); ?></th>
                                    <th scope='col' class="text-center"><?php echo e(__('message.admin_commission')); ?></th>
                                    <th scope='col' class="text-center"><?php echo e(__('message.delivery_man_commission')); ?></th>
                                    <th scope='col'><?php echo e(__('message.created_at')); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__currentLoopData = $orders; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $order): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><?php echo e($loop->iteration); ?></td>
                                        <td><a href="<?php echo e(route('order.show', $order->id)); ?>"><?php echo e($order->id); ?></a></td>
                                        <td><a href="<?php echo e(route('users.show', $order)); ?>"><?php echo e(optional($order->client)->name ?? '-'); ?></a></td>
                                        <td><a href="<?php echo e(route('users.show', $order)); ?>"><?php echo e(optional($order->delivery_man)->name ?? '-'); ?></a></td>
                                        <td class="text-center"><?php echo e(getPriceFormat($order->total_amount) ?? 0); ?></td>
                                        <td> <?php echo e(dateAgoFormate($order->pickup_datetime) ?? '-'); ?></td>
                                        <td><?php echo e(dateAgoFormate($order->delivery_datetime) ?? '-'); ?></td>
                                        <?php
                                            $commission_type = optional($order)->city->commission_type ?? '-' ;
                                            $admin_commission = optional($order)->payment->admin_commission ?? 0 ;
                                            $deliveryman_commission = optional($order)->payment->delivery_man_commission ?? 0 ;
                                        ?>
                                        <td class="text-center text-capitalize"><?php echo e($commission_type); ?></td>
                                        <td class="text-center text-capitalize"><?php echo e(getPriceFormat($admin_commission)); ?></td>
                                        <td class="text-center text-capitalize"><?php echo e(getPriceFormat($deliveryman_commission)); ?></td>
                                        <td><?php echo e(dateAgoFormate($order->created_at) ?? '-'); ?></td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                            <tfoot>
                                <tr>
                                    <td class="font-weight-bold"><?php echo e(__('message.total_amount')); ?></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td class="text-center font-weight-bold"><?php echo e(getPriceFormat($totalAmountorder) ?? '-'); ?></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td class="text-center font-weight-bold"><?php echo e(getPriceFormat($totalAdminSum) ?? '-'); ?></td>
                                    <td class="text-center font-weight-bold"><?php echo e(getPriceFormat($totaldeliverymanSum) ?? '-'); ?></td>
                                    <td></td>

                                </tr>
                            </tfoot>
                        </table>
                    <?php else: ?>
                        <div class ="text-center"><?php echo e(__('message.no_record_found')); ?></div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->startSection('bottom_script'); ?>
<script>
    document.addEventListener('DOMContentLoaded', function() {
        const deliveryman = "<?php echo e(request('delivery_man_id')); ?>";
        const table = document.getElementById('basic-table');

        if (deliveryman) {
            table.style.display = 'table';
            $("#basic-table").DataTable({
                "dom": '<"row align-items-center"<"col-md-2"><"col-md-6" B><"col-md-4" f>><"table-responsive my-3" rt><"d-flex"<"flex-grow-1" l><"" i><"" p>><"clear">',
                language: {
                    search: '',
                    searchPlaceholder: "<?php echo e(__('pagination.search')); ?>",
                    lengthMenu : "<?php echo e(__('pagination.show'). ' _MENU_ ' .__('pagination.entries')); ?>",
                    zeroRecords: "<?php echo e(__('pagination.no_records_found')); ?>",
                    info: "<?php echo e(__('pagination.showing') .' _START_ '.__('pagination.to') .' _END_ ' . __('pagination.of').' _TOTAL_ ' . __('pagination.entries')); ?>", 
                    infoFiltered: "<?php echo e(__('pagination.filtered_from_total') . ' _MAX_ ' . __('pagination.entries')); ?>",
                    infoEmpty: "<?php echo e(__('pagination.showing_entries')); ?>",
                    paginate: {
                        previous: "<?php echo e(__('pagination.__previous')); ?>",
                        next: "<?php echo e(__('pagination.__next')); ?>"
                    }
                },
                "order": [[0, "desc"]]
            });
        }

        document.querySelector('.clearListPropertynumber').addEventListener('click', function() {
            document.querySelector('input[name="delivery_man_id"]').value = null;
            document.getElementById('filter-form').submit();
        });
    });
</script>

<?php $__env->stopSection(); ?>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23)): ?>
<?php $component = $__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23; ?>
<?php unset($__componentOriginalc6e081c8432fe1dd6b4e43af4871c93447ee9b23); ?>
<?php endif; ?>
<?php /**PATH /www/wwwroot/mxunzo.mimeld.com/resources/views/report/reportofdeliveryman.blade.php ENDPATH**/ ?>