Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ae306c8f1b
|
@ -31,7 +31,7 @@ class NewsController extends Controller
|
||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$news = News::query()->paginate($request->input("limit", 20));
|
$news = News::query()->orderBy('id', 'asc')->paginate(2);
|
||||||
|
|
||||||
return Response::detect("news.index", [ "news" => $news ]);
|
return Response::detect("news.index", [ "news" => $news ]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,70 @@ class ResourceController extends Controller
|
||||||
return $resource;
|
return $resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public static function storeMime(Request $request, ResourceCategory $category)
|
||||||
|
{
|
||||||
|
$file = $request->file("resource");
|
||||||
|
|
||||||
|
$resourceExtension = ResourceExtension::query()->where("extension", "=", $file->extension())->first();
|
||||||
|
|
||||||
|
//Create resourceExtension if it doesn't exist
|
||||||
|
if($resourceExtension === null) {
|
||||||
|
$category = substr($file->getMimeType(), 0, strpos($file->getMimeType(), "/"));
|
||||||
|
|
||||||
|
$resourceCategory = ResourceCategory::query()->where("name", "=", $category)->first();
|
||||||
|
|
||||||
|
//If the uploaded file doesn't match the requested mime type
|
||||||
|
if($resourceCategory) {
|
||||||
|
if ($resourceCategory->name !== $category)
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create resourceCategory if it doesn't exist
|
||||||
|
if($resourceCategory === null){
|
||||||
|
$data = [
|
||||||
|
"name" => $category,
|
||||||
|
"description" => "",
|
||||||
|
"slug" => ""
|
||||||
|
];
|
||||||
|
|
||||||
|
$resourceCategory = new ResourceCategory($data);
|
||||||
|
$resourceCategory->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
"extension" => $file->extension(),
|
||||||
|
"description" => "",
|
||||||
|
"resource_category_id" => $resourceCategory->id
|
||||||
|
];
|
||||||
|
|
||||||
|
$resourceExtension = new ResourceExtension($data);
|
||||||
|
$resourceExtension->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
$resource = new Resource();
|
||||||
|
|
||||||
|
$resource->extension_id = $resourceExtension->id;
|
||||||
|
|
||||||
|
$fileName = time().'_'.$file->getClientOriginalName();
|
||||||
|
$filePath = $file->storeAs('uploads', $fileName, 'public');
|
||||||
|
|
||||||
|
/* /uploads/filename.ext */
|
||||||
|
$resource->filename = '/' . $filePath;
|
||||||
|
|
||||||
|
|
||||||
|
$resource->save();
|
||||||
|
|
||||||
|
return $resource;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\News;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
|
||||||
|
@ -14,9 +15,20 @@ class RootController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index() {
|
public function index() {
|
||||||
if(auth()->user()->can('admin.panel.show'))
|
$perPage = 2;
|
||||||
return Response::detect("root.index");
|
|
||||||
else
|
if(auth()->user()->can('admin.panel.show')) {
|
||||||
return view('app.root.index');
|
if(Response::detect("root.index")->name() == "admin.root.index")
|
||||||
|
return Response::detect("root.index");
|
||||||
|
else {
|
||||||
|
$news = News::query()->orderBy('id', 'asc')->paginate($perPage);
|
||||||
|
return Response::detect("root.index", ["news" => $news]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$news = News::query()->orderBy('id', 'asc')->paginate($perPage);
|
||||||
|
|
||||||
|
return view('app.root.index', ["news" => $news]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Helpers\Detector;
|
use App\Helpers\Detector;
|
||||||
|
use App\ResourceCategory;
|
||||||
|
use App\ResourceExtension;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
|
@ -338,8 +340,14 @@ class UserController extends Controller
|
||||||
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>');
|
||||||
}
|
}
|
||||||
} else if($request->file("resource")) { // Else if you're editing the profile pic
|
} else if($request->file("resource")) { // Else if you're editing the profile pic
|
||||||
$user->update([ "resource_id" => ResourceController::store($request)->id ]);
|
$resource = ResourceController::storeMime($request, ResourceCategory::query()->where("name", "=", "image")->first());
|
||||||
|
|
||||||
|
if($resource !== null) {
|
||||||
|
$user->update(["resource_id" => $resource->id]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return redirect()->route("users.accounteditpic");
|
||||||
|
}
|
||||||
|
|
||||||
return redirect()->route("users.account");
|
return redirect()->route("users.account");
|
||||||
} 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.
|
||||||
|
|
|
@ -157,6 +157,42 @@ input.appinput {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nav > .pagination {
|
||||||
|
display: flex;
|
||||||
|
list-style: none;
|
||||||
|
-webkit-padding-start: unset;
|
||||||
|
padding-inline-start: unset;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item {
|
||||||
|
display: block;
|
||||||
|
list-style: none;
|
||||||
|
padding-right: 8px;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item:last-child {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.disabled {
|
||||||
|
color: darkgrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.active {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-item.active > span {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.disabled > .page-link {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
.text-white {
|
.text-white {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,42 @@ input.appinput {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nav > .pagination {
|
||||||
|
display: flex;
|
||||||
|
list-style: none;
|
||||||
|
-webkit-padding-start: unset;
|
||||||
|
padding-inline-start: unset;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item {
|
||||||
|
display: block;
|
||||||
|
list-style: none;
|
||||||
|
padding-right: 8px;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item:last-child {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.disabled {
|
||||||
|
color: darkgrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.active {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-item.active > span {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.disabled > .page-link {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
.text-white {
|
.text-white {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,6 +157,42 @@ input.appinput {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nav > .pagination {
|
||||||
|
display: flex;
|
||||||
|
list-style: none;
|
||||||
|
-webkit-padding-start: unset;
|
||||||
|
padding-inline-start: unset;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item {
|
||||||
|
display: block;
|
||||||
|
list-style: none;
|
||||||
|
padding-right: 8px;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item:last-child {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.disabled {
|
||||||
|
color: darkgrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.active {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-item.active > span {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.disabled > .page-link {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
.text-white {
|
.text-white {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,3 +27,40 @@
|
||||||
.cursor-pointer {
|
.cursor-pointer {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
nav > .pagination {
|
||||||
|
display: flex;
|
||||||
|
list-style: none;
|
||||||
|
padding-inline-start: unset;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item {
|
||||||
|
display: block;
|
||||||
|
list-style: none;
|
||||||
|
padding-right: 8px;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item:last-child {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.disabled {
|
||||||
|
color: darkgrey;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.active {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-item.active > span {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination > .page-item.disabled > .page-link {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
|
@ -79,6 +79,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
{{ $events->links() }}
|
||||||
@else
|
@else
|
||||||
<p class="text-center" style="margin-bottom: auto">{{__('msg.dereringenaktiviteter')}}!</p>
|
<p class="text-center" style="margin-bottom: auto">{{__('msg.dereringenaktiviteter')}}!</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
{{ $guides->links() }}
|
||||||
@else
|
@else
|
||||||
<p style="margin: 0 18px; margin-bottom: auto; text-align: center">{{__('msg.dereringenvejledninger')}}.</p>
|
<p style="margin: 0 18px; margin-bottom: auto; text-align: center">{{__('msg.dereringenvejledninger')}}.</p>
|
||||||
@endif
|
@endif
|
||||||
|
|
|
@ -80,6 +80,12 @@
|
||||||
{{ __('msg.logud') }}
|
{{ __('msg.logud') }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<style>
|
||||||
|
option, textarea {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
@yield("content")
|
@yield("content")
|
||||||
<script src="{{ mix("/js/app.js") }}"></script>
|
<script src="{{ mix("/js/app.js") }}"></script>
|
||||||
@if(request()->cookie("mode") == "dark")
|
@if(request()->cookie("mode") == "dark")
|
||||||
|
|
|
@ -69,8 +69,11 @@
|
||||||
@endforeach
|
@endforeach
|
||||||
@if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)
|
@if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)
|
||||||
<p class="text-center">{{__('msg.ingennyheder')}}</p>
|
<p class="text-center">{{__('msg.ingennyheder')}}</p>
|
||||||
|
@else
|
||||||
|
{{ $news->links() }}
|
||||||
@endif
|
@endif
|
||||||
<div id="snackbar"></div>
|
<div id="snackbar"></div>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
@endsection
|
@endsection
|
||||||
@section("scripts")
|
@section("scripts")
|
||||||
|
|
|
@ -45,12 +45,14 @@
|
||||||
<script src="{{ asset("/js/moment-with-locales.min.js") }}"></script>
|
<script src="{{ asset("/js/moment-with-locales.min.js") }}"></script>
|
||||||
<script src="{{ asset("/js/da.min.js") }}"></script>
|
<script src="{{ asset("/js/da.min.js") }}"></script>
|
||||||
<script>
|
<script>
|
||||||
|
//Global vars to use outside functions
|
||||||
var momentDate = null;
|
var momentDate = null;
|
||||||
var dateText = null;
|
var dateText = null;
|
||||||
|
|
||||||
//Custom forEach
|
//Custom forEach
|
||||||
NodeList.prototype.forEach = Array.prototype.forEach;
|
NodeList.prototype.forEach = Array.prototype.forEach;
|
||||||
|
|
||||||
|
//Generates the calender when the site loads
|
||||||
function generateCalendar(weekOffset = 0) {
|
function generateCalendar(weekOffset = 0) {
|
||||||
const week = (moment().week() + weekOffset);
|
const week = (moment().week() + weekOffset);
|
||||||
|
|
||||||
|
@ -109,6 +111,7 @@
|
||||||
calendar.appendChild(calendarBody);
|
calendar.appendChild(calendarBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//When a date is selected
|
||||||
function onDateSelect(date, dayHolder, datetext) {
|
function onDateSelect(date, dayHolder, datetext) {
|
||||||
//Set selected date and dateText
|
//Set selected date and dateText
|
||||||
momentDate = date;
|
momentDate = date;
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
@endforeach
|
@endforeach
|
||||||
@if(count($reservations) < 1)
|
@if(count($reservations) < 1)
|
||||||
<p style="margin: 0 18px;">{{__('msg.duharingenreservationer')}}.</p>
|
<p style="margin: 0 18px;">{{__('msg.duharingenreservationer')}}.</p>
|
||||||
|
@else
|
||||||
|
{{ $reservations->links() }}
|
||||||
@endif
|
@endif
|
||||||
<a href="{{ route("washing-reservations.create") }}" class="btn btn-sde-blue mt-auto mb-1">{{__('msg.reservervaskemaskine')}}</a>
|
<a href="{{ route("washing-reservations.create") }}" class="btn btn-sde-blue mt-auto mb-1">{{__('msg.reservervaskemaskine')}}</a>
|
||||||
</main>
|
</main>
|
||||||
|
|
Loading…
Reference in New Issue