[Back] @if (!Session::get("username"))
{{-- Redirect to the main page if the user is already logged in --}}
<script>
window.location.href = "login";
</script>
@endif
@if (Session::get("userlevel") === 'admin')
@extends('index')
@section("body")
<body>
<center><h1>MANAGE ASSET</h1>
<p>
<strong>Total Asset:</strong>{{ $totalCompAsset+$totalPrintAsset+$totalOtherAsset }}
<strong>Total Computers:</strong> {{ $totalCompAsset }}
<strong>Total Printers:</strong> {{ $totalPrintAsset }}
<strong>Total Other Assets:</strong> {{ $totalOtherAsset }}
</p>
<br>
<div style="display: flex; flex-direction: column; align-items: center; margin-bottom: 30px;">
<form action="{{ url('/generate-all-report') }}" method="GET">
<select name="type" style="padding: 5px; margin-right: 10px;">
<option value="comp-asset">CompAsset</option>
<option value="print-asset">PrintAsset</option>
<option value="asset">Asset</option>
</select>
<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>
<br><br><br><br>
<h3> List of Computer</h3><br>
<table style="text-align: center;">
<tr>
<th style="display: none;" >Id</th>
<th style="text-align: center;">BRAND</th>
<th style="text-align: center;">MODEL</th>
<th style="text-align: center;">ASSET TAG</th>
<th style="text-align: center;">SERIAL NO</th>
<th style="text-align: center;">Remarks</th>
<th style="text-align: center;">STATUS</th>
<th style="text-align: center;">LOCATION</th>
<th colspan="2" style="text-align: center;">Action</th>
</tr>
@foreach($CompAsset as $Ad)
<tr>
<td style="display: none;">{{$Ad->id}}</td>
<td>{{$Ad->brand}}</td>
<td>{{$Ad->model}}</td>
<td>{{$Ad->assetTag}}</td>
<td>{{$Ad->Serial_No}}</td>
<td>{{$Ad->Remarks}}</td>
<td>{{$Ad->status}}</td>
<td>{{$Ad->location}}</td>
<td>
<form method="POST" action="manageasset-action">
<input type="submit" name="btnViewEditComp" value="Edit" class="button small">
<input type="hidden" name="id" value="{{$Ad->id}}">
@csrf
</form>
</td>
<td>
<form method="POST" action="manageasset-action" >
<input type="submit" name="btnViewDeleteComp" value="Delete" class="button small">
<input type="hidden" name="id" value="{{$Ad->id}}">
@csrf
</form>
</td>
</tr>
@endforeach
</table>
<div style="display: flex; align-items: center; justify-content: center; gap: 20px; text-align: center; padding: 10px;">
<div>
<strong>Total Computers:</strong> {{ $CompAsset->count() }}
<strong>In Use:</strong> {{ $inUseCount }}
<strong>Under Maintenance:</strong> {{ $underMaintenanceCount }}
<strong>Available:</strong> {{ $availableCount }}
<strong>Retired:</strong> {{ $retiredCount }}
<strong>Pending:</strong> {{ $pendingCount }}
</div>
<form method="POST" action="manageasset-action" style="margin: 0;">
@csrf
<input type="submit" name="btnViewAddComp" value="Add Asset" style="padding: 5px 10px; font-size: 14px;">
</form>
</div>
<br><br><br><br>
<br><br><br><br>
<h3> List of Printer</h3><br>
<table style="text-align: center;">
<tr>
<th style="display: none;" >Id</th>
<th style="text-align: center;">TYPE</th>
<th style="text-align: center;">LOCATION</th>
<th style="text-align: center;">DEPARTMENT</th>
<th style="text-align: center;">BRAND</th>
<th style="text-align: center;">MODEL</th>
<th style="text-align: center;">ASSET TAG</th>
<th style="text-align: center;">SERIAL NO</th>
<th style="text-align: center;">REMARKS</th>
<th style="text-align: center;">STATUS</th>
<th colspan="2" style="text-align: center;">Action</th>
</tr>
@foreach($PrintAsset as $d)
<tr>
<td style="display: none;">{{$d->id}}</td>
<td>{{$d->type}}</td>
<td>{{$d->location}}</td>
<td>{{$d->dept}}</td>
<td>{{$d->brand}}</td>
<td>{{$d->model}}</td>
<td>{{$d->assetTag}}</td>
<td>{{$d->Serial_No}}</td>
<td>{{$d->remarks}}</td>
<td>{{$d->status}}</td>
<td>
<form method="POST" action="manageasset-action">
<input type="submit" name="btnViewEditPrint" value="Edit" class="button small">
<input type="hidden" name="id" value="{{$d->id}}">
@csrf
</form>
</td>
<td>
<form method="POST" action="manageasset-action" style="margin: 0;">
<input type="submit" name="btnViewDeletePrint" value="Delete" class="button small">
<input type="hidden" name="id" value="{{$d->id}}">
@csrf
</form>
</td>
</tr>
@endforeach
</table>
<div style="display: flex; align-items: center; justify-content: center; gap: 20px; text-align: center; padding: 10px;">
<div>
<strong>Total Printers:</strong> {{ $PrintAsset->count() }}
<strong>In Use:</strong> {{ $inUseCountPrint }}
<strong>Under Maintenance:</strong> {{ $underMaintenanceCountPrint }}
<strong>Available:</strong> {{ $availableCountPrint }}
<strong>Retired:</strong> {{ $retiredCountPrint }}
<strong>Pending:</strong> {{ $pendingCountPrint }}
</div>
<!-- Add New Print -->
<form method="POST" action="manageasset-action" style="margin: 0;">
<input type="submit" name="btnViewAddPrint" value="Add Asset" style="padding: 5px 10px; font-size: 14px;">
@csrf
</form>
</div>
<br><br><br><br>
<br><br><br><br>
<h3> List of other asset</h3><br>
<table style="text-align: center;">
<tr>
<th style="display: none;" >Id</th>
<th style="text-align: center;">ITEM</th>
<th style="text-align: center;">SERIAL NO</th>
<th style="text-align: center;">ASSET TAG</th>
<th style="text-align: center;">REMARKS</th>
<th style="text-align: center;">STATUS</th>
<th style="text-align: center;">LOCATION</th>
<th colspan="2" style="text-align: center;">Action</th>
</tr>
@foreach($Asset as $a)
<tr>
<td style="display: none;">{{$a->id}}</td>
<td>{{$a->item}}</td>
<td>{{$a->serial_no}}</td>
<td>{{$a->assetTag}}</td>
<td>{{$a->remarks}}</td>
<td>{{$a->status}}</td>
<td>{{$a->location}}</td>
<td>
<form method="POST" action="manageasset-action">
<input type="submit" name="btnViewEditAsset" value="Edit" class="button small">
<input type="hidden" name="id" value="{{$a->id}}">
@csrf
</form>
</td>
<td>
<form method="POST" action="manageasset-action" >
<input type="submit" name="btnViewDeleteAsset" value="Delete" class="button small">
<input type="hidden" name="id" value="{{$a->id}}">
@csrf
</form>
</td>
</tr>
@endforeach
</table>
<div style="display: flex; align-items: center; justify-content: center; gap: 20px; text-align: center; padding: 10px;">
<div>
<strong>Total Other Assets:</strong> {{ $Asset->count() }}
<strong>In Use:</strong> {{ $inUseCountOther }}
<strong>Under Maintenance:</strong> {{ $underMaintenanceCountOther }}
<strong>Available:</strong> {{ $availableCountOther }}
<strong>Retired:</strong> {{ $retiredCountOther }}
<strong>Pending:</strong> {{ $pendingCountOther }}
</div>
<!-- Add New Print -->
<form method="POST" action="manageasset-action" style="margin: 0;">
<input type="submit" name="btnViewAddAsset" value="Add Asset" style="padding: 5px 10px; font-size: 14px;">
@csrf
</form>
</div>
</body>
@endsection
@endif