diff --git a/app/Classes.php b/app/Classes.php index b344981..c5a3d14 100644 --- a/app/Classes.php +++ b/app/Classes.php @@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model; class Classes extends Model { protected $fillable = [ - 'subject_id', 'date', 'classes_code' + 'subject_id', 'date', 'classes_code', 'test_mode' ]; } diff --git a/app/Http/Controllers/User/UserClassesController.php b/app/Http/Controllers/User/UserClassesController.php index ccd216a..36dde84 100644 --- a/app/Http/Controllers/User/UserClassesController.php +++ b/app/Http/Controllers/User/UserClassesController.php @@ -41,9 +41,11 @@ class UserClassesController extends Controller { $subject_id = $request->input('subject_id'); $date = $request->input('date'); + $test_mode = $request->input('test_mode'); $classes_id = Classes::create([ 'subject_id' => $subject_id, - 'date' => $date + 'date' => $date, + 'test_mode' => $test_mode ])->id; return redirect(route('user_start_classes', ['classes_id' => $classes_id])); } @@ -81,6 +83,23 @@ class UserClassesController extends Controller $attendances = Attendance::where('classes_id', $classes->id)->get(); $seat_numbers = $attendances->pluck('seat_number')->toArray(); $subject = Subject::find($classes->subject_id); + + if($classes->test_mode) { + $room_capacity = Room::find($subject->room_id)->capacity; + $random_seat = rand(1, $room_capacity); + while(in_array($random_seat, $seat_numbers)) { + $random_seat = rand(1, $room_capacity); + } + Attendance::create([ + 'classes_id' => $classes->id, + 'student_id_number' => $student_id_number, + 'student_name' => $student_name, + 'student_surname' => $student_surname, + 'seat_number' => $random_seat + ]); + return view('map.summary_map', ['student_name' => $student_name, 'student_surname' => $student_surname, 'seat_number' => $random_seat, 'student_id_number' => $student_id_number, 'classes_id' => $classes->id]); + } + $room_arrangement = Room::find($subject->room_id)->arrangement; if(!$room_arrangement) { $room_arrangement = Room::where('name', 'Inna sala')->first()->arrangement; @@ -101,6 +120,21 @@ class UserClassesController extends Controller $attendances = Attendance::where('classes_id', $classes->id)->get(); $seat_numbers = $attendances->pluck('seat_number')->toArray(); $subject = Subject::find($classes->subject_id); + if($classes->test_mode) { + $room_capacity = Room::find($subject->room_id)->capacity; + $random_seat = rand(1, $room_capacity); + while(in_array($random_seat, $seat_numbers)) { + $random_seat = rand(1, $room_capacity); + } + Attendance::create([ + 'classes_id' => $classes->id, + 'student_id_number' => $student_id_number, + 'student_name' => $student_name, + 'student_surname' => $student_surname, + 'seat_number' => $random_seat + ]); + return view('map.summary_map', ['student_name' => $student_name, 'student_surname' => $student_surname, 'seat_number' => $random_seat, 'student_id_number' => $student_id_number, 'classes_id' => $classes->id]); + } $room_arrangement = Room::find($subject->room_id)->arrangement; if(!$room_arrangement) { $room_arrangement = Room::where('name', 'Inna sala')->first()->arrangement; diff --git a/database/migrations/2019_11_26_232020_create_classes_table.php b/database/migrations/2019_11_26_232020_create_classes_table.php index 7f186fc..13875a5 100644 --- a/database/migrations/2019_11_26_232020_create_classes_table.php +++ b/database/migrations/2019_11_26_232020_create_classes_table.php @@ -18,6 +18,7 @@ class CreateClassesTable extends Migration $table->integer('subject_id'); $table->date('date'); $table->string('classes_code')->nullable(); + $table->boolean('test_mode')->nullable(); $table->timestamps(); }); } diff --git a/database/seeds/ClassesTableSeeder.php b/database/seeds/ClassesTableSeeder.php index cb2d9a3..fd5b2c5 100644 --- a/database/seeds/ClassesTableSeeder.php +++ b/database/seeds/ClassesTableSeeder.php @@ -14,11 +14,13 @@ class ClassesTableSeeder extends Seeder DB::table('classes')->insert([ 'subject_id' => 1, 'date' => '2019-12-02', + 'test_mode' => false ]); DB::table('classes')->insert([ 'subject_id' => 2, 'date' => '2019-12-02', + 'test_mode' => false ]); } } diff --git a/public/css/app.css b/public/css/app.css index 2e3542a..2a00945 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -11199,3 +11199,17 @@ main { padding-top: 20px; } +.badge { + padding: 5px; + font-size: 85%; +} + +.test-mode-div { + display: flex; + justify-content: flex-start; + align-items: center; +} + +.test-mode-div input { + width: 20px; +} diff --git a/public/js/custom.js b/public/js/custom.js index a83c10f..4b2fc21 100644 --- a/public/js/custom.js +++ b/public/js/custom.js @@ -67,4 +67,8 @@ $(document).ready(function(){ }); } setSelectedOptionGroup(); + + $('input[type="checkbox"]').on('change', function() { + $('input[type="checkbox"]').not(this).prop('checked', false); + }); }); diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 6a38e80..f4b0ca0 100644 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -21,16 +21,17 @@

Sprawdzanie obecności możesz rozpocząć w zakładce Sprawdź obecność. -
Po rozpoczęciu zapisów zostanie wygenerowany i wyświetlony na ekranie kod weryfikacyjny. +
W trybe egzaminu studenci nie będą sami wybierać sobie miejsc, lecz miejsca zostaną im przydzielone w sposób losowy. +
Po rozpoczęciu zapisów zostanie wygenerowany i wyświetlony na ekranie kod weryfikacyjny. Należy go wprowadzić do programu obsługującego odczyt danych z legitymacji studenckich. Kod jest ważny 1,5 godziny od momentu utworzenia zajęć. Dopóki kod jest aktywny, zapisy można przerywać i ponownie kontynuować, gdy zajdzie taka potrzeba.
W tej zakładce znajdziesz także listę wszystkich minionych zajęć. -
W każdym momencie możesz zobaczyć podgląd sali i listę obecności dla konkretnych zajęć. Taką listę możesz wyeksportować do formatu xlsx. +
W każdym momencie możesz zobaczyć podgląd sali i listę obecności dla konkretnych zajęć. Taką listę możesz sortować i wyeksportować do formatu xlsx.

Dane dotyczące obecności znajdziesz także w zakładce Obecności. -
Do każdej obecności możesz dodać notatkę. +
Do każdej obecności możesz dodać notatkę i ją później edytować.
Rekordy dotyczące wszystkich obecności możesz grupować i wyeksportować. Przy eksporcie każda tabela-grupa trafi do pliku xlsx jako osobny arkusz.

@endsection diff --git a/resources/views/map/summary_map.blade.php b/resources/views/map/summary_map.blade.php index 9a04720..c5d3d0e 100644 --- a/resources/views/map/summary_map.blade.php +++ b/resources/views/map/summary_map.blade.php @@ -10,10 +10,10 @@
Zakończ zapisy
-

{{ $student_name }} {{ $student_surname }}

-

{{ $student_id_number }}

-

wybrane miejsce:

- +

{{ $student_name }} {{ $student_surname }}

+

{{ $student_id_number }}

+

miejsce:

+ @endsection diff --git a/resources/views/user/user_classes.blade.php b/resources/views/user/user_classes.blade.php index 9e1f0c1..bd79895 100644 --- a/resources/views/user/user_classes.blade.php +++ b/resources/views/user/user_classes.blade.php @@ -44,6 +44,14 @@ +
+ + +
+ +
+
+