IMMREX7
@extends('teachers.teacher_layout')
@section('content')
<div class="row clearfix">
<div class="col-sm-12">
<div class="card">
<div class="header">
<h2><strong>View Gallery Data</strong></h2>
</div>
<div class="body table-responsive">
<table class="table table-bordered table-striped table-hover" id="photo_grid">
<thead>
<tr>
<th>S. No.</th>
<th>Folder Name</th>
<th>Class</th>
<th>Image Title</th>
<th>Photo</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
@foreach($galleries as $val)
<tr>
<th scope="row">{{$i}}</th>
<td>{{$val->folder->folderName}}</td>
<td>{{$val->classM->className or ''}}</td>
<td>{{$val->imageTitle}}</td>
<td><img src="{{ asset('storage/schools/'.$val->idSchool.'/galleries/'.$val->folder->folderName.'/'.$val->image)}}"></td>
<td>
<button class="btn btn-raised btn-danger waves-effect btn-round js-sweetalert" data-id="{{$val->idGallery}}" data-type="confirm">DELETE</button>
</td>
</tr>
<?php $i++; ?>
@endforeach
</tbody>
</table>
{{ $galleries->links('teachers.gallery.custom_page') }}
</div>
</div>
</div>
</div>
@stop
@section('script')
<script>
$(document).on('click', '.js-sweetalert', function (e) {
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
e.preventDefault();
var id = $(this).data('id');
swal({
title: "Are you sure?",
text: "Are You sure you want to delete this Gallery Image!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: true
},
function() {
// console.log('here');
$.ajax({
type: "DELETE",
url: "{{url('/teacher/galleries/')}}" +"/"+id,
data: {id:id}
})
.done(function(data) {
swal({
title: "Deleted",
text: "Gallery has been successfully deleted",
type: "success"
},function() {
location.reload();
});
})
.error(function(data) {
swal("Oops", "We couldn't connect to the server!", "error");
});
return false;
});
});
$(document).ready(function () {
$('#photo_grid').dataTable({
"bPaginate": false
});
});
</script>
@stop
Copyright © 2021 -