v1.5.9 Added and fixed preview, the only problem is that images on event, guide category and guide resource id is not display on the different pages

This commit is contained in:
neerholt
2021-04-10 01:43:05 +02:00
parent abe4a9dda9
commit dd7acc1d24
19 changed files with 530 additions and 262 deletions
@@ -28,6 +28,7 @@
<tr>
<th>Navn</th>
<th>Kategori</th>
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/preview.svg') }}" alt="preview"></th>
@if(auth()->user()->can('guides.edit'))
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@@ -39,8 +40,8 @@
<tr id="guide_row_{{ $guide->id }}" data-id="guide_category_row{{ \App\GuidesCategory::query()->where('id', '=', $guide->guide_category_id)->first()->id }}">
<td>{{$guide->name}}</td>
<td>{{ \App\GuidesCategory::query()->where('id', '=', $guide->guide_category_id)->first()->guidesCategoryName }}</td>
<td><a id="preview" onclick="modalNewsContent({{$guide->id}})" style="cursor: pointer" ><img class="w-100" src="{{ asset('/images/icons/preview-dark.svg') }}" alt="preview"></a></td>
@if(auth()->user()->can('guides.edit'))
<!-- <td><input type="image" name="preview" onclick="preview()" src="{{ asset('/images/icons/preview-dark.svg') }}" alt="preview"></td>-->
<td><a href="{{ route("guides.edit", [ "guide" => $guide ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif
@if(auth()->user()->can('guides.delete'))
@@ -88,15 +89,51 @@
</div>
<script>
function preview(){
$value = $('#preview').val();
console.log($value);
}
</script>
<div id="newsModal" class="modal zindex-100">
<div id="modal-content" class="modal-content text-black d-block w-50">
<span class="close" onclick="closeModal()">&times;</span>
<center>
<h1 id="name"></h1>
<hr>
<strong><label for="guide_articles">Vejledning</label></strong>
<p id="guide_articles"></p>
</center>
</div>
</div>
@endsection
@section('scripts')
<script>
var modalNews = document.getElementById("newsModal");
function modalNewsContent(id) {
$.ajax({
type: 'get',
url: '{{route('guides.preview')}}',
data: {'preview':id},
success:function (data) {
modalNews.style.display = "block";
var l = JSON.parse(data);
console.log(l);
$("#name").html(l.name);
$("#guide_articles").html(l.guide_articles);
//We need to add guide_category_id and resource_id
},
error:function (data) {
console.log(data);
}
});
}
function closeModal() {
modalNews.style.display = "none";
}
window.onmousedown = function(event) {
if (event.target == modalNews) {
modalNews.style.display = "none";
}
}
</script>
<script>
function delete_guide(id) {
var token = $("input[name='_token']").val();