]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5627 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 5 Dec 2022 16:13:16 +0000 (17:13 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 5 Dec 2022 16:13:16 +0000 (17:13 +0100)
app/Http/Controllers/Admin/TeamPayController.php
resources/views/team/pay.blade.php
routes/web.php

index fc368ce5f2a56c85af1be4c6f696fb705ae0199a..12092fbbcadc4b2077c73a3aa05b4bf52c1f725e 100644 (file)
@@ -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;
 
     }
index 483bf78c224d2164bac31a5af7e394c83a653ecf..b8d9a4181c21faa579585f2c7d570257d38b9e21 100644 (file)
@@ -24,7 +24,7 @@
                 <td></td>
                 <td><span>{{$slip['year']}}</span></td>
                 <td><span>{{$slip['month']}}</span></td>
-                <td><a class="btn btn-link" href="{{url('team-pay/'.$slip['year'].'/'.$slip['month'])}}"
+                <td><a class="btn btn-link btn-sm" href="{{url('team-pay/'.$slip['year'].'/'.$slip['month'])}}"
                        download="{{$slip['year'].'-'.$slip['month'].'.pdf'}}"><i
                             class="la la-arrow-circle-down"></i> {{__('Télécharger')}}</a>
                 </td>
index 958c0e0bc1007d48eb946147ef0544dd2d88209a..e20597abbbd634868de78894e905c5ae0699ead1 100644 (file)
@@ -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' => '.*']);