v0.10.5 - Fixed vagttelefon

Added: Washing Machines & their reservations now delete when the location gets removed
This commit is contained in:
Anders 2020-08-18 12:25:32 +02:00
parent d49a896fc0
commit ddbc3b8b60
2 changed files with 20 additions and 7 deletions

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Location;
use App\WashingMachine;
use App\WashingReservation;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -130,12 +131,21 @@ class LocationController extends Controller
*/
public function destroy($id)
{
$locations = Location::find($id);
$location = Location::find($id);
$washingMachines = WashingMachine::query()->where('location_id', '=', $id)->get();
$washingMachines = WashingMachine::query()->where('location_id', '=', $id);
$washingMachines->delete();
foreach ($washingMachines as $machine) {
$washingReservations = WashingReservation::query()->where('machine_id', '=', $machine->id)->get();
$locations->delete();
foreach ($washingReservations as $reservation)
{
$reservation->delete();
}
$machine->delete();
}
$location->delete();
return redirect()->route("locations.index");
}

View File

@ -7,7 +7,10 @@
<main style="justify-content: unset">
<img class="mt-3" src="{{ URL::asset('/images/icons/Vagttelefon-normal.svg') }}" alt="Vagttelefon" style="height: 16vw;">
<h1 class="text-center sde-blue mt-0">{{__('msg.vagttelefon')}}</h1>
<p class="mt-0">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.</p>
<p class="mt-0 mb-0">Den kan bruges i dagtimerne til almindelig kontakt om ting vedrørende kollegiet.</p>
<p class="mt-0">(Det er også det nummer div. kontaktpersoner og vejledere ringer )</p>
<p class="mt-0 mb-0">Ellers kan Vagttelefonen kontaktes, af eleverne, ”efter lukketid” dvs. 22.30 til 07.00.</p>
<p class="mt-0">I det tidsrum har nattevagten den sig.</p>
<label class="toggle">
<input class="toggle__input" type="checkbox" name="accept" id="input" onclick="check()">
<span class="toggle__label sde-blue">
@ -25,10 +28,10 @@
var checkBox = document.getElementById("input");
var btn = document.getElementById("call");
if (checkBox.checked == true){
btn.href = "";
btn.href = "tel:+4524629450";
btn.classList.remove("btn-disabled");
} else {
btn.href = "tel:+4556304566";
btn.href = "";
btn.classList.add("btn-disabled");
}
}