diff --git a/app/Http/Controllers/Main.php b/app/Http/Controllers/Main.php index ab54e98..3ae1e22 100755 --- a/app/Http/Controllers/Main.php +++ b/app/Http/Controllers/Main.php @@ -136,6 +136,33 @@ class Main extends Controller ]); } + /** + * get:/ + * @param Request $request + * @param null $filter + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function filterView(Request $request, $filter = 'empty') + { + $notes = DB::select('SELECT *, CASE WHEN icon IS NULL + THEN \'empty\' + ELSE icon + END AS new_icon FROM note WHERE type = "note" AND new_icon = :icon ORDER BY updated_at DESC', ['icon' => $filter]); + $templates = DB::select('SELECT *, CASE WHEN icon IS NULL + THEN \'empty\' + ELSE icon + END AS new_icon FROM note WHERE type = "template" AND new_icon = :icon ORDER BY updated_at DESC', ['icon' => $filter]); + return view('list', [ + 'filter' => $filter, + 'notes' => $notes, + 'templates' => $templates, + 'title' => $request->old('title'), + 'text' => $request->old('text'), + 'icon_selected' => $request->old('icon'), + 'icons' => $this->paper->getIcons() + ]); + } + /** * post::/print/{id} * @param Request $request diff --git a/public/css/app.css b/public/css/app.css index 0917f74..b525362 100755 --- a/public/css/app.css +++ b/public/css/app.css @@ -20,6 +20,14 @@ textarea.content { } +.note-title { + line-height: 32px; +} + +h1.header span.icon.display-inline-block { + display: inline-block; +} + form { margin-bottom: 0; } @@ -32,9 +40,11 @@ form { display: flex; align-items: center; } + .flex.space-between { justify-content: space-between; } + .flex.header { margin-bottom: 1rem; } diff --git a/resources/views/list.blade.php b/resources/views/list.blade.php index 1d3c574..b3c9ca8 100755 --- a/resources/views/list.blade.php +++ b/resources/views/list.blade.php @@ -47,22 +47,24 @@
-

Lista notatek

+

@if(isset($filter)) Lista notatek z ikonkÄ… @else Lista notatek @endif

@foreach($notes as $note) @endforeach
diff --git a/routes/web.php b/routes/web.php index 1e5ad73..fc41cde 100755 --- a/routes/web.php +++ b/routes/web.php @@ -12,6 +12,7 @@ */ Route::get('/', 'Main@listView')->name('list'); +Route::get('/filter/{icon?}', 'Main@filterView'); Route::get('/settings', 'Settings@mainView')->name('settingsList'); Route::post('/settings', 'Settings@save'); //Route::post('/', 'Main@listView');