v1.5.18 Multiple events works, only admin pages is missing some pdf, view user and jpg functions
This commit is contained in:
parent
42de425aba
commit
027a99b002
|
@ -98,17 +98,17 @@ class MultipleEventsController extends Controller
|
|||
$multiEvents = MultipleEventsParent::query()->get();
|
||||
if($request->newsoption == true){
|
||||
$news = new News();
|
||||
$news->name = "Nye ugenlig aktivitet";
|
||||
$news->name = "Nye ugentlig aktivitets";
|
||||
$news->subname = $event->week;
|
||||
$news->arrangement_id = $multipleParent->id;
|
||||
$news->type_id = '5';
|
||||
$news->content = "Den ugenlige aktivitets plan er landet";
|
||||
$news->content = "Den ugentlige aktivitets plan er landet";
|
||||
$news->resource_id = $event->resource_id;
|
||||
NewsController::storeAndGet($news);
|
||||
|
||||
}
|
||||
|
||||
return redirect()->route('multiple-events.index', ['multiEvents' => $multiEvents]);
|
||||
return redirect()->route('events.index', ['multiEvents' => $multiEvents]);
|
||||
|
||||
}
|
||||
|
||||
|
@ -146,6 +146,18 @@ class MultipleEventsController extends Controller
|
|||
//
|
||||
}
|
||||
|
||||
|
||||
public function accountsignups(Request $request)
|
||||
{
|
||||
// Find every event you have clicked on. And find all users to that event, and the event name itself.
|
||||
$multiEvents = UserEvent::join('users', 'users.id', '=', 'user_events.user_id')->join('multiple_events', 'multiple_events.id', '=', 'user_events.multiple_event_id')->where('multiple_event_id', $request->multiEvent)->get();
|
||||
|
||||
if (count($multiEvents) == 0)
|
||||
$multiEvents = Event::where('id', $request->event)->get();
|
||||
|
||||
return Response::detect("multiple-events.signups", [ "multiEvent" => $multiEvents ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use App\UserEvent;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
|
@ -129,7 +130,45 @@ class UserEventController extends Controller
|
|||
}
|
||||
|
||||
// If not, then it keeps going and saves and shows a success message
|
||||
$UserEvent = new UserEvent($data);
|
||||
$UserEvent = new UserEvent();
|
||||
$UserEvent->event_id = $request->event_id;
|
||||
$UserEvent->user_id = auth()->user()->id;
|
||||
$UserEvent->save();
|
||||
|
||||
if (request()->cookie('languagesSetting') == "dk")
|
||||
return '<p class="text-center"><b>Du er hermed tilmeldt denne aktivitet!</b></p>';
|
||||
if (request()->cookie('languagesSetting') == "en")
|
||||
return '<p class="text-center"><b>You are now participating in this event!</b></p>';
|
||||
|
||||
return '<p class="text-center"><b>Du er hermed tilmeldt denne aktivitet!</b></p>';
|
||||
}
|
||||
|
||||
|
||||
//Signs a user up to a multiple event via ajax
|
||||
public function createmultiajax(Request $request)
|
||||
{
|
||||
// Get written data from events.index
|
||||
$data = $request->validate([
|
||||
"multiple_event_id" => "required|max:255"
|
||||
]);
|
||||
|
||||
// Check the UserEvent table if there is a row that has the user_id AND the event_id
|
||||
$getTableInfo = UserEvent::where('user_id', auth()->user()->id)
|
||||
->where('multiple_event_id', $request->multiple_events_id)->get();
|
||||
|
||||
// If the row has both, then go back and show an error - Cause you're not allowed to be on the same event twice.
|
||||
if (count($getTableInfo) > 0) {
|
||||
if (request()->cookie('languagesSetting') == "dk")
|
||||
return '<p class="text-center"><b>Du har allerede tilmeldt dig denne Aktivitet!</b></p>';
|
||||
if (request()->cookie('languagesSetting') == "en")
|
||||
return '<p class="text-center"><b>You are already participating in this event!</b></p>';
|
||||
|
||||
return '<p class="text-center"><b>Du har allerede tilmeldt dig denne Aktivitet!</b></p>';
|
||||
}
|
||||
|
||||
// If not, then it keeps going and saves and shows a success message
|
||||
$UserEvent = new UserEvent();
|
||||
$UserEvent->multiple_event_id = $request->multiple_event_id;
|
||||
$UserEvent->user_id = auth()->user()->id;
|
||||
$UserEvent->save();
|
||||
|
||||
|
@ -149,6 +188,28 @@ class UserEventController extends Controller
|
|||
->where('event_id', $request->event_id);
|
||||
|
||||
|
||||
// If you are in the Event, then remove yourself.
|
||||
if (count($UserEvent->get()) > 0) {
|
||||
// If not, then it keeps going and saves and shows a success message
|
||||
$UserEvent->delete();
|
||||
|
||||
if (request()->cookie('languagesSetting') == "dk")
|
||||
return '<p class="text-center"><b>Du er hermed afmeldt aktiviteten!</b></p>';
|
||||
if (request()->cookie('languagesSetting') == "en")
|
||||
return '<p class="text-center"><b>You are no longer participating in this event!</b></p>';
|
||||
|
||||
return '<p class="text-center"><b>Du er hermed afmeldt aktiviteten!</b></p>';
|
||||
}
|
||||
}
|
||||
|
||||
//Removes a users participation in an event via ajax
|
||||
public function createmultiajaxcancel(Request $request)
|
||||
{
|
||||
// Check the UserEvent table if there is a row that has the user_id AND the event_id
|
||||
$UserEvent = UserEvent::where('user_id', auth()->user()->id)
|
||||
->where('multiple_event_id', $request->multiple_event_id);
|
||||
|
||||
|
||||
// If you are in the Event, then remove yourself.
|
||||
if (count($UserEvent->get()) > 0) {
|
||||
// If not, then it keeps going and saves and shows a success message
|
||||
|
|
|
@ -1,27 +1,23 @@
|
|||
@extends("app.layout.base")
|
||||
@section("title")
|
||||
Ugenlige aktiviteter
|
||||
Ugentlige aktiviteter
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<style>
|
||||
iframe, .ql-video {
|
||||
width: 100%;
|
||||
}
|
||||
div.card {
|
||||
margin-top: 1rem;
|
||||
margin-bottom: 30px;
|
||||
width: auto;
|
||||
heigt: auto;
|
||||
|
||||
border-bottom: 2px solid black;
|
||||
}
|
||||
div.container {
|
||||
padding: 8px;
|
||||
text-align: justify;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.header > img {
|
||||
border-radius: 2px 2px 2px 2px
|
||||
border-radius: 10px 10px 0px 0px
|
||||
}
|
||||
/*Alert box*/
|
||||
.alert {
|
||||
|
@ -55,9 +51,11 @@
|
|||
|
||||
<?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)
|
||||
|
@ -78,20 +76,32 @@
|
|||
@if($multiEvents->contains('week', $Week)) {{-- If any of the menues in the menu table has the number of the week in the 'week' column, do this --}}
|
||||
@foreach($multiEvents as $multiEvent)
|
||||
@if($multiEvent->week == $Week)
|
||||
<p>{{$multiEvents->name}}</p>
|
||||
<p>{{$multiEvents->accountable}}</p>
|
||||
<p>{{$multiEvents->description}}</p>
|
||||
<p>{{$multiEvents->date}}</p>
|
||||
<p>{{$multiEvents->event}}</p>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="container" class="mt-1">
|
||||
<h4 class="m-none">{{ date('l', strtotime($multiEvent->date)) }}</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>
|
||||
@endif
|
||||
@endforeach
|
||||
@else
|
||||
<p class="text-center">{{__('msg.dereringenugentligeaktiviteter')}}!</p>
|
||||
@endif
|
||||
@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">
|
||||
|
@ -103,11 +113,11 @@
|
|||
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
|
||||
}
|
||||
|
||||
function ajaxCall(event_id, el) {
|
||||
function ajaxCall(multiple_event_id, el) {
|
||||
if(el.innerHTML === "{{__("msg.tilmeld")}}") {
|
||||
axios.post("{{ route("userevents.createajax") }}",
|
||||
axios.post("{{ route("multiple-events.createajax") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
multiple_event_id: multiple_event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
@ -119,9 +129,9 @@
|
|||
console.log(error);
|
||||
});
|
||||
} else if(el.innerHTML === "{{__("msg.afmeld")}}"){
|
||||
axios.post("{{ route("userevents.createajaxcancel") }}",
|
||||
axios.post("{{ route("multiple-events.createajaxcancel") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
multiple_event_id: multiple_event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
@extends("app.layout.base")
|
||||
|
||||
@section("title")
|
||||
Events - Tilmeldte
|
||||
@endsection
|
||||
|
||||
@section("content")
|
||||
<style>
|
||||
.tbl {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.tbl td,
|
||||
.tbl th {
|
||||
@if(request()->cookie("mode") == "dark")
|
||||
border: 0px solid #ddd;
|
||||
@else
|
||||
border: 1px solid #ddd;
|
||||
@endif
|
||||
padding: 8px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tbl tr:nth-child(even) {
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.tbl tr:hover {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.tbl th {
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
text-align: left;
|
||||
background-color: #00788a;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.tbl > tbody > tr > td > a {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tbl > tbody > tr > td > a > img {
|
||||
width: 1em;
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
<main style="min-height: calc(100% - 61.3px)">
|
||||
<table class="tbl mt-2rem mr-1 mb-0 ml-1" style="width: calc(100% - 16px);">
|
||||
@if(count($multiEvent) == 0)
|
||||
<p class="text-center mt-2">{{__('msg.ingentilmeldte')}}</p>
|
||||
@else
|
||||
<tr>
|
||||
<th class="text-center">{{ __('msg.tilmeldtesnavn') }}</th>
|
||||
</tr>
|
||||
@endif
|
||||
@foreach($multiEvent as $UE)
|
||||
@if ($UE->name_first != null && $UE->name_last != null && $UE->phone != null && $UE->multiple_event_id != null && $UE->user_id != null)
|
||||
<tr>
|
||||
<td>{{ $UE->name_first }} {{ $UE->name_last }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
@endforeach
|
||||
</table>
|
||||
<button onclick="document.location = document.referrer;" class="btn btn-sde-blue text-white mb-1 mt-auto">{{ __('msg.tilbage') }}</button>
|
||||
</main>
|
||||
@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("guides.show", ["guide" => $new->arrangement_id])}}" class="sde-blue">{{__('msg.læsmere')}}</a>
|
||||
<a style="font-weight: 700;" href="{{route("multiple-events.index", ["multiEvent" => $new->arrangement_id])}}" class="sde-blue">{{__('msg.læsmere')}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -29,7 +29,9 @@ Route::get("/account/editpass", "UserController@accounteditpass")->name("users.a
|
|||
Route::put("/account/update", "UserController@accountupdate")->name("users.accountupdate");
|
||||
Route::get("/account/editpic", "UserController@accounteditpic")->name("users.accounteditpic");
|
||||
Route::get("/events/signups/{event}", "EventController@signups")->name("events.signups");
|
||||
Route::get("/multiple-events/signups/{multiple-event}", "MultipleEventsController@signups")->name("multiple-events.signups");
|
||||
Route::get("/events/accountsignups", "EventController@accountsignups")->name("events.accountsignups");
|
||||
Route::get("/multiple-events/accountsignups", "MultipleEventsController@accountsignups")->name("multiple-events.accountsignups");
|
||||
Route::get("phones", "PhoneController@index")->name("phones.index");
|
||||
Route::get("/washing-reservationsapi", "WashingReservationController@api")->name("washing-reservations.api");
|
||||
Route::get("/washing-reservationsgetMachines", "WashingReservationController@getMachines")->name("washing-reservations.getMachines");
|
||||
|
@ -37,9 +39,11 @@ Route::get("/washing-reservationsgetTimes", "WashingReservationController@getTim
|
|||
Route::get("/app/washing-reservations", "WashingReservationController@appindex")->name("washing-reservations.appindex");
|
||||
Route::get("/settings", "SettingsController@index")->name("settings.index");
|
||||
Route::post("/events/signup", "UserEventController@createajax")->name("userevents.createajax");
|
||||
Route::post("/multiple-events/signup", "UserEventController@createmultiajax")->name("multiple-events.createajax");
|
||||
Route::post("/account/mailwants", "UserController@createajax")->name("users.createajax");
|
||||
Route::get("/about", "AboutController@index")->name("about.index");
|
||||
Route::post("/events/cancelsignup", "UserEventController@createajaxcancel")->name("userevents.createajaxcancel");
|
||||
Route::post("/multiple-events/cancelsignup", "UserEventController@createmultiajaxcancel")->name("multiple-events.createajaxcancel");
|
||||
Route::post("/account/cancelmailwants", "UserController@createajaxcancel")->name("users.createajaxcancel");
|
||||
Route::delete("/notifications/delete", "EventController@deleteNotifications")->name("notifications.delete");
|
||||
Route::post("/feedbacks/store", "FeedbackController@storeajax")->name("feedbacks.storeajax");
|
||||
|
|
Loading…
Reference in New Issue