some validation and error catching updates

This commit is contained in:
s416422 2020-03-06 18:33:03 +01:00
parent 083583e8e2
commit 7f5b8d8bc4
9 changed files with 143 additions and 53 deletions

View File

@ -34,8 +34,8 @@ class AttendanceGroupedExportSingleView implements FromView, WithTitle
{ {
if($this->groupBy == 'classes_id') { if($this->groupBy == 'classes_id') {
$subject = Subject::find(Classes::find($this->groupedValue)->subject_id)->name; $subject = Subject::findOrFail(Classes::find($this->groupedValue)->subject_id)->name;
$date = Classes::find($this->groupedValue)->date; $date = Classes::findOrFail($this->groupedValue)->date;
$this->groupedValue = "{$date} {$subject}"; $this->groupedValue = "{$date} {$subject}";
} else if($this->groupBy == 'seat_number') { } else if($this->groupBy == 'seat_number') {

View File

@ -28,6 +28,9 @@ class AttendanceGroupedExportView implements WithMultipleSheets
public function sheets(): array public function sheets(): array
{ {
$user_id = Auth::id(); $user_id = Auth::id();
if(!$user_id) {
abort(401);
}
$subjects = Subject::where('user_id', $user_id)->get(); $subjects = Subject::where('user_id', $user_id)->get();
$subjects_ids = $subjects->pluck('id')->toArray(); $subjects_ids = $subjects->pluck('id')->toArray();
$classes = Classes::whereIn('subject_id', $subjects_ids)->orderBy('created_at','DESC')->get(); $classes = Classes::whereIn('subject_id', $subjects_ids)->orderBy('created_at','DESC')->get();

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers\User; namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use App\Exports\AttendanceExportView; use App\Exports\AttendanceExportView;
@ -40,6 +41,9 @@ class UserAttendancesController extends Controller
public function index($groupBy='classes_id') public function index($groupBy='classes_id')
{ {
$user_id = Auth::id(); $user_id = Auth::id();
if(!$user_id) {
abort(401);
}
$subjects = Subject::where('user_id', $user_id)->get(); $subjects = Subject::where('user_id', $user_id)->get();
$subjects_ids = $subjects->pluck('id')->toArray(); $subjects_ids = $subjects->pluck('id')->toArray();
$classes = Classes::whereIn('subject_id', $subjects_ids)->orderBy('created_at','DESC')->get(); $classes = Classes::whereIn('subject_id', $subjects_ids)->orderBy('created_at','DESC')->get();
@ -83,20 +87,29 @@ class UserAttendancesController extends Controller
public function delete_attendance($attendance_id) public function delete_attendance($attendance_id)
{ {
Attendance::find($attendance_id)->delete(); try {
Attendance::findOrFail($attendance_id)->delete();
return redirect()->back(); return redirect()->back();
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Taki wpis obecności nie istnieje w bazie danych, zatem nie można go usunąć.']);
}
} }
public function edit_attendance($attendance_id) public function edit_attendance($attendance_id)
{ {
Attendance::find($attendance_id); Attendance::findOrFail($attendance_id);
return redirect()->back(); return redirect()->back();
} }
public function export($classes_id) public function export($classes_id)
{ {
$classes_date = Classes::find($classes_id)->date; try {
$classes_date = Classes::findOrFail($classes_id)->date;
return Excel::download(new AttendanceExportView($classes_id), "classes-attendance-{$classes_date}.xlsx"); return Excel::download(new AttendanceExportView($classes_id), "classes-attendance-{$classes_date}.xlsx");
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Takie zajęcia nie istnieją w bazie danych, zatem nie można wyeksportować obecności.']);
}
} }
public function export_grouped($groupBy) public function export_grouped($groupBy)
@ -106,18 +119,24 @@ class UserAttendancesController extends Controller
if($groupBy == 'classes_id') { if($groupBy == 'classes_id') {
$groupByLabel = 'classes-name'; $groupByLabel = 'classes-name';
} }
if($today_date & $groupByLabel){
return Excel::download(new AttendanceGroupedExportView($groupBy), "all-attendance-grouped-by-{$groupByLabel}-{$today_date}.xlsx"); return Excel::download(new AttendanceGroupedExportView($groupBy), "all-attendance-grouped-by-{$groupByLabel}-{$today_date}.xlsx");
};
return redirect()->back();
} }
public function add_attendance_note(Request $request) public function add_attendance_note(Request $request)
{ {
$attendance_id = $request->input('attendance_id'); $attendance_id = $request->input('attendance_id');
$note = $request->input('note_content'); $note = $request->input('note_content');
$attendance = Attendance::find($attendance_id); try {
$attendance = Attendance::findOrFail($attendance_id);
$attendance->notes = $note; $attendance->notes = $note;
$attendance->save(); $attendance->save();
$attendance->refresh(); $attendance->refresh();
return redirect()->back(); return redirect()->back();
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Taki wpis obecności nie istnieje w bazie danych, zatem nie można dodaź do niego notatki.']);
}
} }
} }

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers\User;
use App\Attendance; use App\Attendance;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Controllers\UserCache; use App\Http\Controllers\UserCache;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Subject; use App\Subject;
@ -54,6 +55,9 @@ class UserClassesController extends Controller {
public function index($groupBy = 'subject_id') { public function index($groupBy = 'subject_id') {
$user_id = Auth::id(); $user_id = Auth::id();
if(!$user_id) {
abort(401);
}
$subjects = Subject::where('user_id', $user_id)->get(); $subjects = Subject::where('user_id', $user_id)->get();
$subjects_ids = $subjects->pluck('id')->toArray(); $subjects_ids = $subjects->pluck('id')->toArray();
$classes = Classes::whereIn('subject_id', $subjects_ids)->orderBy('created_at', 'DESC')->get(); $classes = Classes::whereIn('subject_id', $subjects_ids)->orderBy('created_at', 'DESC')->get();
@ -91,17 +95,22 @@ class UserClassesController extends Controller {
} }
public function delete_classes($classes_id) { public function delete_classes($classes_id) {
Classes::find($classes_id)->delete(); try {
Classes::findOrFail($classes_id)->delete();
return redirect()->back(); return redirect()->back();
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Takie zajęcia nie istniejeą w bazie danych, zatem nie można ich usunąć.']);
}
} }
public function edit_classes($classes_id) { public function edit_classes($classes_id) {
Classes::find($classes_id); Classes::findOrFail($classes_id);
return redirect()->back(); return redirect()->back();
} }
public function start_classes($classes_id) { public function start_classes($classes_id) {
$classes = Classes::find($classes_id); try {
$classes = Classes::findOrFail($classes_id);
$classes_code = $classes->classes_code; $classes_code = $classes->classes_code;
if (!$classes_code) { if (!$classes_code) {
$classes_code = generateRandomString(10); $classes_code = generateRandomString(10);
@ -109,8 +118,10 @@ class UserClassesController extends Controller {
$classes->save(); $classes->save();
$classes->refresh(); $classes->refresh();
} }
return view('map.start_map', ['classes_code' => $classes_code, 'classes' => $classes]); return view('map.start_map', ['classes_code' => $classes_code, 'classes' => $classes]);
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Takie zajęcia nie istnieją w bazie danych, zatem nie można ich rozpocząć.']);
}
} }
public function start_classes_verified(Request $request) { public function start_classes_verified(Request $request) {
@ -123,9 +134,21 @@ class UserClassesController extends Controller {
$student_id_number = $request->input('student_id_number'); $student_id_number = $request->input('student_id_number');
$student_name = $request->input('student_name'); $student_name = $request->input('student_name');
$student_surname = $request->input('student_surname'); $student_surname = $request->input('student_surname');
$classes = Classes::find($request->get('classes_id')); try {
$subject = Subject::find($classes->subject_id); $classes = Classes::findOrFail($request->get('classes_id'));
$room_capacity = Room::find($subject->room_id)->capacity; } catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Takie zajęcia nie istnieją w bazie danych, zatem nie można ich rozpocząć.']);
}
try {
$subject = Subject::findOrFail($classes->subject_id);
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Taki przedmiot nie istnieje w bazie danych.']);
}
try {
$room_capacity = Room::findOrFail($subject->room_id)->capacity;
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Taka sala nie istnieje w bazie danych.']);
}
$attendances = Attendance::where('classes_id', $classes->id)->get(); $attendances = Attendance::where('classes_id', $classes->id)->get();
$student_ids = $attendances->pluck('student_id_number')->toArray(); $student_ids = $attendances->pluck('student_id_number')->toArray();
$seat_numbers = $attendances->pluck('seat_number')->toArray(); $seat_numbers = $attendances->pluck('seat_number')->toArray();
@ -157,7 +180,11 @@ class UserClassesController extends Controller {
return view('map.summary_map', ['student_name' => $student_name, 'student_surname' => $student_surname, 'seat_number' => null, 'student_id_number' => $student_id_number, 'classes_id' => $classes->id, 'mode' => $classes->mode, 'warning' => null]); return view('map.summary_map', ['student_name' => $student_name, 'student_surname' => $student_surname, 'seat_number' => null, 'student_id_number' => $student_id_number, 'classes_id' => $classes->id, 'mode' => $classes->mode, 'warning' => null]);
} else { } else {
// prepare seat map // prepare seat map
$room_arrangement = Room::find($subject->room_id)->arrangement; try {
$room_arrangement = Room::findOrFail($subject->room_id)->arrangement;
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Taka sala nie istnieje w bazie danych.']);
}
if (!$room_arrangement) { if (!$room_arrangement) {
$room_arrangement = Room::where('name', 'Inna sala')->first()->arrangement; $room_arrangement = Room::where('name', 'Inna sala')->first()->arrangement;
} }
@ -182,6 +209,7 @@ class UserClassesController extends Controller {
} }
} }
} }
} }
public function save_classes_data(Request $request) { public function save_classes_data(Request $request) {
@ -190,7 +218,11 @@ class UserClassesController extends Controller {
$student_name = $request->input('student_name'); $student_name = $request->input('student_name');
$student_surname = $request->input('student_surname'); $student_surname = $request->input('student_surname');
$seat_number = $request->input('seat_number'); $seat_number = $request->input('seat_number');
$classes = Classes::find($request->get('classes_id')); try {
$classes = Classes::findOrFail($request->get('classes_id'));
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Takie zajęcia nie istnieją w bazie danych.']);
}
$attendances = Attendance::where('classes_id', $classes->id)->get(); $attendances = Attendance::where('classes_id', $classes->id)->get();
$student_ids = $attendances->pluck('student_id_number')->toArray(); $student_ids = $attendances->pluck('student_id_number')->toArray();
@ -212,11 +244,23 @@ class UserClassesController extends Controller {
public function preview_classes($classes_id, $orderBy = 'student_surname', $orderDirection = 'ASC') { public function preview_classes($classes_id, $orderBy = 'student_surname', $orderDirection = 'ASC') {
if (!$classes_id == 0) { if (!$classes_id == 0) {
$classes = Classes::find($classes_id); try {
$classes = Classes::findOrFail($classes_id);
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Takie zajęcia nie istnieją w bazie danych.']);
}
$attendances = Attendance::where('classes_id', $classes->id)->orderBy($orderBy, $orderDirection)->get(); $attendances = Attendance::where('classes_id', $classes->id)->orderBy($orderBy, $orderDirection)->get();
$seat_numbers = $attendances->pluck('seat_number')->toArray(); $seat_numbers = $attendances->pluck('seat_number')->toArray();
$subject = Subject::find($classes->subject_id); try {
$room_arrangement = Room::find($subject->room_id)->arrangement; $subject = Subject::findOrFail($classes->subject_id);
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Taki przedmiot nie istnieje w bazie danych.']);
}
try {
$room_arrangement = Room::findOrFail($subject->room_id)->arrangement;
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Taka sala nie istnieje w bazie danych.']);
}
if (!$room_arrangement) { if (!$room_arrangement) {
$room_arrangement = Room::where('name', 'Inna sala')->first()->arrangement; $room_arrangement = Room::where('name', 'Inna sala')->first()->arrangement;
} }
@ -228,7 +272,7 @@ class UserClassesController extends Controller {
$multi_parts = false; $multi_parts = false;
} }
return view('user.user_preview_classes', ['classes_id' => $classes_id, 'room_arrangement' => $room_arrangement, 'attendances' => $attendances, 'seat_numbers' => $seat_numbers, 'orderBy' => $orderBy, 'orderDirection' => $orderDirection, 'multi_parts' => $multi_parts, 'parts_number' => $parts_number]); return view('user.user_preview_classes', ['classes_id' => $classes_id, 'room_arrangement' => $room_arrangement, 'attendances' => $attendances, 'seat_numbers' => $seat_numbers, 'orderBy' => $orderBy, 'orderDirection' => $orderDirection, 'multi_parts' => $multi_parts, 'parts_number' => $parts_number]);
}
} return redirect()->back();
} }
} }

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers\User; namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@ -56,6 +57,9 @@ class UserSubjectsController extends Controller
public function index($groupBy = 'weekday') { public function index($groupBy = 'weekday') {
$user_id = Auth::id(); $user_id = Auth::id();
if(!$user_id) {
abort(401);
}
$subjects = Subject::where('user_id', $user_id)->orderBy('name','ASC')->get(); $subjects = Subject::where('user_id', $user_id)->orderBy('name','ASC')->get();
$subjects_grouped = $subjects->groupBy($groupBy); $subjects_grouped = $subjects->groupBy($groupBy);
$rooms = Room::all(); $rooms = Room::all();
@ -94,15 +98,19 @@ class UserSubjectsController extends Controller
public function delete_subject($subject_id) public function delete_subject($subject_id)
{ {
Subject::find($subject_id)->delete(); try {
Subject::findOrFail($subject_id)->delete();
return redirect()->back(); return redirect()->back();
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Taki przedmiot nie istnieje w bazie danych, zatem nie można go usunąć.']);
}
} }
public function edit_subject(Request $request) public function edit_subject(Request $request)
{ {
$subject_id = $request->input('subject_id'); $subject_id = $request->input('subject_id');
$subject = Subject::find($subject_id); try {
if($subject) { $subject = Subject::findOrFail($subject_id);
if ($request->input('name_e') == $subject->name) { if ($request->input('name_e') == $subject->name) {
$validator = $this->edited_validator($request->except(['name_e'])); $validator = $this->edited_validator($request->except(['name_e']));
} else { } else {
@ -120,7 +128,10 @@ class UserSubjectsController extends Controller
$subject->room_id = $request->input('room_id_e'); $subject->room_id = $request->input('room_id_e');
$subject->save(); $subject->save();
$subject->refresh(); $subject->refresh();
}
return redirect()->back(); return redirect()->back();
} catch(ModelNotFoundException $exception) {
return redirect()->back()->withErrors(['Taki przedmiot nie istnieje w bazie danych, zatem nie można go edytować.']);
}
} }
} }

View File

@ -53,17 +53,17 @@ class RoomsTableSeeder extends Seeder
), ),
array('name' => 'A2-2', 'capacity' => 34, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]c[6,6]++_++c[7,7]c[8,8]c[9,9]c[10,10]c[11,11]c[12,12]++c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]++c[19,19]c[20,20]c[21,21]c[22,22]c[23,23]c[24,24]++_++c[25,25]c[26,26]c[27,27]c[28,28]c[29,29]c[30,30]++c[31,31]c[32,32]c[33,33]c[34,34]', 'description' => ''), array('name' => 'A2-2', 'capacity' => 34, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]c[6,6]++_++c[7,7]c[8,8]c[9,9]c[10,10]c[11,11]c[12,12]++c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]++c[19,19]c[20,20]c[21,21]c[22,22]c[23,23]c[24,24]++_++c[25,25]c[26,26]c[27,27]c[28,28]c[29,29]c[30,30]++c[31,31]c[32,32]c[33,33]c[34,34]', 'description' => ''),
array('name' => 'A2-20', 'capacity' => 32, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]c[6,6]++_++c[7,7]c[8,8]c[9,9]c[10,10]c[11,11]c[12,12]++c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]++c[19,19]c[20,20]c[21,21]c[22,22]c[23,23]c[24,24]++_++c[25,25]c[26,26]c[27,27]c[28,28]c[29,29]c[30,30]++c[31,31]c[32,32]', 'description' => ''), array('name' => 'A2-20', 'capacity' => 32, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]c[6,6]++_++c[7,7]c[8,8]c[9,9]c[10,10]c[11,11]c[12,12]++c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]++c[19,19]c[20,20]c[21,21]c[22,22]c[23,23]c[24,24]++_++c[25,25]c[26,26]c[27,27]c[28,28]c[29,29]c[30,30]++c[31,31]c[32,32]', 'description' => ''),
array('name' => 'A2-21', 'capacity' => 48, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]_c[5,5]c[6,6]c[7,7]c[8,8]++c[9,9]c[10,10]c[11,11]c[12,12]_c[13,13]c[14,14]c[15,15]c[16,16]++c[17,17]c[18,18]c[19,19]c[20,20]_c[21,21]c[22,22]c[23,23]c[24,24]++c[25,25]c[26,26]c[27,27]c[28,28]_c[29,29]c[30,30]c[31,31]c[32,32]++c[33,33]c[34,34]c[35,35]c[36,36]_c[37,37]c[38,38]c[39,39]c[40,40]++c[41,41]c[42,42]c[43,43]c[44,44]_c[45,45]c[46,46]c[47,47]c[48,48]', array('name' => 'A2-21', 'capacity' => 48, 'arrangement' => '_____c[1,1]c[2,2]c[3,3]c[4,4]++_____c[5,5]c[6,6]c[7,7]c[8,8]++c[9,9]c[10,10]c[11,11]c[12,12]_c[13,13]c[14,14]c[15,15]c[16,16]++c[17,17]c[18,18]c[19,19]c[20,20]_c[21,21]c[22,22]c[23,23]c[24,24]++c[25,25]c[26,26]c[27,27]c[28,28]_c[29,29]c[30,30]c[31,31]c[32,32]++c[33,33]c[34,34]c[35,35]c[36,36]_c[37,37]c[38,38]c[39,39]c[40,40]++c[41,41]c[42,42]c[43,43]c[44,44]_c[45,45]c[46,46]c[47,47]c[48,48]',
'description' => 'Perspektywa z poziomu komputera prowadzącego - numery 1-8 to rząd pod ścianą.' 'description' => 'Perspektywa z poziomu komputera prowadzącego - numery 1-4 to rząd pod ścianą.'
), ),
array('name' => 'A2-22', 'capacity' => 48, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]_c[5,5]c[6,6]c[7,7]c[8,8]++c[9,9]c[10,10]c[11,11]c[12,12]_c[13,13]c[14,14]c[15,15]c[16,16]++c[17,17]c[18,18]c[19,19]c[20,20]_c[21,21]c[22,22]c[23,23]c[24,24]++c[25,25]c[26,26]c[27,27]c[28,28]_c[29,29]c[30,30]c[31,31]c[32,32]++c[33,33]c[34,34]c[35,35]c[36,36]_c[37,37]c[38,38]c[39,39]c[40,40]++c[41,41]c[42,42]c[43,43]c[44,44]_c[45,45]c[46,46]c[47,47]c[48,48]', array('name' => 'A2-22', 'capacity' => 48, 'arrangement' => '_____c[1,1]c[2,2]c[3,3]c[4,4]++_____c[5,5]c[6,6]c[7,7]c[8,8]++c[9,9]c[10,10]c[11,11]c[12,12]_c[13,13]c[14,14]c[15,15]c[16,16]++c[17,17]c[18,18]c[19,19]c[20,20]_c[21,21]c[22,22]c[23,23]c[24,24]++c[25,25]c[26,26]c[27,27]c[28,28]_c[29,29]c[30,30]c[31,31]c[32,32]++c[33,33]c[34,34]c[35,35]c[36,36]_c[37,37]c[38,38]c[39,39]c[40,40]++c[41,41]c[42,42]c[43,43]c[44,44]_c[45,45]c[46,46]c[47,47]c[48,48]',
'description' => 'Perspektywa z poziomu komputera prowadzącego - numery 1-8 to rząd pod ścianą.' 'description' => 'Perspektywa z poziomu komputera prowadzącego - numery 1-4 to rząd pod ścianą.'
), ),
array('name' => 'A2-23', 'capacity' => 48, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]_c[5,5]c[6,6]c[7,7]c[8,8]++c[9,9]c[10,10]c[11,11]c[12,12]_c[13,13]c[14,14]c[15,15]c[16,16]++c[17,17]c[18,18]c[19,19]c[20,20]_c[21,21]c[22,22]c[23,23]c[24,24]++c[25,25]c[26,26]c[27,27]c[28,28]_c[29,29]c[30,30]c[31,31]c[32,32]++c[33,33]c[34,34]c[35,35]c[36,36]_c[37,37]c[38,38]c[39,39]c[40,40]++c[41,41]c[42,42]c[43,43]c[44,44]_c[45,45]c[46,46]c[47,47]c[48,48]', array('name' => 'A2-23', 'capacity' => 48, 'arrangement' => '_____c[1,1]c[2,2]c[3,3]c[4,4]++_____c[5,5]c[6,6]c[7,7]c[8,8]++c[9,9]c[10,10]c[11,11]c[12,12]_c[13,13]c[14,14]c[15,15]c[16,16]++c[17,17]c[18,18]c[19,19]c[20,20]_c[21,21]c[22,22]c[23,23]c[24,24]++c[25,25]c[26,26]c[27,27]c[28,28]_c[29,29]c[30,30]c[31,31]c[32,32]++c[33,33]c[34,34]c[35,35]c[36,36]_c[37,37]c[38,38]c[39,39]c[40,40]++c[41,41]c[42,42]c[43,43]c[44,44]_c[45,45]c[46,46]c[47,47]c[48,48]',
'description' => 'Perspektywa z poziomu komputera prowadzącego - numery 1-8 to rząd pod ścianą.' 'description' => 'Perspektywa z poziomu komputera prowadzącego - numery 1-4 to rząd pod ścianą.'
), ),
array('name' => 'A2-24', 'capacity' => 48, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]_c[5,5]c[6,6]c[7,7]c[8,8]++c[9,9]c[10,10]c[11,11]c[12,12]_c[13,13]c[14,14]c[15,15]c[16,16]++c[17,17]c[18,18]c[19,19]c[20,20]_c[21,21]c[22,22]c[23,23]c[24,24]++c[25,25]c[26,26]c[27,27]c[28,28]_c[29,29]c[30,30]c[31,31]c[32,32]++c[33,33]c[34,34]c[35,35]c[36,36]_c[37,37]c[38,38]c[39,39]c[40,40]++c[41,41]c[42,42]c[43,43]c[44,44]_c[45,45]c[46,46]c[47,47]c[48,48]', array('name' => 'A2-24', 'capacity' => 48, 'arrangement' => '_____c[1,1]c[2,2]c[3,3]c[4,4]++_____c[5,5]c[6,6]c[7,7]c[8,8]++c[9,9]c[10,10]c[11,11]c[12,12]_c[13,13]c[14,14]c[15,15]c[16,16]++c[17,17]c[18,18]c[19,19]c[20,20]_c[21,21]c[22,22]c[23,23]c[24,24]++c[25,25]c[26,26]c[27,27]c[28,28]_c[29,29]c[30,30]c[31,31]c[32,32]++c[33,33]c[34,34]c[35,35]c[36,36]_c[37,37]c[38,38]c[39,39]c[40,40]++c[41,41]c[42,42]c[43,43]c[44,44]_c[45,45]c[46,46]c[47,47]c[48,48]',
'description' => 'Perspektywa z poziomu komputera prowadzącego - numery 1-8 to rząd pod ścianą.' 'description' => 'Perspektywa z poziomu komputera prowadzącego - numery 1-4 to rząd pod ścianą.'
), ),
array('name' => 'A2-4', 'capacity' => 24, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]c[6,6]++_++c[7,7]c[8,8]c[9,9]c[10,10]c[11,11]c[12,12]++c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]++c[19,19]c[20,20]c[21,21]c[22,22]c[23,23]++c[24,24]', 'description' => ''), array('name' => 'A2-4', 'capacity' => 24, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]c[6,6]++_++c[7,7]c[8,8]c[9,9]c[10,10]c[11,11]c[12,12]++c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]++c[19,19]c[20,20]c[21,21]c[22,22]c[23,23]++c[24,24]', 'description' => ''),
array('name' => 'A2-5', 'capacity' => 24, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]c[6,6]++_++c[7,7]c[8,8]c[9,9]c[10,10]c[11,11]c[12,12]++c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]++c[19,19]c[20,20]c[21,21]c[22,22]c[23,23]++c[24,24]', 'description' => ''), array('name' => 'A2-5', 'capacity' => 24, 'arrangement' => 'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]c[6,6]++_++c[7,7]c[8,8]c[9,9]c[10,10]c[11,11]c[12,12]++c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]++c[19,19]c[20,20]c[21,21]c[22,22]c[23,23]++c[24,24]', 'description' => ''),

View File

@ -11,7 +11,7 @@
<form method="POST" action="{{ route('user_add_attendance_note') }}"> <form method="POST" action="{{ route('user_add_attendance_note') }}">
@csrf @csrf
<input type="hidden" class="form-control" name="attendance_id" value="{{ $attendance->id }}"> <input type="hidden" class="form-control" name="attendance_id" value="{{ $attendance->id }}" required>
<input type="hidden" id="note_content_hidden-{{ $attendance->id }}" name="note_content_hidden" value="{{ $attendance->notes }}"> <input type="hidden" id="note_content_hidden-{{ $attendance->id }}" name="note_content_hidden" value="{{ $attendance->notes }}">
<div class="form-group"> <div class="form-group">
<label for="note_content-{{ $attendance->id }}" class="col-form-label">Treść notatki:</label> <label for="note_content-{{ $attendance->id }}" class="col-form-label">Treść notatki:</label>

View File

@ -8,7 +8,9 @@
<div class="card-header custom-header"> <div class="card-header custom-header">
<h4> Wszystkie obecności <span class="badge badge-secondary" title="Liczba wszystkich obecności"> {{ $attendances->count() }} </span> </h4> <h4> Wszystkie obecności <span class="badge badge-secondary" title="Liczba wszystkich obecności"> {{ $attendances->count() }} </span> </h4>
<div> <div>
@if ($attendances->count() > 0)
<a href="{{ route('user_export_grouped', [$grouped_by]) }}" class="btn btn-success btn-export" title="Wyeksportuj wszystko do xlsx"> <i class="fa fa-file-excel-o"></i> Wyeksportuj (.xlsx) </a> <a href="{{ route('user_export_grouped', [$grouped_by]) }}" class="btn btn-success btn-export" title="Wyeksportuj wszystko do xlsx"> <i class="fa fa-file-excel-o"></i> Wyeksportuj (.xlsx) </a>
@endif
<button type="button" class="btn btn-primary add-attendance-btn" title="Dodaj nowy wpis"> <i class="fa fa-plus"></i> Dodaj nowy wpis </button> <button type="button" class="btn btn-primary add-attendance-btn" title="Dodaj nowy wpis"> <i class="fa fa-plus"></i> Dodaj nowy wpis </button>
</div> </div>
</div> </div>

View File

@ -35,8 +35,19 @@
<div class="preview-attendance-table"> <div class="preview-attendance-table">
<div class="card-header custom-header"> <div class="card-header custom-header">
<h4> Lista obecności <span class="badge badge-secondary" title="Liczba osób w sali"> {{ $attendances->count() }} </span></h4> <h4> Lista obecności <span class="badge badge-secondary" title="Liczba osób w sali"> {{ $attendances->count() }} </span></h4>
@if($attendances->count() > 0)
<a href="{{ route('user_export', [$classes_id]) }}" class="btn btn-success btn-export" title="Wyeksportuj tabelę do xlsx"> <i class="fa fa-file-excel-o"></i> Wyeksportuj (.xlsx) </a> <a href="{{ route('user_export', [$classes_id]) }}" class="btn btn-success btn-export" title="Wyeksportuj tabelę do xlsx"> <i class="fa fa-file-excel-o"></i> Wyeksportuj (.xlsx) </a>
@endif
</div> </div>
@if ($errors->any())
<div class="alert alert-danger invalid-feedback-alert">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="card-body card-custom"> <div class="card-body card-custom">
<span class="sort-span"> Sortuj: </span> <span class="sort-span"> Sortuj: </span>
<input type="hidden" id="orderBy-hidden" value="{{ $orderBy }}"> <input type="hidden" id="orderBy-hidden" value="{{ $orderBy }}">