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

  <title><?php echo e(trans('admin.Missions')); ?></title>

    <main id="js-page-content" role="main" class="page-content">
                    <ol class="breadcrumb page-breadcrumb">
                        <li class="breadcrumb-item"><a href="javascript:void(0);"> <?php echo e(trans('admin.CRM')); ?></a></li>
                        <li class="breadcrumb-item active"><?php echo e(trans('admin.Missions')); ?></li>
                        <li class="position-absolute pos-top pos-right d-none d-sm-block"><span
                                class="js-get-date"></span></li>
                    </ol>

                    <div class="row">
                        <div class="col-xl-12">
                            <div id="panel-1" class="panel">
                                <div class="panel-hdr">
                                    <h2>
                                         <span class="fw-300"><i><?php echo e(trans('admin.Missions')); ?></i></span>
                                    </h2>

                                    <div class="panel-toolbar">
                                           <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('اضافه مهمه')): ?>
                                        <button type="button" class="btn btn-default" data-toggle="modal" data-target="#default-example-modal-lg"><?php echo e(trans('admin.AddNew')); ?></button>
                                         <?php endif; ?>

                                        <button class="btn btn-primary btn-sm mx-3" data-toggle="dropdown">Table Style</button>

                                               <?php echo $__env->make('admin.layouts.toolbar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                    </div>

                                </div>
                                <div class="panel-container show">
                                   <span id="ex"> <?php echo $__env->make('admin.layouts.messages', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?></span>
                                    <div class="panel-content">
                                        <!-- datatable start -->
                                        <div style="overflow:auto;">
                                        <table id="dt-basic-example"
                                            class="table table-bordered table-hover table-striped " >
                                            <thead class="bg-highlight">
                                                <tr>
                                                    <th><?php echo e(trans('admin.Arabic_Name')); ?></th>
                                                    <th><?php echo e(trans('admin.English_Name')); ?></th>
                                                    <th><?php echo e(trans('admin.Start_Date')); ?></th>
                                                    <th><?php echo e(trans('admin.End_Date')); ?></th>
                                                    <th><?php echo e(trans('admin.Duration')); ?></th>
                                                    <th><?php echo e(trans('admin.Value')); ?></th>
                                                    <th><?php echo e(trans('admin.File')); ?></th>
                                                    <th><?php echo e(trans('admin.Task_Owner')); ?></th>
                                                    <th><?php echo e(trans('admin.Observer')); ?></th>
                                                    <th><?php echo e(trans('admin.Project')); ?></th>
                                                    <th><?php echo e(trans('admin.Desc')); ?></th>
                                                    <th><?php echo e(trans('admin.User')); ?></th>
                                                    <th><?php echo e(trans('admin.Actions')); ?></th>

                                                </tr>
                                            </thead>
                                            <tbody>

                                            <?php $__currentLoopData = $items; $__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->NameEn); ?></td>
                                                    <td><?php echo e($item->Start_Date); ?></td>
                                                    <td><?php echo e($item->End_Date); ?></td>
                                                    <td><?php echo e($item->Duration); ?></td>
                                                    <td><?php echo e($item->Value); ?></td>
                                                    <td>
                                                    <?php if(!empty($item->File)): ?>
                 <a class="btn btn-primary" href="<?php echo e(URL::to($item->File)); ?>" download><i class="fal fa-download"></i></a>
                                                    <?php else: ?>
                                                        <?php echo e(trans('admin.Not_Found')); ?>

                                                    <?php endif; ?>
                                                    </td>
                                                    <td>
                                                        <?php if(!empty($item->Task_Owner()->first()->Name)): ?>
                                                     <?php echo e(app()->getLocale() == 'ar' ?$item->Task_Owner()->first()->Name :$item->Task_Owner()->first()->NameEn); ?>

                                                        <?php endif; ?>
                                                    </td>
                                                    <td>
                                                        <?php if(!empty($item->Observer()->first()->Name)): ?>
                                                     <?php echo e(app()->getLocale() == 'ar' ?$item->Observer()->first()->Name :$item->Observer()->first()->NameEn); ?>

                                                        <?php endif; ?>
                                                    </td>
                                                    <td>
                                                        <?php if(!empty($item->Project()->first()->Name)): ?>
                                                     <?php echo e(app()->getLocale() == 'ar' ?$item->Project()->first()->Name :$item->Project()->first()->NameEn); ?>

                                                        <?php endif; ?>
                                                    </td>

                                                    <td>

                                       <button type="button" class="btn btn-default" data-toggle="modal" data-target="#Desc<?php echo e($item->id); ?>"><?php echo e(trans('admin.Desc')); ?></button>
                                                    </td>
                                 <td><?php echo e($item->User()->first()->name); ?></td>
                                                    <td class="text-center">

                                    <?php if($item->Status == 0): ?>
                                          <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('حذف مهمه')): ?>
                      <button type="button" class="btn btn-default" data-toggle="modal" data-target="#default-example-modal-center<?php echo e($item->id); ?>"><i class="fal fa-trash"></i></button>
                                   <?php endif; ?>
                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('تعديل مهمه')): ?>
                         <button type="button" class="btn btn-default" data-toggle="modal" data-target="#default-example-modal-lg-edit<?php echo e($item->id); ?>"><i class="fal fa-edit"></i></button>
                        <?php endif; ?>


                <a class="btn btn-primary" href="<?php echo e(url('SureMission/'.$item->id)); ?>"><i class="fal fa-check"></i></a>
                                        <?php endif; ?>

                                           <?php if($item->Status == 2): ?>
                            <button type="button" class="btn btn-default" data-toggle="modal" data-target="#Accept<?php echo e($item->id); ?>"><i class="fal fa-thumbs-up"></i></button>
                                            <?php endif; ?>


                                                    </td>
                                                </tr>
                                             <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                                            </tbody>
                                            <tfoot>
                                                <tr>
                                                    <th><?php echo e(trans('admin.Arabic_Name')); ?></th>
                                                    <th><?php echo e(trans('admin.English_Name')); ?></th>
                                                    <th><?php echo e(trans('admin.Start_Date')); ?></th>
                                                    <th><?php echo e(trans('admin.End_Date')); ?></th>
                                                    <th><?php echo e(trans('admin.Duration')); ?></th>
                                                    <th><?php echo e(trans('admin.Value')); ?></th>
                                                    <th><?php echo e(trans('admin.File')); ?></th>
                                                    <th><?php echo e(trans('admin.Task_Owner')); ?></th>
                                                    <th><?php echo e(trans('admin.Observer')); ?></th>
                                                    <th><?php echo e(trans('admin.Project')); ?></th>
                                                    <th><?php echo e(trans('admin.Desc')); ?></th>
                                                    <th><?php echo e(trans('admin.User')); ?></th>
                                                    <th><?php echo e(trans('admin.Actions')); ?></th>
                                                </tr>
                                            </tfoot>
                                        </table>
                                        </div>
                                        <?php echo e($items->Links()); ?>

                                        <!-- datatable end -->
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Modal Add-->
            <div class="modal fade" id="default-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true">
                        <div class="modal-dialog modal-lg" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h5 class="modal-title"><?php echo e(trans('admin.AddNew')); ?>  </h5>

                                      <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                    </button>

                                </div>
                                <div class="modal-body">
                                    <form action="<?php echo e(url('AddMissions')); ?>" method="post">
                                        <?php echo csrf_field(); ?>

                                              <?php echo view('honeypot::honeypotFormFields'); ?>
                                        <div class="form-row">
                                        <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Arabic_Name')); ?></label>
              <input type="text" name="Name"  value="<?php echo e(old('Name')); ?>" class="form-control" required >
                                        </div>

                                            <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.English_Name')); ?></label>
              <input type="text" name="NameEn"  value="<?php echo e(old('NameEn')); ?>" class="form-control"  >
                                        </div>

                                 <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Project')); ?></label>
              <select class="select2 form-control"  name="Project" required>
                                <option value=""><?php echo e(trans('admin.Project')); ?></option>
                                            <?php $__currentLoopData = $Projects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $proj): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($proj->id); ?>">
                   <?php echo e(app()->getLocale() == 'ar' ?$proj->Name :$proj->NameEn); ?>

                  </option>
                                           <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>

                                        <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Start_Date')); ?></label>
            <input type="date" name="Start_Date" id="Start_Date"  value="<?php echo e(date('Y-m-d')); ?>" onchange="Dif()" class="form-control" required >
                                        </div>
                                              <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.End_Date')); ?></label>
            <input type="date" name="End_Date" id="End_Date"  value="<?php echo e(date('Y-m-d')); ?>" onchange="Dif()" class="form-control" required >
                                        </div>

                                                <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Duration')); ?></label>
                                                    <input type="text"  id="Duration"  class="form-control" disabled >
                                                    <input type="hidden" name="Duration" id="DurationHide">
                                        </div>

                                            <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Value')); ?></label>
            <input type="number" step="any" name="Value"   value="<?php echo e(old('Value')); ?>"  class="form-control" required >
                                        </div>

                                                                  <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Task_Owner')); ?></label>
              <select class="select2 form-control"  name="Task_Owner" required>
                                <option value=""><?php echo e(trans('admin.Task_Owner')); ?></option>
                                            <?php $__currentLoopData = $Employess; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $emp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($emp->id); ?>">
                    <?php echo e(app()->getLocale() == 'ar' ?$emp->Name :$emp->NameEn); ?>

                  </option>
                                           <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>

                                      <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Observer')); ?></label>
              <select class="select2 form-control"  name="Observer" required>
                                <option value=""><?php echo e(trans('admin.Observer')); ?></option>
                                            <?php $__currentLoopData = $Employess; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $emp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($emp->id); ?>">
                      <?php echo e(app()->getLocale() == 'ar' ?$emp->Name :$emp->NameEn); ?>

                  </option>
                                           <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>
                                      <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Desc')); ?></label>
            <input type="text" name="Desc"   value="<?php echo e(old('Desc')); ?>"  class="form-control">
                                        </div>





                                                           <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.File')); ?></label>
            <input type="file" name="File" >
                                        </div>

                                        </div>
                                    <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo e(trans('admin.Close')); ?></button>
                                    <button type="submit" class="btn btn-primary"> <?php echo e(trans('admin.Save')); ?></button>
                                </div>
                                    </form>
                                </div>

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


         <?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
             <!-- Modal Edit-->
                    <div class="modal fade" id="default-example-modal-lg-edit<?php echo e($item->id); ?>" tabindex="-1" role="dialog" aria-hidden="true">
                        <div class="modal-dialog modal-lg" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h5 class="modal-title"><?php echo e(trans('admin.Edit')); ?>  </h5>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                    </button>
                                </div>
                                <div class="modal-body">
                                    <form action="<?php echo e(url('EditMissions/'.$item->id)); ?>" method="post">
                                        <?php echo csrf_field(); ?>

                                              <?php echo view('honeypot::honeypotFormFields'); ?>
                            <input type="hidden" name="Files" value="<?php echo e($item->File); ?>">

                                         <div class="form-row">
                                        <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Arabic_Name')); ?></label>
              <input type="text" name="Name"  value="<?php echo e($item->Name); ?>" class="form-control" required >
                                        </div>

                                             <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.English_Name')); ?></label>
              <input type="text" name="NameEn"  value="<?php echo e($item->NameEn); ?>" class="form-control" required >
                                        </div>

                                       <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Project')); ?></label>
              <select class="select2 form-control"  name="Project" required>
                                <option value=""><?php echo e(trans('admin.Project')); ?></option>
                                            <?php $__currentLoopData = $Projects; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $proj): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($proj->id); ?>" <?php if($item->Project == $proj->id): ?> selected <?php endif; ?>>   <?php echo e(app()->getLocale() == 'ar' ?$proj->Name :$proj->NameEn); ?></option>
                                           <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>

                                        <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Start_Date')); ?></label>
            <input type="date" name="Start_Date" id="Start_Date<?php echo e($item->id); ?>"  value="<?php echo e($item->Start_Date); ?>" onchange="Diff(<?php echo e($item->id); ?>)" class="form-control" required >
                                        </div>
                                              <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.End_Date')); ?></label>
            <input type="date" name="End_Date" id="End_Date<?php echo e($item->id); ?>"  value="<?php echo e($item->End_Date); ?>" onchange="Diff(<?php echo e($item->id); ?>)" class="form-control" required >
                                        </div>

                                                <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Duration')); ?></label>
                      <input type="text"  id="Duration<?php echo e($item->id); ?>"  class="form-control" value="<?php echo e($item->Duration); ?>" disabled >
                      <input type="hidden" name="Duration" id="DurationHide<?php echo e($item->id); ?>" value="<?php echo e($item->Duration); ?>">
                                        </div>

                                            <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Value')); ?></label>
            <input type="number" step="any" name="Value"   value="<?php echo e($item->Value); ?>"  class="form-control" required >
                                        </div>


                                <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Task_Owner')); ?></label>
              <select class="select2 form-control"  name="Task_Owner" required>
                                <option value=""><?php echo e(trans('admin.Task_Owner')); ?></option>
                                            <?php $__currentLoopData = $Employess; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $emp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($emp->id); ?>"  <?php if($item->Task_Owner == $emp->id): ?> selected <?php endif; ?>>      <?php echo e(app()->getLocale() == 'ar' ?$emp->Name :$emp->NameEn); ?></option>
                                           <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>

                                      <div class="form-group col-lg-4">
                                            <label class="form-label" for="simpleinput"><?php echo e(trans('admin.Observer')); ?></label>
              <select class="select2 form-control"  name="Observer" required>
                                <option value=""><?php echo e(trans('admin.Observer')); ?></option>
                                            <?php $__currentLoopData = $Employess; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $emp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option value="<?php echo e($emp->id); ?>"  <?php if($item->Observer == $emp->id): ?> selected <?php endif; ?>>           <?php echo e(app()->getLocale() == 'ar' ?$emp->Name :$emp->NameEn); ?></option>
                                           <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </select>
                                        </div>
                                      <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.Desc')); ?></label>
            <input type="text" name="Desc"   value="<?php echo e($item->Desc); ?>"  class="form-control">
                                        </div>



                                                           <div class="form-group col-lg-4">
                                     <label class="form-label" for="simpleinput"> <?php echo e(trans('admin.File')); ?></label>
            <input type="file" name="File" >
                                        </div>

                                        </div>

                                    <div class="modal-footer">
                                    <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo e(trans('admin.Close')); ?></button>
                                    <button type="submit" class="btn btn-primary"> <?php echo e(trans('admin.Save')); ?></button>
                                </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>

                      <!-- Modal Delete -->
                      <div class="modal fade" id="default-example-modal-center<?php echo e($item->id); ?>" tabindex="-1" role="dialog" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h4 class="modal-title">
                                          <?php echo e(trans('admin.RUSWDT')); ?> <strong>
                                         <?php echo e(app()->getLocale() == 'ar' ?$item->Name :$item->NameEn); ?>

                                        </strong>
                                    </h4>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                    </button>
                                </div>

                                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-dismiss="modal"> <?php echo e(trans('admin.No')); ?></button>
                   <a href="<?php echo e(url('DeleteMissions/'.$item->id)); ?>"  class="btn btn-primary"> <?php echo e(trans('admin.Yes')); ?></a>
                                </div>
                            </div>
                        </div>
                    </div>


                <!-- Modal Desc -->
                      <div class="modal fade" id="Desc<?php echo e($item->id); ?>" tabindex="-1" role="dialog" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h4 class="modal-title">
                                      <?php echo e($item->Desc); ?>

                                    </h4>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                    </button>
                                </div>

                                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-dismiss="modal"> <?php echo e(trans('admin.No')); ?></button>
                                </div>
                            </div>
                        </div>
                    </div>


                <!-- Modal Accept -->
              <div class="modal fade" id="Accept<?php echo e($item->id); ?>" tabindex="-1" role="dialog" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h4 class="modal-title">
                                    <?php echo e(trans('admin.Accept')); ?>

                                    </h4>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                        <span aria-hidden="true"><i class="fal fa-times"></i></span>
                                    </button>
                                </div>
            <form action="<?php echo e(url('AcceptMission')); ?>" method="post">
                        <?php echo csrf_field(); ?>

                                <div class="modal-body">
                                <input type="hidden" name="ID" value="<?php echo e($item->id); ?>">
                                <div class="row">
                        <div class="col-md-12">
                        <input type="radio" name="Status" value="3"><?php echo e(trans('admin.Accept')); ?>

                        <input type="radio" name="Status" value="1"><?php echo e(trans('admin.Refuse')); ?>


                                    </div>

                        <div class="col-md-12 mt-2">
                            <label><?php echo e(trans('admin.Value')); ?></label>
                            <input type="number" class="form-control" step="any" name="Value" value="<?php echo e($item->Value); ?>" required>
                                    </div>
                                    </div>
                                </div>
                                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-dismiss="modal"> <?php echo e(trans('admin.No')); ?></button>
                  <button type="submit" class="btn btn-primary" > <?php echo e(trans('admin.Yes')); ?></button>
                                </div>
                      </form>
                            </div>
                        </div>
                    </div>




        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </main>

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

<?php $__env->startPush('js'); ?>
<link rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/datagrid/datatables/datatables.bundle.css')); ?>">
    <link rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/formplugins/summernote/summernote.css')); ?>">
    <link rel="stylesheet" media="screen, print" href="<?php echo e(asset('Admin/css/formplugins/select2/select2.bundle.css')); ?>">
  <script src="<?php echo e(asset('Admin/js/datagrid/datatables/datatables.bundle.js')); ?>"></script>
    <script src="<?php echo e(asset('Admin/js/datagrid/datatables/datatables.export.js')); ?>"></script>
    <script src="<?php echo e(asset('Admin/js/formplugins/summernote/summernote.js')); ?>"></script>
    <script src="<?php echo e(asset('Admin/js/formplugins/select2/select2.bundle.js')); ?>"></script>

    <!-- Search Selecet -->
 <script>
        $(document).ready(function()
        {
            $(function()
            {
                $('.select2').select2();

                $(".select2-placeholder-multiple").select2(
                {
                    placeholder: "Select State"
                });
                $(".js-hide-search").select2(
                {
                    minimumResultsForSearch: 1 / 0
                });
                $(".js-max-length").select2(
                {
                    maximumSelectionLength: 2,
                    placeholder: "Select maximum 2 items"
                });
                $(".select2-placeholder").select2(
                {
                    placeholder: "Select a state",
                    allowClear: true
                });

                $(".js-select2-icons").select2(
                {
                    minimumResultsForSearch: 1 / 0,
                    templateResult: icon,
                    templateSelection: icon,
                    escapeMarkup: function(elm)
                    {
                        return elm
                    }
                });

                function icon(elm)
                {
                    elm.element;
                    return elm.id ? "<i class='" + $(elm.element).data("icon") + " mr-2'></i>" + elm.text : elm.text
                }


  $('.Client').select2({
    placeholder: "select...",
    ajax: {
        type: "GET",
        dataType: 'json',
        url: 'AllCli',
        processResults: function (data) {
          return {
            results: $.map(data, function(obj, index) {
              return { id: index, text: obj };
            })
          };

            	console.log(data);

        },
       data: function (params) {


                   var query = {
                            search: params.term,
                        };


              $.ajax({
                              url: 'AllCliJ/'+params.term,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },

                              success:function(data) {
                                          $('.Client').empty();
                                  $.each(data, function(key, value){

                         $('.Client').append('<option value="'+ key +'">' + value + '</option>');

                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });



        }
    }
  });


$('.Client').on('select2:select', function (e) {
	console.log("select done", e.params.data);
});



          $('#Client').select2({
    placeholder: "select...",
    ajax: {
        type: "GET",
        dataType: 'json',
        url: 'AllCli',
        processResults: function (data) {
          return {
            results: $.map(data, function(obj, index) {
              return { id: index, text: obj };
            })
          };

            	console.log(data);

        },
       data: function (params) {


                   var query = {
                            search: params.term,
                        };


              $.ajax({
                              url: 'AllCliJ/'+params.term,
                              type:"GET",
                              dataType:"json",
                              beforeSend: function(){
                                  $('#loader').css("visibility", "visible");
                              },

                              success:function(data) {
                                          $('#Client').empty();
                                  $.each(data, function(key, value){

                         $('#Client').append('<option value="'+ key +'">' + value + '</option>');

                                  });
                              },
                              complete: function(){
                                  $('#loader').css("visibility", "hidden");
                              }
                          });



        }
    }
  });


$('#Client').on('select2:select', function (e) {
	console.log("select done", e.params.data);
});



            });
        });



    </script>

    <script>
        //_fnFeatureHtmlLength();
        $(document).ready(function () {
            // Setup - add a text input to each footer cell
            $('#dt-basic-example thead tr').clone(true).appendTo('#dt-basic-example thead');
            $('#dt-basic-example thead tr:eq(1) th').each(function (i) {
                var title = $(this).text();
                $(this).html('<input type="text" class="form-control form-control-sm" placeholder="Search ' + '" />');

                $('input', this).on('keyup change', function () {
                    if (table.column(i).search() !== this.value) {
                        table
                            .column(i)
                            .search(this.value)
                            .draw();
                    }
                });
            });
            var table = $('#dt-basic-example').DataTable(
                {
                    // responsive: true,
                    orderCellsTop: true,
                    fixedHeader: true,
                    lengthChange: true,

                    dom: "<'row mb-3'<'col-sm-12 col-md-3 d-flex align-items-center justify-content-start'f><'col-sm-12 col-md-9 d-flex align-items-center justify-content-end'B>>" +
                        "<'row'<'col-sm-12'tr>>" +
                        "<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",

                    buttons: [
                        {
                            extend: 'pageLength',
                            className: 'btn-outline-default'
                        },
                        {
                            extend: 'colvis',
                            text: 'Column Visibility',
                            titleAttr: 'Col visibility',
                            className: 'btn-outline-default'
                        },
                        {
                            extend: 'pdfHtml5',
                            text: 'PDF',
                            titleAttr: 'Generate PDF',
                            className: 'btn-outline-danger btn-sm mr-1'
                        },
                        {
                            extend: 'excelHtml5',
                            text: 'Excel',
                            titleAttr: 'Generate Excel',
                            className: 'btn-outline-success btn-sm mr-1'
                        },
                        {
                            extend: 'csvHtml5',
                            text: 'CSV',
                            titleAttr: 'Generate CSV',
                            className: 'btn-outline-primary btn-sm mr-1'
                        },
                        {
                            extend: 'copyHtml5',
                            text: 'Copy',
                            titleAttr: 'Copy to clipboard',
                            className: 'btn-outline-primary btn-sm mr-1'
                        },
                        {
                            extend: 'print',
                            text: 'Print',
                            titleAttr: 'Print Table',
                            className: 'btn-outline-primary btn-sm'
                        }
                    ],
                });
            $('.js-thead-colors a').on('click', function () {
                var theadColor = $(this).attr("data-bg");
                console.log(theadColor);
                $('#dt-basic-example thead').removeClassPrefix('bg-').addClass(theadColor);
            });

            $('.js-tbody-colors a').on('click', function () {
                var theadColor = $(this).attr("data-bg");
                console.log(theadColor);
                $('#dt-basic-example').removeClassPrefix('bg-').addClass(theadColor);
            });

        });

    </script>

<!-- Differnce Date -->
<script>
    function Dif(){

      var start =new Date($('#Start_Date').val());
      var end = new Date($('#End_Date').val());

// To calculate the time difference of two dates
var Difference_In_Time = end.getTime() - start.getTime();

// To calculate the no. of days between two dates
var res = Difference_In_Time / (1000 * 3600 * 24);

            $('#Duration').val(res);
            $('#DurationHide').val(res);

    }
 function Diff(r){

      var start =new Date($('#Start_Date'+r).val());
      var end = new Date($('#End_Date'+r).val());

// To calculate the time difference of two dates
var Difference_In_Time = end.getTime() - start.getTime();

// To calculate the no. of days between two dates
var res = Difference_In_Time / (1000 * 3600 * 24);

            $('#Duration'+r).val(res);
            $('#DurationHide'+r).val(res);

    }
</script>

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


<?php echo $__env->make('admin.index', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/klarapps/public_html/test.klarapps.com/resources/views/admin/CRM/Missions.blade.php ENDPATH**/ ?>