Guest User

Link2

a guest
Oct 31st, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.21 KB | None | 0 0
  1. <?php
  2.     use Carbon\Carbon;
  3.     $today_date = Carbon::now();
  4.  
  5. ?>  
  6.  
  7. @extends('backpack::layout')
  8.  
  9. @section('header')
  10.     <section class="content-header">
  11.       <h1>
  12.         <span class="text-capitalize">{{ $crud->entity_name_plural }}</span>
  13.         <small>{{ trans('backpack::crud.all') }} <span>{{ $crud->entity_name_plural }}</span> {{ trans('backpack::crud.in_the_database') }}.</small>
  14.       </h1>
  15.       <ol class="breadcrumb">
  16.         <li><a href="{{ url(config('backpack.base.route_prefix'), 'dashboard') }}">{{ trans('backpack::crud.admin') }}</a></li>
  17.         <li><a href="{{ url($crud->route) }}" class="text-capitalize">{{ $crud->entity_name_plural }}</a></li>
  18.         <li class="active">{{ trans('backpack::crud.list') }}</li>
  19.       </ol>
  20.     </section>
  21. @endsection
  22.  
  23. @section('content')
  24. <!-- Default box -->
  25.   <div class="row">
  26.  
  27.     <!-- THE ACTUAL CONTENT -->
  28.     <div class="col-md-12">
  29.       <div class="box">
  30.         <div class="box-header {{ $crud->hasAccess('create')?'with-border':'' }}">
  31.  
  32.           @include('crud::inc.button_stack', ['stack' => 'top'])
  33.  
  34.           <div id="datatable_button_stack" class="pull-right text-right"></div>
  35.         </div>
  36.  
  37.         <div class="box-body table-responsive">
  38.  
  39.         {{-- Backpack List Filters --}}
  40.         @if ($crud->filtersEnabled())
  41.           @include('crud::inc.filters_navbar')
  42.         @endif
  43.  
  44.         <table id="crudTable" class="table table-bordered table-striped display">
  45.             <thead>
  46.               <tr>
  47.                 @if ($crud->details_row)
  48.                   <th data-orderable="false"></th> <!-- expand/minimize button column -->
  49.                 @endif
  50.  
  51.                 {{-- Table columns --}}
  52.                 @foreach ($crud->columns as $column)
  53.                   <th>{{ $column['label'] }}</th>
  54.                 @endforeach
  55.  
  56.                 @if ( $crud->buttons->where('stack', 'line')->count() )
  57.                   <th>{{ trans('backpack::crud.actions') }}</th>
  58.                 @endif
  59.               </tr>
  60.             </thead>
  61.             <tbody>
  62.  
  63.               @if (!$crud->ajaxTable())
  64.                 @foreach ($entries as $k => $entry)
  65.  
  66.                 <?php
  67.                   $expiry_date = [];
  68.                  
  69.                   foreach ($entries as $k => $entry) {
  70.                   $expiry_date[] = Carbon::parse($entry->expiry_date);
  71.                   }
  72.                  
  73.                   $data_difference = $today_date->diffInDays($expiry_date, false);
  74.  
  75.                   if($data_difference <= 7 && $data_difference >= 0) {
  76.                     $color="#FF9900";  
  77.                   } elseif($data_difference < 0) {
  78.                     $color="#EA2C12";
  79.                   } elseif($data_difference > 7) {
  80.                     $color="#539E05";
  81.                   }
  82.  
  83.                 ?>
  84.                
  85.                 <tr data-entry-id="{{ $entry->getKey() }}" style="color: {{$color}}">
  86.  
  87.  
  88.                   @if ($crud->details_row)
  89.                     @include('crud::columns.details_row_button')
  90.                   @endif
  91.  
  92.                   {{-- load the view from the application if it exists, otherwise load the one in the package --}}
  93.                   @foreach ($crud->columns as $column)
  94.                     @if (!isset($column['type']))
  95.                       @include('crud::columns.text')
  96.                     @else
  97.                       @if(view()->exists('vendor.backpack.crud.columns.'.$column['type']))
  98.                         @include('vendor.backpack.crud.columns.'.$column['type'])
  99.                       @else
  100.                         @if(view()->exists('crud::columns.'.$column['type']))
  101.                           @include('crud::columns.'.$column['type'])
  102.                         @else
  103.                           @include('crud::columns.text')
  104.                         @endif
  105.                       @endif
  106.                     @endif
  107.  
  108.                   @endforeach
  109.  
  110.                   @if ($crud->buttons->where('stack', 'line')->count())
  111.                     <td>
  112.                       @include('crud::inc.button_stack', ['stack' => 'line'])
  113.                     </td>
  114.                   @endif
  115.  
  116.                 </tr>
  117.                 @endforeach
  118.               @endif
Add Comment
Please, Sign In to add comment