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

    <div class="dashboard_main">
        <div class="factor_sec mx-auto">
            <div class="dashboard_main_container_style  mx-auto mb-4">
                <h5 class="dashboard_main_container_style_header"> خدمت مربوطه</h5>
                <div class="data_text d-flex flex-wrap mb-md-0">
                    <div class="col-sm-3 align-items-center col-6 d-flex flex-column mb-3 mb-md-0">
                        <span class="text-muted small ">عنوان</span>
                        <span class="text-dark"><?php echo e($order->service->name); ?></span>
                    </div>
                    <div class="col-sm-3 align-items-center col-6 d-flex flex-column mb-3 mb-md-0">
                        <span class="text-muted small ">کد سفارش</span>
                        <span class="text-dark persianumber"><?php echo e($order->code); ?></span>
                    </div>
                    <div class="col-sm-3 align-items-center col-6 d-flex flex-column mb-3 mb-md-0">
                        <span class="text-muted small ">متخصص</span>
                        <span class="text-dark"><?php echo e($order->expert->name ?? 'بی نام'); ?></span>
                    </div>
                    <div class="col-sm-3 align-items-center col-6 d-flex flex-column mb-3 mb-md-0">
                        <span class="text-muted small ">قیمت کل</span>
                        <span class="text-dark persianumber"><?php echo e($order->price); ?> تومان</span>
                    </div>
                </div>
            </div>
            <div class="dashboard_main_container_style  mx-auto">
                <h5 class="dashboard_main_container_style_header">فاکتور نهایی</h5>
                <div
                    class="alert alert-secondary  m-1 mb-2 <?php if( $errors->any() || session()->has('status')): ?> <?php else: ?> d-none <?php endif; ?> "
                    role="alert">
                    <?php if($errors->any()): ?>
                        <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php echo e($error); ?><br>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php endif; ?>
                    <?php if(session()->has('status')): ?>
                        <?php echo e(session()->get('status')); ?>

                    <?php endif; ?>
                </div>
                <div class="table_custom mx-auto">

                    <?php if(is_array($order->meta) && array_key_exists('factor',$order->meta)): ?>
                        <table>
                            <caption class="d-none">فاکتور مربوطه</caption>
                            <thead>
                            <tr>
                                <th scope="col">عنوان</th>
                                <th scope="col">واحد</th>
                                <th scope="col">قیمت(تومان)</th>
                                <th scope="col">تخفیف خالص(تومان)</th>
                                <th scope="col">تخفیف درصدی(٪)</th>
                                <th scope="col">شمارش</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $__currentLoopData = $order->meta['factor']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                                <tr>
                                    <td data-label="عنوان">
                                        <?php echo e($item['name']); ?>

                                    </td>
                                    <td data-label="واحد" class="persianumber">
                                        <?php echo e($item['unit']); ?>

                                    </td>
                                    <td data-label="قیمت(تومان)" class="persianumber">
                                        <?php echo e($item['price']); ?>

                                    </td>
                                    <td data-label="تخفیف خالص(تومان)" class="persianumber">
                                        <?php echo e($item['discount_pure'] ?? '-'); ?>

                                    </td>
                                    <td data-label="تخفیف درصدی(٪)" class="persianumber">
                                        <?php echo e($item['discount_percent'] ?? '-'); ?>

                                    </td>
                                    <td data-label="شمارش" class="persianumber">
                                        <?php echo e($item['count']); ?>

                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php elseif(in_array($order->status,[\Mehrab\OrderService\Models\OrderService::DONE,\Mehrab\OrderService\Models\OrderService::DONE_AND_WAITING_FEEDBACK_FOR_EXPERT,\Mehrab\OrderService\Models\OrderService::WAITING_PAYMENT])): ?>
                                <ul class="list-group p-0 small">
                                    <li class="list-group-item d-flex justify-content-between">
                                        <span class="persianumber">کد رهگیری سفارش</span>
                                        <span class="persianumber"><?php echo e($order->code); ?></span>
                                    </li>
                                    <li class="list-group-item d-flex justify-content-between">
                                        <span>خدمت مد نظر</span>
                                        <span><?php echo e($order->service->name); ?></span>
                                    </li>
                                    <li class="list-group-item d-flex justify-content-between">
                                        <span>هزینه(تومان)</span>
                                        <span class="persianumber"><?php echo e($order->getPrice()); ?></span>
                                    </li>
                                    <?php if(is_array($order->meta) &&  array_key_exists('start_work',$order->meta)): ?>
                                        <li class="list-group-item d-flex justify-content-between">
                                            <span>زمان شروع کار</span>
                                            <span
                                                class="persianumber"><?php echo e(IR_TimestampToDate($order->meta['start_work'])); ?></span>
                                        </li>
                                    <?php endif; ?>
                                    <?php if(is_array($order->meta) && array_key_exists('end_work',$order->meta)): ?>
                                        <li class="list-group-item d-flex justify-content-between">
                                            <span>زمان پایان کار</span>
                                            <span
                                                class="persianumber"><?php echo e(IR_TimestampToDate($order->meta['end_work'])); ?></span>
                                        </li>
                                    <?php endif; ?>
                                </ul>

                            <?php else: ?>
                                <div class="alert alert-primary" role="alert">
                                    فاکتوری ثبت نشده است !
                                </div>
                            <?php endif; ?>
                            </tbody>
                        </table>
                </div>
                <?php if($order->status == \Mehrab\OrderService\Models\OrderService::WAITING_PAYMENT): ?>
                    <form method="post" action="<?php echo e(route('service_order_front.do_payment',$order->id)); ?>">
                        <div class="btnsPayment d-sm-flex justify-content-between mt-2">
                            <div class="col-sm-6 p-2">
                                <button class="btn btn-block" type="submit" name="paymentMethod" value="onlinePayment">
                                    پرداخت آنلاین
                                </button>
                            </div>
                            <?php if($order->getCanCashPayment()): ?>
                                <div class="col-sm-6 p-2">
                                    <button class="btn btn-block" type="submit" name="paymentMethod"
                                            value="cashPayment">پرداخت نقدی
                                    </button>
                                </div>
                            <?php endif; ?>
                        </div>
                        <?php echo csrf_field(); ?>
                    </form>
                <?php endif; ?>
            </div>

        </div>
    </div>



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

<?php echo $__env->make("Front::Layout.Panel.master", \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/foroshg1/laravel/Modules/Mehrab/Front/Providers/../Resources/Views//Panel/factor.blade.php ENDPATH**/ ?>