<?php $__env->startSection('css'); ?>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css">

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

<?php $__env->startSection('title'); ?>
    الأطباء
<?php $__env->stopSection(); ?>

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

    <div class="content-header">
        <h5>الأطباء</h5>

    </div>

    <div class="row">
        <div class="col-12">
            <div class="card table-card">
                <div class="card-header">
                    <a href="<?php echo e(route('doctors.create')); ?>" class="btn btn-sm btn-success">اضافه طبيب جديد</a>
                </div>
                <div class="card-body">
                    <!--begin::Table container-->
                    <div class="table-responsive">
                        <!--begin::Table-->
                        <table class="table table-striped table-row-bordered gy-5 gs-7" id="pc-dt-simple">
                            <?php echo $dataTable->table(); ?>

                        </table>
                        <!--end::Table-->
                    </div>
                    <!--end::Table container-->
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('js'); ?>
    <?php echo $dataTable->scripts(); ?>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>

    <script>
        $(document).on('change', '.toggle-status', function () {

            let doctorId = $(this).data('id');
            let newStatus = $(this).is(':checked') ? 1 : 0;

            $.ajax({
                url: "<?php echo e(route('doctors.toggleStatus')); ?>",
                method: "POST",
                data: {
                    _token: "<?php echo e(csrf_token()); ?>",
                    id: doctorId,
                    is_active: newStatus
                },
                success: function (response) {
                    toastr.success(response.message);
                },
                error: function () {
                    toastr.error("حدث خطأ، من فضلك حاول مرة أخرى");
                }
            });

        });
    </script>

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

<?php echo $__env->make('admin.layouts.master', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\jops\SassMedical\resources\views/admin/doctors/index.blade.php ENDPATH**/ ?>