Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finishing view user #63

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/Http/Controllers/HistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function history()
{
$now = Carbon::now();

$upcomingHistories = LabsBooking::with('lab', 'user')
$upcomingHistories = LabsBooking::with('lab')
->where('user_id', auth()->user()->id)
->where(function ($query) use ($now) {
$query->where('booking_date', '>=', $now->format('Y-m-d'))
Expand All @@ -21,16 +21,16 @@ public function history()
->where('start_time', '>', $now->format('H:i:s'));
});
})
->orderBy('booking_date', 'desc')
->orderBy('booking_date', 'asc')
->get();

$expiredHistories = LabsBooking::with('lab')
->where('user_id', auth()->user()->id)
->where(function ($query) use ($now) {
$query->where('booking_date', '<', $now)
->orWhere(function ($query) use ($now) {
$query->whereDate('booking_date', '=', $now->format('Y-m-d'))
->whereTime('start_time', '<=', $now->format('H:i:s'));
$query->where('booking_date', '<', $now->format('Y-m-d'))
->orWhere(function ($subquery) use ($now) {
$subquery->whereDate('booking_date', '=', $now->format('Y-m-d'))
->whereTime('start_time', '<', $now->format('H:i:s'));
});
})
->orderBy('booking_date', 'desc')
Expand Down
4 changes: 2 additions & 2 deletions app/Livewire/ModalBooking.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public function bookingLab()
$isLabAvailable = ClassSchedule::isLabAvailable($this->lab_id, $day, $this->start_time, $this->end_time)->count() == 0;

if (!$isBookingConflict) {
session()->flash('conflict', 'Pada tanggal dan jam tersebut lab sedang digunakan');
session()->flash('conflict', 'Pada tanggal & jam tersebut ruangan sedang digunakan');
} else if (!$isLabAvailable) {
session()->flash('conflict', 'Pada hari dan jam tersebut sedang ada perkuliahan di lab');
session()->flash('conflict', 'Pada hari & jam tersebut sedang ada perkuliahan di ruangan');
} else {

$data = [
Expand Down
1 change: 1 addition & 0 deletions app/Livewire/ScheduleCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ScheduleCalendar extends Component

private function generateWeekDates(Carbon $startDate, Carbon $endDate)
{
Carbon::setLocale('id');
$weekDates = [];

for ($date = $startDate; $date <= $endDate; $date->addDay()) {
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion resources/views/components/modal-button.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class="rounded-full bg-white p-2 text-blue-600 drop-shadow-md text-4xl border bo
data-te-target="#exampleModal"
data-te-ripple-init
data-te-toggle="tooltip"
title="Booking Lab"
title="Booking Ruangan"
data-te-ripple-color="light">
<i class="bi bi-plus-lg"></i>
</button>
177 changes: 91 additions & 86 deletions resources/views/home/history.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,98 +2,98 @@

@section('container')
<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">
<img class="h-10 ml-4" src="undiksha.png" alt="">
<a href="/" class="text-2xl font-bold absolute -mt-9 ml-[65px]">SIMARU</a>
</div>
<div class="text-xl text-center">
<h3 class="font-bold md:mx-5 mx-0 ml-2 md:ml-0 text-2xl order-3 md:order-2">
Riwayat Peminjaman Ruangan
</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-4xl"></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"
<nav
class="fixed top-0 z-20 flex-no-wrap flex w-full items-center justify-between bg-white/90 py-4 lg:flex-wrap border-b drop-shadow backdrop-blur-md">
<div class="flex w-full flex-wrap items-center justify-between px-4 md:px-10">
<div class="flex items-center justify-center">
<a href="/">
<img class="h-10" src="{{ asset('undiksha.png') }}" alt="">
</a>
<a href="/" class="text-2xl font-bold ml-1">SIMARU</a>
</div>
<div class="text-xl flex items-center justify-between text-center md:w-80">
</div>
<div class="">
@auth
<div class="relative" data-te-dropdown-ref>
<button
class="flex items-center whitespace-nowrap rounded 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-4xl mr-1"></i>
</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><span class="ml-2">Halaman Utama</span></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><span class="ml-2">Riwayat</span></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-speedometer2 text-blue-400"></i><span class="ml-2">Halaman Utama</span></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><span class="ml-2">Riwayat</span></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><span class="ml-2">Keluar</span></button
>
</form>
><i class="bi bi-box-arrow-right text-blue-400"></i><span class="ml-2">Keluar</span></button
>
</form>

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

</div>
</div>
</nav>
</li>
</ul>
</div>
@else
<a href="{{ route('login') }}" class="text-lg uppercase font-semibold hidden md:block">Masuk</a>
<a href="{{ route('login') }}" class="text-3xl uppercase font-semibold md:hidden"><i class="bi bi-box-arrow-in-right"></i></a>
@endauth

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

<h1 class=" text-xl font-bold mt-20 text-neutral-600 dark:text-neutral-200 ml-8">Mendatang</h1>
<div class="mt-24 px-4 md:px-8">
<h1 class="text-center mx-auto text-xl font-bold">Riwayat Peminjaman Ruangan </h1>

@if (count($upcomingHistories) == 0 && count($expiredHistories) == 0)
<div class="mt-20 text-center">
<h1 class="mt-5 font-semibold text-3xl">Anda belum memesan Ruangan</h1>
</div>
@endif



@if(count($upcomingHistories) > 0)
<h1 class=" text-lg font-semibold mt-5 text-neutral-600 dark:text-neutral-200 ">Mendatang</h1>

@foreach ($upcomingHistories as $history)
<div class="block 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 ml-8 w-[1285px] ">
<div class="block 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 w-full">
<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 }}
{{ $history->reason_to_booking }} | <span class="font-medium text-lg">R. {{ str_replace('Ruang ', '', $history->lab->name) }}</span>
</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') }}

<span class="text-base font-normal">({{ \Carbon\Carbon::parse($history->booking_date)->diffForHumans()}})</span>
<span class="text-base font-normal">({{ \Carbon\Carbon::parse("$history->booking_date $history->start_time")->diffForHumans()}})</span>
</h5>
<p class="mb-4 text-base text-neutral-600 dark:text-neutral-200">
{{ $history->start_time }} - {{ $history->end_time }}
Expand All @@ -109,15 +109,18 @@ class="text-left w-full bg-transparent px-4 py-2 text-sm font-normal text-neutra
</div>
</div>
@endforeach
@endif



@if ($expiredHistories->count() > 0)

<h1 class=" text-xl font-bold ml-4 mt-10 text-neutral-600 dark:text-neutral-200 ml-8">Selesai</h1>

<h1 class="text-lg font-semibold mt-10 text-neutral-600 dark:text-neutral-200">Selesai</h1>
@foreach ($expiredHistories as $history)
<div class="block 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 ml-8 mr-8">
<div class="block 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 }}
{{ $history->reason_to_booking }} | <span class="font-medium text-lg">R. {{ str_replace('Ruang ', '', $history->lab->name) }}</span>
</div>
<div class="p-6">
<h5 class="mb-2 text-lg font-medium leading-tight text-neutral-600 dark:text-neutral-200">
Expand All @@ -128,7 +131,9 @@ class="text-left w-full bg-transparent px-4 py-2 text-sm font-normal text-neutra
</p>
</div>
</div>
@endforeach

@endforeach
@endif
</div>

@endsection
10 changes: 5 additions & 5 deletions resources/views/livewire/detail-schedule.blade.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<div>
<div x-show="open" class="relative z-40" aria-labelledby="modal-title" role="dialog" aria-modal="true" id="modalScheduleDetail">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div>
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 backdrop-blur-md transition-opacity"></div>
<div class="fixed inset-0 z-10 w-screen overflow-y-auto">
<div class="flex min-h-full items-center justify-center p-4 text-center sm:items-center sm:p-0">
<div class="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-5xl w-full">
<button @click="open = ! open" class="absolute right-3 top-2 text-2xl"><i class="bi bi-x-circle"></i></button>
<button @click="open = ! open" class="absolute right-3 top-2 text-2xl text-gray-600"><i class="bi bi-x-circle"></i></button>
<div class="bg-white px-4 pb-4 pt-5 sm:p-6 sm:pb-4">
<div class="mt-3 sm:ml-4 sm:mt-0 sm:text-left">
@if ($labName)
<h1 class="text-2xl font-semibold">{{ $labName->name }}</h1>
<h3 class="font-semibold capitalize" id="modal-title">{{ $day }}, {{ \Carbon\Carbon::parse($date)->format('d M Y') }}</h3>
<h3 class="font-semibold capitalize" id="modal-title">{{ \Carbon\Carbon::parse($day)->isoFormat('dddd') }}, {{ \Carbon\Carbon::parse($date)->format('d M Y') }}</h3>
@else
<div class="animate-pulse">
<div class="h-7 bg-gray-400 w-32"></div>
Expand Down Expand Up @@ -39,7 +39,7 @@
<td class="w-full bg-blue-600 rounded-lg p-3 text-white align-top" rowspan="{{ $totalRowspan }}">
<div class="flex justify-between">
<div class="">
<h1 class="text-2xl font-semibold">{{ $booking->reason_to_booking }}</h1>
<h1 class="text-xl md:text-2xl font-semibold">{{ $booking->reason_to_booking }}</h1>
<p class="text-sm font-light mt-1">{{ $booking->user->name }} ({{ $booking->user->role }})</p>
<p class="mt-3">{{ $booking->start_time }} - {{ $booking->end_time }}</p>
</div>
Expand Down Expand Up @@ -79,7 +79,7 @@
class="inline-block whitespace-nowrap rounded-[0.27rem] bg-neutral-50 px-[0.65em] pb-[0.25em] pt-[0.35em] text-center align-baseline text-[0.75em] font-bold leading-none text-neutral-600">
Kuliah
</span>
<h1 class="text-2xl font-semibold">{{ $class->subject }}</h1>
<h1 class="text-xl md:text-2xl font-semibold">{{ $class->subject }}</h1>
<p class="text-sm font-light mt-1">{{ $class->lecturer }}</p>
<p class="mt-3">{{ $class->start_time }} - {{ $class->end_time }}</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/livewire/lab-schedule.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="xl:flex xl:justify-center">
<div class="overflow-x-scroll grid grid-cols-[70px,repeat(7,170px)] grid-rows-[repeat(14,50px)]" id="scrollContainer">
<div class="row-start-[1] col-start-[1] sticky top-0 z-10 bg-white dark:bg-gradient-to-b dark:from-slate-600 dark:to-slate-700 border-slate-100 dark:border-black/10 bg-clip-padding text-slate-900 dark:text-slate-200 border-b text-sm font-medium py-2" id="sticky1"></div>
<div class="row-start-[1] col-start-[1] sticky top-0 z-10 bg-white dark:bg-gradient-to-b dark:from-slate-600 dark:to-slate-700 border-slate-100 dark:border-black/10 bg-clip-padding text-slate-900 dark:text-slate-200 border-b text-xs font-base py-2 flex items-center ml-1" id="sticky1">R. {{ str_replace('Ruang ', '', $lab->name) }}</div>
@php
$col = 2;
@endphp
Expand Down
2 changes: 1 addition & 1 deletion resources/views/livewire/loading.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div>
<div x-show="open" class="relative z-50" aria-labelledby="modal-title" role="dialog" aria-modal="true" id="modalScheduleDetail">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div>
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity backdrop-blur-md"></div>
<div class="fixed inset-0 z-10 w-screen overflow-y-auto">
<div class="flex min-h-full items-center justify-center p-4 text-center sm:items-center sm:p-0">
<div class="relative transform overflow-hidden rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-5xl w-full">
Expand Down
Loading
Loading