v0.7.6 - Added snackbar
This commit is contained in:
parent
1e4d55ef26
commit
b1b96ad080
|
@ -83,10 +83,10 @@ class EventController extends Controller
|
|||
$news->name = "Ny aktivitet";
|
||||
$news->subname = $event->name;
|
||||
$news->content = "<p>" . $this->closetags(substr($event->description, 0, 300)). "</p>" .
|
||||
'<div class="row align-items-center">'.
|
||||
'<a style="width: 33%; margin: 0; padding: 0; font-weight: 700;" class="sde-blue" href="'. route("userevents.create", ["event_id" => $event->id ]) .'">Tilmeld</a>'.
|
||||
'<div class="row align-items-center">'. //route("userevents.createajax", ["event_id" => $event->id ])
|
||||
'<a style="width: 33%; margin: 0; padding: 0; font-weight: 700;" class="sde-blue" href="javascript:void(0);" onclick="ajaxCall('. $event->id .')">Tilmeld</a>'.
|
||||
'<a style="width: 33%; margin: 0; padding: 0; text-align: center; font-weight: 700;" class="sde-blue" href="'. route("events.show", ["event" => $event->id ]) .'">Læs mere</a>'.
|
||||
'<a style="width: 33%; margin: 0; padding: 0; text-align: end; font-weight: 700;" class="sde-blue" href="'. route("events.signups", ["event" => $event->id ]) .'">Se deltagere</a>'.
|
||||
'<a style="width: 33%; margin: 0; padding: 0; text-align: end; font-weight: 700;" class="sde-blue" href="'. route("events.accountsignups", ["event" => $event->id ]) .'">Se deltagere</a>'.
|
||||
'</div>';
|
||||
$news->save();
|
||||
}
|
||||
|
@ -180,8 +180,8 @@ class EventController extends Controller
|
|||
$news->name = "Aktivitet opdateret";
|
||||
$news->subname = $event->name;
|
||||
$news->content = "<p>" . $this->closetags(substr($event->description, 0, 300)). "</p>" .
|
||||
'<div class="row align-items-center">'.
|
||||
'<a style="width: 33%; margin: 0; padding: 0; font-weight: 700;" class="sde-blue" href="'. route("userevents.create", ["event_id" => $event->id ]) .'">Tilmeld</a>'.
|
||||
'<div class="row align-items-center">'. //route("userevents.createajax", ["event_id" => $event->id ])
|
||||
'<a style="width: 33%; margin: 0; padding: 0; font-weight: 700;" class="sde-blue" href="javascript:void(0);" onclick="ajaxCall('. $event->id .')">Tilmeld</a>'.
|
||||
'<a style="width: 33%; margin: 0; padding: 0; text-align: center; font-weight: 700;" class="sde-blue" href="'. route("events.show", ["event" => $event->id ]) .'">Læs mere</a>'.
|
||||
'<a style="width: 33%; margin: 0; padding: 0; text-align: end; font-weight: 700;" class="sde-blue" href="'. route("events.accountsignups", ["event" => $event->id ]) .'">Se deltagere</a>'.
|
||||
'</div>';
|
||||
|
|
|
@ -106,4 +106,38 @@ class UserEventController extends Controller
|
|||
public function update() {
|
||||
|
||||
}
|
||||
|
||||
public function createajax(Request $request)
|
||||
{
|
||||
// Get written data from events.index
|
||||
$data = $request->validate([
|
||||
"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('event_id', $request->event_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($data);
|
||||
$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>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6977,3 +6977,71 @@ main {
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
#snackbar {
|
||||
visibility: hidden;
|
||||
width: calc(90% - 16px);
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 2px;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: calc(5% + 8px);
|
||||
right: calc(5% + 8px);
|
||||
bottom: 30px;
|
||||
}
|
||||
|
||||
#snackbar.show {
|
||||
visibility: visible;
|
||||
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
||||
animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadein {
|
||||
from {
|
||||
bottom: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: 30px;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadein {
|
||||
from {
|
||||
bottom: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: 30px;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeout {
|
||||
from {
|
||||
bottom: 30px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeout {
|
||||
from {
|
||||
bottom: 30px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6977,6 +6977,74 @@ main {
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
#snackbar {
|
||||
visibility: hidden;
|
||||
width: calc(90% - 16px);
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 2px;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: calc(5% + 8px);
|
||||
right: calc(5% + 8px);
|
||||
bottom: 30px;
|
||||
}
|
||||
|
||||
#snackbar.show {
|
||||
visibility: visible;
|
||||
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
||||
animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadein {
|
||||
from {
|
||||
bottom: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: 30px;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadein {
|
||||
from {
|
||||
bottom: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: 30px;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeout {
|
||||
from {
|
||||
bottom: 30px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fadeout {
|
||||
from {
|
||||
bottom: 30px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
to {
|
||||
bottom: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
background-color: #666666;
|
||||
|
|
|
@ -485,3 +485,43 @@ $primary-color: $blue;
|
|||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
#snackbar {
|
||||
visibility: hidden;
|
||||
width: calc(90% - 16px);
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 2px;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: calc(5% + 8px);
|
||||
right: calc(5% + 8px);
|
||||
bottom: 30px;
|
||||
}
|
||||
|
||||
#snackbar.show {
|
||||
visibility: visible;
|
||||
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
||||
animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadein {
|
||||
from {bottom: 0; opacity: 0;}
|
||||
to {bottom: 30px; opacity: 1;}
|
||||
}
|
||||
|
||||
@keyframes fadein {
|
||||
from {bottom: 0; opacity: 0;}
|
||||
to {bottom: 30px; opacity: 1;}
|
||||
}
|
||||
|
||||
@-webkit-keyframes fadeout {
|
||||
from {bottom: 30px; opacity: 1;}
|
||||
to {bottom: 0; opacity: 0;}
|
||||
}
|
||||
|
||||
@keyframes fadeout {
|
||||
from {bottom: 30px; opacity: 1;}
|
||||
to {bottom: 0; opacity: 0;}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,14 @@
|
|||
@else
|
||||
<link type="text/css" rel="stylesheet" href="{{ mix("/css/webapp.css") }}">
|
||||
@endif
|
||||
|
||||
<script type="text/javascript">
|
||||
function setMain() {
|
||||
var main = document.getElementsByTagName("main")[0];
|
||||
var header = document.getElementsByTagName("header")[0];
|
||||
main.style.minHeight = 'calc(100% - ' + header.clientHeight + 'px)';
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onresize="setMain()" onload="setMain()">
|
||||
<header class="row align-items-center" id="header">
|
||||
|
@ -68,11 +76,8 @@
|
|||
{{ __('msg.logud') }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@yield("content")
|
||||
|
||||
<script src="{{ mix("/js/app.js") }}"></script>
|
||||
@yield("scripts")
|
||||
@if(request()->cookie("mode") == "dark")
|
||||
<script type="text/javascript">
|
||||
function toggleMenu(menu) {
|
||||
|
@ -111,14 +116,6 @@
|
|||
};
|
||||
</script>
|
||||
@endif
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function setMain() {
|
||||
var main = document.getElementsByTagName("main")[0];
|
||||
var header = document.getElementsByTagName("header")[0];
|
||||
main.style.minHeight = 'calc(100% - ' + header.clientHeight + 'px)';
|
||||
}
|
||||
</script>
|
||||
@yield("scripts")
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
padding-right: 8px;
|
||||
}
|
||||
</style>
|
||||
<main>
|
||||
<main style="justify-content: unset;">
|
||||
@foreach(\App\News::query()->orderBy("created_at", "desc")->get() as $new)
|
||||
<div class="card">
|
||||
<div class="header">
|
||||
|
@ -43,5 +43,31 @@
|
|||
@if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)
|
||||
<p class="text-center">{{__('msg.ingennyheder')}}</p>
|
||||
@endif
|
||||
<div id="snackbar">Some text some message..</div>
|
||||
</main>
|
||||
@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(event_id) {
|
||||
axios.post("{{ route("userevents.createajax") }}",
|
||||
{
|
||||
event_id: event_id
|
||||
}
|
||||
).then(function (response) {
|
||||
var data = response.data;
|
||||
|
||||
snackbar(data);
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
|
|
@ -31,6 +31,7 @@ Route::get("phones", "PhoneController@index")->name("phones.index");
|
|||
Route::get("/washing-reservationsapi", "WashingReservationController@api")->name("washing-reservations.api");
|
||||
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");
|
||||
|
||||
//Search/Filter
|
||||
Route::get("/contactsapi", "ContactController@search")->name("contacts.search");
|
||||
|
|
Loading…
Reference in New Issue