You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
3.4 KiB
77 lines
3.4 KiB
@extends('layouts.plantilla')
|
|
|
|
@section('contenido')
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<h1>Autos</h1>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<a href="{{ route('autos.create') }}" class="btn btn-primary">Agregar Auto</a>
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Marca</th>
|
|
<th>Modelo</th>
|
|
<th>Año</th>
|
|
<th>Color</th>
|
|
<th>Precio</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($autos as $auto)
|
|
<tr>
|
|
<td>{{ $auto->marca }}</td>
|
|
<td>{{ $auto->modelo }}</td>
|
|
<td>{{ $auto->año }}</td>
|
|
<td>{{ $auto->color }}</td>
|
|
<td>{{ $auto->precio }}</td>
|
|
<td>
|
|
<a href="{{ route('autos.edit', $auto->id) }}" class="btn btn-warning">Editar</a>
|
|
<button type="button" class="btn btn-danger" data-bs-toggle="modal" data-bs-target="#confirmDeleteModal" data-id="{{ $auto->id }}">
|
|
Eliminar
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal -->
|
|
<div class="modal fade" id="confirmDeleteModal" tabindex="-1" aria-labelledby="confirmDeleteModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="confirmDeleteModalLabel">Confirmar Eliminación</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
¿Estás seguro de que deseas eliminar este auto?
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">No</button>
|
|
<form id="deleteForm" action="" method="POST" style="display:inline;">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="btn btn-danger">Sí, eliminar</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
var confirmDeleteModal = document.getElementById('confirmDeleteModal');
|
|
confirmDeleteModal.addEventListener('show.bs.modal', function (event) {
|
|
var button = event.relatedTarget;
|
|
var autoId = button.getAttribute('data-id');
|
|
var form = document.getElementById('deleteForm');
|
|
form.action = '/autos/' + autoId;
|
|
});
|
|
</script>
|
|
@endsection
|
|
|