diff --git a/app/Http/Controllers/Bo/ObjectivesController.php b/app/Http/Controllers/Bo/ObjectivesController.php index 02da10e..cb82ba6 100644 --- a/app/Http/Controllers/Bo/ObjectivesController.php +++ b/app/Http/Controllers/Bo/ObjectivesController.php @@ -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')); } /** diff --git a/public/css/app.css b/public/css/app.css index 50e3af1..3155d80 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -10094,3 +10094,7 @@ h3 { text-align: center; font-size: large; } + +table.no-wrap-header th { + white-space: nowrap; +} diff --git a/resources/sass/app_custom.scss b/resources/sass/app_custom.scss index e990ddc..0c99857 100644 --- a/resources/sass/app_custom.scss +++ b/resources/sass/app_custom.scss @@ -57,3 +57,9 @@ text-align: center; font-size: large; } + +table.no-wrap-header { + th { + white-space: nowrap; + } +} diff --git a/resources/views/bo/cotations/checkgoals.blade.php b/resources/views/bo/cotations/checkgoals.blade.php index 2e88255..4823960 100644 --- a/resources/views/bo/cotations/checkgoals.blade.php +++ b/resources/views/bo/cotations/checkgoals.blade.php @@ -4,7 +4,7 @@
Cotations / Contrôle des objectifs - Liste + Liste
diff --git a/resources/views/bo/modules/sorter.blade.php b/resources/views/bo/modules/sorter.blade.php new file mode 100644 index 0000000..00623bd --- /dev/null +++ b/resources/views/bo/modules/sorter.blade.php @@ -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)) + ↓  +@endif +@if(!session($list.'.sort_way') or session($list.'.sort_col') !== $colname or (session($list.'.sort_way') === 'asc' and session($list.'.sort_col') === $colname)) + ↑  +@endif diff --git a/resources/views/bo/objectives/index.blade.php b/resources/views/bo/objectives/index.blade.php new file mode 100644 index 0000000..3a6863a --- /dev/null +++ b/resources/views/bo/objectives/index.blade.php @@ -0,0 +1,66 @@ +@extends('layouts.bo') + +@section('content') +
+
+ Objectifs +
+ +
+ + + + + + + + + + + + + + + + @foreach($objectives as $objectif) + + + + + + + + + + + + @endforeach + +
Produit  + @include('bo.modules.sorter', ['colname' => 'produit', 'list' => 'objectives']) + Qualité  + @include('bo.modules.sorter', ['colname' => 'qualite', 'list' => 'objectives']) + Campagne  + @include('bo.modules.sorter', ['colname' => 'campagne', 'list' => 'objectives']) + Qté  + @include('bo.modules.sorter', ['colname' => 'quantite', 'list' => 'objectives']) + Prix  + @include('bo.modules.sorter', ['colname' => 'prix', 'list' => 'objectives']) + Echeance  + @include('bo.modules.sorter', ['colname' => 'echeance', 'list' => 'objectives']) + Client  + @include('bo.modules.sorter', ['colname' => 'user_id', 'list' => 'objectives']) + Status  + @include('bo.modules.sorter', ['colname' => 'status_id', 'list' => 'objectives']) + Réinitialiser le tri
{{$objectif->produit}}{{$objectif->qualite}}{{$objectif->campagne}}{{$objectif->quantite}}{{$objectif->prix}}{{$objectif->echeance}}{{$objectif->user->lastname}} + {{$objectif->status->label}} + @if(!empty($objectif->goal_at)) +
{{$objectif->goal_at}} + @endif +
Detail
+ @if($objectives instanceof \Illuminate\Pagination\LengthAwarePaginator ) + {{ $objectives->appends($_GET)->links() }} + @endif +
+
+@endsection diff --git a/resources/views/bo/objectives/show.blade.php b/resources/views/bo/objectives/show.blade.php new file mode 100644 index 0000000..29831a6 --- /dev/null +++ b/resources/views/bo/objectives/show.blade.php @@ -0,0 +1,54 @@ +@extends('layouts.bo') + +@section('content') +
+
+ Détail d'un objectif + Retour +
+ +
+
+
Produit
+
{{$objectif->produit}}
+ +
Qualité
+
{{$objectif->qualite}}
+ +
Campagne
+
{{$objectif->campagne}}
+ +
Quantité
+
{{$objectif->quantite}}
+ +
Prix cible
+
{{$objectif->prix}}
+ +
Echéance
+
{{$objectif->echeance}}
+ +
Volume restant
+
{{$objectif->volume_restant}}
+ +
Observations
+
{{$objectif->observations}}
+ +
Client
+
{{$objectif->user->firstname}} {{$objectif->user->lastname}}
+ +
Statut
+
{{$objectif->status->label}} + @if(!empty($objectif->goal_at)) + le {{$objectif->goal_at}} + @endif +
+
+
+
+@endsection + +@section('scripts') + +@endsection diff --git a/resources/views/bo/users/edit_pro.blade.php b/resources/views/bo/users/edit_pro.blade.php index 454b3fc..ef94bf1 100644 --- a/resources/views/bo/users/edit_pro.blade.php +++ b/resources/views/bo/users/edit_pro.blade.php @@ -4,7 +4,7 @@
Utilisateurs - Retour + Retour {{--
@method('DELETE') @csrf diff --git a/resources/views/layouts/bo.blade.php b/resources/views/layouts/bo.blade.php index 41b23ad..3d4c31d 100644 --- a/resources/views/layouts/bo.blade.php +++ b/resources/views/layouts/bo.blade.php @@ -83,13 +83,13 @@ Ajouter
- Cotations + {{-- Cotations --}} Pdfs Affichés diff --git a/routes/web.php b/routes/web.php index 684825b..fc00e30 100644 --- a/routes/web.php +++ b/routes/web.php @@ -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');