PATH:
home
/
lab2454c
/
omvstudio.com
/
resources
/
views
/
admin
/
movie
@extends('admin.layouts.adminMasterLayout') @section('title', 'List Movie') @section('movie_management_select','active') @section('content') <div class="container-fluid"> <div class="dashboard__main mb-4"> <h2>Movie List</h2> </div> <div class="card shadow mb-4"> <div class="card-body"> <div class="col-md-2"> <form action="{{ route('movie.index') }}" method="GET" class="movie-is-featured-frm"> <select name="is_featured" id="movie_is_featured" class="form-control"> <option value="ALL" {{ $is_featured == 'ALL' ? 'selected' : ''}}>ALL</option> <option value="FEATURED" {{ $is_featured == 'FEATURED' ? 'selected' : ''}}>FEATURED</option> </select> </form> </div> <div class="float-right"> <a href="{{ route('movie.create') }}" class="btn btn-success mb-4">Add New</a> </div> <div class="table-responsive"> @if ($is_featured == 'FEATURED') <table class="table table-bordered" id="example" width="100%" cellspacing="0"> <thead> <tr> <th>NAME</th> <th>COVER IMAGE</th> <th>CATEGORIES</th> <th>PRICE</th> <th>DURATION</th> <th>AVG.RATING</th> <th>STATUS</th> <th>ACTION</th> </tr> </thead> <tbody> @if ($featured_movies->count() > 0 ) @foreach ($featured_movies as $movie) @php $movies_reviews = App\Models\Review::where('movie_id',$movie->id)->where('status','active')->orderByDesc('created_at')->get(); $movies_rating_sum = App\Models\Review::where('movie_id',$movie->id)->where('status','active')->sum('rating'); if ($movies_reviews->count() > 0) { //slove error if no review $movies_rating_value = $movies_rating_sum / $movies_reviews->count(); } else{ $movies_rating_value = 0; } $rating_val_num = number_format($movies_rating_value,1); @endphp <tr> <td>{{ $movie->title }}</td> <td> <img src="{{ isset($movie->cover_image) ? asset('storage/movies/'.$movie->cover_image) : asset('admin_assets/images/default-image.png') }}" class="hei-120 wid-120 rounded-circle" alt=""> </td> <td> @foreach ($movie->categories as $category) {{ $category->title }}, @endforeach </td> <td>{{ $movie->price }}</td> <td>{{ $movie->movie_length }}</td> <td> @if ($rating_val_num > 0) <a href="{{ route('rating.review',$movie->slug) }}" target="_blank">{{ $rating_val_num }}</a> @endif </td> <td> @if($movie->status=='active') <a href="{{ url('admin/movie/status/inactive/'.$movie->id) }}" class="btn btn-success frm-btn_handler btn__active">Active</a> @else <a href="{{ url('admin/movie/status/active/'.$movie->id) }}" class="btn btn-warning frm-btn_handler btn__deactive">Deactive</a> @endif </td> <td> <a href="{{ route('movie.edit',$movie) }}" class="btn btn-primary frm-btn_handler btn__edit">Edit</a> <form action="{{ route('movie.destroy',$movie->id) }}" method="POST"> {{ csrf_field() }} @method('DELETE') <button class="btn btn-danger frm-btn_handler" onclick="return confirm('Are you sure?')">Delete </button> </form> <a href="{{ route('movie.preview',$movie->slug) }}" class="btn btn-primary frm-btn_handler btn__preview">Preview</a> </td> </tr> @endforeach @else <td colspan="7">No data Found!!</td> @endif </tbody> </table> @else <table class="table table-bordered" id="example" width="100%" cellspacing="0"> <thead> <tr> <th>NAME</th> <th>COVER IMAGE</th> <th>CATEGORIES</th> <th>PRICE</th> <th>DURATION</th> <th>AVG.RATING</th> <th>STATUS</th> <th>ACTION</th> </tr> </thead> <tbody> @if ($movies->count() > 0 ) @foreach ($movies as $movie) @php $movies_reviews = App\Models\Review::where('movie_id',$movie->id)->where('status','active')->orderByDesc('created_at')->get(); $movies_rating_sum = App\Models\Review::where('movie_id',$movie->id)->where('status','active')->sum('rating'); if ($movies_reviews->count() > 0) { //slove error if no review $movies_rating_value = $movies_rating_sum / $movies_reviews->count(); } else{ $movies_rating_value = 0; } $rating_val_num = number_format($movies_rating_value,1); @endphp <tr> <td>{{ $movie->title }}</td> <td> <img src="{{ isset($movie->cover_image) ? asset('storage/movies/'.$movie->cover_image) : asset('admin_assets/images/default-image.png') }}" class="hei-120 wid-120 rounded-circle" alt=""> </td> <td> @foreach ($movie->categories as $category) {{ $category->title }}, @endforeach </td> <td>{{ $movie->price }}</td> <td>{{ $movie->movie_length }}</td> <td> @if ($rating_val_num > 0) <a href="{{ route('rating.review',$movie->id) }}" target="_blank">{{ $rating_val_num }}</a> @endif </td> <td> @if($movie->status=='active') <a href="{{ url('admin/movie/status/inactive/'.$movie->id) }}" class="btn btn-success frm-btn_handler btn__active">Active</a> @else <a href="{{ url('admin/movie/status/active/'.$movie->id) }}" class="btn btn-warning frm-btn_handler btn__deactive">Deactive</a> @endif </td> <td> <a href="{{ route('movie.edit',$movie) }}" class="btn btn-primary frm-btn_handler btn__edit">Edit</a> <form action="{{ route('movie.destroy',$movie->id) }}" method="POST"> {{ csrf_field() }} @method('DELETE') <button class="btn btn-danger frm-btn_handler btn__delete" onclick="return confirm('Are you sure?')">Delete </button> </form> <a href="{{ route('movie.preview',$movie->slug) }}" target="_blank" class="btn btn-primary frm-btn_handler btn__preview">Preview</a> </td> </tr> @endforeach @else <td colspan="7">No data Found!!</td> @endif </tbody> </table> @endif </div> </div> </div> </div> @endsection @push('backend-scripts') <script type="text/javascript"> (function($){ $(document).ready(function(){ $('#movie_is_featured').on('change',function(){ let is_featured = $(this).val(); $('.movie-is-featured-frm').submit(); }); }); })(jQuery) </script> @endpush
[-] form.blade.php
[edit]
[-] create.blade.php
[edit]
[-] edit.blade.php
[edit]
[+]
..
[-] user-review-list.blade.php
[edit]
[-] list.blade.php
[edit]
[+]
bkp
[-] review-list.blade.php
[edit]
[-] category-movie-list.blade.php
[edit]