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
+7 -2
View File
@@ -11,16 +11,21 @@
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
backdrop-filter: blur(6px);
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
/* Modal Content */
.modal-content {
background-color: #fefefe;
background-color: #E0E0E0;
margin: auto;
padding: 20px;
border: 1px solid #888;
border: 2px solid #888;
width: 330px;
min-width: 400px;
border-radius: 6px;
overflow: auto;
padding-bottom: 120px;
}
/* The Close Button */
@@ -32,10 +32,10 @@
<label for="accountable">Aktivitet Ansvarlig:</label>
<input type="text" name="accountable" id="accountable" required>
<label for="description">Aktivitet Beskrivelse:</label>
<small class="form-text text-muted">For at kunne indsætte et link, skal du markere den text du vil lave som et link først.</small>
<small class="form-text text-muted">For at kunne indsætte et link, skal du markere teksten du vil lave op til et link først.</small>
<div id="editor"></div>
<textarea name="description" class="d-none" id="hiddenArea"></textarea>
<label for="date">Aktivitet dato:</label>
<label for="date">Aktivitets dato:</label>
<input type="datetime-local" name="date" id="date" required>
<label class="toggle">
<input class="toggle__input" type="checkbox" name="newsoption">
@@ -43,7 +43,7 @@
<span class="toggle__text">Opret som nyhed</span>
</span>
</label>
<label id="fileuploadee"for="fileuploade">Baggrundsbillede til nyheden (Valgfri):</label>
<label id="fileuploadee"for="fileuploade">Baggrundsbillede til nyheden (Valgfri)</label>
<input id="fileuploade" type="file" name="resource" accept="image/*">
<input id="disable" type="submit" class="btn btn-dark text-white" value="Opret">
@@ -26,10 +26,11 @@
</div>
<table class="tbl mt-2 letterSpaceTable fixOverflow" id="table_id">
<thead>
<th>Aktivitet Navn</th>
<th>Aktivitet Ansvarlig</th>
<th>Aktivitet Dato</th>
<th>Aktivitets Navn</th>
<th>Aktivitets Ansvarlig</th>
<th>Aktivitets Dato</th>
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/eye.svg') }}" alt="Show"></th>
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/preview.svg') }}" alt="preview"></th>
@if(auth()->user()->can('event.edit'))
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
@endif
@@ -45,6 +46,7 @@
<td>{{ $event->accountable }}</td>
<td>{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($event->date))->format('d/m/Y \k\l\. H:i') }}</td>
<td><a href="{{ route("events.signups", [ "event" => $event ]) }}"><img class="w-100" src="{{ asset('/images/icons/eye-dark.svg') }}" alt="Show"></a></td>
<td><a id="preview" onclick="modalNewsContent({{$event->id}})" style="cursor: pointer" ><img class="w-100" src="{{ asset('/images/icons/preview-dark.svg') }}" alt="preview"></a></td>
@if(auth()->user()->can('event.edit'))
<td><a href="{{ route("events.edit", [ "event" => $event ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
@endif
@@ -59,13 +61,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="name"></h1>
<hr>
<strong><label for="date">Aktivitets dato</label></strong>
<p id="date"></p>
<strong><label for="accountable">Aktivitets ansvarlig</label></strong>
<p id="accountable"></p>
<hr>
<img src="{{ asset(\App\Resource::query()->where($event->id, "=", $event->resource_id)->first()->filename) }}">
<p id="description"></p>
</center>
</div>
</div>
@endsection
@section('scripts')
<script>
var modalNews = document.getElementById("newsModal");
function modalNewsContent(id) {
$.ajax({
type: 'get',
url: '{{route('events.preview')}}',
data: {'preview':id},
success:function (data) {
modalNews.style.display = "block";
var l = JSON.parse(data);
console.log(l);
$("#name").html(l.name);
$("#date").html(l.date);
$("#accountable").html(l.accountable);
$("#description").html(l.description);
$("#f").html(l.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>
$(document).ready( function () {
$('#table_id').DataTable({
columnDefs: [
{ orderable: false, targets: [-1, -2, -3] }
{ orderable: false, targets: [-1, -2, -3, -4] }
]
});
});
@@ -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();
@@ -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] }
]
});
});
@@ -24,9 +24,9 @@
<thead>
<th>Navn</th>
<th>Udløbsdato</th>
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/preview.svg') }}" alt="preview"></th>
@if(auth()->user()->can('news.edit'))
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/preview.svg') }}" alt="Update"></th>
@endif
@if(auth()->user()->can('news.delete'))
<th class="w-1em"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
@@ -41,9 +41,9 @@
@else
<td>Ingen udløbsdato</td>
@endif
<td><a id="preview" onclick="modalNewsContent({{$new->id}})" style="cursor: pointer" ><img class="w-100" src="{{ asset('/images/icons/preview-dark.svg') }}" alt="preview"></a></td>
@if(auth()->user()->can('news.edit'))
<td><a href="{{ route("news.edit", [ "news" => $new ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><a href="#" id="preview" onclick="modalNewsContent({{$new->id}})" ><img class="w-100" src="{{ asset('/images/icons/preview-dark.svg') }}" alt="Update"></a></td>
@endif
@if(auth()->user()->can('news.delete'))
<td>
@@ -76,16 +76,14 @@
function modalNewsContent(id) {
$.ajax({
type: 'get',
url: '{{route('events.preview')}}',
url: '{{route('news.preview')}}',
data: {'preview':id},
success:function (data) {
modalNews.style.display = "block";
var l = JSON.parse(data);
$("#titleEvent").text(l.name);
$("#dateEvent").text(l.date);
$("#descriptionEvent").text(l.description);
$("#titleEvent").html(l.subname);
$("#dateEvent").html(l.news_expiration_date);
$("#descriptionEvent").html(l.content);
},
error:function (data) {
console.log(data);