Merge branch 'master' of https://github.com/sebathefox/skolehjem-webapp into master
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
@section("content")
|
||||
<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") }}">
|
||||
@csrf
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<img src="{{URL::asset('/images/icons/Aktiviteter.svg')}}" alt="Aktiviteter">
|
||||
Aktiviteter
|
||||
</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">
|
||||
Reservationer
|
||||
</a>
|
||||
|
||||
@@ -92,13 +92,14 @@
|
||||
}
|
||||
|
||||
function onDateSelect(date, dayHolder) {
|
||||
console.log("Opdaterer selects");
|
||||
let events;
|
||||
let machinez;
|
||||
let buttonz;
|
||||
|
||||
let container = document.getElementById("event-container");
|
||||
|
||||
NodeList.prototype.forEach = Array.prototype.forEach
|
||||
NodeList.prototype.forEach = Array.prototype.forEach;
|
||||
var children = document.getElementById("calenderRow").childNodes;
|
||||
|
||||
children.forEach(function(item){
|
||||
@@ -107,11 +108,19 @@
|
||||
|
||||
dayHolder.classList.add("selected");
|
||||
|
||||
let machine_id;
|
||||
|
||||
if(document.getElementById('washing-machines'))
|
||||
machine_id = document.getElementById('washing-machines').value;
|
||||
else
|
||||
machine_id = 0;
|
||||
|
||||
axios({
|
||||
method: 'get',
|
||||
url: '{{ route("washing-reservations.api") }}',
|
||||
params: { 'date': date }
|
||||
params: { 'date': date, 'machine_id': machine_id }
|
||||
}).then(function (response) {
|
||||
console.log(response.data["unavailable_times"]);
|
||||
var data = response.data;
|
||||
|
||||
if(document.getElementById("washing-machines") != undefined)
|
||||
@@ -126,6 +135,10 @@
|
||||
select.id = "washing-machines";
|
||||
select.name = "machine_id";
|
||||
|
||||
select.onchange = function() {
|
||||
onDateSelect(date, dayHolder);
|
||||
}
|
||||
|
||||
container.appendChild(span);
|
||||
container.appendChild(select);
|
||||
|
||||
@@ -165,11 +178,18 @@
|
||||
let machines = data["washingmachines"];
|
||||
|
||||
machinez.innerHTML = "";
|
||||
machinez.onchange = function () {
|
||||
onDateSelect(date, dayHolder);
|
||||
}
|
||||
|
||||
for (let i = 0; i < machines.length; i++) {
|
||||
let option = document.createElement("option");
|
||||
option.text = machines[i]["name"];
|
||||
option.value = machines[i]["id"];
|
||||
|
||||
if(machine_id == machines[i]["id"])
|
||||
option.selected = "selected";
|
||||
|
||||
machinez.appendChild(option);
|
||||
}
|
||||
|
||||
@@ -187,7 +207,6 @@
|
||||
let unavailable_times = data["unavailable_times"];
|
||||
|
||||
unavailable_times.forEach(function (item, index) {
|
||||
console.log(item);
|
||||
document.getElementById(item).remove();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user