v0.5.9 - Fixed en/dk messages + added backend en/dk messages

This commit is contained in:
Anders 2020-08-07 10:51:10 +02:00
parent b5fb505eaa
commit a23337b9d4
12 changed files with 75 additions and 42 deletions

View File

@ -70,9 +70,9 @@ class EventController extends Controller
$allEvents = Event::query()->where('name', '=', $request->name)->get(); $allEvents = Event::query()->where('name', '=', $request->name)->get();
if(count($allEvents) > 0) if(count($allEvents) > 0) {
return redirect()->route("events.index", ['events' => $event])->with('EventNameExists', '<p><b>Der findes allerede et event med det navn!</b></p>'); return redirect()->route("events.index", ['events' => $event])->with('EventNameExists', '<p><b>Der findes allerede et event med det navn!</b></p>');
else { } else {
$event->save(); $event->save();
$event = Event::query()->paginate($request->input("limit", 20)); $event = Event::query()->paginate($request->input("limit", 20));
return redirect()->route("events.index", ['events' => $event]); return redirect()->route("events.index", ['events' => $event]);

View File

@ -152,7 +152,7 @@ class UserController extends Controller
/** @var User $user */ /** @var User $user */
$user->update($data); $user->update($data);
} else // Else go back with an error message } else // Else go back with an error message
return redirect()->route("users.edit", ['user' => $id])->with('error#notsamepass', '<p><b>Der stod ikke det samme i `Password` & `Confirm Password`!</b></p>'); return redirect()->route("users.edit", ['user' => $id])->with('error#notsamepass', '<p><b>Der stod ikke det samme i `Password` & `Bekræft Adgangskode`!</b></p>');
} }
else { // If you haven't touched the password, then update everything else but password else { // If you haven't touched the password, then update everything else but password
$data = $request->only(['name_first', 'name_last', 'email', 'phone', 'roles']); $data = $request->only(['name_first', 'name_last', 'email', 'phone', 'roles']);
@ -211,13 +211,19 @@ class UserController extends Controller
return redirect()->route("root.index"); return redirect()->route("root.index");
} }
return redirect()->back(303)->with('error#wrongcredentials', '<p><b>Email eller Password matchede ikke!</b></p>'); if (request()->cookie('languagesSetting') == "dk")
return redirect()->back(303)->with('error#wrongcredentials', '<p class="text-center text-white"><b>Email eller Password matchede ikke!</b></p>');
if (request()->cookie('languagesSetting') == "en")
return redirect()->back(303)->with('error#wrongcredentials', '<p class="text-center text-white"><b>Wrong Email or Password!</b></p>');
} }
public function logout(Request $request) { public function logout(Request $request) {
Auth::logout(); Auth::logout();
return redirect()->route("users.login")->with('success#loggedout', '<p><b>Du er hermed logget ud!</b></p>'); if (request()->cookie('languagesSetting') == "dk")
return redirect()->route("users.login")->with('success#loggedout', '<p class="text-center text-white"><b>Du er hermed logget ud!</b></p>');
if (request()->cookie('languagesSetting') == "en")
return redirect()->route("users.login")->with('success#loggedout', '<p class="text-center text-white"><b>You are logged out!</b></p>');
} }
/*******************************************/ /*******************************************/
@ -232,7 +238,7 @@ class UserController extends Controller
$user = User::query()->where('email', '=', $request->email)->first(); $user = User::query()->where('email', '=', $request->email)->first();
if($user == null){ if($user == null){
return redirect()->back()->with('errornosuchuser', '<p>Denne email findes ikke i systemet!</p>'); return redirect()->back()->with('errornosuchuser', '<p class="text-center text-white"><b>Denne email findes ikke i systemet!</b></p>');
} }
//Send email //Send email
@ -290,21 +296,33 @@ class UserController extends Controller
if ($request->input('password') != null) { // If you're editing the password if ($request->input('password') != null) { // If you're editing the password
$data = $request->only(['name_first', 'name_last', 'email', 'phone', 'password']); $data = $request->only(['name_first', 'name_last', 'email', 'phone', 'password']);
if ($request->input('password') != $request->input('confirmpassword')) { // If new password and new password confirm is not the same, go back with fail message. if ($request->input('password') != $request->input('confirmpassword')) { // If new password and new password confirm is not the same, go back with fail message.
if (request()->cookie('languagesSetting') == "dk")
return redirect()->route("users.accounteditpass")->with('error#notsamepass', '<p class="text-center"><b>Der stod ikke det samme i `Nyt Password` & `Confirm Password`!</b></p>'); return redirect()->route("users.accounteditpass")->with('error#notsamepass', '<p class="text-center"><b>Der stod ikke det samme i `Nyt Password` & `Confirm Password`!</b></p>');
elseif (request()->cookie('languagesSetting') == "en")
return redirect()->route("users.accounteditpass")->with('error#notsamepass', '<p class="text-center"><b>`New Password` & `Confirm Password` was not the same!</b></p>');
} elseif (!Hash::check($request->input('oldpassword'), $user->password)) { // If the written current password and current password in DB is not the same, go back with fail message. } elseif (!Hash::check($request->input('oldpassword'), $user->password)) { // If the written current password and current password in DB is not the same, go back with fail message.
if (request()->cookie('languagesSetting') == "dk")
return redirect()->route("users.accounteditpass")->with('error#oldpass', '<p class="text-center"><b>Det indtastede password i `Nuværende Password` er ikke dit nuværende password!</b></p>'); return redirect()->route("users.accounteditpass")->with('error#oldpass', '<p class="text-center"><b>Det indtastede password i `Nuværende Password` er ikke dit nuværende password!</b></p>');
elseif (request()->cookie('languagesSetting') == "en")
return redirect()->route("users.accounteditpass")->with('error#oldpass', '<p class="text-center"><b>The entered `Current Password` was not the same as your current password!</b></p>');
} else { // If new password and current password is the same AND current written and current DB password is the same. Then update and logout. } else { // If new password and current password is the same AND current written and current DB password is the same. Then update and logout.
/** @var User $user */ /** @var User $user */
$user->update($data); $user->update($data);
Auth::logout(); Auth::logout();
if (request()->cookie('languagesSetting') == "dk")
return redirect()->route("users.login")->with('success#passwordchange', '<p class="text-center text-white"><b>Dit password er hermed ændret!</b></p>'); return redirect()->route("users.login")->with('success#passwordchange', '<p class="text-center text-white"><b>Dit password er hermed ændret!</b></p>');
elseif (request()->cookie('languagesSetting') == "en")
return redirect()->route("users.login")->with('success#passwordchange', '<p class="text-center text-white"><b>Your password was changed successfully!</b></p>');
} }
} else { // Else if you're not editing the password but anything else (Email, Phone Number). Then update user. } else { // Else if you're not editing the password but anything else (Email, Phone Number). Then update user.
$data = $request->only(['email', 'phone']); $data = $request->only(['email', 'phone']);
$user->update($data); $user->update($data);
if (request()->cookie('languagesSetting') == "dk")
return redirect()->route("users.account")->with('success#credentialschanged', '<p class="text-center"><b>Dine oplysninger er hermed ændret!</b></p>'); return redirect()->route("users.account")->with('success#credentialschanged', '<p class="text-center"><b>Dine oplysninger er hermed ændret!</b></p>');
elseif (request()->cookie('languagesSetting') == "en")
return redirect()->route("users.account")->with('success#credentialschanged', '<p class="text-center"><b>Your information has changed!</b></p>');
} }
$users = User::query()->paginate(20); $users = User::query()->paginate(20);

View File

@ -48,15 +48,22 @@ class UserEventController extends Controller
->where('event_id', $request->event_id)->get(); ->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 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 (count($getTableInfo) > 0) {
if (request()->cookie('languagesSetting') == "dk")
return redirect()->route("events.index")->with('error#' . $request->event_id, '<p class="text-center"><b>Du har allerede tilmeldt dig denne Aktivitet!</b></p>'); return redirect()->route("events.index")->with('error#' . $request->event_id, '<p class="text-center"><b>Du har allerede tilmeldt dig denne Aktivitet!</b></p>');
if (request()->cookie('languagesSetting') == "en")
return redirect()->route("events.index")->with('error#' . $request->event_id, '<p class="text-center"><b>You are already participating in this event!</b></p>');
}
// If not, then it keeps going and saves and shows a success message // If not, then it keeps going and saves and shows a success message
$UserEvent = new UserEvent($data); $UserEvent = new UserEvent($data);
$UserEvent->user_id = auth()->user()->id; $UserEvent->user_id = auth()->user()->id;
$UserEvent->save(); $UserEvent->save();
if (request()->cookie('languagesSetting') == "dk")
return redirect()->route("events.index")->with('signup#' . $request->event_id, '<p class="text-center"><b>Du er hermed tilmeldt denne aktivitet!</b></p>'); return redirect()->route("events.index")->with('signup#' . $request->event_id, '<p class="text-center"><b>Du er hermed tilmeldt denne aktivitet!</b></p>');
if (request()->cookie('languagesSetting') == "en")
return redirect()->route("events.index")->with('signup#' . $request->event_id, '<p class="text-center"><b>You are now participating in this event!</b></p>');
} }
/** /**
@ -76,7 +83,10 @@ class UserEventController extends Controller
$JoinedEvents = UserEvent::query()->join('events', 'events.id', '=', 'user_events.event_id')->where('user_id', "=", auth()->user()->id)->get(); $JoinedEvents = UserEvent::query()->join('events', 'events.id', '=', 'user_events.event_id')->where('user_id', "=", auth()->user()->id)->get();
if (request()->cookie('languagesSetting') == "dk")
return redirect()->route("userevents.index", [ "userevents" => $JoinedEvents ])->with('eventunsubscribed', '<p class="text-center"><b>Du er hermed afmeldt aktiviteten!</b></p>'); return redirect()->route("userevents.index", [ "userevents" => $JoinedEvents ])->with('eventunsubscribed', '<p class="text-center"><b>Du er hermed afmeldt aktiviteten!</b></p>');
if (request()->cookie('languagesSetting') == "en")
return redirect()->route("userevents.index", [ "userevents" => $JoinedEvents ])->with('eventunsubscribed', '<p class="text-center"><b>You are no longer participating in this event!</b></p>');
} }
public function show() public function show()

View File

@ -12,33 +12,37 @@ return[
"logud" => "Log ud", "logud" => "Log ud",
"dereringenmenuplanerdenneuge" => "Der er ingen menuplaner denne uge", "dereringenmenuplanerdenneuge" => "Der er ingen menuplaner denne uge",
"dereringenaktiviteter" => "Der er ingen aktiviteter", "dereringenaktiviteter" => "Der er ingen aktiviteter",
"setilmeldteaktiviteter" => "Se tilmeldte aktiviteter", "setilmeldteaktiviteter" => "Se Tilmeldte Aktiviteter",
"dinereservationer" => "Dine reservationer", "dinereservationer" => "Dine reservationer",
"duharingenreservationer" => "Du har ingen reservationer", "duharingenreservationer" => "Du har ingen reservationer",
"reservervaskemaskine" => "Reserver vaskemaskine", "reservervaskemaskine" => "Reserver vaskemaskine",
"kontakt" => "Kontakt", "dereringenvaskemaskiner" => "Der er ikke nogen vaskemaskiner",
"lokation" => "Lokation",
"kontakter" => "Kontakt",
"navn" => "Navn", "navn" => "Navn",
"email"=> "E-mail", "email"=> "E-mail",
"ring" => "Ring", "ring" => "Ring",
"givfeedback" => "Giv feedback", "givfeedback" => "Giv feedback",
"sendfeedback" => "Send feedback omkring hvem el. hvad som helst", "sendfeedback" => "Send feedback omkring hvem el. hvad som helst",
"accepterer" => "Accepterer", "accepter" => "Accepter",
"dereringenvejledninger" => "Der er ingen vejledninger", "dereringenvejledninger" => "Der er ingen vejledninger",
"telefon" => "Telefon", "telefon" => "Telefon",
"redigeroplysninger" => "Rediger Oplysninger", "redigeroplysninger" => "Rediger Oplysninger",
"ændrepassword" => "Ænder Password", "ændrepassword" => "Ændre Password",
"tilmeldteaktiviteter" => "Tilmeldte aktiviteter", "tilmeldteaktiviteter" => "Tilmeldte aktiviteter",
"tilmeld" => "Tilmeld",
"duharikketilmeldtdignogenaktiviteter" => "Du har ikke tilmeldt dig nogen aktiviteter", "duharikketilmeldtdignogenaktiviteter" => "Du har ikke tilmeldt dig nogen aktiviteter",
"afmeld" => "Afmeld",
"tilbage" => "Tilbage", "tilbage" => "Tilbage",
"bookingliste" => "Bokking Liste", "bookingliste" => "Booking Liste",
"ugestor" => "Uge", "ugestor" => "Uge",
"maskiner" => "Maskiner", "maskiner" => "Vaskemaskiner",
"tilgængeligetider" => "Tilgængelige tider", "tilgængeligetider" => "Tilgængelige tider",
"reserver" => "Reserver", "reserver" => "Reserver",
"rediger" => "Rediger", "rediger" => "Rediger",
"nuværendepassword" => "Nuværende Password", "nuværendepassword" => "Nuværende Adgangskode",
"nytpassword" => "Nyt password", "nytpassword" => "Ny Adgangskode",
"confirmpassword" => "Gentag adgangskode", "confirmpassword" => "Gentag Adgangskode",

View File

@ -4,7 +4,7 @@ return[
"menuplan" => "Menu", "menuplan" => "Menu",
"aktiviteter" => "Activities", "aktiviteter" => "Activities",
"reservationer" => "Reservations", "reservationer" => "Reservations",
"kontoret" => "The office", "kontoret" => "The Bureau",
"vagttelefon" => "Emergency phone", "vagttelefon" => "Emergency phone",
"vejledning" => "Guide", "vejledning" => "Guide",
"home" => "Home", "home" => "Home",
@ -19,11 +19,11 @@ return[
"ugestor" => "Week", "ugestor" => "Week",
"dereringenaktiviteter" => "There is no activity this week", "dereringenaktiviteter" => "There is no activity this week",
"setilmeldteaktiviteter" => "See Registered Activities", "setilmeldteaktiviteter" => "See Registered Activities",
"tilmeld" => "Register Activities ",
"tilmeldteaktiviteter" => "Your Registered Activities", "tilmeldteaktiviteter" => "Your Registered Activities",
"duharikketilmeldtdignogenaktiviteter" => "You have not signed up for any activities", "duharikketilmeldtdignogenaktiviteter" => "You have not signed up for any activities",
"afmeld" => "Cancel",
"tilbage" => "Go Back", "tilbage" => "Go Back",
"dinereservationer" => "Your reservations", "dinereservationer" => "Your Reservations",
"fjern" => "Remove", "fjern" => "Remove",
"tid" => "Time", "tid" => "Time",
"reservervaskemaskine" => "Reserve washing machine", "reservervaskemaskine" => "Reserve washing machine",
@ -31,9 +31,10 @@ return[
"bookingliste" => "Booking List", "bookingliste" => "Booking List",
"dereringenvaskemaskiner" => "There are no washing machines", "dereringenvaskemaskiner" => "There are no washing machines",
"tilgængeligetider" => "Available times", "tilgængeligetider" => "Available times",
"maskiner" => "Washing machine", "maskiner" => "Washing machines",
"reserver" => "Reserves", "reserver" => "Reserve",
"kontakt" => "Contacts", "lokation" => "Location",
"kontakter" => "Contacts",
"navn" => "Name", "navn" => "Name",
"email" => "E-mail", "email" => "E-mail",
"telefontid" => "Telephone hours", "telefontid" => "Telephone hours",
@ -41,9 +42,9 @@ return[
"givfeedback" => "Feedback", "givfeedback" => "Feedback",
"sendfeedback" => "Send us feedback about what you like and what you don't like", "sendfeedback" => "Send us feedback about what you like and what you don't like",
"dereringenkontakter" => "There are no contacts", "dereringenkontakter" => "There are no contacts",
"accepterer" => "Accept", "accepter" => "Accept",
"dereringenvejledninger" => "There are no guides", "dereringenvejledninger" => "There are no guides",
"tilmelde" => "Participating", "tilmeld" => "Participating",
"telefon" => "Phone", "telefon" => "Phone",
"redigeroplysninger" => "Edit information", "redigeroplysninger" => "Edit information",
"ændrepassword" => "Change Password", "ændrepassword" => "Change Password",
@ -51,5 +52,4 @@ return[
"nuværendepassword" => "Current password", "nuværendepassword" => "Current password",
"nytpassword" => "New password", "nytpassword" => "New password",
"confirmpassword" => "Confirm password", "confirmpassword" => "Confirm password",
]; ];

View File

@ -22,12 +22,12 @@
<input type="text" name="name_last" id="name_last" placeholder="Efternavn" required> <input type="text" name="name_last" id="name_last" placeholder="Efternavn" required>
<label for="email">Email:</label> <label for="email">Email:</label>
<input type="email" name="email" id="email" placeholder="x@y.z" required> <input type="email" name="email" id="email" placeholder="x@y.z" required>
<label for="password1">Password:</label> <label for="password1">Adgangskode:</label>
<div class="input-group text-left"> <div class="input-group text-left">
<input type="password" class="form-control" name="password" id="password1" placeholder="******" required> <input type="password" class="form-control" name="password" id="password1" placeholder="******" required>
<span class="fa fa-fw fa-eye field-icon toggle-password" id="fa-new" onclick="show('password1', 'fa-new')"></span> <span class="fa fa-fw fa-eye field-icon toggle-password" id="fa-new" onclick="show('password1', 'fa-new')"></span>
</div> </div>
<label for="password2">Confirm Password:</label> <label for="password2">Bekræft Adgangskode:</label>
<div class="input-group text-left"> <div class="input-group text-left">
<input type="password" class="form-control" name="password2" id="password2" placeholder="******" required> <input type="password" class="form-control" name="password2" id="password2" placeholder="******" required>
<span class="fa fa-fw fa-eye field-icon toggle-password" id="fa-confirm" onclick="show('password2', 'fa-confirm')"></span> <span class="fa fa-fw fa-eye field-icon toggle-password" id="fa-confirm" onclick="show('password2', 'fa-confirm')"></span>

View File

@ -5,7 +5,7 @@
@section("content") @section("content")
<main> <main>
<h1 class="text-center sde-blue mt-0 mb-0">{{__('msg.kontakt')}}</h1> <h1 class="text-center sde-blue mt-0 mb-0">{{__('msg.kontakter')}}</h1>
@if(!$contacts->isEmpty()) @if(!$contacts->isEmpty())
@foreach($contacts as $contact) @foreach($contacts as $contact)
<h4 class="mt-2">{{__('msg.navn')}}: {{ $contact->contactname }}</h4> <h4 class="mt-2">{{__('msg.navn')}}: {{ $contact->contactname }}</h4>

View File

@ -16,7 +16,7 @@
<input type="hidden" name="event_id" value="{{ $event->id }}"> <input type="hidden" name="event_id" value="{{ $event->id }}">
{!! session()->get('error#' . $event->id) !!} {!! session()->get('error#' . $event->id) !!}
{!! session()->get('signup#' . $event->id) !!} {!! session()->get('signup#' . $event->id) !!}
<button type="submit" class="btn text-center btn-sde-blue" id="tilmeld">{{__('msg.tilmelde')}}</button> <button type="submit" class="btn text-center btn-sde-blue" id="tilmeld">{{__('msg.tilmeld')}}</button>
</form> </form>
@endforeach @endforeach
@else @else

View File

@ -15,7 +15,7 @@
<h3 class="sde-blue bold text-center mb-0">{{$userevent->name}}</h3> <h3 class="sde-blue bold text-center mb-0">{{$userevent->name}}</h3>
<p class="text-center mt-0">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($userevent->date))->format('d/m/Y \k\l\. H:i') }}</p> <p class="text-center mt-0">{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime($userevent->date))->format('d/m/Y \k\l\. H:i') }}</p>
<p class="text-center">{!! $userevent->description !!}</p> <p class="text-center">{!! $userevent->description !!}</p>
<button type="submit" class="btn text-center btn-sde-blue" onclick="return confirm('Are you sure you want to remove this event?');">Afmeld</button> <button type="submit" class="btn text-center btn-sde-blue" onclick="return confirm('Are you sure you want to remove this event?');">{{__('msg.afmeld')}}</button>
</form> </form>
@endforeach @endforeach
@else @else

View File

@ -9,11 +9,12 @@
<div class="brand"> <div class="brand">
<img src="{{URL::asset('/images/logos/Logo-hvid.svg')}}" alt="Syddansk Erhvervsskole"> <img src="{{URL::asset('/images/logos/Logo-hvid.svg')}}" alt="Syddansk Erhvervsskole">
</div> </div>
<form action="" method="post"> <form action="{{ route('users.forgot') }}" method="post">
@csrf @csrf
<input class="appinput" type="email" name="email" placeholder="Email" required> <input class="appinput" type="email" name="email" placeholder="Email" required>
{!! session()->get('errornosuchuser') !!}
<input class="btn btn-dark" type="submit" value="Send reset mail"> <input class="btn btn-dark" type="submit" value="Send reset mail">
<button class="btn btn-dark" onclick="window.location.href = '{{ route("users.login") }}';">Tilbage</button> <a class="btn btn-dark text-center" href="{{ route("users.login") }}">Tilbage</a>
</form> </form>
</main> </main>
@endsection @endsection

View File

@ -11,7 +11,7 @@
<label class="toggle"> <label class="toggle">
<input class="toggle__input" type="checkbox" name="accept" id="input" onclick="check()"> <input class="toggle__input" type="checkbox" name="accept" id="input" onclick="check()">
<span class="toggle__label sde-blue"> <span class="toggle__label sde-blue">
<span class="toggle__text sde-blue semi-bold">{{__('msg.accepterer')}}</span> <span class="toggle__text sde-blue semi-bold">{{__('msg.accepter')}}</span>
</span> </span>
</label> </label>
<span class="text-center sde-black-20 mt-2">+45 24 62 94 50</span> <span class="text-center sde-black-20 mt-2">+45 24 62 94 50</span>

View File

@ -139,7 +139,7 @@
else { else {
let span = document.createElement("span"); let span = document.createElement("span");
span.classList.add("events__title"); span.classList.add("events__title");
span.innerText = "Lokation"; span.innerText = "{{__('msg.lokation')}}";
let select = document.createElement("select"); let select = document.createElement("select");
select.classList.add("events__title"); select.classList.add("events__title");