<?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.deliverymandatefilter', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                </div>
                <div class="card-body">
                    <div class="card-header-toolbar">

                    </div>
                    <table id="basic-table" class="table mb-1 border-1  text-center" role="grid">
                        <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.user')); ?></th>
                                <th scope='col'><?php echo e(__('message.delivery_man')); ?></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.total_amount')); ?></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 if(count($orders) > 0): ?>
                            <?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)); ?>"><?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> <?php echo e(dateAgoFormate($order->pickup_datetime) ?? '-'); ?></td>
                                    <td><?php echo e(dateAgoFormate($order->delivery_datetime) ?? '-'); ?></td>
                                    <td class="text-center"><?php echo e(getPriceFormat($order->total_amount) ?? 0); ?></td>
                                    <?php
                                        $commission_type = optional($order)->city->commission_type ?? '-' ;
                                        $deliveryman_commission = optional($order)->payment->delivery_man_commission ?? 0 ;
                                        $admin_commission = optional($order)->payment->admin_commission ?? 0 ;
                                        // $formatted_commission = $commission_type == 'percentage' ? getPriceFormat($deliveryman_commission) . ' %' : ($commission_type == 'fixed' ? getPriceFormat($deliveryman_commission) . ' fixed' : '-');
                                    ?>
                                    <td class="text-center text-capitalize"><?php echo e($commission_type); ?></td>
                                    <td class="text-center"><?php echo e(getPriceFormat($admin_commission)); ?></td>
                                    <td class="text-center "><?php echo e(getPriceFormat($deliveryman_commission)); ?></td>
                                    <td><?php echo e(dateAgoFormate($order->created_at) ?? '-'); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php else: ?>
                            <tr>
                                <td colspan="7"><?php echo e(__('message.no_record_found')); ?></td>
                            </tr>
                        <?php endif; ?>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td class="font-weight-bold"><?php echo e(__('message.total_amount')); ?></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td class="text-center font-weight-bold"><?php echo e(getPriceFormat($totalAmountorder) ?? '-'); ?></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($totaldeliverymanAmountSum)); ?></td>
                                <td></td>

                            </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->startSection('bottom_script'); ?>
    <script>
        $("#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><"p-2" i><"mt-4" p>><"clear">',
            "order": [[0, "desc"]]
        });
    </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/deliverymanreport.blade.php ENDPATH**/ ?>