bakalarska_praca/resources/views/facesList.blade.php

50 lines
1.9 KiB
PHP
Raw Permalink Normal View History

2023-05-11 19:57:12 +00:00
@extends('layouts.app')
@section('content')
<div class="container">
<h1 class="text-center">Faces List</h1>
<div class="text-center">
<button id="delete-pictures-btn" class="btn btn-danger">Delete All Pictures</button>
</div>
<div class="row justify-content-center">
<div class="col-md-8">
<div class="row">
@foreach ($images as $image)
<div class="col-md-6 mb-4">
<div class="card">
<img style="height: 320px; object-fit: cover;" class="card-img-top" src="{{ asset('storage/pictures/' . $image['filename']) }}" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">
{{ $image['datetime'] }}
@if (strpos($image['filename'], 'success') !== false)
<span style="color: green">&#10003;</span>
@elseif (strpos($image['filename'], 'failure') !== false)
<span style="color: red">&#10007;</span>
@endif
</h5>
</div>
</div>
</div>
@endforeach
</div>
</div>
</div>
</div>
<script>
document.getElementById('delete-pictures-btn').addEventListener('click', function() {
if (confirm('Are you sure you want to delete all pictures? This cannot be undone.')) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
alert(xhr.responseText);
window.location.reload();
}
};
xhr.open('GET', '{{ route("deletePictures") }}', true);
xhr.send();
}
});
</script>
@endsection