Clicking on icon next to note title will filter list to notes that has been assigned with clicked icon.

This commit is contained in:
kplaczek
2018-07-05 08:37:52 +02:00
parent 42c61feff8
commit 0b3d25d013
4 changed files with 47 additions and 7 deletions

View File

@@ -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