v1.5.17 - Added multiple events to event index

This commit is contained in:
Anders
2021-04-27 15:15:23 +02:00
parent e1d6bd95f5
commit 7e5c1f8dbe
7 changed files with 160 additions and 36 deletions
@@ -53,28 +53,28 @@
<td><input type="text" name="name[]" max="255" value="{{ old("name.0") }}"></td>
<td><input type="text" name="description[]" max="255" value="{{ old("description.0") }}"></td>
<td><input type="text" name="accountable[]" value="{{ old("accountable.0") }}"></td>
<td><input type="text" name="date[]" value="{{ old("date.0") }}"></td>
<td><input type="datetime-local" name="date[]" value="{{ old("date.0") }}"></td>
</tr>
<tr>
<td>Tirsdag</td>
<td><input type="text" name="name[]" max="255" value="{{ old("name.1") }}"></td>
<td><input type="text" name="description[]" max="255" value="{{ old("description.1") }}"></td>
<td><input type="text" name="accountable[]" value="{{ old("accountable.1") }}"></td>
<td><input type="text" name="date[]" value="{{ old("date.1") }}"></td>
<td><input type="datetime-local" name="date[]" value="{{ old("date.1") }}"></td>
</tr>
<tr>
<td>Onsdag</td>
<td><input type="text" name="name[]" max="255" value="{{ old("name.2") }}"></td>
<td><input type="text" name="description[]" max="255" value="{{ old("description.2") }}"></td>
<td><input type="text" name="accountable[]" value="{{ old("accountable.2") }}"></td>
<td><input type="text" name="date[]" value="{{ old("date.2") }}"></td>
<td><input type="datetime-local" name="date[]" value="{{ old("date.2") }}"></td>
</tr>
<tr>
<td>Torsdag</td>
<td><input type="text" name="name[]" max="255" value="{{ old("name.3") }}"></td>
<td><input type="text" name="description[]" max="255" value="{{ old("description.3") }}"></td>
<td><input type="text" name="accountable[]" value="{{ old("accountable.3") }}"></td>
<td><input type="text" name="date[]" value="{{ old("date.3") }}"></td>
<td><input type="datetime-local" name="date[]" value="{{ old("date.3") }}"></td>
</tr>
</table>
@@ -24,7 +24,6 @@
</thead>
<tbody>
@foreach($multiEvents as $event)
<tr id="row_{{ $event->id }}">
<td>{{ $event->week}}</td>
<td><a id="preview" onclick="modalEventContent({{$event->id}})" style="cursor: pointer"><img class="w-100" src="{{ asset('/images/icons/preview-dark.svg') }}" alt="preview"></a></td>
@@ -48,10 +47,8 @@
<center>
<h1 id="week"></h1>
<hr>
<strong><label>Aktiviteter</label></strong>
<hr>
<img id="eventimg">
<p id="description"></p>
<p id="events"></p>
</center>
</div>
</div>
@@ -68,17 +65,20 @@
dataType: 'JSON',
success:function (data) {
modalEvent.style.display = "flex";
$("#week").html(data[0].week);
$("#week").html('Uge: '+data[0].week);
if (data[0].resource_id != null)
$("#eventimg").attr('src', data[0].filename);
/*var l = JSON.parse(data);
$("#name").html(l.name);
$("#date").html(l.date);
$("#accountable").html(l.accountable);
$("#description").html(l.description);
if (l.filename)
$("#eventimg").attr('src', l.filename);*/
for (var i = 0; i < data[1].length; i++) {
$("#events").append("<div class='container text-center'><div class='row justify-content-center'><div class='col'><h1 class='mb-0'>"+data[1][i].name+"</h1>" +
"<h3 class='mt-0 mb-0'>"+data[1][i].date+" - "+data[1][i].event_end+"</h3>" +
"<h3 class='mt-0'>Tovholder: "+data[1][i].accountable+"</h3>" +
"<h3 class='mb-0'>Beskrivelse:</h3>" +
"<p class='mt-0'>"+data[1][i].description+"</p>" +
"</div>" +
"</div>" +
"</div><hr>");
}
},
error:function (data) {
console.log(data);
@@ -89,22 +89,18 @@
function closeModal() {
modalEvent.style.display = "none";
$("#name").html('');
$("#date").html('');
$("#accountable").html('');
$("#description").html('');
$("#week").html('');
$("#eventimg").attr('src', '');
$("#events").html('');
}
window.onmousedown = function(event) {
if (event.target == modalEvent) {
modalEvent.style.display = "none";
$("#name").html('');
$("#date").html('');
$("#accountable").html('');
$("#description").html('');
$("#week").html('');
$("#eventimg").attr('src', '');
$("#events").html('');
}
}