Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp into master
This commit is contained in:
commit
e8f6c2242a
skolehjem
app/Http/Controllers
database/migrations
2020_06_08_080402_create_permission_tables.php2020_06_09_081126_alter_washing_reservations.php2020_06_23_070657_create_menu_plans.php
resources/views
admin/washing-reservations
app
routes
|
@ -164,7 +164,10 @@ class WashingReservationController extends Controller
|
||||||
|
|
||||||
$machines = WashingMachine::all();
|
$machines = WashingMachine::all();
|
||||||
|
|
||||||
$reservations = WashingReservation::query()->where("time", "LIKE", substr($date, 1, strpos($date, "T"))."%")->get();
|
if($request->machine_id == 0)
|
||||||
|
$request->machine_id = WashingMachine::all()->first()->id;
|
||||||
|
|
||||||
|
$reservations = WashingReservation::query()->where("machine_id", "=", $request->machine_id)->where("time", "LIKE", substr($date, 1, strpos($date, "T"))."%")->get();
|
||||||
|
|
||||||
$times = [];
|
$times = [];
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ class CreatePermissionTables extends Migration
|
||||||
Schema::create($tableNames['roles'], function (Blueprint $table) {
|
Schema::create($tableNames['roles'], function (Blueprint $table) {
|
||||||
$table->bigIncrements('id');
|
$table->bigIncrements('id');
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
|
$table->unique('name');
|
||||||
$table->string('description');
|
$table->string('description');
|
||||||
$table->string('guard_name');
|
$table->string('guard_name');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
<?php
|
|
||||||
//Migrations acts as a version control for the database allowing you to modify the app's database schema
|
|
||||||
|
|
||||||
//allows use of necessary libraries
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
class AlterWashingReservations extends Migration
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -22,6 +22,7 @@ class CreateMenuPlans extends Migration
|
||||||
$table->string('tuesday', 255);
|
$table->string('tuesday', 255);
|
||||||
$table->string('wednesday', 255);
|
$table->string('wednesday', 255);
|
||||||
$table->string('thursday', 255);
|
$table->string('thursday', 255);
|
||||||
|
$table->unique('week');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
//$table->text('description');
|
//$table->text('description');
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
@section("content")
|
@section("content")
|
||||||
<div class="row align-items-center">
|
<div class="row align-items-center">
|
||||||
<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('washing-reservations.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Reservation</a>
|
<!--<a class="btn btn-inline btn-sde-blue mb-0" href="{{ route('washing-reservations.create') }}"><img src="{{ asset('/images/icons/plus.svg') }}" alt="Create">Opret Reservation</a>!-->
|
||||||
|
|
||||||
<form method="post" action="{{ route("washing-reservations.store") }}">
|
<form method="post" action="{{ route("washing-reservations.store") }}">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<img src="{{URL::asset('/images/icons/Aktiviteter.svg')}}" alt="Aktiviteter">
|
<img src="{{URL::asset('/images/icons/Aktiviteter.svg')}}" alt="Aktiviteter">
|
||||||
Aktiviteter
|
Aktiviteter
|
||||||
</a>
|
</a>
|
||||||
<a href="{{ route("washing-reservations.index") }}">
|
<a href="{{ route("washing-reservations.appindex") }}">
|
||||||
<img src="{{URL::asset('/images/icons/Vaske booking liste.svg')}}" alt="Reservationer">
|
<img src="{{URL::asset('/images/icons/Vaske booking liste.svg')}}" alt="Reservationer">
|
||||||
Reservationer
|
Reservationer
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -92,13 +92,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDateSelect(date, dayHolder) {
|
function onDateSelect(date, dayHolder) {
|
||||||
|
console.log("Opdaterer selects");
|
||||||
let events;
|
let events;
|
||||||
let machinez;
|
let machinez;
|
||||||
let buttonz;
|
let buttonz;
|
||||||
|
|
||||||
let container = document.getElementById("event-container");
|
let container = document.getElementById("event-container");
|
||||||
|
|
||||||
NodeList.prototype.forEach = Array.prototype.forEach
|
NodeList.prototype.forEach = Array.prototype.forEach;
|
||||||
var children = document.getElementById("calenderRow").childNodes;
|
var children = document.getElementById("calenderRow").childNodes;
|
||||||
|
|
||||||
children.forEach(function(item){
|
children.forEach(function(item){
|
||||||
|
@ -107,11 +108,19 @@
|
||||||
|
|
||||||
dayHolder.classList.add("selected");
|
dayHolder.classList.add("selected");
|
||||||
|
|
||||||
|
let machine_id;
|
||||||
|
|
||||||
|
if(document.getElementById('washing-machines'))
|
||||||
|
machine_id = document.getElementById('washing-machines').value;
|
||||||
|
else
|
||||||
|
machine_id = 0;
|
||||||
|
|
||||||
axios({
|
axios({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: '{{ route("washing-reservations.api") }}',
|
url: '{{ route("washing-reservations.api") }}',
|
||||||
params: { 'date': date }
|
params: { 'date': date, 'machine_id': machine_id }
|
||||||
}).then(function (response) {
|
}).then(function (response) {
|
||||||
|
console.log(response.data["unavailable_times"]);
|
||||||
var data = response.data;
|
var data = response.data;
|
||||||
|
|
||||||
if(document.getElementById("washing-machines") != undefined)
|
if(document.getElementById("washing-machines") != undefined)
|
||||||
|
@ -126,6 +135,10 @@
|
||||||
select.id = "washing-machines";
|
select.id = "washing-machines";
|
||||||
select.name = "machine_id";
|
select.name = "machine_id";
|
||||||
|
|
||||||
|
select.onchange = function() {
|
||||||
|
onDateSelect(date, dayHolder);
|
||||||
|
}
|
||||||
|
|
||||||
container.appendChild(span);
|
container.appendChild(span);
|
||||||
container.appendChild(select);
|
container.appendChild(select);
|
||||||
|
|
||||||
|
@ -165,11 +178,18 @@
|
||||||
let machines = data["washingmachines"];
|
let machines = data["washingmachines"];
|
||||||
|
|
||||||
machinez.innerHTML = "";
|
machinez.innerHTML = "";
|
||||||
|
machinez.onchange = function () {
|
||||||
|
onDateSelect(date, dayHolder);
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < machines.length; i++) {
|
for (let i = 0; i < machines.length; i++) {
|
||||||
let option = document.createElement("option");
|
let option = document.createElement("option");
|
||||||
option.text = machines[i]["name"];
|
option.text = machines[i]["name"];
|
||||||
option.value = machines[i]["id"];
|
option.value = machines[i]["id"];
|
||||||
|
|
||||||
|
if(machine_id == machines[i]["id"])
|
||||||
|
option.selected = "selected";
|
||||||
|
|
||||||
machinez.appendChild(option);
|
machinez.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +207,6 @@
|
||||||
let unavailable_times = data["unavailable_times"];
|
let unavailable_times = data["unavailable_times"];
|
||||||
|
|
||||||
unavailable_times.forEach(function (item, index) {
|
unavailable_times.forEach(function (item, index) {
|
||||||
console.log(item);
|
|
||||||
document.getElementById(item).remove();
|
document.getElementById(item).remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ Route::put("/account/update", "UserController@accountupdate")->name("users.accou
|
||||||
Route::get("/events/signups", "EventController@signups")->name("events.signups");
|
Route::get("/events/signups", "EventController@signups")->name("events.signups");
|
||||||
Route::get("phones", "PhoneController@index")->name("phones.index");
|
Route::get("phones", "PhoneController@index")->name("phones.index");
|
||||||
Route::get("/washing-reservationsapi", "WashingReservationController@api")->name("washing-reservations.api");
|
Route::get("/washing-reservationsapi", "WashingReservationController@api")->name("washing-reservations.api");
|
||||||
|
Route::get("/app/washing-reservations", "WashingReservationController@appindex")->name("washing-reservations.appindex");
|
||||||
|
|
||||||
//Search/Filter
|
//Search/Filter
|
||||||
Route::get("/contactsapi", "ContactController@search")->name("contacts.search");
|
Route::get("/contactsapi", "ContactController@search")->name("contacts.search");
|
||||||
|
|
Loading…
Reference in New Issue