ldc-mesbr-app/resources/views/campagne/index.blade.php
2019-03-18 09:40:02 +01:00

73 lines
2.5 KiB
PHP

@extends('layouts.main')
@section('content')
<h2><i class="fa fa-folder"><i class="fas fa-ticket-alt"></i></i> Campagnes <a href="{{ route('campagne.create') }}" class="add-button"><i class="fas fa-plus-square"></i> Ajouter</a></h2>
<div class="content-list">
<table>
<thead>
<tr>
<th>{{__('Ref') }}</th>
<th>{{__('Nom') }}</th>
<th>{{__('Création') }}</th>
<th class="center">{{__('Publié ?')}}</th>
<th class="center">{{__('Démo')}}</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach($campagnes as $c)
<tr>
<td>{{ $c->camp_id }}</td>
<td><a href="{{ route('campagne.edit', $c) }}">{{ $c->camp_name }}</a></td>
<td>{{ $c->camp_createdate }}</td>
@if ( $c->camp_published === 1)
<td class="pub center"><i data-campid="{{ $c->camp_id }}" class="fas fa-check-circle green unpublishcamp"></i></td>
@else
<td class="pub center"><i data-campid="{{ $c->camp_id }}" class="fas fa-times-circle red publishcamp"></i></td>
@endif
<td class="center"><i class="fas fa-eye showTemplate" data-campid="{{ $c->camp_id }}"></i></td>
<td><a href="{{ route('campagne.destroy', $c) }}"><i class="fas fa-times delete-icon"></i></a></td>
</tr>
@endforeach
</tbody>
</table>
<input type="hidden" name="csrf" id="csrf" value="<?php echo csrf_token(); ?>">
</div>
<div class="actions">
</div>
{!! Form::open(['id' => 'delete-hidden']) !!}
@method('DELETE')
{!! Form::close() !!}
@endsection
@section('scripts')
<script>
$('.content-list').on('click', '.showTemplate', function(event){
event.preventDefault();
let campid = $(this).attr('data-campid');
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('#csrf').val()
}
});
$.ajax({
url: '/showDemo',
type: 'POST',
data: {
camp_id: campid,
},
dataType: 'JSON',
success: function (response) {
window.open(response, '_blank');
//console.log(response);
},
error: function (e) {
console.log(e.responseText);
}
});
})
</script>
@endsection