<?php $__env->startSection('title', 'Admin | Desawar Market'); ?>
<?php $__env->startSection('content'); ?>
    <div class="loader"></div>
    <div id="app">
        <div class="main-wrapper main-wrapper-1">
            <?php echo $__env->make('layouts.navbar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
            <!-- Main Content -->
            <div class="main-content">
                <section class="section">
                    <div class="row">
                        <div class="col-12">
                            <?php if(session('success')): ?>
                                <div class="alert alert-success">
                                    <?php echo e(session('success')); ?>

                                </div>
                            <?php endif; ?>
                            <div class="card">
                                <div class="card-header">
                                    <h4>Desawar Markets</h4>
                                    <form action="<?php echo e(route('desawar-markets.index')); ?>" method="GET"
                                        class="form-inline mr-auto">
                                        <div class="search-element">
                                            <input name="searchValue" id="myInput" class="form-control"
                                                <?php if(isset($searchValue)): ?> value="<?php echo e($searchValue); ?>" <?php endif; ?>
                                                type="search" placeholder="Search" aria-label="Search" data-width="200">
                                            <button class="btn" type="submit">
                                                <i class="fas fa-search"></i>
                                            </button>
                                        </div>
                                    </form>
                                    <div class="card-header-form">
                                        <form>
                                            <div class="input-group">
                                                <div class="ml-5 form-group">
                                                    <a href="<?php echo e(route('desawar-markets.create')); ?>"
                                                        class="btn btn-outline-primary">Create</a>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                                <div class="card-body p-2">
                                    <div class="table-responsive">
                                        <table data-order='[[ 0, "desc" ]]' id="myTable" class="table table-striped">
                                            <thead>
                                                <tr>
                                                    <th>ID</th>
                                                    <th>Name</th>
                                                    <th>Current Status</th>
                                                    <th>Game On</th>
                                                    <th>Open Time</th>
                                                    <th>Close Time</th>
                                                    <th> Time Status</th>
                                                    <th> Result Time</th>
                                                    <th> Created At</th>
                                                    <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->any(['edit-desawar', 'delete-desawar'])): ?>
                                                        <th class="col-2">Action</th>
                                                    <?php endif; ?>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php $__currentLoopData = $desawarMarkets; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $market): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <tr>
                                                        <td><?php echo e($market->id); ?></td>
                                                        <td><?php echo e($market->name); ?></td>
                                                        <td class="<?php echo \Illuminate\Support\Arr::toCssClasses([
                                                            'text-success' => $market->gameOn,
                                                            'text-danger' => !$market->gameOn,
                                                        ]); ?>">
                                                            <?php echo e($market->gameOn ? 'OPEN NOW' : 'CLOSED NOW'); ?>

                                                        </td>
                                                        </td>
                                                        <td><?php echo e($market->game_on ? 'On' : 'Off'); ?></td>
                                                        <td><?php echo e($market->open_time); ?></td>
                                                        <td><?php echo e($market->close_time); ?></td>
                                                        <td><?php echo e($market->time_status ? 'On' : 'Off'); ?></td>
                                                        <td><?php echo e($market->result_time); ?></td>
                                                        <td><?php echo e($market->created_at); ?></td>
                                                        <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->any(['edit-desawar', 'delete-desawar'])): ?>
                                                            <td>
                                                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('edit-desawar')): ?>
                                                                    <a href="<?php echo e(route('desawar-markets.edit', ['market' => $market->id])); ?>"
                                                                        class="btn btn-outline-primary">Edit</a>|
                                                                <?php endif; ?>
                                                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('delete-desawar')): ?>
                                                                    <a href="<?php echo e(route('desawar-markets.destroy', ['market' => $market->id])); ?>"
                                                                        class="btn btn-outline-primary deleteBtn">Delete</a>
                                                                <?php endif; ?>
                                                            </td>
                                                        <?php endif; ?>
                                                    </tr>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="m-2" id="pagination">
                                        <?php echo e($desawarMarkets->links('pagination.custom')); ?>

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

    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <script>
        $('.deleteBtn').click(function(e) {
            e.preventDefault();
            // show swal
            Swal.fire({
                title: 'Are you sure?',
                text: "You want to delete this record!",
                icon: 'warning',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Yes, Delete it!'
            }).then((result) => {
                if (result.isConfirmed) {
                    window.location.href = $(this).attr('href');
                }
            });
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/shyambabamatka/public_html/alpha786.com/resources/views/dashboard/desawar-markets/index.blade.php ENDPATH**/ ?>