atcheck/resources/views/user/user_classes.blade.php

116 lines
6.0 KiB
PHP
Raw Normal View History

2019-12-01 23:36:12 +01:00
@extends('home')
@section('title') Mój Panel - Zajęcia @endsection
2019-12-01 23:36:12 +01:00
@section('user_content')
<div class="row justify-content-center">
<div class="col-md-12">
2019-12-13 23:28:16 +01:00
<div class="card-header custom-header">
<h4> Sprawdź obecność </h4>
</div>
2019-12-01 23:36:12 +01:00
<div class="card-body">
2019-12-13 23:28:16 +01:00
<form method="POST" action="{{ route('user_add_classes') }}" class="classes-form">
2019-12-01 23:36:12 +01:00
@csrf
<div class="form-group row">
<label for="subject_id" class="col-md-4 col-form-label text-md-right">{{ __('Przedmiot') }}</label>
2019-12-01 23:36:12 +01:00
<div class="col-md-6">
<select id="subject_id" class="form-control @error('subject_id') is-invalid @enderror" name="subject_id" required>
@foreach ($subjects as $subject)
2019-12-09 12:25:32 +01:00
<option value="{{ $subject->id }}">{{ $subject->name }}, {{ $subject->weekday }} {{ $subject->time }}, sala {{ App\Room::find($subject->room_id)->name }}</option>
2019-12-01 23:36:12 +01:00
@endforeach
</select>
@error('subject_id')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row">
<label for="date" class="col-md-4 col-form-label text-md-right">{{ __('Data') }}</label>
2019-12-01 23:36:12 +01:00
<div class="col-md-6">
2019-12-13 23:28:16 +01:00
<input id="date" type="date" class="form-control @error('date') is-invalid @enderror" name="date" value="{{ $defaultDate }}" required autocomplete="date">
2019-12-01 23:36:12 +01:00
@error('date')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Dodaj zajęcia i rozpocznij zapisy') }}
2019-12-01 23:36:12 +01:00
</button>
</div>
</div>
</form>
</div>
2019-12-13 23:28:16 +01:00
@if ($classes->count() > 0)
<div class="card-header custom-header">
<h4> Moje zajęcia: ({{ $classes->count() }}) </h4>
</div>
2019-12-01 23:36:12 +01:00
2019-12-13 23:28:16 +01:00
<div class="card-body">
<span> Grupuj: </span>
<a href="{{ route('user_classes', ['subject_id']) }}" class="btn btn-primary"> po nazwie przedmiotu </a>
<a href="{{ route('user_classes', ['date']) }}" class="btn btn-primary"> po dacie </a>
</div>
2019-12-01 23:36:12 +01:00
2019-12-13 23:28:16 +01:00
<div class="card-body">
2019-12-01 23:36:12 +01:00
@foreach ($classes_grouped as $classes_group_name => $classes_list)
@if($classes_group_name)
@if($grouped_by == 'subject_id')
<h5 class="card-title"> {{ App\Subject::find($classes_group_name)->name }},
2019-12-01 23:36:12 +01:00
{{ App\Subject::find($classes_group_name)->weekday }} {{ App\Subject::find($classes_group_name)->time }} ({{ $classes_list->count() }}) </h5>
@else
<h5 class="card-title"> {{ $classes_group_name }} ({{ $classes_list->count() }}) </h5>
@endif
@else
<h5 class="card-title"> Inne ({{ $classes_list->count() }})</h5>
2019-12-01 23:36:12 +01:00
@endif
2019-12-13 23:28:16 +01:00
<table class="table table-striped subjects-table">
2019-12-01 23:36:12 +01:00
<tr class="thead-dark">
<th> Nazwa przedmiotu </th>
<th> Data </th>
2019-12-01 23:36:12 +01:00
<th></th>
<th></th>
<th></th>
2019-12-01 23:36:12 +01:00
</tr>
@foreach ($classes_list as $classes_item)
<tr>
<td> {{ App\Subject::find($classes_item->subject_id)->name }},
2019-12-09 12:17:23 +01:00
{{ App\Subject::find($classes_item->subject_id)->weekday }} {{ App\Subject::find($classes_item->subject_id)->time }}, sala {{ App\Room::find(App\Subject::find($classes_item->subject_id)->room_id)->name }}</td>
2019-12-01 23:36:12 +01:00
<td> {{ $classes_item->date }} </td>
2019-12-07 19:49:42 +01:00
<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
2019-12-07 19:49:42 +01:00
</td>
2019-12-13 23:28:16 +01:00
<td>
<a href="{{ route('user_preview_classes', [$classes_item->id]) }}" name="preview-classes-btn" class="btn btn-info"> Zobacz podgląd sali </a>
</td>
<td>
<a href="{{ route('user_delete_classes', [$classes_item->id]) }}" name="delete-classes-btn" class="btn btn-danger"> Usuń </a>
</td>
2019-12-01 23:36:12 +01:00
</tr>
@endforeach
</table>
@endforeach
2019-12-13 23:28:16 +01:00
</div>
2019-12-01 23:36:12 +01:00
@else
2019-12-13 23:28:16 +01:00
<div class="card-body">
<p> Brak zajęć. </p>
</div>
2019-12-01 23:36:12 +01:00
@endif
</div>
</div>
@endsection