@extends('index') @if (!Session::get("username")) {{-- Redirect to the main page if the user is already logged in --}} <script> window.location.href = "login"; </script> @endif @section("body") <body> <center><h1>ASSET HISTORY</h1><br><br><br> {{-- Search form --}} <div style="display: flex; justify-content: center; margin-bottom: 20px;"> <form style="display: flex; align-items: center;"> <input type="text" name="searchTxtHist" placeholder="Search History..." style="width: 300px; padding: 5px; margin-right: 10px;"> <input type="submit" name="btnSearchHist" value="Search" style="padding: 5px 10px;" class="button small"> @csrf </form> </div> <div style="display: flex; justify-content: center; margin-bottom: 20px;"> <form action="{{ route('generateReport') }}" method="GET"> <input type="hidden" name="searchTxtHist" value="{{ request('searchTxtHist') }}"> <select name="format" style="padding: 5px; margin-right: 10px;"> <option value="pdf">PDF</option> <option value="csv">CSV</option> </select> <input type="submit" value="Generate Report" style="padding: 5px 10px;" class="button small"> </form> </div> <table style="text-align: center;"> <thead> <tr> <th style="text-align: center;">Asset ID</th> <th style="text-align: center;">Type</th> <th style="text-align: center;">Details</th> <!-- New column --> <th style="text-align: center;">User</th> <th style="text-align: center;">Status</th> <th style="text-align: center;">Location</th> <th style="text-align: center;">Start Date</th> <th style="text-align: center;">End Date</th> <th style="text-align: center;">Remarks</th> <th style="text-align: center;">Create At</th> <th style="text-align: center;">Update At</th> </tr> </thead> <tbody> @foreach($history as $entry) <tr> <td>{{ $entry->asset_id }}</td> <td>{{ $entry->type_label }}</td> <td>{{ $entry->details ?? 'N/A' }}</td> <!-- Display details --> <td>{{ $entry->username }}</td> <td>{{ $entry->status }}</td> <td>{{ $entry->location }}</td> <td>{{ $entry->start_date ?? 'N/A' }}</td> <td>{{ $entry->end_date ?? 'N/A' }}</td> <td>{{ $entry->remarks }}</td> <td>{{ $entry->created_at }}</td> <td>{{ $entry->updated_at }}</td> </tr> @endforeach </tbody> </table> <br> <div style="width: 15%; margin: auto;"> {{ $history->firstItem() }} to {{ $history->lastItem() }} of {{ $history->total() }} results <div> @if ($history->onFirstPage()) <span>Previous</span> @else <a href="{{ $history->previousPageUrl() }}">Previous</a> @endif @if ($history->hasMorePages()) <a href="{{ $history->nextPageUrl() }}">Next</a> @else <span>Next</span> @endif </div> </div> </center> </body> @endsection