Guest User

Link1

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