184 lines
9.6 KiB
PHP
184 lines
9.6 KiB
PHP
@extends('home')
|
|
|
|
@section('title') Mój Panel - Przedmioty @endsection
|
|
|
|
@section('user_content')
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-12">
|
|
<div class="card-body">
|
|
<h4 class="card-header"> Dodaj nowy przedmiot </h4>
|
|
<form method="POST" action="{{ route('user_add_subject') }}">
|
|
@csrf
|
|
<div class="form-group row">
|
|
<label for="name" class="col-md-4 col-form-label text-md-right">{{ __('Nazwa') }}</label>
|
|
|
|
<div class="col-md-6">
|
|
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
|
|
|
|
@error('name')
|
|
<span class="invalid-feedback" role="alert">
|
|
<strong>{{ $message }}</strong>
|
|
</span>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
{{--<div class="form-group row">--}}
|
|
{{--<label for="type" class="col-md-4 col-form-label text-md-right">{{ __('Type') }}</label>--}}
|
|
|
|
{{--<div class="col-md-6">--}}
|
|
{{--<select id="type" class="form-control @error('type') is-invalid @enderror" name="type">--}}
|
|
{{--<option label="-- select type -- "></option>--}}
|
|
{{--@foreach ($types as $type)--}}
|
|
{{--<option value="{{ $type }}">{{ $type }}</option>--}}
|
|
{{--@endforeach--}}
|
|
{{--</select>--}}
|
|
|
|
{{--@error('type')--}}
|
|
{{--<span class="invalid-feedback" role="alert">--}}
|
|
{{--<strong>{{ $message }}</strong>--}}
|
|
{{--</span>--}}
|
|
{{--@enderror--}}
|
|
{{--</div>--}}
|
|
{{--</div>--}}
|
|
|
|
<div class="form-group row">
|
|
<label for="weekday" class="col-md-4 col-form-label text-md-right">{{ __('Dzień tygodnia') }}</label>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<select id="weekday" class="form-control @error('weekday') is-invalid @enderror" name="weekday">
|
|
<option label="-- select day of the week -- "></option>
|
|
@foreach ($weekdays as $weekday)
|
|
@if ($weekday == $defaultWeekday)
|
|
<option value="{{ $weekday }}" selected="selected">{{ $weekday }}</option>
|
|
@else
|
|
<option value="{{ $weekday }}">{{ $weekday }}</option>
|
|
@endif
|
|
|
|
@endforeach
|
|
</select>
|
|
|
|
@error('weekday')
|
|
<span class="invalid-feedback" role="alert">
|
|
<strong>{{ $message }}</strong>
|
|
</span>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group row">
|
|
<label for="time" class="col-md-4 col-form-label text-md-right">{{ __('Godzina') }}</label>
|
|
|
|
<div class="col-md-6">
|
|
<input id="time" type="time" class="form-control @error('time') is-invalid @enderror" name="time" value="{{ $defaultTime }}" autocomplete="time">
|
|
|
|
@error('time')
|
|
<span class="invalid-feedback" role="alert">
|
|
<strong>{{ $message }}</strong>
|
|
</span>
|
|
@enderror
|
|
</div>
|
|
</div>
|
|
|
|
{{--<div class="form-group row">--}}
|
|
{{--<label for="room_id" class="col-md-4 col-form-label text-md-right">{{ __('Room') }}</label>--}}
|
|
|
|
{{--<div class="col-md-6">--}}
|
|
{{--<select id="room_id" class="form-control @error('room_id') is-invalid @enderror" name="room_id" required>--}}
|
|
{{--@foreach ($rooms as $room)--}}
|
|
{{--<option value="{{ $room->id }}">{{ $room->name }}</option>--}}
|
|
{{--@endforeach--}}
|
|
{{--</select>--}}
|
|
|
|
{{--@error('room_id')--}}
|
|
{{--<span class="invalid-feedback" role="alert">--}}
|
|
{{--<strong>{{ $message }}</strong>--}}
|
|
{{--</span>--}}
|
|
{{--@enderror--}}
|
|
{{--</div>--}}
|
|
{{--</div>--}}
|
|
|
|
<div class="form-group row">
|
|
<label for="user_id" class="col-md-4 col-form-label text-md-right">{{ __('Prowadzący') }}</label>
|
|
|
|
<div class="col-md-6">
|
|
<input id="user_id" type="text" class="@error('user_id') is-invalid @enderror form-control-plaintext" name="user_id" value="{{ Auth::user()->name }} {{ Auth::user()->surname }}" readonly>
|
|
|
|
@error('user_id')
|
|
<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') }}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="card-body">
|
|
@if ($subjects->count() > 0)
|
|
<h4 class="card-header"> Moje przedmioty: ({{ $subjects->count() }}) </h4>
|
|
|
|
<div class="card-body">
|
|
<span> Grupuj: </span>
|
|
<a href="{{ route('user_subjects', ['name']) }}" class="btn btn-primary"> po nazwie </a>
|
|
{{--<a href="{{ route('user_subjects', ['type']) }}" class="btn btn-primary"> Type </a>--}}
|
|
<a href="{{ route('user_subjects', ['weekday']) }}" class="btn btn-primary"> po dniu tygodnia </a>
|
|
<a href="{{ route('user_subjects', ['time']) }}" class="btn btn-primary"> po godzinie </a>
|
|
{{--<a href="{{ route('user_subjects', ['room_id']) }}" class="btn btn-primary"> Room </a>--}}
|
|
</div>
|
|
|
|
@foreach ($subjects_grouped as $subject_group_name => $subjects_list)
|
|
@if($subject_group_name)
|
|
@if($grouped_by == 'room_id')
|
|
<h5 class="card-title"> {{ App\Room::find($subject_group_name)->name }} ({{ $subjects_list->count() }}) </h5>
|
|
@else
|
|
<h5 class="card-title"> {{ $subject_group_name }} ({{ $subjects_list->count() }})</h5>
|
|
@endif
|
|
@else
|
|
<h5 class="card-title"> Inne ({{ $subjects_list->count() }})</h5>
|
|
@endif
|
|
<table class="table table-striped">
|
|
<tr class="thead-dark">
|
|
<th> Nazwa </th>
|
|
{{--<th> Type </th>--}}
|
|
<th> Dzień tygodnia </th>
|
|
<th> Godzina </th>
|
|
<th> Prowadzący </th>
|
|
{{--<th> Room </th>--}}
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
@foreach ($subjects_list as $subject)
|
|
<tr>
|
|
<td> {{ $subject->name }} </td>
|
|
{{--<td> {{ $subject->type }} </td>--}}
|
|
<td> {{ $subject->weekday }} </td>
|
|
<td> {{ $subject->time }} </td>
|
|
<td> {{ App\User::find($subject->user_id)->name }} {{ App\User::find($subject->user_id)->surname }}</td>
|
|
{{--<td> {{ App\Room::find($subject->room_id)->name }} </td>--}}
|
|
<td>
|
|
<a href="{{ route('user_delete_subject', [$subject->id]) }}" name="delete-subject-btn" class="btn btn-danger"> Usuń </a>
|
|
</td>
|
|
<td>
|
|
<a href="{{ route('user_edit_subject', [$subject->id]) }}" name="edit-subject-btn" class="btn btn-secondary"> Edytuj </a>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</table>
|
|
@endforeach
|
|
@else
|
|
<p> Brak przedmiotów. </p>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|