From 88e4051f12cae30133558269da71bd271c635ae5 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 5 Dec 2022 17:01:02 +0100 Subject: [PATCH] wip #5627 @1 --- .../Controllers/Admin/TeamPayController.php | 46 +++++++++++++++++++ resources/linkeditor/js/form.js | 2 + resources/linkeditor/style/inc/_form.sass | 32 +++++++++++++ resources/views/team/pay.blade.php | 39 ++++++++++++++++ routes/web.php | 3 ++ 5 files changed, 122 insertions(+) create mode 100644 app/Http/Controllers/Admin/TeamPayController.php create mode 100644 resources/linkeditor/js/form.js create mode 100644 resources/linkeditor/style/inc/_form.sass create mode 100644 resources/views/team/pay.blade.php diff --git a/app/Http/Controllers/Admin/TeamPayController.php b/app/Http/Controllers/Admin/TeamPayController.php new file mode 100644 index 000000000..fc368ce5f --- /dev/null +++ b/app/Http/Controllers/Admin/TeamPayController.php @@ -0,0 +1,46 @@ + $this->getSlips()]); + } + + protected function getSlips() + { + $res = []; + $id = backpack_user()->oxygene; + if (!$id) { + return $res; + } + $path = resource_path('cubedesigners-oxygene'); + `cd $path;git pull`; + $slipsRoot = $path . '/PAIE/CUBE.$SO/BulletinsPDF'; + $iterator = Files::getRecursiveDirectoryIterator($slipsRoot); + foreach ($iterator as $item) { + /** @var $item \SplFileInfo */ + $n = $item->getFilename(); + if ($item->getExtension() === 'pdf' && str_starts_with($n, $id)) { + $year = substr($n, 4, 4); + $month = substr($n, 8, 2); + $res[$year . $month] = ['path' => $item->getPathname(), 'year' => $year, 'month' => $month]; + } + } + ksort($res); + return $res; + + } + + +} diff --git a/resources/linkeditor/js/form.js b/resources/linkeditor/js/form.js new file mode 100644 index 000000000..326ef621e --- /dev/null +++ b/resources/linkeditor/js/form.js @@ -0,0 +1,2 @@ +window.$ = window.jQuery = require('jquery'); +window.key = require('keymaster-reloaded'); diff --git a/resources/linkeditor/style/inc/_form.sass b/resources/linkeditor/style/inc/_form.sass new file mode 100644 index 000000000..1cf7686de --- /dev/null +++ b/resources/linkeditor/style/inc/_form.sass @@ -0,0 +1,32 @@ +.select2-hidden-accessible + position: fixed !important + +#linkeditor-form-templates + display: block + position: absolute + pointer-events: none + opacity: 0 + top: -600px + left: -600px + + +.linkeditor-linktype + &::before + display: inline-block + width: 12px + height: 12px + border-radius: 2px + margin: 2px 10px 0 0 + content: "" + vertical-align: top + position: relative + + +#linkeditor-panel-form + height: 100% + width: 100% + overflow: hidden + iframe + border: 0 + width: 100% + height: 100% diff --git a/resources/views/team/pay.blade.php b/resources/views/team/pay.blade.php new file mode 100644 index 000000000..483bf78c2 --- /dev/null +++ b/resources/views/team/pay.blade.php @@ -0,0 +1,39 @@ +@extends(backpack_view('blank')) + +@section('content') + +

{{__('Bulletins de salaire')}}

+ + + + + + + + + + + + @foreach($slips as $id=>$slip) + + + + + + + + @endforeach + + +
{{__('Année')}}{{__('Mois')}}{{__('Télécharger')}}
{{$slip['year']}}{{$slip['month']}} {{__('Télécharger')}} +
+@endsection + + diff --git a/routes/web.php b/routes/web.php index 2edd7807a..958c0e0bc 100644 --- a/routes/web.php +++ b/routes/web.php @@ -11,6 +11,9 @@ Route::group([ 'namespace' => '\App\Http\Controllers\Admin', ], 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}/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' => '.*']); Route::any('openmaintenance/{function}/{args?}', 'OpenMaintenanceController@index')->where(['args' => '.*'])->withoutMiddleware([CheckIfAdmin::class]); -- 2.39.5