<section class="content">
    <div class="box box-primary">
        <div class="box-body">
            <div class="row">

                <div class="col-lg-12">
                    <?php
                        $route = route('clients.create',['req'=>'ajax']);
                        $route2 = route('suppliers.create',['req'=>'ajax']);
                    ?>
                    <div class="form-group">
                        <label>العميل / المورد</label>
                        <div class="input-group">
                            <select id="personList" style="width: 100%;" class="form-control select2" name="client_id">
                                <option value="">-- إختر  --</option>
                                <?php $__currentLoopData = $persons; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option <?php echo e($ordertask->client_id==$p->id?'selected':''); ?> value="<?php echo e($p->id); ?>"> <?php echo e($p->name); ?> </option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                            <div style="padding: 1px 12px" class="input-group-addon no-print">
                                <a title="إضافة عميل جديد" style="padding: 1px 8px" class="btn btn-sm btn-primary external" href="<?php echo e($route); ?>" data-toggle="modal" data-target="#myModal">
                                    <i class="fa fa-2x fa-user"></i>
                                </a>
                            </div>
                            <div style="padding: 1px 12px" class="input-group-addon no-print">
                                <a title="إضافة مورد جديد" style="padding: 1px 8px" class="btn btn-sm btn-success external" href="<?php echo e($route2); ?>" data-toggle="modal" data-target="#myModal">
                                    <i class="fa fa-2x fa-truck"></i>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>


                <div class="col-lg-4">
                    <div class="form-group">
                        <label for="department_id">القسم</label>
                        <select style="width: 100%;" required class="form-control select2 departmentList" id="department_id" name="department_id">
                            <option value="">-- إختر القسم --</option>
                            <?php $__currentLoopData = $departments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $department): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option <?php echo e($ordertask->department_id==$department->id?'selected':''); ?> value="<?php echo e($department->id); ?>"> <?php echo e($department->name); ?> </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group">
                        <label for="task_id">المهمة</label>
                        <select required class="form-control " id="task_id" name="mission_id">
                            <option value="">-- إختر المهمة --</option>
                            <?php $__currentLoopData = $tasks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $task): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option <?php echo e($ordertask->mission_id==$task->id?'selected':''); ?> class="depart<?php echo e($task->department_id); ?> optionelm" value="<?php echo e($task->id); ?>"> <?php echo e($task->title); ?> </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                </div>
                <div class="col-lg-4">
                    <div class="form-group">
                        <label for="user_id">المسئول عن المهمة</label>
                        <select required class="form-control " id="user_id" name="user_id">
                            <option rel="" value="">-- إختر المسئول --</option>
                            <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $user): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php
                                    $depclass=$user->dep_id?implode('dep ',$user->dep_id):'';
                                ?>
                                <option <?php echo e($ordertask->user_id==$user->id?'selected':''); ?> class="optionelm <?php echo e($depclass); ?>" value="<?php echo e($user->id); ?>"> <?php echo e($user->name); ?> </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                </div>

                <div class="col-lg-6">
                    <div class="form-group">
                        <?php
                            $statusList = ['معلق','مراجعة','رفض','قبول'];
                        ?>
                        <label for="status">الحالة</label>
                        <select name="status" id="status" class="form-control" required="">
                            
                            <?php $__currentLoopData = $statusList; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $status): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option <?php echo e($ordertask->status==$status?'selected':''); ?> value="<?php echo e($status); ?>"> <?php echo e($status); ?> </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label>التاريخ</label>
                        <div class="input-group date">
                            <div class="input-group-addon">
                                <i class="fa fa-calendar"></i>
                            </div>
                            <input name="notifcation_date" type="text" value="<?php echo e(($ordertask->notifcation_date)??date('Y-m-d')); ?>" id="datepicker" class="form-control pull-right ">
                        </div>
                        <!-- /.input group -->
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="form-group">
                        <label>تفاصيل</label>
                        <textarea name="note" cols="15" rows="5" class="form-control"><?php echo e($ordertask->note); ?></textarea>
                    </div>
                </div>

                <div class="form-group col-md-12">
                    <label for="Logo">الصور والمرفقات</label>
                    <input multiple name="images[]" type="file" class="form-control" id="Logo">
                    <div class="row">
                        <?php $__currentLoopData = $ordertask->getMedia('images'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $m): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="mt-2 col-md-2 imageContainer">
                                <a href="<?php echo e($m->getUrl()); ?>" target="_blank">
                                    <img width="100px" src="<?php echo e($m->getUrl()); ?>"/>
                                </a>
                                <a class="btn btn-danger btn-sm deleteImg" rel="<?php echo e($m->id); ?>" href="#"><i class="fa fa-trash close_button"></i></a>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                </div>
            </div>
        </div>
        <!-- /.box-body -->
        <div class="box-footer">
            <button type="submit" class="btn btn-primary">حفظ</button>
        </div>
    </div>
</section>
<?php $__env->startPush('js'); ?>
<script>
    $(".departmentList,.select2").select2();

    $('#datepicker').datepicker({
        autoclose: true,
        rtl: true,
        format: 'yyyy-mm-dd',
        language: "ar",
    });
    $(document).on("change",'.departmentList',function(e){
            var value = $(this).val();
            if(value){
                $(".optionelm").hide();
                $(".depart"+value).show();
                $("."+value).show();
                $("."+value+"dep").show();
            }

    });
    $(".departmentList").trigger("change");
</script>
<?php $__env->stopPush(); ?>
<?php /**PATH /home/mwarsha2023/public_html/test4.mwarsha.com/resources/views/order_task/_form.blade.php ENDPATH**/ ?>