v1.5.21c Made the last changes to multiple events on the app
This commit is contained in:
parent
7560cfe1a3
commit
f8073d8686
|
@ -33,9 +33,9 @@ class MultipleEventsController extends Controller
|
|||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index()
|
||||
{
|
||||
$multiEvents = MultipleEventsParent::query()->join("multiple_events", "multiple_events.multiple_events_parent_id", "=", "multiple_events_parent.id")->where('multiple_events_parent.id', '=', $request->multiEvent)->orderBY('multiple_events_parent.id' , 'desc')->get();
|
||||
$multiEvents = MultipleEventsParent::query()->get();
|
||||
return Response::detect("multiple-events.index", [ "multiEvents" => $multiEvents]);
|
||||
}
|
||||
|
||||
|
@ -114,9 +114,12 @@ class MultipleEventsController extends Controller
|
|||
* @param \App\MultipleEvents $multipleeventsController
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(MultipleeventsController $multipleeventsController)
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
$multiEvents = MultipleEvents::where('multiple_events.multiple_events_parent_id', '=', $id)->get();
|
||||
$multiEventParent = MultipleEventsParent::find($id);
|
||||
|
||||
return Response::detect("multiple-events.show", [ "week" => $multiEventParent->week, "multiEvents" => $multiEvents]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,19 +1,28 @@
|
|||
@extends("app.layout.base")
|
||||
@section("title")
|
||||
Ugentlige aktiviteter
|
||||
Aktiviteter
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<style>
|
||||
iframe, .ql-video {
|
||||
width: 100%;
|
||||
}
|
||||
div.card {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 30px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
border-bottom: 2px solid black;
|
||||
heigt: auto;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
border-radius: 10px;
|
||||
}
|
||||
div.container {
|
||||
padding: 8px;
|
||||
text-align: justify;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.header > img {
|
||||
border-radius: 10px 10px;
|
||||
border-radius: 10px 10px 0px 0px
|
||||
}
|
||||
/*Alert box*/
|
||||
.alert {
|
||||
|
@ -41,17 +50,11 @@
|
|||
margin-top: 1rem;
|
||||
margin-bottom: 30px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
heigt: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
$Week = date('W'); //Current week
|
||||
|
||||
?>
|
||||
|
||||
<main>
|
||||
<p hidden>{{ setlocale(LC_ALL, 'da_dk')}}</p>
|
||||
<h1 class="text-center sde-blue mb-2rem">{{ __('msg.ugentligaktiviteter') }}</h1>
|
||||
<!--Alert box, display when a event is delete: start-->
|
||||
@if(count(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get()) > 0)
|
||||
|
@ -71,19 +74,16 @@
|
|||
@if(!$multiEvents->isEmpty())
|
||||
@foreach($multiEvents as $multiEvent)
|
||||
<div class="card">
|
||||
<div class="container mt-1">
|
||||
<h4 class="m-none">{{ ucfirst(\Carbon\Carbon::parse($multiEvent->date)->formatLocalized('%A')) }}</h4>
|
||||
<h4 class="m-none">{{$multiEvent->name}}</h4>
|
||||
<p class="mt-0">{{__('msg.af')}}: {{$multiEvent->accountable}}</p>
|
||||
<p class="mt-0">{{$multiEvent->description}}</p>
|
||||
@if($multiEvent->resource_id !== null)
|
||||
<div class="header">
|
||||
<img class="w-100" src="{{ asset(\App\Resource::query()->where("id", "=", $multiEvent->resource_id)->first()->filename) }}">
|
||||
</div>
|
||||
@endif
|
||||
<div class="container" class="mt-1">
|
||||
<p class="m-none">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($multiEvent->date))->format('d/m/Y \k\l\. H:i') }}</p>
|
||||
<h4 class="m-none">Den ugentlige aktivitets plan for uge {{ $multiEvent->week }}</h4>
|
||||
<div class="row justify-content-space mt-1">
|
||||
@if (count(\App\UserEvent::query()->where('multiple_event_id', '=', $multiEvent->id)->where('user_id', '=', Auth::user()->id)->get()) > 0)
|
||||
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $multiEvent->id }}, this)" >{{__('msg.afmeld')}}</a>
|
||||
@else {{-- ^ If you're already participating in the event, then show a ´cancel´ button - v Else show a ´participate´ button --}}
|
||||
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $multiEvent->id }}, this)" >{{__('msg.tilmeld')}}</a>
|
||||
@endif
|
||||
<a class="sde-blue text-center m-none p-none bold" href="{{route("multiple-events.accountsignups", ["multiEvent" => $multiEvent->id ])}}">{{__('msg.sedeltagere')}}</a>
|
||||
<a class="sde-blue text-center m-none p-none bold" href="{{route("multiple-events.show", $multiEvent->id)}}">{{__('msg.læsmere')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -91,9 +91,9 @@
|
|||
@else
|
||||
<p class="text-center mb-auto">{{__('msg.dereringenaktiviteter')}}!</p>
|
||||
@endif
|
||||
<button onclick="document.location = document.referrer;" class="btn btn-sde-blue text-white mb-1 mt-auto">{{ __('msg.tilbage') }}</button>
|
||||
<a href="{{ route("userevents.index") }}" class="mt-auto btn text-center btn-sde-blue" id="tilmeld">{{__('msg.setilmeldteaktiviteter')}}</a>
|
||||
<div id="snackbar"></div>
|
||||
</main>
|
||||
<div id="snackbar"></div>
|
||||
@endsection
|
||||
@section("scripts")
|
||||
<script type="text/javascript">
|
||||
|
@ -105,11 +105,11 @@
|
|||
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
|
||||
}
|
||||
|
||||
function ajaxCall(multiple_event_id, el) {
|
||||
function ajaxCall(event_id, el) {
|
||||
if(el.innerHTML === "{{__("msg.tilmeld")}}") {
|
||||
axios.post("{{ route("multiple-events.createajax") }}",
|
||||
axios.post("{{ route("userevents.createajax") }}",
|
||||
{
|
||||
multiple_event_id: multiple_event_id
|
||||
event_id: event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
@ -121,9 +121,9 @@
|
|||
console.log(error);
|
||||
});
|
||||
} else if(el.innerHTML === "{{__("msg.afmeld")}}"){
|
||||
axios.post("{{ route("multiple-events.createajaxcancel") }}",
|
||||
axios.post("{{ route("userevents.createajaxcancel") }}",
|
||||
{
|
||||
multiple_event_id: multiple_event_id
|
||||
event_id: event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
@extends("app.layout.base")
|
||||
@section("title")
|
||||
Ugentlige aktiviteter
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<style>
|
||||
div.card {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 30px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
border-bottom: 2px solid black;
|
||||
}
|
||||
.header > img {
|
||||
border-radius: 10px 10px;
|
||||
}
|
||||
/*Alert box*/
|
||||
.alert {
|
||||
opacity: 0.8;
|
||||
padding: 20px;
|
||||
background-color: #00788A;
|
||||
color: white;
|
||||
border-radius: 10px;
|
||||
background: linear-gradient(to right, red, purple);
|
||||
}
|
||||
.closebtn {
|
||||
margin-left: 15px;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
float: right;
|
||||
font-size: 22px;
|
||||
line-height: 20px;
|
||||
cursor: pointer;
|
||||
transition: 0.3s;
|
||||
}
|
||||
.closebtn:hover {
|
||||
color: black;
|
||||
}
|
||||
alertBoxBackground {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 30px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
$Week = date('W'); //Current week
|
||||
|
||||
?>
|
||||
|
||||
<main>
|
||||
<p hidden>{{ setlocale(LC_ALL, 'da_dk')}}</p>
|
||||
<h1 class="text-center sde-blue mb-2rem">{{ __('msg.ugentligaktiviteter') }}</h1>
|
||||
<h4 class="text-center sde-blue mb-2rem">Uge {{ $week }}</h4>
|
||||
<!--Alert box, display when a event is delete: start-->
|
||||
@if(count(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get()) > 0)
|
||||
<div class="alertBoxBackground" id="notifications">
|
||||
<div class="alert">
|
||||
<span class="closebtn" onclick="deleteNotifications(document.getElementById('notifications'))">×</span>
|
||||
<strong>{{__('msg.aktivitetaflyst')}}</strong>
|
||||
@foreach(\App\Notification::query()->where("user_id", "=", auth()->user()->id)->get() as $notification)
|
||||
<p>{{ $notification->message }}{{ __("msg.canceled") }}</p>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<!--Alert box, display when a event is delete: end -->
|
||||
|
||||
<!--If there is a images to the event do this: Start-->
|
||||
@if(!$multiEvents->isEmpty())
|
||||
@foreach($multiEvents as $multiEvent)
|
||||
<div class="card">
|
||||
<div class="container mt-1">
|
||||
<h4 class="m-none">{{ ucfirst(\Carbon\Carbon::parse($multiEvent->date)->formatLocalized('%A')) }}</h4>
|
||||
<h4 class="m-none">{{$multiEvent->name}}</h4>
|
||||
<p class="mt-0">{{__('msg.af')}}: {{$multiEvent->accountable}}</p>
|
||||
<p class="mt-0">{{$multiEvent->description}}</p>
|
||||
<p class="m-none">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($multiEvent->date))->format('d/m/Y \k\l\. H:i') }}</p>
|
||||
<div class="row justify-content-space mt-1">
|
||||
@if (count(\App\UserEvent::query()->where('multiple_event_id', '=', $multiEvent->id)->where('user_id', '=', Auth::user()->id)->get()) > 0)
|
||||
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $multiEvent->id }}, this)" >{{__('msg.afmeld')}}</a>
|
||||
@else {{-- ^ If you're already participating in the event, then show a ´cancel´ button - v Else show a ´participate´ button --}}
|
||||
<a class="sde-blue text-center m-none p-none bold" href="javascript:void(0);" onclick="ajaxCall({{ $multiEvent->id }}, this)" >{{__('msg.tilmeld')}}</a>
|
||||
@endif
|
||||
<a class="sde-blue text-center m-none p-none bold" href="{{route("multiple-events.accountsignups", ["multiEvent" => $multiEvent->id ])}}">{{__('msg.sedeltagere')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@else
|
||||
<p class="text-center mb-auto">{{__('msg.dereringenaktiviteter')}}!</p>
|
||||
@endif
|
||||
<button onclick="document.location = document.referrer;" class="btn btn-sde-blue text-white mb-1 mt-auto">{{ __('msg.tilbage') }}</button>
|
||||
</main>
|
||||
<div id="snackbar"></div>
|
||||
@endsection
|
||||
@section("scripts")
|
||||
<script type="text/javascript">
|
||||
function snackbar(data) {
|
||||
var x = document.getElementById("snackbar");
|
||||
x.innerHTML = data;
|
||||
x.className = "show";
|
||||
|
||||
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
|
||||
}
|
||||
|
||||
function ajaxCall(multiple_event_id, el) {
|
||||
if(el.innerHTML === "{{__("msg.tilmeld")}}") {
|
||||
axios.post("{{ route("multiple-events.createajax") }}",
|
||||
{
|
||||
multiple_event_id: multiple_event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
|
||||
el.innerHTML = "{{__("msg.afmeld")}}";
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
} else if(el.innerHTML === "{{__("msg.afmeld")}}"){
|
||||
axios.post("{{ route("multiple-events.createajaxcancel") }}",
|
||||
{
|
||||
multiple_event_id: multiple_event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
|
||||
el.innerHTML = "{{__("msg.tilmeld")}}";
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function deleteNotifications(el) {
|
||||
el.remove();
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
setMain();
|
||||
axios({
|
||||
method: 'delete',
|
||||
url: '{{route("notifications.delete")}}',
|
||||
data: {
|
||||
user_id: {{ auth()->user()->id }}
|
||||
}
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@endsection
|
||||
|
|
@ -232,7 +232,7 @@
|
|||
@php $tags = [ '<p>', '<b>', '<em>', '<a>', '<u>', '<s>', '<sub>', '<ul>', '<li>', '<sup>', '<div>', '<blockquote>', '<ol>', '<strong>', '<br>', '<h1>', '<h2>', '<h3>', '<h4>', '<h5>', '<h6>', '<h7>', '<span>'] @endphp
|
||||
{!! \App\Helpers::closetags(substr(strip_tags($new->content, $tags), 0, 300)) !!}
|
||||
<div class="row" style="justify-content: center; padding-top: 12px; border-top: 1px solid rgba(0, 0, 0, .2);">
|
||||
<a style="font-weight: 700;" href="{{route("multiple-events.index", ["multiEvent" => $new->arrangement_id])}}" class="sde-blue">{{__('msg.læsmere')}}</a>
|
||||
<a style="font-weight: 700;" href="{{route("multiple-events.show", ["multiple_event" => $new->arrangement_id])}}" class="sde-blue">{{__('msg.læsmere')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue