room arrangements added

This commit is contained in:
s416422 2019-12-09 12:17:23 +01:00
parent a5c9c2cb86
commit 5bc28b56cd
15 changed files with 197 additions and 179 deletions

View File

@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model;
class Attendance extends Model
{
protected $fillable = [
'classes_id', 'student_id_number', 'student_name', 'student_surname', 'seat_number'
'classes_id', 'student_id_number', 'student_name', 'student_surname', 'seat_number', 'notes'
];
}

View File

@ -8,6 +8,7 @@ use Illuminate\Http\Request;
use App\Subject;
use App\Classes;
use App\Room;
use Illuminate\Support\Facades\Auth;
@ -67,7 +68,6 @@ class UserClassesController extends Controller
$classes->save();
$classes->refresh();
}
return view('map.start_map', ['classes_code' => $classes_code, 'classes' => $classes]);
}
@ -79,7 +79,12 @@ class UserClassesController extends Controller
$classes = Classes::find($request->get('classes_id'));
$attendances = Attendance::where('classes_id', $classes->id)->get();
$seat_numbers = $attendances->pluck('seat_number')->toArray();
return view('map.seat_map', ['student_name' => $student_name, 'student_surname' => $student_surname, 'student_id_number' => $student_id_number, 'classes_id' => $classes->id, 'seat_numbers' => $seat_numbers]);
$subject = Subject::find($classes->subject_id);
$room_arrangement = Room::find($subject->room_id)->arrangement;
if(!$room_arrangement) {
$room_arrangement = Room::where('name', 'Inna sala')->get()->arrangement;
}
return view('map.seat_map', ['student_name' => $student_name, 'student_surname' => $student_surname, 'student_id_number' => $student_id_number, 'classes_id' => $classes->id, 'seat_numbers' => $seat_numbers, 'room_arrangement' => $room_arrangement]);
}
public function save_classes_data(Request $request)

View File

@ -18,13 +18,13 @@ class UserSubjectsController extends Controller
$user_id = Auth::id();
$subjects = Subject::where('user_id', $user_id)->get();
$subjects_grouped = $subjects->groupBy($groupBy);
// $rooms = Room::all();
$rooms = Room::all();
$weekdays = ['Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota', 'Niedziela'];
// $types = ['Lecture', 'Excercises', 'Labs', 'Other'];
$defaultTime = date("H:i");
$defaultWeekday = $weekdays[date('w')-1];
return view('user.user_subjects', ['subjects' => $subjects, 'weekdays' => $weekdays,
'subjects_grouped' => $subjects_grouped, 'grouped_by' => $groupBy, 'defaultTime' => $defaultTime, 'defaultWeekday' => $defaultWeekday]);
'subjects_grouped' => $subjects_grouped, 'grouped_by' => $groupBy, 'defaultTime' => $defaultTime, 'defaultWeekday' => $defaultWeekday, 'rooms' => $rooms]);
}
public function add_subject(Request $request)
@ -33,14 +33,14 @@ class UserSubjectsController extends Controller
// $type = $request->input('type');
$weekday = $request->input('weekday');
$time = $request->input('time');
// $room_id = $request->input('room_id');
$room_id = $request->input('room_id');
$user_id_n = Auth::id();
Subject::create([
'name' => $name,
// 'type' => $type,
'weekday'=> $weekday,
'time' => $time,
// 'room_id' => $room_id,
'room_id' => $room_id,
'user_id' => $user_id_n
]);
return redirect(route('user_subjects'));

View File

@ -19,7 +19,7 @@ class CreateSubjectsTable extends Migration
// $table->string('type')->nullable();
$table->string('weekday')->nullable();
$table->string('time')->nullable();
// $table->integer('room_id');
$table->integer('room_id');
$table->integer('user_id');
$table->timestamps();
});

View File

@ -17,7 +17,7 @@ class CreateRoomsTable extends Migration
$table->bigIncrements('id')->unique();
$table->string('name')->unique();
$table->integer('capacity')->nullable();
$table->string('arrangement')->nullable();
$table->text('arrangement')->nullable();
$table->timestamps();
});
}

View File

@ -20,6 +20,7 @@ class CreateAttendancesTable extends Migration
$table->string('student_name');
$table->string('student_surname');
$table->integer('seat_number');
$table->text('notes')->nullable();
$table->timestamps();
});
}

View File

@ -13,7 +13,7 @@ class DatabaseSeeder extends Seeder
{
$this->call([
UsersTableSeeder::class,
// RoomsTableSeeder::class,
RoomsTableSeeder::class,
SubjectsTableSeeder::class,
ClassesTableSeeder::class,
AttendancesTableSeeder::class,

View File

@ -12,61 +12,76 @@ class RoomsTableSeeder extends Seeder
public function run()
{
$rooms = [
array('name' => 'A0-1', 'capacity' => 30),
array('name' => 'A0-11', 'capacity' => 24),
array('name' => 'A0-12', 'capacity' => 24),
array('name' => 'A0-3', 'capacity' => 13),
array('name' => 'A0-5', 'capacity' => 13),
array('name' => 'A1-14/15', 'capacity' => 25),
array('name' => 'A1-16/17', 'capacity' => 25),
array('name' => 'A1-18', 'capacity' => 13),
array('name' => 'A1-20', 'capacity' => 13),
array('name' => 'A1-22/23', 'capacity' => 25),
array('name' => 'A1-24/25', 'capacity' => 25),
array('name' => 'A1-33 (Sala RW)', 'capacity' => 64),
array('name' => 'A2-1', 'capacity' => 24),
array('name' => 'A2-10', 'capacity' => 34),
array('name' => 'A2-11', 'capacity' => 34),
array('name' => 'A2-12', 'capacity' => 34),
array('name' => 'A2-14', 'capacity' => 48),
array('name' => 'A2-19', 'capacity' => 48),
array('name' => 'A2-2', 'capacity' => 34),
array('name' => 'A2-20', 'capacity' => 32),
array('name' => 'A2-21', 'capacity' => 48),
array('name' => 'A2-22', 'capacity' => 48),
array('name' => 'A2-23', 'capacity' => 48),
array('name' => 'A2-24', 'capacity' => 48),
array('name' => 'A2-3', 'capacity' => 24),
array('name' => 'A2-4', 'capacity' => 24),
array('name' => 'A2-5', 'capacity' => 24),
array('name' => 'A2-8', 'capacity' => 24),
array('name' => 'A2-9', 'capacity' => 34),
array('name' => 'Aula A', 'capacity' => 196),
array('name' => 'Aula B', 'capacity' => 117),
array('name' => 'Aula C', 'capacity' => 117),
array('name' => 'B1-06', 'capacity' => 4),
array('name' => 'B1-07/08', 'capacity' => 16),
array('name' => 'B1-37', 'capacity' => 18),
array('name' => 'B1-38', 'capacity' => 12),
array('name' => 'B2-08/09', 'capacity' => 16),
array('name' => 'B2-38', 'capacity' => 15),
array('name' => 'B2-39', 'capacity' => 12),
array('name' => 'B2-44', 'capacity' => 4),
array('name' => 'B3-08/09', 'capacity' => 16),
array('name' => 'B3-38', 'capacity' => 18),
array('name' => 'B3-39', 'capacity' => 18),
array('name' => 'B3-49', 'capacity' => 12),
array('name' => 'C2-3', 'capacity' => 1),
array('name' => 'D-1', 'capacity' => 22),
array('name' => 'D-2', 'capacity' => 21),
array('name' => 'D-3', 'capacity' => 22),
array('name' => 'Klub Profesorski', 'capacity' => null)
array('name' => 'A0-1', 'capacity' => 30, 'arrangement' =>
'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]c[6,6]++_++c[7,7]c[8,8]c[9,9]c[10,10]c[11,11]c[12,12]++c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]'
),
array('name' => 'A0-11', 'capacity' => 24, 'arrangement' =>
'__c[3,3]c[4,4]c[5,5]c[6,6]++c[7,7]c[8,8]_c[10,10]c[11,11]c[12,12]++c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]'
),
array('name' => 'A0-12', 'capacity' => 24, 'arrangement' => ''),
array('name' => 'A0-3', 'capacity' => 13, 'arrangement' => ''),
array('name' => 'A0-5', 'capacity' => 13, 'arrangement' => ''),
array('name' => 'A1-14/15', 'capacity' => 25, 'arrangement' =>
'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]++_++c[6,6]c[7,7]c[8,8]c[9,9]++c[10,10]c[11,11]c[12,12]c[13,13]++_++c[14,14]c[15,15]c[16,16]c[17,17]++_++c[18,18]c[19,19]c[20,20]c[21,21]++c[22,22]c[23,23]c[24,24]c[25,25]'
),
array('name' => 'A1-16/17', 'capacity' => 25, 'arrangement' =>
'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]++_++c[6,6]c[7,7]c[8,8]c[9,9]++c[10,10]c[11,11]c[12,12]c[13,13]++_++c[14,14]c[15,15]c[16,16]c[17,17]++_++c[18,18]c[19,19]c[20,20]c[21,21]++c[22,22]c[23,23]c[24,24]c[25,25]'
),
array('name' => 'A1-18', 'capacity' => 13, 'arrangement' => ''),
array('name' => 'A1-20', 'capacity' => 13, 'arrangement' => ''),
array('name' => 'A1-22/23', 'capacity' => 25, 'arrangement' =>
'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]++_++c[6,6]c[7,7]c[8,8]c[9,9]++c[10,10]c[11,11]c[12,12]c[13,13]++_++c[14,14]c[15,15]c[16,16]c[17,17]++_++c[18,18]c[19,19]c[20,20]c[21,21]++c[22,22]c[23,23]c[24,24]c[25,25]'
),
array('name' => 'A1-24/25', 'capacity' => 25, 'arrangement' =>
'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]++_++c[6,6]c[7,7]c[8,8]c[9,9]++c[10,10]c[11,11]c[12,12]c[13,13]++_++c[14,14]c[15,15]c[16,16]c[17,17]++_++c[18,18]c[19,19]c[20,20]c[21,21]++c[22,22]c[23,23]c[24,24]c[25,25]'
),
array('name' => 'A1-33 (Sala RW)', 'capacity' => 64, 'arrangement' => ''),
array('name' => 'A2-1', 'capacity' => 24, 'arrangement' => ''),
array('name' => 'A2-10', 'capacity' => 34, 'arrangement' => ''),
array('name' => 'A2-11', 'capacity' => 34, 'arrangement' => ''),
array('name' => 'A2-12', 'capacity' => 34, 'arrangement' => ''),
array('name' => 'A2-14', 'capacity' => 48, 'arrangement' => ''),
array('name' => 'A2-19', 'capacity' => 48, 'arrangement' => ''),
array('name' => 'A2-2', 'capacity' => 34, 'arrangement' => ''),
array('name' => 'A2-20', 'capacity' => 32, 'arrangement' => ''),
array('name' => 'A2-21', 'capacity' => 48, 'arrangement' => ''),
array('name' => 'A2-22', 'capacity' => 48, 'arrangement' => ''),
array('name' => 'A2-23', 'capacity' => 48, 'arrangement' => ''),
array('name' => 'A2-24', 'capacity' => 48, 'arrangement' => ''),
array('name' => 'A2-3', 'capacity' => 24, 'arrangement' => ''),
array('name' => 'A2-4', 'capacity' => 24, 'arrangement' => ''),
array('name' => 'A2-5', 'capacity' => 24, 'arrangement' => ''),
array('name' => 'A2-8', 'capacity' => 24, 'arrangement' => ''),
array('name' => 'A2-9', 'capacity' => 34, 'arrangement' => ''),
array('name' => 'Aula A', 'capacity' => 196, 'arrangement' => ''),
array('name' => 'Aula B', 'capacity' => 117, 'arrangement' => ''),
array('name' => 'Aula C', 'capacity' => 117, 'arrangement' => ''),
array('name' => 'B1-06', 'capacity' => 4, 'arrangement' => ''),
array('name' => 'B1-07/08', 'capacity' => 16, 'arrangement' => ''),
array('name' => 'B1-37', 'capacity' => 18, 'arrangement' => ''),
array('name' => 'B1-38', 'capacity' => 12, 'arrangement' => ''),
array('name' => 'B2-08/09', 'capacity' => 16, 'arrangement' => ''),
array('name' => 'B2-38', 'capacity' => 15, 'arrangement' => ''),
array('name' => 'B2-39', 'capacity' => 12, 'arrangement' => ''),
array('name' => 'B2-44', 'capacity' => 4, 'arrangement' => ''),
array('name' => 'B3-08/09', 'capacity' => 16, 'arrangement' => ''),
array('name' => 'B3-38', 'capacity' => 18, 'arrangement' => ''),
array('name' => 'B3-39', 'capacity' => 18, 'arrangement' => ''),
array('name' => 'B3-49', 'capacity' => 12, 'arrangement' => ''),
array('name' => 'C2-3', 'capacity' => 1, 'arrangement' => ''),
array('name' => 'D-1', 'capacity' => 22, 'arrangement' => ''),
array('name' => 'D-2', 'capacity' => 21, 'arrangement' => ''),
array('name' => 'D-3', 'capacity' => 22, 'arrangement' => ''),
array('name' => 'Klub Profesorski', 'capacity' => null, 'arrangement' => ''),
array('name' => 'Inna sala', 'capacity' => null, 'arrangement' =>
'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]++_++c[6,6]c[7,7]c[8,8]c[9,9]++c[10,10]c[11,11]c[12,12]c[13,13]++_++c[14,14]c[15,15]c[16,16]c[17,17]++_++c[18,18]c[19,19]c[20,20]c[21,21]++c[22,22]c[23,23]c[24,24]c[25,25]'
)
];
foreach ($rooms as $room) {
DB::table('rooms')->insert([
'name' => $room['name'],
'capacity' => $room['capacity'],
'arrangement' => ''
'arrangement' => $room['arrangement']
]);
}
}

View File

@ -15,6 +15,7 @@ class SubjectsTableSeeder extends Seeder
'name' => 'Systemy Informatyczne UA0',
'weekday' => 'Poniedziałek',
'time' => '15:30',
'room_id' => 1,
'user_id' => 2
]);
@ -22,6 +23,7 @@ class SubjectsTableSeeder extends Seeder
'name' => 'Systemy Informatyczne UA0',
'weekday' => 'Wtorek',
'time' => '17:15',
'room_id' => 2,
'user_id' => 3
]);
}

View File

@ -31,7 +31,6 @@ function checkForUnavailablePlaces() {
unavailablePlaces.push($(this).val());
});
console.log(unavailablePlaces);
const allPlaces = $('.seatCharts-seat.seatCharts-cell.available');
if(unavailablePlaces){
allPlaces.each(function(){

View File

@ -1,6 +1,8 @@
var firstSeatLabel = 1;
$(document).ready(function() {
const seat_map = $('#room_arrangement').val().split('++');
var $cart = $('#selected-seats'),
seatNumber = '',
placeNumber = ('#sel-seat'),
@ -8,12 +10,7 @@ var firstSeatLabel = 1;
$name = $('#studentName'),
$total = $('#total'),
sc = $('#seat-map').seatCharts({
map: [
'c[1,1]c[2,2]c[3,3]c[4,4]c[5,5]c[6,6]',
'_',
'c[7,7]c[8,8]c[9,9]c[10,10]c[11,11]c[12,12]',
'c[13,13]c[14,14]c[15,15]c[16,16]c[17,17]c[18,18]',
],
map: seat_map,
seats: {
h: {
price : 2500,
@ -25,11 +22,11 @@ var firstSeatLabel = 1;
rows: ['','','',''],
top : false,
getLabel : function (character, row, column) {
if (row == '1') {
if (row === '1') {
return column;
} else if (row == '2') {
} else if (row === '2') {
return column;
} else if (row == '3') {
} else if (row === '3') {
return column;
}
},

View File

@ -26,11 +26,10 @@
<h3>Wybrane miejsce:
<span id="selected-seats"></span>
</h3>
@foreach($seat_numbers as $seat_number)
<input type="hidden" class="unavailable_place" value="{{ $seat_number }}">
@endforeach
<input type="hidden" class="room_arrangement" name="room_arrangement" id="room_arrangement" value="{{ $room_arrangement }}">
<form method="POST" action="{{ route('user_save_classes_data') }}">
<input type="hidden" value="{{ $classes_id }}" class="classes_id" name="classes_id">
<input type="hidden" value="{{ $student_name }}" class="student_name" name="student_name">

View File

@ -133,7 +133,7 @@
@foreach ($attendances_list as $attendance)
<tr>
<td> {{ App\Subject::find(App\Classes::find($attendance->classes_id)->subject_id)->name }},
{{ App\Classes::find($attendance->classes_id)-> date }} {{ App\Subject::find(App\Classes::find($attendance->classes_id)->subject_id)->time }} </td>
{{ App\Classes::find($attendance->classes_id)-> date }} {{ App\Subject::find(App\Classes::find($attendance->classes_id)->subject_id)->time }}, sala {{ App\Room::find(App\Subject::find(App\Classes::find($attendance->classes_id)->subject_id)->room_id) }} </td>
<td> {{ $attendance->student_id_number }} </td>
<td> {{ $attendance->student_name}}</td>
<td> {{ $attendance->student_surname}}</td>
@ -141,9 +141,9 @@
<td>
<a href="{{ route('user_delete_attendance', [$attendance->id]) }}" name="delete-attendance-btn" class="btn btn-danger"> Usuń </a>
</td>
<td>
<a href="{{ route('user_edit_attendance', [$attendance->id]) }}" name="edit-attendance-btn" class="btn btn-secondary"> Edytuj </a>
</td>
{{--<td>--}}
{{--<a href="{{ route('user_edit_attendance', [$attendance->id]) }}" name="edit-attendance-btn" class="btn btn-secondary"> Edytuj </a>--}}
{{--</td>--}}
</tr>
@endforeach
</table>

View File

@ -83,7 +83,7 @@
@foreach ($classes_list as $classes_item)
<tr>
<td> {{ App\Subject::find($classes_item->subject_id)->name }},
{{ App\Subject::find($classes_item->subject_id)->weekday }} {{ App\Subject::find($classes_item->subject_id)->time }}</td>
{{ 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>
<td> {{ $classes_item->date }} </td>
<td>
@if($classes_item->classes_code)

View File

@ -81,23 +81,23 @@
</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="form-group row">
<label for="room_id" class="col-md-4 col-form-label text-md-right">{{ __('Sala') }}</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>--}}
<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>--}}
@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>
@ -132,7 +132,7 @@
{{--<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>--}}
<a href="{{ route('user_subjects', ['room_id']) }}" class="btn btn-primary"> Room </a>
</div>
@foreach ($subjects_grouped as $subject_group_name => $subjects_list)
@ -152,7 +152,7 @@
<th> Dzień tygodnia </th>
<th> Godzina </th>
<th> Prowadzący </th>
{{--<th> Room </th>--}}
<th> Sala </th>
<th></th>
<th></th>
</tr>
@ -163,13 +163,13 @@
<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> {{ 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>
{{--<td>--}}
{{--<a href="{{ route('user_edit_subject', [$subject->id]) }}" name="edit-subject-btn" class="btn btn-secondary"> Edytuj </a>--}}
{{--</td>--}}
</tr>
@endforeach
</table>