Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is my previous list.blade.php
- <?php
- use Carbon\Carbon;
- $today_date = Carbon::now();
- $expiry_date = []; // array();
- foreach ($entries as $k => $entry) {
- $expiry_date[] = Carbon::parse($entry->expiry_date);
- }
- $expiry_date = []; // array();
- ?>
- @extends('backpack::layout')
- @section('header')
- <section class="content-header">
- <h1>
- <span class="text-capitalize">{{ $crud->entity_name_plural }}</span>
- <small>{{ trans('backpack::crud.all') }} <span>{{ $crud->entity_name_plural }}</span> {{ trans('backpack::crud.in_the_database') }}.</small>
- </h1>
- <ol class="breadcrumb">
- <li><a href="{{ url(config('backpack.base.route_prefix'), 'dashboard') }}">{{ trans('backpack::crud.admin') }}</a></li>
- <li><a href="{{ url($crud->route) }}" class="text-capitalize">{{ $crud->entity_name_plural }}</a></li>
- <li class="active">{{ trans('backpack::crud.list') }}</li>
- </ol>
- </section>
- @endsection
- @section('content')
- <!-- Default box -->
- <div class="row">
- <!-- THE ACTUAL CONTENT -->
- <div class="col-md-12">
- <div class="box">
- <div class="box-header {{ $crud->hasAccess('create')?'with-border':'' }}">
- @include('crud::inc.button_stack', ['stack' => 'top'])
- <div id="datatable_button_stack" class="pull-right text-right"></div>
- </div>
- <div class="box-body table-responsive">
- {{-- Backpack List Filters --}}
- @if ($crud->filtersEnabled())
- @include('crud::inc.filters_navbar')
- @endif
- <table id="crudTable" class="table table-bordered table-striped display">
- <thead>
- <tr>
- @if ($crud->details_row)
- <th data-orderable="false"></th> <!-- expand/minimize button column -->
- @endif
- {{-- Table columns --}}
- @foreach ($crud->columns as $column)
- <th>{{ $column['label'] }}</th>
- @endforeach
- @if ( $crud->buttons->where('stack', 'line')->count() )
- <th>{{ trans('backpack::crud.actions') }}</th>
- @endif
- </tr>
- </thead>
- <tbody>
- @if (!$crud->ajaxTable())
- @foreach ($entries as $k => $entry)
- <?php
- $data_difference = $today_date->diffInDays(Carbon::parse($entry->expiry_date), false);
- if($data_difference <= 7 && $data_difference >= 0) {
- $color="#FF9900";
- } elseif($data_difference < 0) {
- $color="#EA2C12";
- } elseif($data_difference > 7) {
- $color="#539E05";
- }
- ?>
- <tr data-entry-id="{{ $entry->getKey() }}" style="color: {{$color}}">
- @if ($crud->details_row)
- @include('crud::columns.details_row_button')
- @endif
- {{-- load the view from the application if it exists, otherwise load the one in the package --}}
- @foreach ($crud->columns as $column)
- @if (!isset($column['type']))
- @include('crud::columns.text')
- @else
- @if(view()->exists('vendor.backpack.crud.columns.'.$column['type']))
- @include('vendor.backpack.crud.columns.'.$column['type'])
- @else
- @if(view()->exists('crud::columns.'.$column['type']))
- @include('crud::columns.'.$column['type'])
- @else
- @include('crud::columns.text')
- @endif
- @endif
- @endif
- @endforeach
- @if ($crud->buttons->where('stack', 'line')->count())
- <td>
- @include('crud::inc.button_stack', ['stack' => 'line'])
- </td>
- @endif
- </tr>
- @endforeach
- @endif
- And this is link1 and it is working and coloring my crud list items
Add Comment
Please, Sign In to add comment