2019-12-01 00:22:33 +01:00
|
|
|
@extends('layouts.adminpanel')
|
|
|
|
|
2019-12-06 22:34:25 +01:00
|
|
|
@section('title') Panel admina - Przedmioty @endsection
|
2019-12-01 00:22:33 +01:00
|
|
|
|
|
|
|
@section('admin_content')
|
2019-12-01 19:31:49 +01:00
|
|
|
<div class="row justify-content-center">
|
|
|
|
<div class="col-md-12">
|
2019-12-06 22:34:25 +01:00
|
|
|
<h5> Dodaj przedmiot </h5>
|
2019-12-01 19:31:49 +01:00
|
|
|
<form method="POST" action="{{ route('admin_add_subject') }}">
|
|
|
|
@csrf
|
|
|
|
<div class="form-group row">
|
2019-12-06 22:34:25 +01:00
|
|
|
<label for="name" class="col-md-4 col-form-label text-md-right">{{ __('Nazwa') }}</label>
|
2019-12-01 19:31:49 +01:00
|
|
|
|
|
|
|
<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>
|
|
|
|
|
2019-12-06 22:34:25 +01:00
|
|
|
{{--<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>--}}
|
2019-12-01 19:31:49 +01:00
|
|
|
|
|
|
|
<div class="form-group row">
|
2019-12-06 22:34:25 +01:00
|
|
|
<label for="weekday" class="col-md-4 col-form-label text-md-right">{{ __('Dzień tygodnia') }}</label>
|
2019-12-01 19:31:49 +01:00
|
|
|
|
|
|
|
<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)
|
|
|
|
<option value="{{ $weekday }}">{{ $weekday }}</option>
|
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
|
|
|
|
@error('weekday')
|
|
|
|
<span class="invalid-feedback" role="alert">
|
|
|
|
<strong>{{ $message }}</strong>
|
|
|
|
</span>
|
|
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group row">
|
2019-12-06 22:34:25 +01:00
|
|
|
<label for="time" class="col-md-4 col-form-label text-md-right">{{ __('Godzina') }}</label>
|
2019-12-01 19:31:49 +01:00
|
|
|
|
|
|
|
<div class="col-md-6">
|
2019-12-06 22:34:25 +01:00
|
|
|
<input id="time" type="time" class="form-control @error('time') is-invalid @enderror" name="time" value="{{ old('time') }}" autocomplete="time">
|
2019-12-01 19:31:49 +01:00
|
|
|
|
|
|
|
@error('time')
|
|
|
|
<span class="invalid-feedback" role="alert">
|
|
|
|
<strong>{{ $message }}</strong>
|
|
|
|
</span>
|
|
|
|
@enderror
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-12-06 22:34:25 +01:00
|
|
|
{{--<div class="form-group row">--}}
|
|
|
|
{{--<label for="room_id" class="col-md-4 col-form-label text-md-right">{{ __('Room') }}</label>--}}
|
2019-12-01 19:31:49 +01:00
|
|
|
|
2019-12-06 22:34:25 +01:00
|
|
|
{{--<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>--}}
|
2019-12-01 19:31:49 +01:00
|
|
|
|
2019-12-06 22:34:25 +01:00
|
|
|
{{--@error('room_id')--}}
|
|
|
|
{{--<span class="invalid-feedback" role="alert">--}}
|
|
|
|
{{--<strong>{{ $message }}</strong>--}}
|
|
|
|
{{--</span>--}}
|
|
|
|
{{--@enderror--}}
|
|
|
|
{{--</div>--}}
|
|
|
|
{{--</div>--}}
|
2019-12-01 19:31:49 +01:00
|
|
|
|
|
|
|
<div class="form-group row">
|
2019-12-06 22:34:25 +01:00
|
|
|
<label for="user_id" class="col-md-4 col-form-label text-md-right">{{ __('Prowadzący') }}</label>
|
2019-12-01 19:31:49 +01:00
|
|
|
|
|
|
|
<div class="col-md-6">
|
|
|
|
<select id="user_id" class="form-control @error('user_id') is-invalid @enderror" name="user_id" required>
|
|
|
|
@foreach ($users as $user)
|
|
|
|
<option value="{{ $user->id }}">{{ $user->name }} {{ $user->surname }}</option>
|
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
|
|
|
|
@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">
|
2019-12-06 22:34:25 +01:00
|
|
|
{{ __('Dodaj') }}
|
2019-12-01 19:31:49 +01:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
@if ($subjects->count() > 0)
|
2019-12-06 22:34:25 +01:00
|
|
|
<h5> Wszystkie przedmioty: ({{ $subjects->count() }}) </h5>
|
2019-12-01 19:31:49 +01:00
|
|
|
<table class="table table-striped">
|
|
|
|
<tr class="thead-dark">
|
|
|
|
<th>ID</th>
|
2019-12-06 22:34:25 +01:00
|
|
|
<th> Nazwa </th>
|
|
|
|
{{--<th> Type </th>--}}
|
|
|
|
<th> Dzień tygodnia </th>
|
|
|
|
<th> Godzina </th>
|
|
|
|
<th> ID prowadzącego </th>
|
|
|
|
<th> Prowadzący </th>
|
|
|
|
{{--<th> Room id </th>--}}
|
|
|
|
{{--<th> Room name </th>--}}
|
2019-12-01 19:31:49 +01:00
|
|
|
<th></th>
|
|
|
|
<th></th>
|
|
|
|
</tr>
|
|
|
|
@foreach ($subjects as $subject)
|
2019-12-01 00:22:33 +01:00
|
|
|
<tr>
|
2019-12-01 19:31:49 +01:00
|
|
|
<td> {{ $subject->id }}</td>
|
|
|
|
<td> {{ $subject->name }} </td>
|
2019-12-06 22:34:25 +01:00
|
|
|
{{--<td> {{ $subject->type }} </td>--}}
|
2019-12-01 19:31:49 +01:00
|
|
|
<td> {{ $subject->weekday }} </td>
|
|
|
|
<td> {{ $subject->time }} </td>
|
|
|
|
<td> {{ $subject->user_id}}</td>
|
|
|
|
<td> {{ App\User::find($subject->user_id)->name }} {{ App\User::find($subject->user_id)->surname }}</td>
|
2019-12-06 22:34:25 +01:00
|
|
|
{{--<td> {{ $subject->room_id}}</td>--}}
|
|
|
|
{{--<td> {{ App\Room::find($subject->room_id)->name }} </td>--}}
|
2019-12-01 19:31:49 +01:00
|
|
|
<td>
|
2019-12-06 22:34:25 +01:00
|
|
|
<a href="{{ route('admin_delete_subject', [$subject->id]) }}" name="delete-subject-btn" class="btn btn-danger"> Usuń </a>
|
2019-12-01 19:31:49 +01:00
|
|
|
</td>
|
|
|
|
<td>
|
2019-12-06 22:34:25 +01:00
|
|
|
<a href="{{ route('admin_edit_subject', [$subject->id]) }}" name="edit-subject-btn" class="btn btn-secondary"> Edytuj </a>
|
2019-12-01 19:31:49 +01:00
|
|
|
</td>
|
2019-12-01 00:22:33 +01:00
|
|
|
</tr>
|
2019-12-01 19:31:49 +01:00
|
|
|
@endforeach
|
|
|
|
</table>
|
|
|
|
@else
|
2019-12-06 22:34:25 +01:00
|
|
|
<p> Brak przedmiotów. </p>
|
2019-12-01 19:31:49 +01:00
|
|
|
@endif
|
2019-12-01 00:22:33 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endsection
|