<?php $__env->startSection('content'); ?>
    <div class="content-header row">
      <div class="content-header-left col-md-6 col-12 mb-2 breadcrumb-new">
        <h3 class="content-header-title mb-0 d-inline-block"> جميع حالات التصاريح</h3>
        <div class="row breadcrumbs-top d-inline-block">
          <div class="breadcrumb-wrapper col-12">
            <ol class="breadcrumb">
              <li class="breadcrumb-item"><a href="<?php echo e(route("Status.create")); ?>">إضافة  حالة</a>
              </li>
            </ol>
          </div>
        </div>
      </div>
    </div>
    <div class="content-body">
      <!-- HTML5 export buttons table -->
      <!-- Column selectors table -->
      <section id="column-selectors">
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h4 class="card-title">عرض الجميع</h4>
                <a class="heading-elements-toggle"><i class="la la-ellipsis-v font-medium-3"></i></a>
                <div class="heading-elements">
                  <ul class="list-inline mb-0">
                    <li><a data-action="collapse"><i class="ft-minus"></i></a></li>
                    <li><a data-action="reload"><i class="ft-rotate-cw"></i></a></li>
                    <li><a data-action="expand"><i class="ft-maximize"></i></a></li>
                    <li><a data-action="close"><i class="ft-x"></i></a></li>
                  </ul>
                </div>
              </div>
              <div class="card-content collapse show">
                <div class="card-body card-dashboard">
                  <table class="table table-striped table-bordered dataex-html5-selectors">
                    <thead>
                      <tr>
                          <th>ت</th>
                        <th>الاسم</th>

                        <th>الاجراءات</th>


                      </tr>
                    </thead>
                    <tbody>
                        <?php $__currentLoopData = $index; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <tr>
                                <td><?php echo e($loop->iteration); ?></td>
 <td><?php echo e($i->name); ?></td>
                                <td>
                                    <a href="<?php echo e(route('Status.edit' ,$i->id)); ?>" class="btn btn-secondary btn-min-width mr-1 mb-1"><i
                                        class="ft-edit"></i>تعديل</a>
                                    <input type="hidden" value="<?php echo e(csrf_token()); ?>" id="csrf_token" />

                                    <button class="btn btn-danger btn-min-width btn-glow mr-1 mb-1"
    onclick="DeleteRow(event, <?php echo e($i->id); ?>)"><i class="ft-delete"></i> حذف</button>

                                    </td>
                            </tr>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </tbody>
                    <tfoot>
                        <tr>
                                <th>ت</th>
                        <th>الاسم</th>

                        <th>الاجراءات</th>


                      </tr>
                    </tfoot>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </section>
      <!--/ Column selectors table -->
</div>


<?php $__env->stopSection(); ?>
<?php $__env->startSection('scripts'); ?>
<script src="https://cdn.jsdelivr.net/npm/sweetalert/dist/sweetalert.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<script>
    function DeleteRow(event, id) {
        event.preventDefault();
        swal({
            title: "هل أنت متأكد من الحذف؟",
            text: "في حالة الموافقة سيتم حذف البيانات نهائيًا",
            icon: "warning",
            buttons: {
                cancel: {
                    text: "لا، إلغاء",
                    visible: true,
                    closeModal: true,
                },
                confirm: {
                    text: "نعم، حذف",
                    visible: true,
                    closeModal: false
                }
            }
        }).then((isConfirm) => {
            if (isConfirm) {
                $.ajax({
                    url: `/admin/Status/${id}`,
                    type: 'POST',
                    data: {
                        _method: 'DELETE',
                        _token: '<?php echo e(csrf_token()); ?>'
                    },
                    success: function(response) {
                        swal("تم الحذف!", "تم حذف الحالة بنجاح", "success").then(() => {
                            location.reload();
                        });
                    },
                    error: function(xhr) {
                        swal("خطأ!", "حدث خطأ أثناء الحذف", "error");
                    }
                });
            }
        });
    }
</script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/almaugqb/permits.bariqgreenline.com/resources/views/admin/permit_Statuss/index.blade.php ENDPATH**/ ?>