js map controlles updated, README updated
This commit is contained in:
parent
3d13bdb8bb
commit
81a03268a7
@ -3,5 +3,6 @@
|
||||
```
|
||||
atcheck$ php artisan migrate:fresh
|
||||
atcheck$ php artisan db:seed
|
||||
atcheck$ composer dump-autoload
|
||||
atcheck$ php artisan serve
|
||||
```
|
||||
|
@ -21,6 +21,16 @@ class UserClassesController extends Controller
|
||||
$subjects = Subject::where('user_id', $user_id)->get();
|
||||
$subjects_ids = $subjects->pluck('id')->toArray();
|
||||
$classes = Classes::whereIn('subject_id', $subjects_ids)->get();
|
||||
foreach($classes as $classes_item) {
|
||||
$current_date = date('Y-m-d H:i:s');
|
||||
$classes_date = $classes_item->date;
|
||||
$hours_difference = checkHoursDifference($classes_date, $current_date);
|
||||
if ($hours_difference > 24) {
|
||||
$classes_item->classes_code = null;
|
||||
$classes_item->save();
|
||||
$classes_item->refresh();
|
||||
}
|
||||
}
|
||||
$classes_grouped = $classes->groupBy($groupBy);
|
||||
$defaultDate = date("Y-m-d");
|
||||
return view('user.user_classes', ['classes' => $classes, 'classes_grouped' => $classes_grouped, 'subjects' => $subjects, 'grouped_by' => $groupBy, 'defaultDate' => $defaultDate]);
|
||||
@ -58,7 +68,9 @@ class UserClassesController extends Controller
|
||||
$classes_code = generateRandomString(10);
|
||||
$classes->classes_code = $classes_code;
|
||||
$classes->save();
|
||||
$classes->refresh();
|
||||
}
|
||||
|
||||
return view('map.start_map', ['classes_code' => $classes_code, 'classes' => $classes]);
|
||||
}
|
||||
|
||||
|
@ -8,3 +8,11 @@ function generateRandomString($length = 10) {
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
function checkHoursDifference($dateStart, $dateEnd) {
|
||||
$dateStart = strtotime($dateStart);
|
||||
$dateEnd = strtotime($dateEnd);
|
||||
$diff = $dateEnd - $dateStart;
|
||||
$hours = floor(($diff / (60*60)));
|
||||
return $hours;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ body {
|
||||
bottom: -20%;
|
||||
transform: translate(-50%, -10%);
|
||||
background-color: rgba(139, 152, 172, 0.856);
|
||||
padding: 30px 80px;
|
||||
padding: 30px 40px;
|
||||
font-family: monospace;
|
||||
font-size: 30px;
|
||||
}
|
||||
@ -38,7 +38,16 @@ body {
|
||||
.code-p {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.test-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.test-form div {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.main-text {
|
||||
|
||||
font-family: "Oswald", Tahoma, sans-serif;
|
||||
|
@ -19,7 +19,7 @@
|
||||
<a href="{{ route('user_subjects') }}" class="btn btn-primary"> Moje przedmioty </a>
|
||||
{{--<a href="{{ route('user_classes') }}" class="btn btn-primary"> My classes </a>--}}
|
||||
<a href="{{ route('user_classes') }}" class="btn btn-primary"> Sprawdź obecność </a>
|
||||
<a href="{{ route('user_attendances') }}" class="btn btn-primary"> Statystyki </a>
|
||||
<a href="{{ route('user_attendances') }}" class="btn btn-primary"> Obecności </a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
@yield('user_content')
|
||||
|
@ -14,6 +14,7 @@
|
||||
<body>
|
||||
|
||||
<div class="wrapper">
|
||||
<a href="{{ route('user_classes') }}"> Zakończ zapisy </a>
|
||||
@yield('map_content')
|
||||
</div>
|
||||
|
||||
|
@ -9,4 +9,26 @@
|
||||
@section('map_content')
|
||||
<p class="code-p"> <b>Kod:</b> {{ $classes_code }}</p>
|
||||
<h1 class="main-text">Przyłóż legitymację do czytnika</h1>
|
||||
<div class="czytnik">
|
||||
<h3> CZYTNIK </h3>
|
||||
<form method="POST" action="{{ route('user_start_classes_verified') }}" class="test-form">
|
||||
<div>
|
||||
<label for="classes_code"> Kod: </label>
|
||||
<input type="text" name="classes_code" id="classes_code">
|
||||
</div>
|
||||
<div>
|
||||
<label for="student_id_number"> ID studenta: </label>
|
||||
<input type="number" name="student_id_number" id="student_id_number">
|
||||
</div>
|
||||
<div>
|
||||
<label for="student_name"> Imię studenta: </label>
|
||||
<input type="text" name="student_name" id="student_name">
|
||||
</div>
|
||||
<div>
|
||||
<label for="student_surname"> Nazwisko studenta: </label>
|
||||
<input type="text" name="student_surname" id="student_surname">
|
||||
</div>
|
||||
<button type="submit"> Wyślij requesta </button>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
@ -149,7 +149,7 @@
|
||||
</table>
|
||||
@endforeach
|
||||
@else
|
||||
<p> No attendance data yet. </p>
|
||||
<p> Brak zarejestrowantch obecności. </p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
@ -86,14 +86,13 @@
|
||||
{{ App\Subject::find($classes_item->subject_id)->weekday }} {{ App\Subject::find($classes_item->subject_id)->time }}</td>
|
||||
<td> {{ $classes_item->date }} </td>
|
||||
<td>
|
||||
@if($classes_item->classes_code)
|
||||
<a href="{{ route('user_start_classes', [$classes_item->id]) }}" name="start-classes-btn" class="btn btn-warning"> Kontynuuj zapisy </a>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ route('user_delete_classes', [$classes_item->id]) }}" name="delete-classes-btn" class="btn btn-danger"> Usuń </a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{ route('user_edit_classes', [$classes_item->id]) }}" name="edit-classes-btn" class="btn btn-secondary"> Edytuj </a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
|
@ -73,7 +73,6 @@ Route::group(array('prefix' => 'user', 'namespace' => 'User'), function() { //TO
|
||||
|
||||
Route::group(array('prefix' => 'edit'), function() {
|
||||
Route::get('/subject/{subject_id}/{groupBy?}', 'UserSubjectsController@edit_subject')->name('user_edit_subject');
|
||||
Route::get('/classes/{classes_id}/{groupBy?}', 'UserClassesController@edit_classes')->name('user_edit_classes');
|
||||
Route::get('/attendance/{attendance_id}/{groupBy?}', 'UserAttendancesController@edit_attendance')->name('user_edit_attendance');
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user