File manager - Edit - /home/u300416816/domains/travelwithacam.com/public_html/resources/views/backend/category/index.blade.php
Back
@extends('backend.layout') @section('content') <!-- Bootstrap CSS (if not already included) --> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"> <!-- Bootstrap Switch CSS --> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.4/css/bootstrap3/bootstrap-switch.min.css" rel="stylesheet"> <div class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> <h1 class="m-0">Categories</h1> </div><!-- /.col --> </div><!-- /.row --> </div><!-- /.container-fluid --> </div> <!-- /.content-header --> <!-- Main content --> <section class="content"> <div class="container-fluid"> <div class="row"> <div class="col-12"> <div class="card"> <!-- /.card-header --> <div class="card-body"> <table id="example2" class="table table-bordered table-hover"> <thead> <tr> <th>#</th> <th>Name</th> <th>Description</th> <th>Status</th> <th class="text-right">Action</th> </tr> </thead> <tbody> @foreach ($categories as $key => $category) <tr> <td>{{ ($categories->currentPage() - 1) * $categories->perPage() + $key + 1 }}</td> <td> <img src="{{asset('images/categories/'.$category->image)}}" width="30"> {{ $category->name }} </td> <td>{!! Str::limit($category->description, 50, '...') !!}</td> <td> <input type="checkbox" class="status-switch" data-id="{{ $category->id }}" {{ $category->is_active ? 'checked' : '' }} data-bootstrap-switch data-off-color="danger" data-on-color="success"> </td> <td class="text-right"> <a href="{{ route('admin.categories.edit', $category->id) }}" class="btn btn-success"><i class="fa fa-edit"></i></a> <a href="{{ route('admin.categories.delete', $category->id) }}" class="btn btn-danger delete"><i class="fa fa-trash"></i></a> </td> </tr> @endforeach </tbody> </table> <!-- Pagination Links --> <div class="d-flex justify-content-center mt-3"> {{ $categories->onEachSide(1)->links('pagination::bootstrap-4') }} </div> </div> <!-- /.card-body --> </div> <!-- /.card --> </div> <!-- /.col --> </div> <!-- /.row --> </div> <!-- /.container-fluid --> </section> <!-- jQuery (if not already included) --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <!-- Bootstrap Switch JS --> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-switch/3.3.4/js/bootstrap-switch.min.js"></script> <script> $(document).ready(function() { $("input[data-bootstrap-switch]").each(function(){ $(this).bootstrapSwitch(); }); // Handle the switch change event $('.status-switch').on('switchChange.bootstrapSwitch', function (event, state) { let categoryId = $(this).data('id'); let isActive = state ? 1 : 0; $.ajax({ url: '{{ route("admin.categories.toggleStatus") }}', type: 'POST', data: { _token: '{{ csrf_token() }}', id: categoryId, is_active: isActive }, success: function(response) { if(response.success) { toastr.state('Status updated successfully!'); } else { toastr.error('Status update failed.'); } }, error: function(xhr) { toastr.error('An error occurred. Please try again.'); } }); }); }); </script> @endsection
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings