Ajout de la base des réductions

This commit is contained in:
Romain Bonhomme 2020-10-05 15:21:25 +02:00
parent dff2741d62
commit 82700ceea3
6 changed files with 85 additions and 14 deletions

View file

@ -0,0 +1,17 @@
<?php
namespace App\Http\Controllers\Bo;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Reductions;
class ReductionsController extends Controller
{
public function index() {
// TODO : Traiter le flux des réductions
$r = Reductions::all();
return view('bo.reductions.index', compact('r'));
}
}

10
app/Models/Reductions.php Normal file
View file

@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Reductions extends Model
{
//
}

View file

@ -0,0 +1,43 @@
@extends('layouts.bo')
@section('content')
<div class="card">
<div class="card-header">
Réductions
</div>
<div class="card-body">
<table class="table table-sm table-hover text-center">
<thead class="thead-dark">
<th scope="col">Visuel</th>
<th scope="col">Code</th>
<th scope="col">Libellé</th>
<th scope="col">Nombre à diffuser</th>
<th scope="col">Nombre diffusé</th>
<th scope="col">Valeur faciale</th>
<th scope="col">Début de diffusion</th>
<th scope="col">Fin de diffusion</th>
<th scope="col">Configuration</th>
</thead>
<tbody>
@foreach ($r as $reduction)
<tr>
<td>
@if ($reduction->picture !== null)
<img src="/images/reductions/{{$reduction->picture}}" style="max-height: 50px;">
@endif
</td>
<td>{{$reduction->code}}</td>
<td>{{$reduction->wording}}</td>
<td>{{$reduction->number_broadcast}}</td>
<td>{{$reduction->number_broadcasted}}</td>
<td>{{$reduction->face_value}}€</td>
<td>{{\Carbon\Carbon::parse($reduction->start_date_broadcast)->format('d/m/Y')}}</td>
<td>{{\Carbon\Carbon::parse($reduction->end_date_broadcast)->format('d/m/Y')}}</td>
<td>{{-- TODO : Ajouter en Vue.js la configuration des promos --}}
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection

View file

@ -77,19 +77,19 @@
</tr>
</thead>
<tbody>
@foreach($t as $traca)
<tr>
<th>{{$traca->created_at->format('d/m/Y à i:s')}}</th>
<td>{{$traca->code}}</td>
<td class="response-{{$traca->response_type}}">
@if ($traca->response_tpe !== 1)
{{$responseType[$traca->response_type]}}
@else
{{$traca->response}}
@endif
</td>
</tr>
@endforeach
@foreach($t as $traca)
<tr>
<th>{{$traca->created_at->format('d/m/Y à i:s')}}</th>
<td>{{$traca->code}}</td>
<td class="response-{{$traca->response_type}}">
@if ($traca->response_tpe !== 1)
{{$responseType[$traca->response_type]}}
@else
{{$traca->response}}
@endif
</td>
</tr>
@endforeach
</tbody>
</table>
{{$t->links()}}

View file

@ -160,7 +160,7 @@
<a class="dropdown-item" href="{{route('bo.moments.create')}}">Ajouter</a>
</div>
</li>
<a class="nav-link" href="#">Les réductions</a>
<a class="nav-link" href="{{route('bo.reductions.index')}}">Les réductions</a>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Les QR codes</a>
<div class="dropdown-menu">

View file

@ -53,6 +53,7 @@ Route::namespace('Bo')
Route::resource('moments', 'MomentsController');
Route::put('/traceability/filters', 'TraceabilityController@filter')->name('traceability.filter');
Route::get('/traceability', 'TraceabilityController@index')->name('traceability.index');
Route::get('/reductions', 'ReductionsController@index')->name('reductions.index');
});
Route::get('/', function () {