affichage des objectifs
This commit is contained in:
parent
d12ab3e721
commit
be31eebfdf
10 changed files with 199 additions and 9 deletions
|
|
@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
|
|||
use App\Models\Objectives;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
|
||||
class ObjectivesController extends Controller
|
||||
{
|
||||
|
|
@ -17,7 +18,59 @@ class ObjectivesController extends Controller
|
|||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
return view('bo.objectives.index');
|
||||
$objectives = $this->filterObjectives($request);
|
||||
|
||||
$objectives = $objectives->paginate(10);
|
||||
|
||||
return view('bo.objectives.index', compact('objectives'));
|
||||
}
|
||||
|
||||
protected function filterObjectives(Request $request) {
|
||||
$objectives = Objectives::query();
|
||||
|
||||
if ($request->rst) {
|
||||
Session::remove('objectives.sort_col');
|
||||
Session::remove('objectives.sort_way');
|
||||
}
|
||||
if ($request->sort_col) {
|
||||
Session::put('objectives.sort_col', $request->sort_col);
|
||||
Session::save();
|
||||
}
|
||||
if ($request->sort_way) {
|
||||
Session::put('objectives.sort_way', $request->sort_way);
|
||||
Session::save();
|
||||
}
|
||||
|
||||
if (Session::has('objectives.sort_col') and Session::has('objectives.sort_way')) {
|
||||
switch (Session::get('objectives.sort_col')) {
|
||||
case 'produit':
|
||||
$objectives = $objectives->orderBy('produit', Session::get('objectives.sort_way'));
|
||||
break;
|
||||
case 'qualite':
|
||||
$objectives = $objectives->orderBy('qualite', Session::get('objectives.sort_way'));
|
||||
break;
|
||||
case 'campagne':
|
||||
$objectives = $objectives->orderBy('campagne', Session::get('objectives.sort_way'));
|
||||
break;
|
||||
case 'quantite':
|
||||
$objectives = $objectives->orderBy('quantite', Session::get('objectives.sort_way'));
|
||||
break;
|
||||
case 'prix':
|
||||
$objectives = $objectives->orderBy('prix', Session::get('objectives.sort_way'));
|
||||
break;
|
||||
case 'echeance':
|
||||
$objectives = $objectives->orderBy('echeance', Session::get('objectives.sort_way'));
|
||||
break;
|
||||
case 'status_id':
|
||||
$objectives = $objectives->orderBy('status_id', Session::get('objectives.sort_way'));
|
||||
break;
|
||||
case 'user_id':
|
||||
$objectives = $objectives->orderBy('user_id', Session::get('objectives.sort_way'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $objectives;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -49,7 +102,8 @@ class ObjectivesController extends Controller
|
|||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
$objectif = Objectives::findOrFail($id);
|
||||
return view('bo.objectives.show', compact('objectif'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
4
public/css/app.css
vendored
4
public/css/app.css
vendored
|
|
@ -10094,3 +10094,7 @@ h3 {
|
|||
text-align: center;
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
table.no-wrap-header th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
|
|
|||
6
resources/sass/app_custom.scss
vendored
6
resources/sass/app_custom.scss
vendored
|
|
@ -57,3 +57,9 @@
|
|||
text-align: center;
|
||||
font-size: large;
|
||||
}
|
||||
|
||||
table.no-wrap-header {
|
||||
th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<div class="card">
|
||||
<div class="card-header">
|
||||
<a href="{{route('bo.cotations.index')}}">Cotations</a> / Contrôle des objectifs
|
||||
<a href="{{route('bo.cotations.index')}}" class="btn btn-sm btn-primary float-right">Liste</a>
|
||||
<a href="{{route('bo.objectives.index')}}" class="btn btn-sm btn-primary float-right">Liste</a>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
|
|
|
|||
6
resources/views/bo/modules/sorter.blade.php
Normal file
6
resources/views/bo/modules/sorter.blade.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
@if(!session($list.'.sort_way') or session($list.'.sort_col') !== $colname or (session($list.'.sort_way') === 'desc' and session($list.'.sort_col') === $colname))
|
||||
<a class="col_sort text-secondary asc" href="{{ route('bo.'.$list.'.index', ['sort_col' => $colname, 'sort_way' => 'asc']) }}"> ↓ </a>
|
||||
@endif
|
||||
@if(!session($list.'.sort_way') or session($list.'.sort_col') !== $colname or (session($list.'.sort_way') === 'asc' and session($list.'.sort_col') === $colname))
|
||||
<a class="col_sort text-secondary desc" href="{{ route('bo.'.$list.'.index', ['sort_col' => $colname, 'sort_way' => 'desc']) }}"> ↑ </a>
|
||||
@endif
|
||||
66
resources/views/bo/objectives/index.blade.php
Normal file
66
resources/views/bo/objectives/index.blade.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
@extends('layouts.bo')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Objectifs
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<table class="table table-striped table-sm no-wrap-header">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th scope="col">Produit
|
||||
@include('bo.modules.sorter', ['colname' => 'produit', 'list' => 'objectives'])
|
||||
</th>
|
||||
<th scope="col">Qualité
|
||||
@include('bo.modules.sorter', ['colname' => 'qualite', 'list' => 'objectives'])
|
||||
</th>
|
||||
<th scope="col">Campagne
|
||||
@include('bo.modules.sorter', ['colname' => 'campagne', 'list' => 'objectives'])
|
||||
</th>
|
||||
<th scope="col">Qté
|
||||
@include('bo.modules.sorter', ['colname' => 'quantite', 'list' => 'objectives'])
|
||||
</th>
|
||||
<th scope="col">Prix
|
||||
@include('bo.modules.sorter', ['colname' => 'prix', 'list' => 'objectives'])
|
||||
</th>
|
||||
<th scope="col">Echeance
|
||||
@include('bo.modules.sorter', ['colname' => 'echeance', 'list' => 'objectives'])
|
||||
</th>
|
||||
<th scope="col">Client
|
||||
@include('bo.modules.sorter', ['colname' => 'user_id', 'list' => 'objectives'])
|
||||
</th>
|
||||
<th scope="col">Status
|
||||
@include('bo.modules.sorter', ['colname' => 'status_id', 'list' => 'objectives'])
|
||||
</th>
|
||||
<th><a href="{{ route(Route::currentRouteName(), ['rst' => 1]) }}" class="float-right btn btn-sm btn-dark">Réinitialiser le tri</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($objectives as $objectif)
|
||||
<tr>
|
||||
<td>{{$objectif->produit}}</td>
|
||||
<td>{{$objectif->qualite}}</td>
|
||||
<td>{{$objectif->campagne}}</td>
|
||||
<td>{{$objectif->quantite}}</td>
|
||||
<td>{{$objectif->prix}}</td>
|
||||
<td>{{$objectif->echeance}}</td>
|
||||
<td><a href="{{route('bo.users.edit', $objectif->user_id)}}">{{$objectif->user->lastname}}</a></td>
|
||||
<td>
|
||||
{{$objectif->status->label}}
|
||||
@if(!empty($objectif->goal_at))
|
||||
<br/>{{$objectif->goal_at}}
|
||||
@endif
|
||||
</td>
|
||||
<td><a href="{{route('bo.objectives.show', $objectif->id)}}" class="btn btn-sm btn-primary">Detail</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@if($objectives instanceof \Illuminate\Pagination\LengthAwarePaginator )
|
||||
{{ $objectives->appends($_GET)->links() }}
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
54
resources/views/bo/objectives/show.blade.php
Normal file
54
resources/views/bo/objectives/show.blade.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
@extends('layouts.bo')
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
Détail d'un objectif
|
||||
<a href="{{route('bo.objectives.index')}}" class="btn btn-sm btn-primary float-right ml-2">Retour</a>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<dl class="row">
|
||||
<dt class="col-sm-3">Produit</dt>
|
||||
<dd class="col-sm-9">{{$objectif->produit}}</dd>
|
||||
|
||||
<dt class="col-sm-3">Qualité</dt>
|
||||
<dd class="col-sm-9">{{$objectif->qualite}}</dd>
|
||||
|
||||
<dt class="col-sm-3">Campagne</dt>
|
||||
<dd class="col-sm-9">{{$objectif->campagne}}</dd>
|
||||
|
||||
<dt class="col-sm-3">Quantité</dt>
|
||||
<dd class="col-sm-9">{{$objectif->quantite}}</dd>
|
||||
|
||||
<dt class="col-sm-3">Prix cible</dt>
|
||||
<dd class="col-sm-9">{{$objectif->prix}}</dd>
|
||||
|
||||
<dt class="col-sm-3">Echéance</dt>
|
||||
<dd class="col-sm-9">{{$objectif->echeance}}</dd>
|
||||
|
||||
<dt class="col-sm-3">Volume restant</dt>
|
||||
<dd class="col-sm-9">{{$objectif->volume_restant}}</dd>
|
||||
|
||||
<dt class="col-sm-3">Observations</dt>
|
||||
<dd class="col-sm-9">{{$objectif->observations}}</dd>
|
||||
|
||||
<dt class="col-sm-3">Client</dt>
|
||||
<dd class="col-sm-9"><a href="{{route('bo.users.edit', $objectif->user_id)}}">{{$objectif->user->firstname}} {{$objectif->user->lastname}}</a></dd>
|
||||
|
||||
<dt class="col-sm-3">Statut</dt>
|
||||
<dd class="col-sm-9">{{$objectif->status->label}}
|
||||
@if(!empty($objectif->goal_at))
|
||||
le {{$objectif->goal_at}}
|
||||
@endif
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
<div class="card">
|
||||
<div class="card-header">
|
||||
Utilisateurs
|
||||
<a href="{{route('bo.users.index')}}" class="btn btn-sm btn-primary float-right ml-2">Retour</a>
|
||||
<a href="{{ URL::previous() }}" class="btn btn-sm btn-primary float-right ml-2">Retour</a>
|
||||
{{--<form action="{{route('bo.users.destroy', $user->id)}}" method="POST" class="d-inline">
|
||||
@method('DELETE')
|
||||
@csrf
|
||||
|
|
|
|||
|
|
@ -83,13 +83,13 @@
|
|||
<a class="dropdown-item" href="{{route('bo.articles.create')}}">Ajouter</a>
|
||||
</div>
|
||||
</li>
|
||||
<a class="nav-link" href="{{route('bo.cotations.index')}}">Cotations</a>
|
||||
{{-- <a class="nav-link" href="{{route('bo.cotations.index')}}">Cotations</a> --}}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Marchés</a>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="{{route('bo.cotations.index')}}">Cotations</a>
|
||||
<a class="dropdown-item" href="{{route('bo.cotations.checkgoals')}}">Contrôle des Objectifs</a>
|
||||
<a class="dropdown-item" href="#">Objectifs</a>
|
||||
<a class="dropdown-item" href="{{route('bo.objectives.index')}}">Objectifs</a>
|
||||
</div>
|
||||
</li>
|
||||
<a class="nav-link" href="{{route('bo.public-pdfs.index')}}">Pdfs Affichés</a>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use App\Http\Controllers\Bo\BusinessSectorsController;
|
|||
//use App\Http\Controllers\Bo\CotationsController;
|
||||
use App\Http\Controllers\Pro\DashboardController as ProDashboard;
|
||||
use App\Http\Controllers\Pro\CustomerController as ProCustomerController;
|
||||
use App\Http\Controllers\Bo\ObjectivesController;
|
||||
//use App\Http\Controllers\Bo\ObjectivesController;
|
||||
use App\Http\Controllers\HomeController;
|
||||
use App\Http\Controllers\AboutUsController;
|
||||
use App\Http\Controllers\OurTradeController;
|
||||
|
|
@ -48,8 +48,8 @@ Route::namespace('App\Http\Controllers\Bo')
|
|||
'home-sliders' => HomeSlidersController::class,
|
||||
'articles' => ArticlesController::class,
|
||||
'cotations' => CotationsController::class,
|
||||
'public-pdfs'=> PublicPdfsController::class,
|
||||
'objectives'=> ObjectivesController::class,
|
||||
'public-pdfs' => PublicPdfsController::class,
|
||||
'objectives' => ObjectivesController::class,
|
||||
]);
|
||||
// ordres
|
||||
Route::get('/home-sliders/change-order/{id}/{action}', [App\Http\Controllers\Bo\HomeSlidersController::class,'changeOrder'])->name('home-sliders.change-order');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue