Skip to content

Commit

Permalink
finishing history & title, deleting unused
Browse files Browse the repository at this point in the history
  • Loading branch information
ranggaadithia committed Nov 5, 2023
1 parent 05fa7df commit 046285a
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 54 deletions.
1 change: 1 addition & 0 deletions app/Http/Controllers/HistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public function history()
$now = Carbon::now();

$upcomingHistories = LabsBooking::with('lab', 'user')
->where('user_id', auth()->user()->id)
->where(function ($query) use ($now) {
$query->where('booking_date', '>=', $now->format('Y-m-d'))
->orWhere(function ($subquery) use ($now) {
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/LabBookingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ public function update(Request $request, LabsBooking $labsBooking)
public function destroy(LabsBooking $labsBooking)
{
$labsBooking->delete();
return redirect('/')->with('success', 'Booking berhasil dihapus');
return back()->with('success', 'Booking berhasil dihapus');
}
}
1 change: 1 addition & 0 deletions app/Livewire/LabSchedule.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public function render()
'timeMapping' => TimeMappings::$timeMappings,
'classSchedule' => ClassSchedule::where('lab_id', $this->lab->id)->get(),
'labsBooking' => $filteredData,
'title' => $this->lab->name,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
@stack('style')
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">

<title>{{ $title ?? 'Page Title' }}</title>
<title>Dashboard | {{ config('app.name') }}</title>
</head>
<body>
<main class="d-flex flex-nowrap">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/dashboard/reschedule/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<td>{{ $booking->end_time }}</td>
<td class="d-flex">
<a href="{{ route('reschedule.create', $booking->id) }}" class="btn btn-outline-warning me-1">Reschadule</a>
<form action="{{ route('labs.destroy', $booking->id) }}" method="post">
<form action="{{ route('labs-booking.destroy', $booking->id) }}" method="post">
@csrf
@method('delete')
<button type="submit" class="btn btn-outline-danger">Hapus</button>
Expand Down
114 changes: 94 additions & 20 deletions resources/views/home/history.blade.php
Original file line number Diff line number Diff line change
@@ -1,44 +1,120 @@
@extends('layouts.index')

@section('container')
<h1 class="text-center m-5 font-bold text-2xl">Histori Booking Ruangan</h1>
<div class="block mx-28 rounded-lg shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] dark:bg-neutral-700 p-2 mt-5 mb-2 ">
<h1 class=" text-xl font-bold ml-[17px] text-neutral-600 dark:text-neutral-200 text-center">Mendatang</h1>
<div>
<nav
class="fixed top-0 z-20 flex-no-wrap flex w-full items-center justify-between bg-white py-4 lg:flex-wrap border-b">
<div class="flex w-full flex-wrap items-center justify-between px-4 md:px-10">
<div class="hidden md:block">
<a href="/" class="text-2xl font-bold">SIMARU</a>
</div>
<div class="text-xl text-center">
<h3 class="md:mx-5 mx-0 ml-2 md:ml-0 font-semibold text-2xl order-3 md:order-2">
History Booking Lab
</h3>
</div>
<div class="">
@auth
<div class="relative" data-te-dropdown-ref>
<button
class="flex items-center whitespace-nowrap rounded pr-3 first-letter:text-sm font-medium uppercase leading-normal"
type="button"
id="dropdownMenuButton1"
data-te-dropdown-toggle-ref
aria-expanded="false"
data-te-ripple-init
data-te-ripple-color="light">
<i class="bi bi-person-circle text-3xl"></i>
<span class="w-2 text-blue-400 hidden md:block">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
fill="currentColor"
class="h-5 w-5">
<path
fill-rule="evenodd"
d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z"
clip-rule="evenodd" />
</svg>
</span>
</button>
<ul
class="absolute z-[1000] float-left m-0 hidden min-w-max list-none overflow-hidden rounded-lg border-none bg-white bg-clip-padding text-left text-base shadow-lg dark:bg-neutral-700 [&[data-te-dropdown-show]]:block"
aria-labelledby="dropdownMenuButton1"
data-te-dropdown-menu-ref>
@if (auth()->user()->role === 'admin')
<li>
<a
class="block w-full whitespace-nowrap bg-transparent px-4 py-2 text-sm font-normal text-neutral-700 hover:bg-neutral-100 active:text-neutral-800 active:no-underline disabled:pointer-events-none disabled:bg-transparent disabled:text-neutral-400 dark:text-neutral-200 dark:hover:bg-neutral-600"
href="/dashboard"
data-te-dropdown-item-ref
><i class="bi bi-speedometer2 text-blue-400"></i> Dashboard</a
>
</li>
@endif
<li>
<a
class="block w-full whitespace-nowrap bg-transparent px-4 py-2 text-sm font-normal text-neutral-700 hover:bg-neutral-100 active:text-neutral-800 active:no-underline disabled:pointer-events-none disabled:bg-transparent disabled:text-neutral-400 dark:text-neutral-200 dark:hover:bg-neutral-600"
href="/history"
data-te-dropdown-item-ref
><i class="bi bi-clock-history text-blue-400"></i> Booking History</a
>
</li>
<li>
<form action="{{ route('logout') }}" method="post">
@csrf
<button
class="text-left w-full bg-transparent px-4 py-2 text-sm font-normal text-neutral-700 hover:bg-neutral-100 active:text-neutral-800 active:no-underline disabled:pointer-events-none disabled:bg-transparent disabled:text-neutral-400 dark:text-neutral-200 dark:hover:bg-neutral-600"
data-te-dropdown-item-ref
><i class="bi bi-box-arrow-right text-blue-400"></i> Logout</button
>
</form>

</li>
</ul>
</div>
@else
<a href="{{ route('login') }}" class="text-sm uppercase font-semibold">Login</a>
@endauth

</div>
</div>
</nav>
</div>

<h1 class="ml-4 text-xl font-bold mt-20 text-neutral-600 dark:text-neutral-200 ">Mendatang</h1>
@foreach ($upcomingHistories as $history)
<div class="block mx-28 rounded-lg bg-white shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] dark:bg-neutral-700 mt-3">
<div class="block mx-4 lg:mx-28 rounded-lg bg-white shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] dark:bg-neutral-700 mt-3">
<div class="border-b-2 border-neutral-100 px-6 py-3 dark:border-neutral-600 dark:text-neutral-50 text-xl font-semibold">
{{ $history->reason_to_booking }}
</div>
<div class="p-6">
<h5 class="mb-2 text-lg font-medium leading-tight text-neutral-600 dark:text-neutral-200">
{{ \Carbon\Carbon::parse($history->booking_date)->format('d F Y') }}
<br>
({{ \Carbon\Carbon::parse($history->booking_date)->diffForHumans()}})
</h5>
<p class="mb-4 text-base text-neutral-600 dark:text-neutral-200">
{{ $history->start_time }} - {{ $history->end_time }}
</p>
<button type="button" href="#"
class="inline-block rounded bg-primary px-6 pb-2 pt-2.5 text-xs font-medium leading-normal text-white shadow-[0_4px_9px_-4px_#3b71ca] transition duration-150 ease-in-out hover:bg-primary-600 hover:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.3),0_4px_18px_0_rgba(59,113,202,0.2)] focus:bg-primary-600 focus:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.3),0_4px_18px_0_rgba(59,113,202,0.2)] focus:outline-none focus:ring-0 active:bg-primary-700 active:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.3),0_4px_18px_0_rgba(59,113,202,0.2)] dark:shadow-[0_4px_9px_-4px_rgba(59,113,202,0.5)] dark:hover:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.2),0_4px_18px_0_rgba(59,113,202,0.1)] dark:focus:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.2),0_4px_18px_0_rgba(59,113,202,0.1)] dark:active:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.2),0_4px_18px_0_rgba(59,113,202,0.1)]"
data-te-ripple-init data-te-ripple-color="light">
Reschedule
</button>
<button type="button" href="#"
class="inline-block rounded bg-red-500 px-6 pb-2 pt-2.5 text-xs font-medium leading-normal text-white shadow-[0_4px_9px_-4px_#3b71ca] transition duration-150 ease-in-out hover:bg-primary-600 hover:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.3),0_4px_18px_0_rgba(59,113,202,0.2)] focus:bg-primary-600 focus:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.3),0_4px_18px_0_rgba(59,113,202,0.2)] focus:outline-none focus:ring-0 active:bg-primary-700 active:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.3),0_4px_18px_0_rgba(59,113,202,0.2)] dark:shadow-[0_4px_9px_-4px_rgba(59,113,202,0.5)] dark:hover:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.2),0_4px_18px_0_rgba(59,113,202,0.1)] dark:focus:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.2),0_4px_18px_0_rgba(59,113,202,0.1)] dark:active:shadow-[0_8px_9px_-4px_rgba(59,113,202,0.2),0_4px_18px_0_rgba(59,113,202,0.1)]"
data-te-ripple-init data-te-ripple-color="light">
Cancel
</button>

<form action="{{ route('labs-booking.destroy', $history->id) }}" method="POST">
@csrf
@method('delete')
<button type="submit" class="px-4 py-2 bg-red-500 font-semibold text-white text-sm rounded-md"
onclick="return confirm('Apakah anda yakin ingin membatalkan booking ini?')"
>Batalkan Booking</button></form>
</form>
</div>
</div>
@endforeach


<div class="block mx-28 rounded-lg bg-gray-200 shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] dark:bg-neutral-700 p-2 mt-5 mb-2 ">


<h1 class=" text-xl font-bold ml-[17px] text-neutral-600 dark:text-neutral-200 text-center">Selesai</h1>
</div>
<h1 class=" text-xl font-bold ml-4 mt-10 text-neutral-600 dark:text-neutral-200">Selesai</h1>
@foreach ($expiredHistories as $history)
<div class="block mx-28 rounded-lg bg-gray-200 shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] dark:bg-neutral-700 mt-3">
<div class="block mx-4 rounded-lg bg-gray-200 shadow-[0_2px_15px_-3px_rgba(0,0,0,0.07),0_10px_20px_-2px_rgba(0,0,0,0.04)] dark:bg-neutral-700 mt-3">
<div class="border-b-2 border-neutral-100 px-6 py-3 dark:border-neutral-600 dark:text-neutral-50 text-xl font-semibold">
{{ $history->reason_to_booking }}
</div>
Expand All @@ -54,6 +130,4 @@ class="inline-block rounded bg-red-500 px-6 pb-2 pt-2.5 text-xs font-medium lead
@endforeach




@endsection
28 changes: 0 additions & 28 deletions resources/views/lab/index.blade.php

This file was deleted.

2 changes: 1 addition & 1 deletion resources/views/layouts/dashboard.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="" />

<title>Sidebars · Bootstrap v5.3</title>
<title>Dashboard | {{ config('app.name') }}</title>

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">

Expand Down
2 changes: 1 addition & 1 deletion resources/views/layouts/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SIMARU</title>
<title>{{ $title ?? config('app.name') }}</title>


<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
Expand Down
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
Route::middleware('auth')->group(function () {
Route::post('/', [LabBookingController::class, 'store'])->name('booking');
Route::get('accept/{request_reschedule}', [RescheduleController::class, 'acceptReschedule']);
Route::delete('labs-booking/{labs_booking}', [LabBookingController::class, 'destroy'])->name('labs-booking.destroy');
});


Expand All @@ -63,7 +64,6 @@
Route::get('reschedule/', [RescheduleController::class, 'index'])->name('reschedule.index');
Route::get('reschedule/{labs_booking}', [RescheduleController::class, 'create'])->name('reschedule.create');
Route::post('reschedule/{labs_booking}', [RescheduleController::class, 'store'])->name('reschedule.store');
Route::delete('labs-booking/{labs_booking}', [LabBookingController::class, 'destroy'])->name('labs.destroy');
Route::get('report', Report::class)->name('report');
});

Expand Down

0 comments on commit 046285a

Please sign in to comment.