cms-laravel/resources/views/livewire/station-locator/station-list.blade.php

64 lines
3.1 KiB
PHP

@extends('layouts.app')
@section('content')
<div class="container mt-4">
<div class="card">
<div class="card-header d-flex justify-content-between align-items-center">
<h4>Station List</h4>
<div>
<button class="btn btn-primary" wire:click="toggleUploadPriceModal">Upload Prices</button>
<a href="{{ route('stations.create') }}" class="btn btn-success">Add Station</a>
</div>
</div>
<div class="card-body">
<table class="table table-bordered">
<thead>
<tr>
<th>Station Code</th>
<th>Station Name</th>
<th>Branch Name</th>
<th>Date Created</th>
<th>Created By</th>
<th>Modified By</th>
<th>Date Modified</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@forelse ($stations as $station)
<tr>
<td>{{ $station['code'] }}</td>
<td>{{ $station['name'] }}</td>
<td>{{ $station['Branch']['name'] ?? 'N/A' }}</td>
<td>{{ \Carbon\Carbon::parse($station['createdAt'])->format('M d, Y H:i') }}</td>
<td>{{ $station['created_by'] ?? 'N/A' }}</td>
<td>{{ $station['modified_by'] ?? 'N/A' }}</td>
<td>{{ \Carbon\Carbon::parse($station['updatedAt'])->format('M d, Y H:i') }}</td>
<td>
<button class="btn btn-sm btn-info" wire:click="showLocation({{ json_encode($station) }})">Location</button>
<a href="{{ route('stations.edit', $station['id']) }}" class="btn btn-sm btn-warning">Edit</a>
<button class="btn btn-sm btn-danger" wire:click="delete({{ $station['id'] }})">Delete</button>
</td>
</tr>
@empty
<tr>
<td colspan="8" class="text-center">No stations found.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<!-- Floating Add Button -->
<div style="position: fixed; right: 10px; bottom: 30px;">
<a href="{{ route('stations.create') }}" class="btn btn-success btn-lg rounded-circle">
<i class="fas fa-plus"></i>
</a>
</div>
<!-- Include Modals -->
<livewire:station-locator.upload-prices-modal :visible="$uploadPriceModal" />
<livewire:station-locator.location-modal :visible="$locationModal" :data="$dataLocation" />
</div>
@endsection