<?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>
                        <?php if($order->meta['end_work']): ?>
                            <li class="list-group-item d-flex justify-content-between">
                                <span>زمان پایان کار</span>
                                <span><?php echo e(IR_TimestampToDate($order->meta['end_work'])); ?></span>
                            </li>
                        <?php endif; ?>
                        <li class="list-group-item d-flex justify-content-between">
                            <span>موعد انجام</span>
                            <span><?php echo e($order->time_todo); ?></span>
                        </li>
                    </ul>
                </div>
            </div>
            <?php if($order->meta['factor']): ?>
                <div class="card">
                    <div class="card-header">
                        <h3 class="card-title">فاکتور کنونی</h3>
                    </div>
                    <p class="p-2 mb-0 mt-2">
                        ثبت شده توسط <?php echo app('translator')->get($order->meta['end_role']); ?> <?php echo e($order->meta['end_id']); ?>

                    </p>
                    <!-- /.card-header -->
                    <div class="card-body p-0mx-auto pt-0 my-2">
                        <table class="table table-bordered small">
                            <thead>
                            <tr class="bg-info border-info">
                                <td>عنوان</td>
                                <td>واحد</td>
                                <td>مبلغ واحد</td>
                                <td>تخفیف خالص</td>
                                <td>تخفیف درصدی</td>
                                <td>تعداد</td>
                                <td>مبلغ</td>
                            </tr>
                            </thead>
                            <tbody>
                            <?php $__currentLoopData = $order->meta['factor']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e($item['name']); ?></td>
                                    <td><?php echo e($item['unit']); ?></td>
                                    <td><?php echo e($item['price']); ?></td>
                                    <td><?php echo e($item['discount_pure']); ?></td>
                                    <td><?php echo e($item['discount_percent']); ?></td>
                                    <td><?php echo e($item['count']); ?></td>
                                    <td class="main_factor_amount"><?php echo e($item['amount']); ?></td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td scope="1" colspan="7" rowspan="1" class="text-center">
                                    <span class="mx-2">مبلغ کل</span>
                                    <span><?php echo e($order->price); ?></span>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            <?php endif; ?>


            <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="#"
                          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">

                            <div class="form-row align-items-center mb-3">
                                <div class="col-auto">
                                    <input type="text" class="form-control mb-2" id="custom_title"
                                           placeholder="عنوان" >
                                </div>
                                <div class="col-auto">
                                    <input type="text" class="form-control mb-2" id="custom_unit"
                                           placeholder="واحد">
                                </div>
                                    <div class="col-auto">
                                        <input type="text" class="form-control mb-2" id="custom_price"
                                               placeholder="مبلغ">
                                </div>
                                <div class="col-auto">
                                        <input type="text" class="form-control mb-2" id="custom_discount_pure"
                                               placeholder="تخفیف خالص">
                                </div>
                                <div class="col-auto">
                                        <input type="text" class="form-control mb-2" id="custom_discount_percent"
                                               placeholder="تخفیف درصدی">
                                </div>
                                <div class="col-auto">
                                    <button type="submit" class="btn btn-primary mb-2" id="custom_add_fields">اضافه شود</button>
                                </div>
                            </div>

                            <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_factor_admin_submit_form(event,'<?php echo e(route("set_factor_order_by_factor_admin",$order->id)); ?>')"
                            >
                                صدور فاکتور و اتمام کار
                            </a>
                        </div>

                    </form>
                </div>
            </div>

        <!-- /.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/FactorAdmin/end_work_factor_admin_order_service.blade.php ENDPATH**/ ?>
