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
@@ -25,6 +25,7 @@
<table class="tbl letterSpaceTable" id="table_id">
<thead>
<th>Uge</th>
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/preview.svg') }}" alt="preview"></th>
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/print-hvid.svg') }}" alt="Print"></th>
@if(auth()->user()->can('menuplan.edit'))
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@@ -37,6 +38,7 @@
@foreach($menuPlans as $menuplan)
<tr id="row_{{ $menuplan->id }}">
<td>{{$menuplan->week}}</td>
<td><a id="preview" onclick="modalNewsContent({{$menuplan->id}})" style="cursor: pointer" ><img class="w-100" src="{{ asset('/images/icons/preview-dark.svg') }}" alt="preview"></a></td>
<td><a href="{{ route("pdf.genPDF", [ "menuPlan" => $menuplan ]) }}" target="_blank"><img class="w-100" src="{{ asset('/images/icons/print.svg') }}" alt="Print"></a></td>
@if(auth()->user()->can('menuplan.edit'))
<td><a href="{{ route("menu-plans.edit", [ "menu_plan" => $menuplan ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@@ -51,13 +53,64 @@
@endforeach
</tbody>
</table>
<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="week"></h1>
<hr>
<strong><label for="monday">Mandag</label></strong>
<p id="monday"></p>
<strong><label for="tuesday">Tirsdag</label></strong>
<p id="tuesday"></p>
<strong><label for="wednesday">Onsdag</label></strong>
<p id="wednesday"></p>
<strong><label for="thursday">Torsdag</label></strong>
<p id="thursday"></p>
</center>
</div>
</div>
@endsection
@section('scripts')
<script>
var modalNews = document.getElementById("newsModal");
function modalNewsContent(id) {
$.ajax({
type: 'get',
url: '{{route('menuplans.preview')}}',
data: {'preview':id},
success:function (data) {
modalNews.style.display = "block";
var l = JSON.parse(data);
$("#week").html("Menuplan for uge " + l.week);
$("#monday").html(l.monday);
$("#tuesday").html(l.tuesday);
$("#wednesday").html(l.wednesday);
$("#thursday").html(l.thursday);
},
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>
$(document).ready( function () {
$('#table_id').DataTable({
columnDefs: [
{ orderable: false, targets: [-1, -2, -3] }
{ orderable: false, targets: [-1, -2, -3, -4] }
]
});
});