From: Vincent Vanwaelscappel Date: Mon, 5 Dec 2022 16:13:16 +0000 (+0100) Subject: wip #5627 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3a457e4d0c1bfc7c567036e82031ea08ca170fa7;p=fluidbook-toolbox.git wip #5627 @0.25 --- diff --git a/app/Http/Controllers/Admin/TeamPayController.php b/app/Http/Controllers/Admin/TeamPayController.php index fc368ce5f..12092fbbc 100644 --- a/app/Http/Controllers/Admin/TeamPayController.php +++ b/app/Http/Controllers/Admin/TeamPayController.php @@ -7,6 +7,7 @@ namespace App\Http\Controllers\Admin; use App\Http\Controllers\Admin\Operations\Tools\Excel2JSON; use App\Http\Controllers\Controller; use App\Http\Controllers\Admin\Operations\Tools\SASSCompiler; +use Cubist\Backpack\Http\Controllers\Base\XSendFileController; use Cubist\Util\Files\Files; class TeamPayController extends Controller @@ -17,6 +18,14 @@ class TeamPayController extends Controller return view('team.pay', ['slips' => $this->getSlips()]); } + protected function download($year, $month) + { + $slips = $this->getSlips(); + if (isset($slips[$year . $month])) { + return XSendFileController::sendfile($slips[$year . $month]['path']); + } + } + protected function getSlips() { $res = []; @@ -37,7 +46,7 @@ class TeamPayController extends Controller $res[$year . $month] = ['path' => $item->getPathname(), 'year' => $year, 'month' => $month]; } } - ksort($res); + krsort($res); return $res; } diff --git a/resources/views/team/pay.blade.php b/resources/views/team/pay.blade.php index 483bf78c2..b8d9a4181 100644 --- a/resources/views/team/pay.blade.php +++ b/resources/views/team/pay.blade.php @@ -24,7 +24,7 @@ {{$slip['year']}} {{$slip['month']}} - {{__('Télécharger')}} diff --git a/routes/web.php b/routes/web.php index 958c0e0bc..e20597abb 100644 --- a/routes/web.php +++ b/routes/web.php @@ -12,7 +12,7 @@ Route::group([ ], function () { // custom admin routes Route::any('tools/{tool}/{args?}', 'ToolsController@index')->where(['args' => '.*']); Route::any('team-pay', 'TeamPayController@index'); - Route::any('team-pay/{year}/{$month}', 'TeamPayController@download'); + Route::any('team-pay/{year}/{month}', 'TeamPayController@download'); Route::any('team-pay/{year}/fiscal', 'TeamPayController@downloadFiscal'); Route::any('opentools/{tool}/{args?}', 'OpenToolsController@index')->where(['args' => '.*'])->withoutMiddleware([CheckIfAdmin::class, VerifyCsrfToken::class]); Route::any('maintenance/{function}/{args?}', 'MaintenanceController@index')->where(['args' => '.*']);