123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- @extends('backend.layouts.app')
- @section('content')
- <div class="aiz-titlebar text-left mt-2 mb-3">
- <div class="row align-items-center">
- <!--<div class="col-auto">-->
- <!-- <h1 class="h3">{{translate('All Posts')}}</h1>-->
- <!--</div>-->
- <div class="col text-left">
- <a href="{{ route('blog.create') }}" class="btn btn-circle btn-info">
- <span>{{translate('Add New Post')}}</span>
- </a>
- </div>
- </div>
- </div>
- <br>
- <div class="card">
- <form class="" id="sort_blogs" action="" method="GET">
- <div class="card-header row gutters-5">
- <div class="col text-center text-md-left">
- <h5 class="mb-md-0 h6">{{ translate('All blog posts') }}</h5>
- </div>
-
- <div class="col-md-2">
- <div class="form-group mb-0">
- <input type="text" class="form-control form-control-sm" id="search" name="search"@isset($sort_search) value="{{ $sort_search }}" @endisset placeholder="{{ translate('Type & Enter') }}">
- </div>
- </div>
- </div>
- </from>
- <div class="card-body">
- <table class="table mb-0 aiz-table">
- <thead>
- <tr>
- <th>#</th>
- <th>{{translate('Title')}}</th>
- <th data-breakpoints="lg">{{translate('Category')}}</th>
- <th data-breakpoints="lg">{{translate('Short Description')}}</th>
- <th data-breakpoints="lg">{{translate('Status')}}</th>
- <th class="text-right">{{translate('Options')}}</th>
- </tr>
- </thead>
- <tbody>
- @foreach($blogs as $key => $blog)
- <tr>
- <td>
- {{ ($key+1) + ($blogs->currentPage() - 1) * $blogs->perPage() }}
- </td>
- <td>
- {{ $blog->title }}
- </td>
- <td>
- @if($blog->category != null)
- {{ $blog->category->category_name }}
- @else
- --
- @endif
- </td>
- <td>
- {{ $blog->short_description }}
- </td>
- <td>
- <label class="aiz-switch aiz-switch-success mb-0">
- <input type="checkbox" onchange="change_status(this)" value="{{ $blog->id }}" <?php if($blog->status == 1) echo "checked";?>>
- <span></span>
- </label>
- </td>
- <td class="text-right">
- <a class="btn btn-soft-primary btn-icon btn-circle btn-sm" href="{{ route('blog.edit',$blog->id)}}" title="{{ translate('Edit') }}">
- <i class="las la-pen"></i>
- </a>
-
- <a href="#" class="btn btn-soft-danger btn-icon btn-circle btn-sm confirm-delete" data-href="{{route('blog.destroy', $blog->id)}}" title="{{ translate('Delete') }}">
- <i class="las la-trash"></i>
- </a>
- </td>
- </tr>
- @endforeach
- </tbody>
- </table>
- <div class="aiz-pagination">
- {{ $blogs->links() }}
- </div>
- </div>
- </div>
- @endsection
- @section('modal')
- @include('modals.delete_modal')
- @endsection
- @section('script')
- <script type="text/javascript">
- function change_status(el){
- var status = 0;
- if(el.checked){
- var status = 1;
- }
- $.post('{{ route('blog.change-status') }}', {_token:'{{ csrf_token() }}', id:el.value, status:status}, function(data){
- if(data == 1){
- AIZ.plugins.notify('success', '{{ translate('Change blog status successfully') }}');
- }
- else{
- AIZ.plugins.notify('danger', '{{ translate('Something went wrong') }}');
- }
- });
- }
- </script>
- @endsection
|