Printing data on numpad key press, first version. Settings page for mapping key to actions.
This commit is contained in:
@@ -34,6 +34,7 @@ class Main extends Controller
|
||||
* post::/printImage
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function imagePrint(Request $request)
|
||||
{
|
||||
@@ -138,28 +139,6 @@ class Main extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* get:/airly
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function airly(Request $request)
|
||||
{
|
||||
$airly = new Airly();
|
||||
$this->paper->sendImagePrint($airly->icon);
|
||||
$this->paper->sendHeaderPrint('Jakość powietrza:' . PHP_EOL . date('H:i d-m-Y'));
|
||||
$airly->setStations(config('paper.airly.stations'));
|
||||
|
||||
foreach ($airly->getStations() as $stationId) {
|
||||
$stationInfo = $airly->getStationInfo($stationId);
|
||||
$this->paper->sendHeaderPrint($stationInfo['address']['locality'] . ' ' . $stationInfo['address']['route']);
|
||||
$dataText = $airly->getInformationText($stationId);
|
||||
$this->paper->sendPrint('', $dataText);
|
||||
}
|
||||
return back();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* post::/print/{id}
|
||||
* @param Request $request
|
||||
@@ -168,15 +147,24 @@ class Main extends Controller
|
||||
*/
|
||||
public function printText(Request $request, $id)
|
||||
{
|
||||
$note = DB::table('note')->where('id', $id)->first();
|
||||
$this->paper->sendPrint($note->topic, $note->text, $note->icon);
|
||||
$note = $this->printNote($id);
|
||||
$request->session()->flash('print_status', 'Wydrukowano notatkę: ' . $note->topic . '!');
|
||||
return back();
|
||||
}
|
||||
|
||||
public function printNote($noteId){
|
||||
$note = DB::table('note')->where('id', $noteId)->first();
|
||||
$this->paper->sendPrint($note->topic, $note->text, $note->icon);
|
||||
return $note;
|
||||
}
|
||||
|
||||
public function noteLast(){
|
||||
$note = DB::table('note')->orderBy('id', 'desc')->first();
|
||||
$this->printNote($note->id);
|
||||
}
|
||||
|
||||
private function templateReplace($input)
|
||||
{
|
||||
|
||||
return str_replace(['[d]', '[m]', '[y]', '[h]', '[i]', '[s]'],
|
||||
[date('d'), date('m'), date('Y'), date('H'), date('i'), date('s')],
|
||||
$input);
|
||||
|
||||
Reference in New Issue
Block a user