<?php if (isset($component)) { $__componentOriginalfcbcb094a4e25784fc05a845b0fe2686439b0eb5 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\AdminPanelLayout::class, []); ?>
<?php $component->withName('admin-panel-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
     <?php $__env->slot('title'); ?>
        اتمام کار خدمت
     <?php $__env->endSlot(); ?>
     <?php $__env->slot('linkCss'); ?>
        <link rel="stylesheet" href="<?php echo e(asset('adminPanel/dist/css/bootstrap-table.min.css')); ?>">
     <?php $__env->endSlot(); ?>
     <?php $__env->slot('linkScript'); ?>
        <script src="<?php echo e(asset('adminPanel/dist/js/bootstrap-table.min.js')); ?>"></script>
     <?php $__env->endSlot(); ?>
     <?php $__env->slot('main'); ?>
        <!-- Checked checkbox -->
        <div class="content-header">
            <div class="container-fluid">
                <div class="row mb-2">
                    <div class="col-sm-6">
                        <h1 class="m-0 text-dark">اتمام کار خدمت</h1>
                    </div><!-- /.col -->
                    <div class="col-sm-6">
                        <ol class="breadcrumb float-sm-left">

                            <li class="breadcrumb-item">مدیریت سفارشات خدمات</li>
                            <li class="breadcrumb-item active">اتمام کار خدمت</li>
                        </ol>
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.container-fluid -->
        </div>
        <section class="content mt-sm-3 col-md-10 mx-auto">
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">صدور فاکتور</h3>
                </div>
                <!-- /.card-header -->
                <div class="card-body p-0mx-auto my-2">
                    <ul class="list-group list-group-flush">
                        <li class="list-group-item d-flex justify-content-between">
                            <span>کد رهگیری سفارش</span>
                            <span><?php echo e($order->code); ?></span>
                        </li>
                        <li class="list-group-item d-flex justify-content-between">
                            <span>مشتری</span>
                            <span><?php echo e($order->user->mobile); ?> | id :<?php echo e($order->user->id); ?></span>
                        </li>
                        <li class="list-group-item d-flex justify-content-between">
                            <span>خدمت مد نظر</span>
                            <span><?php echo e($order->service->name); ?></span>
                        </li>
                        <?php if($order->price != 0): ?>
                            <li class="list-group-item d-flex justify-content-between">
                                <span>هزینه</span>
                                <span><?php echo e($order->getPrice()); ?></span>
                            </li>
                        <?php endif; ?>
                        <li class="list-group-item d-flex justify-content-between">
                            <span>تاریخ ثبت</span>
                            <span><?php echo e($order->created_at); ?></span>
                        </li>
                        <li class="list-group-item d-flex justify-content-between">
                            <span>زمان شروع کار</span>
                            <span><?php echo e(IR_TimestampToDate($order->meta['start_work'])); ?></span>
                        </li>
                        <li class="list-group-item d-flex justify-content-between">
                            <span>موعد انجام</span>
                            <span><?php echo e($order->time_todo); ?></span>
                        </li>
                    </ul>
                    <?php if($order->price != 0): ?>
                        <div class="d-flex justify-content-around mt-4" id="btnsActiveForm">
                            <a href="#"
                               class="btn btn-outline-info btn-sm col-md-5 mx-auto"
                               onclick="end_work_order_by_expert(event,'<?php echo e(route('end_work_order_by_expert',$order->id)); ?>')"
                            >
                                صدور فاکتور و اتمام کار
                            </a>
                        </div>
                        <div class="d-flex justify-content-around mt-3" id="btnsActiveForm">
                            <a href="#"
                               onclick="send_to_supporter_set_factor(event,'<?php echo e(route('send_to_supporter_set_factor',$order->id)); ?>')"
                               class="btn btn-warning col-md-5 mx-auto btn-sm">
                                ارجاع به پشتیبان
                            </a>
                        </div>

                    <?php endif; ?>
                </div>
            </div>
            <?php if($order->price == 0): ?>
            <div class="card mt-4 bg-light">
                    <div class="card-header">
                        <h3 class="card-title">نوشتن فاکتور</h3>
                    </div>
                    <!-- /.card-header -->
                    <div class="card-body p-0mx-auto my-2">
                        <form class="mx-auto" action="<?php echo e(route('end_work_order_by_expert_and_set_factor',$order->id)); ?>" method="post" id="factor_form">
                            <?php if($errors->any()): ?>
                               <small class="small text-danger">
                                   <?php echo implode('', $errors->all('<div>:message</div>')); ?>

                               </small>
                            <?php endif; ?>
                            <?php echo csrf_field(); ?>
                            <div class="form-group">
                                <select class="form-control"
                                        id="select_item_factor"
                                >
                                    <?php $__currentLoopData = $prices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $price): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option
                                            value="<?php echo e($price['name']); ?>"
                                            data-unit="<?php echo e($price['unit']); ?>"
                                            data-price="<?php echo e($price['price']); ?>"
                                            data-discount_pure="<?php echo e($price['discount_pure']); ?>"
                                            data-discount_percent="<?php echo e($price['discount_percent']); ?>"
                                            data-price_id="<?php echo e($key); ?>"
                                        >
                                            <?php echo e($price['name']); ?>

                                        </option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <button class="btn-block btn btn-sm btn-outline-info mb-2" id="btn_add_price">اضافه کردن</button>
                            <table class="table table-bordered small" id="table_factor">
                                <thead>
                                <tr>
                                    <td>عنوان</td>
                                    <td>واحد</td>
                                    <td>مبلغ</td>
                                    <td>تخفیف خالص</td>
                                    <td>تخفیف درصدی</td>
                                    <td>مقدار</td>
                                    <td>مبلغ</td>
                                    <td>عملیات</td>
                                </tr>
                                </thead>
                                <tbody id="table_factor_body">

                                </tbody>
                            </table>
                            <div class="mx-auto border mt-3 py-2 justify-content-around col-md-8 d-flex">
                                <span>هزینه نهایی</span>
                                <div>
                                    <span id="final_price">0</span>
                                    <span> تومان</span>
                                </div>
                            </div>
                            <div class="d-flex justify-content-around mt-4" id="btnsActiveForm">
                                <a href="#"
                                   class="btn btn-outline-info btn-sm col-md-5 mx-auto"
                                   onclick="end_work_order_by_expert_submit_form(event)"
                                >
                                    صدور فاکتور و اتمام کار
                                </a>
                            </div>
                            <div class="d-flex justify-content-around mt-3" id="btnsActiveForm">
                                <a href="#"
                                   onclick="send_to_supporter_set_factor(event,'<?php echo e(route('send_to_supporter_set_factor',$order->id)); ?>')"
                                   class="btn btn-warning col-md-5 mx-auto btn-sm">
                                    ارجاع به پشتیبان
                                </a>
                            </div>

                        </form>
                    </div>
                </div>
            <?php endif; ?>
                <!-- /.card-body -->
        </section>
     <?php $__env->endSlot(); ?>
    <?php if(session()->get('status') == 'done'): ?>
         <?php $__env->slot('linkScript'); ?>
            <script>
                Swal.fire({
                    icon: 'success',
                    text: 'ویرایش جزئیات سفارش با موفقیت انجام شد',
                })
            </script>
         <?php $__env->endSlot(); ?>
    <?php endif; ?>
    <?php if(session()->get('status') == 'failed'): ?>
         <?php $__env->slot('linkScript'); ?>
            <script>
                Swal.fire({
                    icon: 'error',
                    text: 'انتخاب سرتیم سفارش با خطا مواجه شد',
                })
            </script>
         <?php $__env->endSlot(); ?>
    <?php endif; ?>
 <?php if (isset($__componentOriginalfcbcb094a4e25784fc05a845b0fe2686439b0eb5)): ?>
<?php $component = $__componentOriginalfcbcb094a4e25784fc05a845b0fe2686439b0eb5; ?>
<?php unset($__componentOriginalfcbcb094a4e25784fc05a845b0fe2686439b0eb5); ?>
<?php endif; ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php /**PATH C:\wamp64\www\newer\Modules\Mehrab\OrderService\Providers/../Resources/Views//Admin/Expert/end_work_experts_order_service.blade.php ENDPATH**/ ?>
