Merge branch 'master' of https://bitbucket.org/Terminon/motorradig
This commit is contained in:
commit
fe284c2aa6
18 changed files with 1961 additions and 825 deletions
|
|
@ -2,3 +2,8 @@
|
||||||
laravel new motorradig
|
laravel new motorradig
|
||||||
cd motorradig
|
cd motorradig
|
||||||
composer require laravel/ui --dev
|
composer require laravel/ui --dev
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
mysql -ud0304938 -phubbabubba -h motorrad-ig.de d0304938
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ APP_ENV=local
|
||||||
APP_KEY=base64:7Md2wHHNq04ldtpdsz4B2LDAMEOB+4fSfxMJGfDU2zY=
|
APP_KEY=base64:7Md2wHHNq04ldtpdsz4B2LDAMEOB+4fSfxMJGfDU2zY=
|
||||||
APP_DEBUG=true
|
APP_DEBUG=true
|
||||||
APP_URL=http://test.motorrad-ig.de
|
APP_URL=http://test.motorrad-ig.de
|
||||||
LOG_CHANNEL=stack
|
LOG_CHANNEL=daily
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
DB_CONNECTION=mysql
|
||||||
DB_HOST=127.0.0.1
|
DB_HOST=127.0.0.1
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ class RegisterController extends Controller
|
||||||
return Validator::make($data, [
|
return Validator::make($data, [
|
||||||
'name' => ['required', 'string', 'max:255'],
|
'name' => ['required', 'string', 'max:255'],
|
||||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||||
|
'mobile' => ['required', 'string', 'max:255'],
|
||||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
@ -67,6 +68,7 @@ class RegisterController extends Controller
|
||||||
return User::create([
|
return User::create([
|
||||||
'name' => $data['name'],
|
'name' => $data['name'],
|
||||||
'email' => $data['email'],
|
'email' => $data['email'],
|
||||||
|
'mobile' => $data['mobile'],
|
||||||
'password' => Hash::make($data['password']),
|
'password' => Hash::make($data['password']),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,103 +1,111 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Page;
|
use App\Page;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class PageController extends Controller
|
class PageController extends Controller
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
{
|
||||||
//
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Page $page
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(Page $page)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Page $page
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit(Page $page)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\Page $page
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, Page $page)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\Page $page
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(Page $page)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function page_home()
|
||||||
|
{
|
||||||
|
$page = Page::where('name', 'home')->first();
|
||||||
|
$content = $page->content;
|
||||||
|
|
||||||
|
$content = rtrim(ltrim($content, '"'), '"');
|
||||||
|
|
||||||
|
$user = Auth::user();
|
||||||
|
if ($user) {
|
||||||
|
Log::info("Home page display for user " . $user->name . "[" . $user->id . "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
return view('home')->with('content', $content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function page_activities()
|
||||||
|
{
|
||||||
|
$page = Page::where('name', 'activities')->first();
|
||||||
|
$content = $page->content;
|
||||||
|
return view('activities')->with('content', $content);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the specified resource.
|
|
||||||
*
|
|
||||||
* @param \App\Page $page
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function show(Page $page)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*
|
|
||||||
* @param \App\Page $page
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function edit(Page $page)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param \App\Page $page
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function update(Request $request, Page $page)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*
|
|
||||||
* @param \App\Page $page
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function destroy(Page $page)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function page_home() {
|
|
||||||
$page=Page::where('name','home')->first();
|
|
||||||
$content=$page->content;
|
|
||||||
|
|
||||||
$content = rtrim(ltrim($content,'"'),'"');
|
|
||||||
|
|
||||||
|
|
||||||
return view('home')->with('content',$content);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function page_activities() {
|
|
||||||
$page=Page::where('name','activities')->first();
|
|
||||||
$content=$page->content;
|
|
||||||
return view('activities')->with('content',$content);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,158 +1,159 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Tour;
|
use App\Tour;
|
||||||
use App\Booking;
|
use App\Booking;
|
||||||
use App\User;
|
use App\User;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\File;
|
use Illuminate\Http\File;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Intervention\Image\Facades\Image;
|
use Intervention\Image\Facades\Image;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class TourController extends Controller
|
class TourController extends Controller
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
{
|
||||||
error_log("Tour:index");
|
/**
|
||||||
$tours=Tour::where('start','>',Carbon::now())->orderBy('start')->get();
|
* Display a listing of the resource.
|
||||||
$participantCount=array();
|
*
|
||||||
foreach($tours as $key => $tour) {
|
* @return \Illuminate\Http\Response
|
||||||
$result = DB::select('select count(*) as cnt from bookings where tour_id=?', [$tour->id]);
|
*/
|
||||||
$participantCount[$tour->id] = $result[0]->cnt;
|
public function index()
|
||||||
$tours[$key]->start=Tour::toGermanDate($tour->start);
|
{
|
||||||
$tours[$key]->deadline=Tour::toGermanDate($tour->deadline);
|
error_log("Tour:index");
|
||||||
}
|
$tours = Tour::where('start', '>', Carbon::now())->orderBy('start')->get();
|
||||||
return view('tour.index')->with('tours',$tours)->with('participantCount',$participantCount);
|
$participantCount = array();
|
||||||
}
|
foreach ($tours as $key => $tour) {
|
||||||
|
$result = DB::select('select count(*) as cnt from bookings where tour_id=?', [$tour->id]);
|
||||||
public function index_old()
|
$participantCount[$tour->id] = $result[0]->cnt;
|
||||||
{
|
$tours[$key]->start = Tour::toGermanDate($tour->start);
|
||||||
error_log("Tour:index_old");
|
$tours[$key]->deadline = Tour::toGermanDate($tour->deadline);
|
||||||
$tours=Tour::where('start','<',Carbon::now())->orderBy('start')->get();
|
}
|
||||||
$participantCount=array();
|
return view('tour.index')->with('tours', $tours)->with('participantCount', $participantCount);
|
||||||
foreach($tours as $key => $tour) {
|
|
||||||
$result = DB::select('select count(*) as cnt from bookings where tour_id=?', [$tour->id]);
|
|
||||||
$participantCount[$tour->id] = $result[0]->cnt;
|
|
||||||
$tours[$key]->start=Tour::toGermanDate($tour->start);
|
|
||||||
$tours[$key]->deadline=Tour::toGermanDate($tour->deadline);
|
|
||||||
}
|
|
||||||
return view('tour.index_old')->with('tours',$tours)->with('participantCount',$participantCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for creating a new resource.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
error_log("Tour:create");
|
|
||||||
$tour = new Tour;
|
|
||||||
$tour->name="neue Tour";
|
|
||||||
$tour->beschreibung="Tour Beschreibung";
|
|
||||||
$tour->user_id=Auth::user()->id;
|
|
||||||
return view('tour.create')->with('tour',$tour);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
error_log("Tour:store");
|
|
||||||
|
|
||||||
$request->validate(
|
|
||||||
[
|
|
||||||
'name'=>'required|min:3',
|
|
||||||
'beschreibung'=>'required',
|
|
||||||
'start'=>'required',
|
|
||||||
'deadline'=>'required',
|
|
||||||
'user_id'=>'required',
|
|
||||||
'bild'=>'mimes:jpg,jpeg,bmp,png,gif'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$tour=new Tour;
|
|
||||||
$tour->name=$request->input('name');
|
|
||||||
$tour->user_id=$request->input('user_id');
|
|
||||||
$tour->beschreibung=$request->input('beschreibung');
|
|
||||||
$tour->start=Tour::toDBDate($request->input('start'));
|
|
||||||
$tour->deadline=Tour::toDBDate($request->input('deadline'));
|
|
||||||
$tour->max_participants=$request->input('max_participants');
|
|
||||||
$tour->is_cancelled=$request->input('is_cancelled',false);
|
|
||||||
$tour->save();
|
|
||||||
|
|
||||||
error_log("Stored deadline:".$tour->deadline);
|
|
||||||
|
|
||||||
return redirect('/tour');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the specified resource.
|
|
||||||
*
|
|
||||||
* @param \App\Tour $tour
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function show(Tour $tour)
|
|
||||||
{
|
|
||||||
$creator = User::find($tour->user_id);
|
|
||||||
$bookings = Booking::where('tour_id',$tour->id)->get();
|
|
||||||
$users = array();
|
|
||||||
foreach($bookings as $booking) {
|
|
||||||
$user=User::find($booking->user_id);
|
|
||||||
array_push($users, $user);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vergangene Tour anzeigen
|
public function index_old()
|
||||||
if($tour->start < Carbon::now()) {
|
{
|
||||||
|
error_log("Tour:index_old");
|
||||||
|
$tours = Tour::where('start', '<', Carbon::now())->orderBy('start')->get();
|
||||||
|
$participantCount = array();
|
||||||
|
foreach ($tours as $key => $tour) {
|
||||||
|
$result = DB::select('select count(*) as cnt from bookings where tour_id=?', [$tour->id]);
|
||||||
|
$participantCount[$tour->id] = $result[0]->cnt;
|
||||||
|
$tours[$key]->start = Tour::toGermanDate($tour->start);
|
||||||
|
$tours[$key]->deadline = Tour::toGermanDate($tour->deadline);
|
||||||
|
}
|
||||||
|
return view('tour.index_old')->with('tours', $tours)->with('participantCount', $participantCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
error_log("Tour:create");
|
||||||
|
$tour = new Tour;
|
||||||
|
$tour->name = "neue Tour";
|
||||||
|
$tour->beschreibung = "Tour Beschreibung";
|
||||||
|
$tour->user_id = Auth::user()->id;
|
||||||
|
return view('tour.create')->with('tour', $tour);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
error_log("Tour:store");
|
||||||
|
|
||||||
|
$request->validate(
|
||||||
|
[
|
||||||
|
'name' => 'required|min:3',
|
||||||
|
'beschreibung' => 'required',
|
||||||
|
'start' => 'required',
|
||||||
|
'deadline' => 'required',
|
||||||
|
'user_id' => 'required',
|
||||||
|
'bild' => 'mimes:jpg,jpeg,bmp,png,gif'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$tour = new Tour;
|
||||||
|
$tour->name = $request->input('name');
|
||||||
|
$tour->user_id = $request->input('user_id');
|
||||||
|
$tour->beschreibung = $request->input('beschreibung');
|
||||||
|
$tour->start = Tour::toDBDate($request->input('start'));
|
||||||
|
$tour->deadline = Tour::toDBDate($request->input('deadline'));
|
||||||
|
$tour->max_participants = $request->input('max_participants');
|
||||||
|
$tour->is_cancelled = $request->input('is_cancelled', false);
|
||||||
|
$tour->save();
|
||||||
|
|
||||||
|
error_log("Stored deadline:" . $tour->deadline);
|
||||||
|
|
||||||
|
return redirect('/tour');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Tour $tour
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show(Tour $tour)
|
||||||
|
{
|
||||||
|
$creator = User::find($tour->user_id);
|
||||||
|
$bookings = Booking::where('tour_id', $tour->id)->get();
|
||||||
|
$users = array();
|
||||||
|
foreach ($bookings as $booking) {
|
||||||
|
$user = User::find($booking->user_id);
|
||||||
|
array_push($users, $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vergangene Tour anzeigen
|
||||||
|
if ($tour->start < Carbon::now()) {
|
||||||
|
$tour->start = Tour::toGermanDate($tour->start);
|
||||||
|
$tour->deadline = Tour::toGermanDate($tour->deadline);
|
||||||
|
return view('tour.show_old')
|
||||||
|
->with('tour', $tour)
|
||||||
|
->with('users', $users)
|
||||||
|
->with('creator', $creator);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zukünftige Tour anzeigen
|
||||||
|
$rooms = $this->fetch_rooms($tour->id);
|
||||||
|
|
||||||
$tour->start = Tour::toGermanDate($tour->start);
|
$tour->start = Tour::toGermanDate($tour->start);
|
||||||
$tour->deadline = Tour::toGermanDate($tour->deadline);
|
$tour->deadline = Tour::toGermanDate($tour->deadline);
|
||||||
return view('tour.show_old')
|
return view('tour.show')
|
||||||
->with('tour', $tour)
|
->with('tour', $tour)
|
||||||
->with('users', $users)
|
->with('users', $users)
|
||||||
->with('creator', $creator);
|
->with('creator', $creator)
|
||||||
|
->with('rooms', $rooms);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zukünftige Tour anzeigen
|
/**
|
||||||
$rooms=$this->fetch_rooms($tour->id);
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\Tour $tour
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
|
||||||
$tour->start = Tour::toGermanDate($tour->start);
|
private function fetch_rooms($tour_id)
|
||||||
$tour->deadline = Tour::toGermanDate($tour->deadline);
|
{
|
||||||
return view('tour.show')
|
// - all existing rooms with booked users (if any)
|
||||||
->with('tour', $tour)
|
// - all users without room
|
||||||
->with('users', $users)
|
$sql = "
|
||||||
->with('creator', $creator)
|
|
||||||
->with('rooms', $rooms);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*
|
|
||||||
* @param \App\Tour $tour
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
|
|
||||||
private function fetch_rooms($tour_id) {
|
|
||||||
// - all existing rooms with booked users (if any)
|
|
||||||
// - all users without room
|
|
||||||
$sql="
|
|
||||||
SELECT
|
SELECT
|
||||||
qry.tour_id,
|
qry.tour_id,
|
||||||
qry.room_id,
|
qry.room_id,
|
||||||
|
|
@ -162,7 +163,7 @@ class TourController extends Controller
|
||||||
qry.free_slots,
|
qry.free_slots,
|
||||||
|
|
||||||
COALESCE(qry.room_name,'Ungebucht') as room_name,
|
COALESCE(qry.room_name,'Ungebucht') as room_name,
|
||||||
COALESCE(qry.room_name,'ZZZZZZZZZ') as room_sort_order
|
COALESCE(qry.room_id,'ZZZZZZZZZ') as room_sort_order
|
||||||
FROM
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -173,15 +174,16 @@ class TourController extends Controller
|
||||||
b.user_id,
|
b.user_id,
|
||||||
(SELECT tr.capacity - count(*) from bookings where tour_id=tr.tour_id and room_id=tr.id) as free_slots
|
(SELECT tr.capacity - count(*) from bookings where tour_id=tr.tour_id and room_id=tr.id) as free_slots
|
||||||
FROM
|
FROM
|
||||||
tour_rooms tr
|
tour_rooms tr LEFT JOIN bookings as b
|
||||||
LEFT JOIN bookings as b
|
ON b.tour_id = tr.tour_id AND b.room_id = tr.id
|
||||||
ON b.tour_id = tr.tour_id AND b.room_id = tr.id
|
|
||||||
WHERE
|
WHERE
|
||||||
tr.tour_id= ".$tour_id."
|
tr.tour_id= " . $tour_id . "
|
||||||
|
|
||||||
) qry
|
) qry
|
||||||
LEFT JOIN users as u
|
LEFT JOIN users as u
|
||||||
ON qry.user_id = u.id
|
ON qry.user_id = u.id
|
||||||
|
|
||||||
|
|
||||||
UNION
|
UNION
|
||||||
|
|
||||||
-- unbooked tour users
|
-- unbooked tour users
|
||||||
|
|
@ -200,154 +202,183 @@ class TourController extends Controller
|
||||||
LEFT JOIN tour_rooms as tr
|
LEFT JOIN tour_rooms as tr
|
||||||
ON b.room_id = tr.id
|
ON b.room_id = tr.id
|
||||||
WHERE
|
WHERE
|
||||||
b.tour_id= ".$tour_id."
|
b.tour_id= " . $tour_id . "
|
||||||
AND
|
AND
|
||||||
b.user_id = u.id
|
b.user_id = u.id
|
||||||
AND
|
AND
|
||||||
capacity is null
|
capacity is null
|
||||||
ORDER BY room_name, user_name
|
ORDER BY room_sort_order, user_name
|
||||||
;
|
;
|
||||||
";
|
";
|
||||||
|
|
||||||
$rooms=DB::select($sql);
|
$rooms = DB::select($sql);
|
||||||
|
|
||||||
Log::info("TourController.fetch_rooms, returning rooms result:");
|
//Log::info("TourController.fetch_rooms, returning rooms result:");
|
||||||
Log::info($rooms);
|
//Log::info($rooms);
|
||||||
|
|
||||||
return($rooms);
|
return ($rooms);
|
||||||
}
|
|
||||||
|
|
||||||
public function edit(Tour $tour)
|
|
||||||
{
|
|
||||||
error_log("Tour:edit");
|
|
||||||
if ($tour->start<Carbon::now()) {
|
|
||||||
return view('tour.edit_old')->with('tour', $tour);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tour->start = Tour::toGermanDate($tour->start);
|
public function edit(Tour $tour)
|
||||||
$tour->deadline = Tour::toGermanDate($tour->deadline);
|
{
|
||||||
|
if (Auth::user()->role != 'ADMIN') {
|
||||||
$rooms = $this->fetch_rooms($tour->id);
|
return redirect('/tour');
|
||||||
|
|
||||||
return view('tour.edit')
|
|
||||||
->with('tour', $tour)
|
|
||||||
->with('rooms', $rooms);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param \App\Tour $tour
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function update(Request $request, Tour $tour)
|
|
||||||
{
|
|
||||||
|
|
||||||
error_log("Tour:update");
|
|
||||||
$tour=Tour::find($request->input('tour_id'));
|
|
||||||
|
|
||||||
$request->validate(
|
|
||||||
[
|
|
||||||
'tour_id' => 'required',
|
|
||||||
'name'=>'required|min:3',
|
|
||||||
'user_id'=>'required',
|
|
||||||
'bild'=>'mimes:jpg,jpeg,bmp,png,gif'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($request->bild){
|
|
||||||
$bild = Image::make($request->bild);
|
|
||||||
$breite = $bild->width();
|
|
||||||
$hoehe = $bild->height();
|
|
||||||
if ($breite>$hoehe) {
|
|
||||||
Image::make($request->bild)
|
|
||||||
->widen(1200)
|
|
||||||
->save(public_path().'/img/tour/'.$tour->id.'_gross.jpg');
|
|
||||||
Image::make($request->bild)
|
|
||||||
->widen(64)
|
|
||||||
->save(public_path().'/img/tour/'.$tour->id.'.jpg');
|
|
||||||
}else {
|
|
||||||
Image::make($request->bild)
|
|
||||||
->heighten(900)
|
|
||||||
->save(public_path().'/img/tour/'.$tour->id.'_gross.jpg');
|
|
||||||
Image::make($request->bild)
|
|
||||||
->widen(96)
|
|
||||||
->save(public_path().'/img/tour/'.$tour->id.'.jpg');
|
|
||||||
}
|
}
|
||||||
|
error_log("Tour:edit");
|
||||||
|
if ($tour->start < Carbon::now()) {
|
||||||
|
return view('tour.edit_old')->with('tour', $tour);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tour->start = Tour::toGermanDate($tour->start);
|
||||||
|
$tour->deadline = Tour::toGermanDate($tour->deadline);
|
||||||
|
|
||||||
|
$rooms = $this->fetch_rooms($tour->id);
|
||||||
|
|
||||||
|
|
||||||
|
return view('tour.edit')
|
||||||
|
->with('tour', $tour)
|
||||||
|
->with('rooms', $rooms);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tour->name=$request->input('name');
|
/**
|
||||||
if ($request->beschreibung) $tour->beschreibung=$request->input('beschreibung');
|
* Update the specified resource in storage.
|
||||||
if ($request->start) $tour->start=Tour::toDBDate($request->input('start'));
|
*
|
||||||
if ($request->deadline) $tour->deadline=Tour::toDBDate($request->input('deadline'));
|
* @param \Illuminate\Http\Request $request
|
||||||
if ($request->max_participants) $tour->max_participants=$request->input('max_participants');
|
* @param \App\Tour $tour
|
||||||
$tour->is_cancelled= ($request->has('is_cancelled'));
|
* @return \Illuminate\Http\Response
|
||||||
if ($request->bericht) $tour->bericht=$request->bericht;
|
*/
|
||||||
$tour->save();
|
public function update(Request $request, Tour $tour)
|
||||||
|
{
|
||||||
|
|
||||||
|
error_log("Tour:update");
|
||||||
|
$tour = Tour::find($request->input('tour_id'));
|
||||||
|
|
||||||
|
$request->validate(
|
||||||
|
[
|
||||||
|
'tour_id' => 'required',
|
||||||
|
'name' => 'required|min:3',
|
||||||
|
'user_id' => 'required',
|
||||||
|
'bild' => 'mimes:jpg,jpeg,bmp,png,gif'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($request->bild) {
|
||||||
|
$bild = Image::make($request->bild);
|
||||||
|
$breite = $bild->width();
|
||||||
|
$hoehe = $bild->height();
|
||||||
|
if ($breite > $hoehe) {
|
||||||
|
Image::make($request->bild)
|
||||||
|
->widen(1200)
|
||||||
|
->save(public_path() . '/img/tour/' . $tour->id . '_gross.jpg');
|
||||||
|
Image::make($request->bild)
|
||||||
|
->widen(64)
|
||||||
|
->save(public_path() . '/img/tour/' . $tour->id . '.jpg');
|
||||||
|
} else {
|
||||||
|
Image::make($request->bild)
|
||||||
|
->heighten(900)
|
||||||
|
->save(public_path() . '/img/tour/' . $tour->id . '_gross.jpg');
|
||||||
|
Image::make($request->bild)
|
||||||
|
->widen(96)
|
||||||
|
->save(public_path() . '/img/tour/' . $tour->id . '.jpg');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$tour->name = $request->input('name');
|
||||||
|
if ($request->beschreibung) $tour->beschreibung = $request->input('beschreibung');
|
||||||
|
if ($request->start) $tour->start = Tour::toDBDate($request->input('start'));
|
||||||
|
if ($request->deadline) $tour->deadline = Tour::toDBDate($request->input('deadline'));
|
||||||
|
if ($request->max_participants) $tour->max_participants = $request->input('max_participants');
|
||||||
|
$tour->is_cancelled = ($request->has('is_cancelled'));
|
||||||
|
if ($request->bericht) $tour->bericht = $request->bericht;
|
||||||
|
$tour->save();
|
||||||
|
|
||||||
|
|
||||||
error_log("Is cancelled:". $tour->is_cancelled);
|
error_log("Is cancelled:" . $tour->is_cancelled);
|
||||||
|
|
||||||
return redirect('/tour');
|
return redirect('/tour');
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
public function create_room($tour_id, $capacity) {
|
|
||||||
DB::delete("INSERT INTO booking_rooms")
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function upload_gallery(Request $request, Tour $tour){
|
|
||||||
dd($request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*
|
|
||||||
* @param \App\Tour $tour
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function destroy(Tour $tour)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
public function join_room($tour_id,$room_id) {
|
|
||||||
Log::info("TourController::join_room");
|
|
||||||
$user=Auth::user();
|
|
||||||
Tour::join_room($tour_id,$user->id, $room_id);
|
|
||||||
return redirect('/tour/'.$tour_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cancelBooking($tour_id) {
|
|
||||||
$user=Auth::user();
|
|
||||||
Booking::where('tour_id', $tour_id)->where('user_id', $user->id)->delete();
|
|
||||||
return redirect('/tour');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cancelBookingAdmin($tour_id, $user_id) {
|
|
||||||
$user=Auth::user();
|
|
||||||
if (Auth::user()->role == "ADMIN") {
|
|
||||||
Booking::where('tour_id', $tour_id)->where('user_id', $user_id)->delete();
|
|
||||||
}
|
}
|
||||||
return redirect('/tour/'.$tour_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function create_room($tour_id,$capacity) {
|
/*
|
||||||
Log::info("create_room Controller started");
|
public function create_room($tour_id, $capacity) {
|
||||||
$user=Auth::user();
|
DB::delete("INSERT INTO booking_rooms")
|
||||||
Tour::create_room($tour_id,$capacity);
|
}
|
||||||
return redirect('tour/'.$tour_id.'/edit');
|
*/
|
||||||
}
|
|
||||||
public function delete_room($tour_id,$room_id) {
|
|
||||||
Log::info("create_room Controller started");
|
|
||||||
$user=Auth::user();
|
|
||||||
|
|
||||||
Booking::where('tour_id', $tour_id)->where('room_id', $room_id)->delete();
|
public function upload_gallery(Request $request, Tour $tour)
|
||||||
DB::delete("DELETE FROM tour_rooms WHERE tour_id = ? AND id = ?",[$tour_id, $room_id]);
|
{
|
||||||
return redirect('tour/'.$tour_id.'/edit');
|
dd($request);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\Tour $tour
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy(Tour $tour)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
public function join_room($tour_id, $room_id)
|
||||||
|
{
|
||||||
|
Log::info("TourController::join_room");
|
||||||
|
$user_id = Auth::user()->id;
|
||||||
|
Tour::join_room($tour_id, $user_id, $room_id);
|
||||||
|
return redirect('/tour/' . $tour_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function join_room4user($tour_id, $room_id, $user_id)
|
||||||
|
{
|
||||||
|
Log::info("TourController::join_room");
|
||||||
|
Tour::join_room($tour_id, $user_id, $room_id);
|
||||||
|
|
||||||
|
$tour = Tour::find($tour_id);
|
||||||
|
$tour->start = Tour::toGermanDate($tour->start);
|
||||||
|
$tour->deadline = Tour::toGermanDate($tour->deadline);
|
||||||
|
|
||||||
|
$rooms = $this->fetch_rooms($tour->id);
|
||||||
|
|
||||||
|
return view('tour.edit')
|
||||||
|
->with('tour', $tour)
|
||||||
|
->with('rooms', $rooms);
|
||||||
|
|
||||||
|
return redirect('/tour/' . $tour_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cancelBooking($tour_id)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
Booking::where('tour_id', $tour_id)->where('user_id', $user->id)->delete();
|
||||||
|
return redirect('/tour');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cancelBookingAdmin($tour_id, $user_id)
|
||||||
|
{
|
||||||
|
$user = Auth::user();
|
||||||
|
if (Auth::user()->role == "ADMIN") {
|
||||||
|
Booking::where('tour_id', $tour_id)->where('user_id', $user_id)->delete();
|
||||||
|
}
|
||||||
|
return redirect('/tour/' . $tour_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create_room($tour_id, $capacity)
|
||||||
|
{
|
||||||
|
Log::info("create_room Controller started");
|
||||||
|
$user = Auth::user();
|
||||||
|
Tour::create_room($tour_id, $capacity);
|
||||||
|
return redirect('tour/' . $tour_id . '/edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete_room($tour_id, $room_id)
|
||||||
|
{
|
||||||
|
Log::info("create_room Controller started");
|
||||||
|
$user = Auth::user();
|
||||||
|
|
||||||
|
DB::update("UPDATE bookings SET room_id=0 WHERE room_id=" . $room_id);
|
||||||
|
DB::delete("DELETE FROM tour_rooms WHERE tour_id = ? AND id = ?", [$tour_id, $room_id]);
|
||||||
|
return redirect('tour/' . $tour_id . '/edit');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,144 +1,164 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\User;
|
use App\User;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Log;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Intervention\Image\Facades\Image;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Log;
|
||||||
|
use Intervention\Image\Facades\Image;
|
||||||
|
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Display a listing of the resource.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function index()
|
|
||||||
{
|
{
|
||||||
$users=User::all();
|
/**
|
||||||
return view('users.index')->with('users',$users);
|
* Display a listing of the resource.
|
||||||
}
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
/**
|
*/
|
||||||
* Show the form for creating a new resource.
|
public function index()
|
||||||
*
|
{
|
||||||
* @return \Illuminate\Http\Response
|
$users = User::all();
|
||||||
*/
|
return view('users.index')->with('users', $users);
|
||||||
public function create()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a newly created resource in storage.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
* /
|
|
||||||
public function store(Request $request)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Display the specified resource.
|
|
||||||
*
|
|
||||||
* @param \App\User $user
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function show($id)
|
|
||||||
{
|
|
||||||
//Log("show user id=".$id);
|
|
||||||
error_log("(show)=>".$id);
|
|
||||||
|
|
||||||
$user=User::find($id);
|
|
||||||
|
|
||||||
|
|
||||||
return view('users.show')->with('user',$user);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the form for editing the specified resource.
|
|
||||||
*
|
|
||||||
* @param \App\User $user
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function edit($id)
|
|
||||||
{
|
|
||||||
error_log("Edit:".$id);
|
|
||||||
$user=User::find($id);
|
|
||||||
|
|
||||||
error_log($user);
|
|
||||||
return view('users.edit')->with('user',$user);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the specified resource in storage.
|
|
||||||
*
|
|
||||||
* @param \Illuminate\Http\Request $request
|
|
||||||
* @param \App\User $user
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function update(Request $request, User $user)
|
|
||||||
{
|
|
||||||
$user=User::find($request->input('id'));
|
|
||||||
|
|
||||||
$request->validate(
|
|
||||||
[
|
|
||||||
'name'=>'required|min:3',
|
|
||||||
'email'=>'required|email',
|
|
||||||
'role'=>'required',
|
|
||||||
'mobile'=>'required',
|
|
||||||
'bild'=>'mimes:jpg,jpeg,bmp,png,gif'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($request->bild){
|
|
||||||
$bild = Image::make($request->bild);
|
|
||||||
$breite = $bild->width();
|
|
||||||
$hoehe = $bild->height();
|
|
||||||
if ($breite>$hoehe) {
|
|
||||||
Image::make($request->bild)
|
|
||||||
->widen(1200)
|
|
||||||
->save(storage_path().'/img_storage/user/'.$user->id.'_gross.jpg');
|
|
||||||
Image::make($request->bild)
|
|
||||||
->widen(64)
|
|
||||||
->save(storage_path().'/img_storage/user/'.$user->id.'.jpg');
|
|
||||||
}else {
|
|
||||||
Image::make($request->bild)
|
|
||||||
->heighten(900)
|
|
||||||
->save(storage_path().'/img_storage/user/'.$user->id.'_gross.jpg');
|
|
||||||
Image::make($request->bild)
|
|
||||||
->widen(96)
|
|
||||||
->save(storage_path().'/img_storage/user/'.$user->id.'.jpg');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->name=$request->input('name');
|
/**
|
||||||
$user->email=$request->input('email');
|
* Show the form for creating a new resource.
|
||||||
$user->role=$request->input('role');
|
*
|
||||||
$user->mobile=$request->input('mobile');
|
* @return \Illuminate\Http\Response
|
||||||
$user->save();
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
error_log("User role: ".$user->role);
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\User $user
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
* /
|
||||||
|
* public function store(Request $request)
|
||||||
|
* {
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* /**
|
||||||
|
* Display the specified resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
//Log("show user id=".$id);
|
||||||
|
error_log("(show)=>" . $id);
|
||||||
|
|
||||||
|
$user = User::find($id);
|
||||||
|
|
||||||
|
|
||||||
|
return view('users.show')->with('user', $user);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
*
|
||||||
|
* @param \App\User $user
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
|
||||||
|
error_log("Edit:" . $id);
|
||||||
|
$user = User::find($id);
|
||||||
|
|
||||||
|
if (Auth::user()->role != 'ADMIN' && $user->id != Auth::user()->id) {
|
||||||
|
return redirect('/users');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
error_log($user);
|
||||||
|
return view('users.edit')->with('user', $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @param \App\User $user
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request, User $user)
|
||||||
|
{
|
||||||
|
$user = User::find($request->input('id'));
|
||||||
|
|
||||||
|
$request->validate(
|
||||||
|
[
|
||||||
|
'name' => 'required|min:3',
|
||||||
|
'email' => 'required|email',
|
||||||
|
'role' => 'required',
|
||||||
|
'mobile' => 'required',
|
||||||
|
'bild' => 'mimes:jpg,jpeg,bmp,png,gif'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($request->bild) {
|
||||||
|
$bild = Image::make($request->bild);
|
||||||
|
$breite = $bild->width();
|
||||||
|
$hoehe = $bild->height();
|
||||||
|
if ($breite > $hoehe) {
|
||||||
|
Image::make($request->bild)
|
||||||
|
->widen(1200)
|
||||||
|
->save(storage_path() . '/img_storage/user/' . $user->id . '_gross.jpg');
|
||||||
|
Image::make($request->bild)
|
||||||
|
->widen(64)
|
||||||
|
->save(storage_path() . '/img_storage/user/' . $user->id . '.jpg');
|
||||||
|
} else {
|
||||||
|
Image::make($request->bild)
|
||||||
|
->heighten(900)
|
||||||
|
->save(storage_path() . '/img_storage/user/' . $user->id . '_gross.jpg');
|
||||||
|
Image::make($request->bild)
|
||||||
|
->widen(96)
|
||||||
|
->save(storage_path() . '/img_storage/user/' . $user->id . '.jpg');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$user->name = $request->input('name');
|
||||||
|
$user->email = $request->input('email');
|
||||||
|
$user->role = $request->input('role');
|
||||||
|
$user->mobile = $request->input('mobile');
|
||||||
|
$user->save();
|
||||||
|
|
||||||
|
error_log("User role: " . $user->role);
|
||||||
|
|
||||||
|
return redirect('/member/');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
*
|
||||||
|
* @param \App\User $user
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function destroy($user_id)
|
||||||
|
{
|
||||||
|
$user = User::find($user_id);
|
||||||
|
Log::info("UserController::destroy for user_id " . $user->id);
|
||||||
|
|
||||||
|
Log::info("Preparing to destroy user [" . $user->id . "]" . $user->name);
|
||||||
|
Log::info("#DESTROY_USER [users]" . $user);
|
||||||
|
|
||||||
|
$tours = DB::select("SELECT id FROM tours WHERE user_id=" . $user_id);
|
||||||
|
Log::info('#DESTROY_USER [affected tour ids]', $tours);
|
||||||
|
$bookings = DB::select("SELECT id FROM bookings WHERE user_id=" . $user_id);
|
||||||
|
Log::info("#DESTROY_USER [affected booking ids]", $bookings);
|
||||||
|
|
||||||
|
DB::delete('DELETE FROM users WHERE id=' . $user->id);
|
||||||
|
|
||||||
|
return redirect('/member/');
|
||||||
|
}
|
||||||
|
|
||||||
return redirect('/member/');
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the specified resource from storage.
|
|
||||||
*
|
|
||||||
* @param \App\User $user
|
|
||||||
* @return \Illuminate\Http\Response
|
|
||||||
*/
|
|
||||||
public function destroy(User $user)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,88 +1,107 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Log;
|
use Log;
|
||||||
|
|
||||||
class Tour extends Model
|
class Tour extends Model
|
||||||
{
|
|
||||||
protected $fillable = [
|
|
||||||
'id', 'name', 'beschreibung','user_id','start','deadline','is_cancelled', 'status'
|
|
||||||
];
|
|
||||||
|
|
||||||
public static function getBookings($tour_id) {
|
|
||||||
error_log("getBookings for tour_id: ".$tour_id);
|
|
||||||
$bookings=Booking::where('tour_id',$tour_id)->get();
|
|
||||||
return $bookings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function has_participant($tour_id, $user_id) {
|
|
||||||
$booking=Booking::where('tour_id', $tour_id)->where('user_id',$user_id)->first();
|
|
||||||
|
|
||||||
if($booking) return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// new join with room parameter
|
|
||||||
public static function join_room($tour_id, $user_id, $room_id) {
|
|
||||||
Log::info("Tour::join_room, tour_id=".$tour_id.", user_id=".$user_id.", room_id=".$room_id);
|
|
||||||
$booking = Booking::firstOrCreate(
|
|
||||||
['tour_id' => $tour_id, 'user_id' => $user_id], // Retrieve if existing
|
|
||||||
['tour_id' => $tour_id, 'user_id' => $user_id, 'room_id' => $room_id,
|
|
||||||
'created_at' => Carbon::now(), 'updated_at' => Carbon::now() ] // or create new
|
|
||||||
);
|
|
||||||
$booking->room_id=$room_id;
|
|
||||||
$booking->save();
|
|
||||||
//Log::info($booking);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function cancel($tour_id, $user_id) {
|
|
||||||
Booking::where('tour_id',$tour_id)->where('user_id',$user_id)->delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function is_over($tour_id) {
|
|
||||||
$tour = Tour::find($tour_id);
|
|
||||||
if ($tour->start < Carbon::now()) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function create_room($tour_id,$capacity) {
|
|
||||||
$tour = Tour::find($tour_id);
|
|
||||||
$name="Einzelzimmer";
|
|
||||||
if ($capacity!=1) { $name="Doppelzimmer";}
|
|
||||||
$sql="INSERT INTO tour_rooms (name,tour_id,capacity,created_at,updated_at) VALUES ('".$name."',".$tour_id.",".$capacity.",now(),now());";
|
|
||||||
DB::insert($sql);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function toGermanDate($engDate)
|
|
||||||
{
|
{
|
||||||
error_log("to german Date:");
|
protected $fillable = [
|
||||||
error_log($engDate);
|
'id', 'name', 'beschreibung', 'user_id', 'start', 'deadline', 'is_cancelled', 'status', 'bericht', 'max_participants'
|
||||||
$values = explode("-", $engDate);
|
];
|
||||||
$year = $values[0];
|
|
||||||
$month = $values[1];
|
|
||||||
$day = $values[2];
|
|
||||||
|
|
||||||
return $day.".".$month.".".$year;
|
public static function getBookings($tour_id)
|
||||||
|
{
|
||||||
|
error_log("getBookings for tour_id: " . $tour_id);
|
||||||
|
$bookings = Booking::where('tour_id', $tour_id)->get();
|
||||||
|
return $bookings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function has_participant($tour_id, $user_id)
|
||||||
|
{
|
||||||
|
$booking = Booking::where('tour_id', $tour_id)->where('user_id', $user_id)->first();
|
||||||
|
if ($booking) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function has_space($tour_id)
|
||||||
|
{
|
||||||
|
//$tour = Tour::where("id", $tour_id)->get();
|
||||||
|
//Log::info($tour[0]);
|
||||||
|
$tour = Tour::find($tour_id);
|
||||||
|
//Log::info($tour);
|
||||||
|
|
||||||
|
$bookings = Booking::where('tour_id', $tour_id)->get();
|
||||||
|
if (count($bookings) >= $tour->max_participants) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// new join with room parameter
|
||||||
|
public static function join_room($tour_id, $user_id, $room_id)
|
||||||
|
{
|
||||||
|
Log::info("Tour::join_room, tour_id=" . $tour_id . ", user_id=" . $user_id . ", room_id=" . $room_id);
|
||||||
|
$booking = Booking::firstOrCreate(
|
||||||
|
['tour_id' => $tour_id, 'user_id' => $user_id], // Retrieve if existing
|
||||||
|
['tour_id' => $tour_id, 'user_id' => $user_id, 'room_id' => $room_id,
|
||||||
|
'created_at' => Carbon::now(), 'updated_at' => Carbon::now()] // or create new
|
||||||
|
);
|
||||||
|
$booking->room_id = $room_id;
|
||||||
|
$booking->save();
|
||||||
|
//Log::info($booking);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function cancel($tour_id, $user_id)
|
||||||
|
{
|
||||||
|
Booking::where('tour_id', $tour_id)->where('user_id', $user_id)->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function is_over($tour_id)
|
||||||
|
{
|
||||||
|
$tour = Tour::find($tour_id);
|
||||||
|
if ($tour->start < Carbon::now()) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create_room($tour_id, $capacity)
|
||||||
|
{
|
||||||
|
$tour = Tour::find($tour_id);
|
||||||
|
$name = "Einzelzimmer";
|
||||||
|
if ($capacity != 1) {
|
||||||
|
$name = "Doppelzimmer";
|
||||||
|
}
|
||||||
|
$sql = "INSERT INTO tour_rooms (name,tour_id,capacity,created_at,updated_at) VALUES ('" . $name . "'," . $tour_id . "," . $capacity . ",now(),now());";
|
||||||
|
DB::insert($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function toGermanDate($engDate)
|
||||||
|
{
|
||||||
|
error_log("to german Date:");
|
||||||
|
error_log($engDate);
|
||||||
|
$values = explode("-", $engDate);
|
||||||
|
$year = $values[0];
|
||||||
|
$month = $values[1];
|
||||||
|
$day = $values[2];
|
||||||
|
|
||||||
|
return $day . "." . $month . "." . $year;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function toDBDate($deDate)
|
||||||
|
{
|
||||||
|
if (!$deDate) return "";
|
||||||
|
|
||||||
|
$values = explode(" ", $deDate);
|
||||||
|
|
||||||
|
$year = explode(".", $values[0])[2];
|
||||||
|
$month = explode(".", $values[0])[1];
|
||||||
|
$day = explode(".", $values[0])[0];
|
||||||
|
|
||||||
|
$dbDate = $year . "-" . $month . "-" . $day;
|
||||||
|
//Log::info("deDate=".$deDate." converted to:".$dbDate);
|
||||||
|
|
||||||
|
return $dbDate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function toDBDate($deDate)
|
|
||||||
{
|
|
||||||
if (!$deDate) return "";
|
|
||||||
|
|
||||||
$values = explode(" ", $deDate);
|
|
||||||
|
|
||||||
$year = explode(".",$values[0])[2];
|
|
||||||
$month = explode(".",$values[0])[1];
|
|
||||||
$day = explode(".", $values[0])[0];
|
|
||||||
|
|
||||||
$dbDate=$year . "-" . $month . "-" . $day;
|
|
||||||
//Log::info("deDate=".$deDate." converted to:".$dbDate);
|
|
||||||
|
|
||||||
return $dbDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,47 +1,48 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use Notifiable;
|
use Notifiable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name', 'email', 'password',
|
'name', 'email', 'password','mobile'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be hidden for arrays.
|
* The attributes that should be hidden for arrays.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'password', 'remember_token',
|
'password', 'remember_token',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be cast to native types.
|
* The attributes that should be cast to native types.
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'email_verified_at' => 'datetime',
|
'email_verified_at' => 'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function has_tour($tour_id, $user_id) {
|
public static function has_tour($tour_id, $user_id)
|
||||||
$tour=Tour::find($tour_id);
|
{
|
||||||
$user=User::first($user_id);
|
// $tour=Tour::find($tour_id);
|
||||||
$booking=Booking::where('tour_id', $tour_id)->where('user_id', $user_id);
|
// $user=User::first($user_id);
|
||||||
if ($booking) return true;
|
$booking = Booking::where('tour_id', $tour_id)->where('user_id', $user_id);
|
||||||
return false;
|
if ($booking) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label for="email" class="col-md-4 col-form-label text-md-right">Telefonnummer</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="mobile" type="text" class="form-control @error('mobile') is-invalid @enderror" name="mobile" value="{{ old('mobile') }}" required autocomplete="mobile">
|
||||||
|
|
||||||
|
@error('email')
|
||||||
|
<span class="invalid-feedback" role="alert">
|
||||||
|
<strong>{{ $message }}</strong>
|
||||||
|
</span>
|
||||||
|
@enderror
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="password" class="col-md-4 col-form-label text-md-right">Passwort</label>
|
<label for="password" class="col-md-4 col-form-label text-md-right">Passwort</label>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
|
<form style="background-color: #fff;" class="text-dark" method="post"
|
||||||
<form style="background-color: #fff;" class="text-dark" method="post" action="/tour/{{$tour->id}}" enctype="multipart/form-data">
|
action="/tour/{{$tour->id}}" enctype="multipart/form-data">
|
||||||
|
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
|
|
@ -24,134 +24,284 @@
|
||||||
|
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<!-- label class="ml-2 mt-4 col-form-label col-form-label-sm" style="width:150px; text-align:left;" for="name"><h4>Name:</h4></label> -->
|
<!-- label class="ml-2 mt-4 col-form-label col-form-label-sm" style="width:150px; text-align:left;" for="name"><h4>Name:</h4></label> -->
|
||||||
<label class="ml-2 mt-3 col-form-label col-form-label-sm" style="width:180px; text-align:left;font-size:18px;" for="name">Name:</label>
|
<label class="ml-2 mt-3 col-form-label col-form-label-sm"
|
||||||
<input class="mt-3 mr-2 form-control input-sm" type="text" id="name" name="name" value="{{ old('name') ?? $tour->name }}" required >
|
style="width:180px; text-align:left;font-size:18px;" for="name">Name:</label>
|
||||||
|
<input class="mt-3 mr-2 form-control input-sm" type="text" id="name" name="name"
|
||||||
|
value="{{ old('name') ?? $tour->name }}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-3" style="width:180px; text-align:left;font-size:18px;" for="name">Start:</label>
|
<label class="ml-2 mt-3" style="width:180px; text-align:left;font-size:18px;"
|
||||||
<input class="mt-3 mr-2 form-control input-sm" type="text" id="start" name="start" value="{{ $tour->start }}" required >
|
for="name">Start:</label>
|
||||||
|
<input class="mt-3 mr-2 form-control input-sm" type="text" id="start" name="start"
|
||||||
|
value="{{ $tour->start }}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-4" style="width:180px; text-align:left;font-size:18px;" for="deadline">Anmeldeschluss:</label>
|
<label class="ml-2 mt-4" style="width:180px; text-align:left;font-size:18px;"
|
||||||
<input class="mt-3 mr-2 form-control" type="text" id="deadline" style="font-size:16px;" name="deadline" value="{{ old('deadline') ?? $tour->deadline }}" required >
|
for="deadline">Anmeldeschluss:</label>
|
||||||
|
<input class="mt-3 mr-2 form-control" type="text" id="deadline" style="font-size:16px;"
|
||||||
|
name="deadline" value="{{ old('deadline') ?? $tour->deadline }}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-4" style="width:180px; text-align:left;font-size:18px;" for="name">Max Teilnehmer:</label>
|
<label class="ml-2 mt-4" style="width:180px; text-align:left;font-size:18px;"
|
||||||
<input class="mt-3 mr-2 form-control" type="text" id="max_participants" style="font-size:16px;" name="max_participants" value="{{ old('max_participants') ?? $tour->max_participants }}" required >
|
for="name">Max Teilnehmer:</label>
|
||||||
|
<input class="mt-3 mr-2 form-control" type="text" id="max_participants"
|
||||||
|
style="font-size:16px;" name="max_participants" type="number" min="1" max="99"
|
||||||
|
value="{{ old('max_participants') ?? $tour->max_participants }}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="bild" ><h4>Bild:</h4></label>
|
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="bild"><h4>Bild:</h4>
|
||||||
|
</label>
|
||||||
|
|
||||||
@if(file_exists (public_path ('img/tour/'.$tour->id.'.jpg')))
|
@if(file_exists (public_path ('img/tour/'.$tour->id.'.jpg')))
|
||||||
<!--File exists -->
|
<!--File exists -->
|
||||||
<a href="/img/tour/{{$tour->id}}_gross.jpg" data-lightbox="{{$tour->id}}_gross.jpg" data-title="{{ $tour->name }}">
|
<a href="/img/tour/{{$tour->id}}_gross.jpg" data-lightbox="{{$tour->id}}_gross.jpg"
|
||||||
<img src="/img/tour/{{$tour->id}}.jpg" class="mt-3 ml-3" >
|
data-title="{{ $tour->name }}">
|
||||||
|
<img src="/img/tour/{{$tour->id}}.jpg" class="mt-3 ml-3">
|
||||||
</a>
|
</a>
|
||||||
@else
|
@else
|
||||||
<img src="/img/placeholder/tour128x100.jpg" class="mt-3 ml-3" >
|
<img src="/img/placeholder/tour128x100.jpg" class="mt-3 ml-3">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<input type="file" class="mt-3 mr-2 form-control" id="bild" style="font-size:20px;" name="bild" value="" >
|
<input type="file" class="mt-3 mr-2 form-control" id="bild" style="font-size:20px;"
|
||||||
|
name="bild" value="">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-3" style="width:140px; text-align:left;font-size:18px;" for="is_cancelled">Storniert:</label>
|
<label class="ml-2 mt-3" style="width:140px; text-align:left;font-size:18px;"
|
||||||
<input class="mt-3 mr-2 form-control" type="checkbox" id="is_cancelled" style="font-size:10px;width:20px;" name="is_cancelled"
|
for="is_cancelled">Storniert:</label>
|
||||||
@if($tour->is_cancelled)
|
<input class="mt-3 mr-2 form-control" type="checkbox" id="is_cancelled"
|
||||||
checked
|
style="font-size:10px;width:20px;" name="is_cancelled"
|
||||||
|
@if($tour->is_cancelled)
|
||||||
|
checked
|
||||||
@endif
|
@endif
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<textarea class="col-12" name="beschreibung" rows="10" cols="50" >{{ $tour->beschreibung }}
|
<textarea class="col-12" name="beschreibung" rows="10" cols="50">{{ $tour->beschreibung }}
|
||||||
</textarea>
|
</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<a href="/tour/{{$tour->id}}"><div type="submit" class="btn btn-success col-2 mb-2 float-right mr-2">Abbrechen</div></a>
|
<a href="/tour/{{$tour->id}}">
|
||||||
|
<div type="submit" class="btn btn-success col-2 mb-2 float-right mr-2">Abbrechen</div>
|
||||||
|
</a>
|
||||||
<button type="submit" class="btn btn-danger col-2 mb-2 float-right mr-2">Speichern</button>
|
<button type="submit" class="btn btn-danger col-2 mb-2 float-right mr-2">Speichern</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-3 mt-2">
|
<!-- Modal Anzeige start -->
|
||||||
<div class="card mt-4">
|
|
||||||
<div class="card-header"><h5>Teilnehmer</h5></div>
|
|
||||||
|
|
||||||
<div class="card-body">
|
<!-- The Modal -->
|
||||||
<p>
|
<div id="myModal" class="modal">
|
||||||
<!-- Intentional Assignment ! -->
|
|
||||||
@if ($room_id="") @endif
|
|
||||||
@foreach($rooms as $room)
|
|
||||||
@if ($room_id != $room->room_id)
|
|
||||||
@if(strlen($room_id))
|
|
||||||
<hr/>
|
|
||||||
@endif
|
|
||||||
<p><b>[{{$room->room_id}}] {{$room->room_name}}</b>
|
|
||||||
@if($room->room_id>0) <!-- Delete link only for real room ids -->
|
|
||||||
<a class="text-primary ts_tooltip" href="/tour/{{$tour->id}}/delete_room/{{$room->room_id}}">
|
|
||||||
(X) <span class="ts_tooltiptext">Raum Löschen</span>
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
<!-- Modal content -->
|
||||||
|
<div class="modal-content">
|
||||||
|
<span class="close">×</span>
|
||||||
|
<h2>Bitte Zimmer auswählen</h2>
|
||||||
|
<!-- Teilnehmer+Raum Anzeige/Auswahl: Nur buchbare -->
|
||||||
|
<div class="card-body">
|
||||||
|
<ul>
|
||||||
<!-- Intentional Assignment ! -->
|
<!-- Intentional Assignment ! -->
|
||||||
@if ($room_id=$room->room_id) @endif
|
@if ($room_id="") @endif
|
||||||
@endif
|
@foreach($rooms as $room)
|
||||||
|
@if( $room->room_id != 0 and $room->free_slots >0)
|
||||||
|
<!-- Dont show "Ungebucht", room_id=0 and only with available slots -->
|
||||||
|
@if ($room_id != $room->room_id)
|
||||||
|
@if(strlen($room_id))
|
||||||
|
<hr/>
|
||||||
|
@endif
|
||||||
|
<p style="list-style-type: none;">[{{$room->room_id}}]
|
||||||
|
<span>{{$room->room_name}}
|
||||||
|
</span><b><a id="booking_link"
|
||||||
|
href="/tour/{{$tour->id}}/join4user/{{$room->room_id}}/#USER_ID">
|
||||||
|
==> Buchen</a></b>
|
||||||
|
</p>
|
||||||
|
|
||||||
@if(strlen($room->user_name))
|
<!-- Intentional Assignment ! -->
|
||||||
<li style="list-style:none"> {{ $room->user_name}}
|
@if ($room_id=$room->room_id) @endif
|
||||||
@if(Auth::user()->role=="ADMIN")
|
@endif
|
||||||
<a href="/tour/{{$tour->id}}/cancelBookingAdmin/{{$room->user_id}}" class="text-primary ts_tooltip">
|
|
||||||
<span class="ts_tooltiptext">Stornieren</span>
|
@if(strlen($room->user_name))
|
||||||
</a>
|
<li> {{ $room->user_name}}
|
||||||
|
</li>
|
||||||
|
@endif
|
||||||
@endif
|
@endif
|
||||||
</li>
|
@endforeach
|
||||||
@endif
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
<div class="card-header">
|
|
||||||
<a href="/tour/{{$tour->id}}/create_room/1" class="text-primary">+ Einzelzimmer</a>
|
|
||||||
<!-- <button type="submit" class="btn">+ Einzelzimmer</button> -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card-header">
|
|
||||||
<a href="/tour/{{$tour->id}}/create_room/2" class="text-primary">+ Doppelzimmer</a>
|
|
||||||
<!-- <button type="submit" class="btn">+ Doppelzimmer</button> -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!--Modal Anzeige end -->
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-3 mt-2">
|
||||||
|
<div class="card mt-4">
|
||||||
|
<div class="card-header"><h5>Teilnehmer</h5></div>
|
||||||
|
|
||||||
|
<div class="card-body" >
|
||||||
|
|
||||||
|
<!-- Intentional Assignment ! -->
|
||||||
|
@if ($room_id="") @endif
|
||||||
|
@foreach($rooms as $room)
|
||||||
|
|
||||||
|
@if ($room_id != $room->room_id)
|
||||||
|
@if($room_id!="")
|
||||||
|
@if($room->room_name=="Ungebucht")
|
||||||
|
</div> <div style="height:30px;"></div>
|
||||||
|
@else
|
||||||
|
</div> <div style="height:2px;"></div>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div style="border:solid;border-width:1px;">
|
||||||
|
<div><b>{{$room->room_name}}
|
||||||
|
@if( $room->room_name != "Ungebucht" )
|
||||||
|
<!-- Delete link only for real room ids -->
|
||||||
|
<a id="room_booking_link" class="text-primary ts_tooltip"
|
||||||
|
href="/tour/{{$tour->id}}/delete_room/{{$room->room_id}}">
|
||||||
|
(X) <span class="ts_tooltiptext">Raum Löschen</span>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Intentional Assignment ! -->
|
||||||
|
@if ($room_id=$room->room_id) @endif
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(strlen($room->user_name))
|
||||||
|
<div> {{ $room->user_name}}
|
||||||
|
@if( $room->room_name == "Ungebucht" )
|
||||||
|
<a href="#" data-user_id="{{$room->user_id}}" id="myBtn"
|
||||||
|
class="float-left ts_tooltip">
|
||||||
|
(+)
|
||||||
|
<span class="ts_tooltiptext">Zimmer zuweisen</span>
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
<a href="/tour/{{$tour->id}}/join4user/0/{{$room->user_id}}"
|
||||||
|
class="float-left ts_tooltip">
|
||||||
|
(-)
|
||||||
|
<span class="ts_tooltiptext">Zimmer-Zuweisung löschen</span>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</div> <div style="height:2px;"></div>
|
||||||
|
|
||||||
|
<div class="card-header">
|
||||||
|
<p>
|
||||||
|
<a href="/tour/{{$tour->id}}/create_room/1" class="text-primary">+ Einzelzimmer
|
||||||
|
erstellen</a>
|
||||||
|
<!-- <button type="submit" class="btn">+ Einzelzimmer</button> -->
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="/tour/{{$tour->id}}/create_room/2" class="text-primary">+ Doppelzimmer
|
||||||
|
erstellen</a>
|
||||||
|
<!-- <button type="submit" class="btn">+ Doppelzimmer</button> -->
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const elem = document.querySelector('input[name="start"]');
|
const elem = document.querySelector('input[name="start"]');
|
||||||
const datepicker_start = new Datepicker(elem, {
|
const datepicker_start = new Datepicker(elem, {
|
||||||
'autohide':true,
|
'autohide': true,
|
||||||
'format':'dd.mm.yyyy',
|
'format': 'dd.mm.yyyy',
|
||||||
'language': 'de'
|
'language': 'de'
|
||||||
});
|
});
|
||||||
|
|
||||||
const elem2 = document.querySelector('input[name="deadline"]');
|
const elem2 = document.querySelector('input[name="deadline"]');
|
||||||
const datepicker_deadline = new Datepicker(elem2, {
|
const datepicker_deadline = new Datepicker(elem2, {
|
||||||
'autohide':true,
|
'autohide': true,
|
||||||
'format':'dd.mm.yyyy',
|
'format': 'dd.mm.yyyy',
|
||||||
'language':'de'
|
'language': 'de'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////
|
||||||
|
// Get the modal
|
||||||
|
var modal = document.getElementById("myModal");
|
||||||
|
|
||||||
|
// Get the button that opens the modal
|
||||||
|
//var btn = document.getElementById("myBtn");
|
||||||
|
var btns = document.querySelectorAll("#myBtn");
|
||||||
|
for (let i = 0; i < btns.length; ++i) {
|
||||||
|
//btns[i].user_id=
|
||||||
|
btns[i].onclick = function (e) {
|
||||||
|
|
||||||
|
console.log("** CLICK **")
|
||||||
|
console.log(this)
|
||||||
|
let user_id = this.dataset.user_id
|
||||||
|
|
||||||
|
// Jetzt die Links
|
||||||
|
var elems = document.querySelectorAll("#booking_link")
|
||||||
|
for (var i = 0; i < elems.length; i++) {
|
||||||
|
console.log("Before: ")
|
||||||
|
console.log(elems[i].href)
|
||||||
|
elems[i].href = elems[i].href.replace("#USER_ID", user_id)
|
||||||
|
console.log("After:")
|
||||||
|
console.log(elems[i].href)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the user clicks on the button, open the modal
|
||||||
|
e.preventDefault();
|
||||||
|
modal.style.display = "block";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the <span> element that closes the modal
|
||||||
|
var span = document.getElementsByClassName("close")[0];
|
||||||
|
|
||||||
|
|
||||||
|
// When the user clicks on <span> (x), close the modal, restore the links
|
||||||
|
span.onclick = function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
modal.style.display = "none";
|
||||||
|
|
||||||
|
// Jetzt die Links
|
||||||
|
var elems = document.querySelectorAll("#booking_link")
|
||||||
|
for (var i = 0; i < elems.length; i++) {
|
||||||
|
arr = elems[i].href.split("/")
|
||||||
|
arr.pop()
|
||||||
|
str = arr.join("/") + "/#USER_ID"
|
||||||
|
elems[i].href = str
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// When the user clicks anywhere outside of the modal, close it
|
||||||
|
window.onclick = function (event) {
|
||||||
|
if (event.target == modal) {
|
||||||
|
modal.style.display = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,7 @@
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-md-8 mt-2">
|
<div class="col-md-8 mt-2">
|
||||||
<div class="card mt-4">
|
<div class="card mt-4">
|
||||||
|
|
@ -18,33 +12,41 @@
|
||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<form style="background-color: #fff;" class="text-dark" method="post" action="" enctype="multipart/form-data">
|
<form style="background-color: #fff;" class="text-dark" method="post" action=""
|
||||||
|
enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
|
|
||||||
<div class="" style="display:flex;">
|
<div class="" style="display:flex;">
|
||||||
<!-- label class="ml-2 mt-4 col-form-label col-form-label-sm" style="width:150px; text-align:left;" for="name"><h4>Name:</h4></label> -->
|
<!-- label class="ml-2 mt-4 col-form-label col-form-label-sm" style="width:150px; text-align:left;" for="name"><h4>Name:</h4></label> -->
|
||||||
<label class="ml-2" style="width:180px; text-align:left;font-size:18px;" for="name">Name:</label>
|
<label class="ml-2" style="width:180px; text-align:left;font-size:18px;" for="name">Name:</label>
|
||||||
<input class="mr-1 form-control" type="text" id="name" name="name" value="{{ old('name') ?? $tour->name }}" readonly >
|
<input class="mr-1 form-control" type="text" id="name" name="name"
|
||||||
|
value="{{ old('name') ?? $tour->name }}" readonly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-1" style="display:flex;">
|
<div class="mt-1" style="display:flex;">
|
||||||
<label class="ml-2" style="width:180px; text-align:left;font-size:18px;" for="name">Start:</label>
|
<label class="ml-2" style="width:180px; text-align:left;font-size:18px;" for="name">Start:</label>
|
||||||
<input class="mr-1 form-control" type="text" id="start" name="start" value="{{ old('start') ?? $tour->start }}" readonly >
|
<input class="mr-1 form-control" type="text" id="start" name="start"
|
||||||
|
value="{{ old('start') ?? $tour->start }}" readonly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-1" style="display:flex;">
|
<div class="mt-1" style="display:flex;">
|
||||||
<label class="ml-2" style="width:180px; text-align:left;font-size:18px;" for="creator">Ansprechpartner:</label>
|
<label class="ml-2" style="width:180px; text-align:left;font-size:18px;" for="creator">Ansprechpartner:</label>
|
||||||
<input class="mr-1 form-control" type="text" id="creator" name="creator" value="{{ old('creator') ?? $creator->name }}" readonly >
|
<input class="mr-1 form-control" type="text" id="creator" name="creator"
|
||||||
|
value="{{ old('creator') ?? $creator->name }}" readonly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-1" style="display:flex;">
|
<div class="mt-1" style="display:flex;">
|
||||||
<label class="ml-2" style="width:180px; text-align:left;font-size:18px;" for="name">Anmeldeschluss:</label>
|
<label class="ml-2" style="width:180px; text-align:left;font-size:18px;" for="name">Anmeldeschluss:</label>
|
||||||
<input class="mr-1 form-control" type="text" id="anmeldeschluss" style="font-size:16px;" name="deadline" value="{{ old('anmeldeschluss') ?? $tour->deadline }}" readonly >
|
<input class="mr-1 form-control" type="text" id="anmeldeschluss" style="font-size:16px;"
|
||||||
|
name="deadline" value="{{ old('anmeldeschluss') ?? $tour->deadline }}" readonly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-1" style="display:flex;">
|
<div class="mt-1" style="display:flex;">
|
||||||
<label class="ml-2" style="width:180px; text-align:left;font-size:18px;" for="name">Max Teilnehmer:</label>
|
<label class="ml-2" style="width:180px; text-align:left;font-size:18px;" for="name">Max
|
||||||
<input class="mr-1 form-control" type="text" id="max_participants" style="font-size:16px;" name="max_participants" value="{{ old('max_participants') ?? $tour->max_participants }}" required >
|
Teilnehmer:</label>
|
||||||
|
<input class="mr-1 form-control" type="text" id="max_participants"
|
||||||
|
style="font-size:16px;" name="max_participants"
|
||||||
|
value="{{ old('max_participants') ?? $tour->max_participants }}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if(App\Tour::has_participant($tour->id, Auth::user()->id))
|
@if(App\Tour::has_participant($tour->id, Auth::user()->id))
|
||||||
|
|
@ -55,17 +57,20 @@
|
||||||
|
|
||||||
|
|
||||||
@if(file_exists (public_path ('img/tour/'.$tour->id.'.jpg')))
|
@if(file_exists (public_path ('img/tour/'.$tour->id.'.jpg')))
|
||||||
<!--File exists -->
|
<!--File exists -->
|
||||||
<a href="/img/tour/{{$tour->id}}_gross.jpg" data-lightbox="{{$tour->id}}_gross.jpg" data-title="{{ $tour->name }}">
|
<a href="/img/tour/{{$tour->id}}_gross.jpg" data-lightbox="{{$tour->id}}_gross.jpg"
|
||||||
<img src="/img/tour/{{$tour->id}}.jpg" class="mt-3 ml-3" >
|
data-title="{{ $tour->name }}">
|
||||||
|
<img src="/img/tour/{{$tour->id}}.jpg" class="mt-3 ml-3">
|
||||||
</a>
|
</a>
|
||||||
@else
|
@else
|
||||||
<img src="/img/placeholder/tour128x100.jpg" class="mt-3 ml-3" >
|
<img src="/img/placeholder/tour128x100.jpg" class="mt-3 ml-3">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="mt-1" style="display:flex;">
|
<div class="mt-1" style="display:flex;">
|
||||||
<label class="ml-2" style="width:140px; text-align:left;font-size:18px;" for="is_cancelled">Storniert:</label>
|
<label class="ml-2" style="width:140px; text-align:left;font-size:18px;"
|
||||||
<input class="mr-1 form-control" type="checkbox" id="is_cancelled" style="font-size:10px;width:20px;" name="is_cancelled"
|
for="is_cancelled">Storniert:</label>
|
||||||
|
<input class="mr-1 form-control" type="checkbox" id="is_cancelled"
|
||||||
|
style="font-size:10px;width:20px;" name="is_cancelled"
|
||||||
@if($tour->is_cancelled)
|
@if($tour->is_cancelled)
|
||||||
checked
|
checked
|
||||||
@endif
|
@endif
|
||||||
|
|
@ -79,29 +84,31 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- TODO: Only if owner or admin -->
|
<!-- TODO: Only if owner or admin -->
|
||||||
<a href="/tour/{{$tour->id}}/edit"><div type="submit" class="btn btn-danger col-3 mb-2 float-left mr-2">Bearbeiten</div></a>
|
@if(Auth::user()->role=="ADMIN")
|
||||||
|
<a href="/tour/{{$tour->id}}/edit">
|
||||||
|
<div type="submit" class="btn btn-danger col-3 mb-2 float-left mr-2">Bearbeiten
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
<a href="/tour" type="submit" class="btn btn-success col-3 mb-2 float-right mr-2">Ok</a>
|
<a href="/tour" type="submit" class="btn btn-success col-3 mb-2 float-right mr-2">Ok</a>
|
||||||
|
|
||||||
@if(!App\Tour::has_participant($tour->id, Auth::user()->id))
|
@if(!App\Tour::has_participant($tour->id, Auth::user()->id) && App\Tour::has_space($tour->id))
|
||||||
<!-- Connected to Modal -->
|
<!-- Connected to Modal -->
|
||||||
<button id="myBtn" class="btn btn-danger float-left">Teilnehmen</button>
|
<button id="myBtn" class="btn btn-danger float-left">Teilnehmen</button>
|
||||||
@else
|
@endif
|
||||||
<a href="/tour/{{$tour->id}}/cancelBooking" type="submit" class="btn btn-danger col-3 mb-2 float-right mr-2">Absagen</a>
|
@if(App\Tour::has_participant($tour->id, Auth::user()->id))
|
||||||
|
<a href="/tour/{{$tour->id}}/cancelBooking" type="submit"
|
||||||
|
class="btn btn-danger col-3 mb-2 float-right mr-2">Absagen</a>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
<!-- Modal Anzeige start -->
|
<!-- Modal Anzeige start -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- The Modal -->
|
<!-- The Modal -->
|
||||||
<div id="myModal" class="modal">
|
<div id="myModal" class="modal">
|
||||||
|
|
||||||
<!-- Modal content -->
|
<!-- Modal content -->
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<span class="close">×</span>
|
<span class="close">×</span>
|
||||||
<h2>Bitte Zimmer auswählen</h2>
|
<h2>Bitte Zimmer auswählen</h2>
|
||||||
|
|
@ -111,14 +118,16 @@
|
||||||
<!-- Intentional Assignment ! -->
|
<!-- Intentional Assignment ! -->
|
||||||
@if ($room_id="") @endif
|
@if ($room_id="") @endif
|
||||||
@foreach($rooms as $room)
|
@foreach($rooms as $room)
|
||||||
@if( $room->room_id != 0 and $room->free_slots >0) <!-- Dont show "Ungebucht", room_id=0 and only with available slots -->
|
@if( $room->room_id != 0 and $room->free_slots >0)
|
||||||
|
<!-- Dont show "Ungebucht", room_id=0 and only with available slots -->
|
||||||
@if ($room_id != $room->room_id)
|
@if ($room_id != $room->room_id)
|
||||||
@if(strlen($room_id))
|
@if(strlen($room_id))
|
||||||
<hr/>
|
<hr/>
|
||||||
@endif
|
@endif
|
||||||
<p style="list-style-type: none;">[{{$room->room_id}}]
|
<p style="list-style-type: none;">[{{$room->room_id}}]
|
||||||
<span>{{$room->room_name}}
|
<span>{{$room->room_name}}
|
||||||
</span><b><a href="/tour/{{$tour->id}}/join/{{$room->room_id}}"> ==> Buchen</a></b>
|
</span><b><a href="/tour/{{$tour->id}}/join/{{$room->room_id}}">
|
||||||
|
==> Buchen</a></b>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- Intentional Assignment ! -->
|
<!-- Intentional Assignment ! -->
|
||||||
|
|
@ -138,8 +147,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--Modal Anzeige end -->
|
<!--Modal Anzeige end -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -150,39 +159,49 @@
|
||||||
|
|
||||||
<!-- Teilnehmer+Raum Anzeige -->
|
<!-- Teilnehmer+Raum Anzeige -->
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<ul>
|
|
||||||
<!-- Intentional Assignment ! -->
|
|
||||||
@if ($room_id="") @endif
|
|
||||||
@foreach($rooms as $room)
|
|
||||||
@if ($room_id != $room->room_id)
|
|
||||||
@if(strlen($room_id))
|
|
||||||
<p>-------------------------</p>
|
|
||||||
@endif
|
|
||||||
<p><b>[{{$room->room_id}}] {{$room->room_name}}</b></p>
|
|
||||||
|
|
||||||
<!-- Intentional Assignment ! -->
|
<!-- Intentional Assignment ! -->
|
||||||
@if ($room_id=$room->room_id) @endif
|
@if ($room_id="") @endif
|
||||||
@endif
|
@foreach($rooms as $room)
|
||||||
|
|
||||||
@if(strlen($room->user_name))
|
@if ($room_id != $room->room_id)
|
||||||
<li style="list-style:none"> {{ $room->user_name}}
|
@if($room_id!="")
|
||||||
@if(Auth::user()->role=="ADMIN")
|
@if($room->room_name=="Ungebucht")
|
||||||
<a href="/tour/{{$tour->id}}/cancelBookingAdmin/{{$room->user_id}}" class="text-primary ts_tooltip">(X)
|
|
||||||
<span class="ts_tooltiptext">Stornieren</span>
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
</li>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@endforeach
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div style="height:30px;"></div>
|
||||||
|
@else
|
||||||
</div>
|
</div>
|
||||||
|
<div style="height:2px;"></div>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div style="border:solid;border-width:1px;">
|
||||||
|
<div style="text-align:center;"><b>{{$room->room_name}}
|
||||||
|
@if( $room->room_name != "Ungebucht" )
|
||||||
|
_{{$room->room_id}}</b></div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<!-- Intentional Assignment ! -->
|
||||||
|
@if ($room_id=$room->room_id) @endif
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if(strlen($room->user_name))
|
||||||
|
<div style="list-style:none"> {{ $room->user_name}}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
<div style="height:2px;"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -205,19 +224,19 @@
|
||||||
var span = document.getElementsByClassName("close")[0];
|
var span = document.getElementsByClassName("close")[0];
|
||||||
|
|
||||||
// When the user clicks on the button, open the modal
|
// When the user clicks on the button, open the modal
|
||||||
btn.onclick = function(e) {
|
btn.onclick = function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
modal.style.display = "block";
|
modal.style.display = "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the user clicks on <span> (x), close the modal
|
// When the user clicks on <span> (x), close the modal
|
||||||
span.onclick = function(e) {
|
span.onclick = function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
// When the user clicks anywhere outside of the modal, close it
|
// When the user clicks anywhere outside of the modal, close it
|
||||||
window.onclick = function(event) {
|
window.onclick = function (event) {
|
||||||
if (event.target == modal) {
|
if (event.target == modal) {
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,63 +4,82 @@
|
||||||
<div class="container text-center text-light mt-5">
|
<div class="container text-center text-light mt-5">
|
||||||
<h1 class="text-center">{{$user->name}}</h1>
|
<h1 class="text-center">{{$user->name}}</h1>
|
||||||
|
|
||||||
<form style="background-color: #fff;" class="text-dark" method="post" action="/member/{{$user->name}}" enctype="multipart/form-data">
|
<form style="background-color: #fff;" class="text-dark" method="post" action="/member/{{$user->name}}"
|
||||||
|
enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
<input type="hidden" name="id" value="{{ $user->id }}">
|
<input type="hidden" name="id" value="{{ $user->id }}">
|
||||||
|
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="name"><h4>Name:</h4></label>
|
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="name"><h4>Name:</h4></label>
|
||||||
<input class="mt-3 mr-2 form-control" type="text" id="name" style="font-size:20px;" name="name" value="{{ old('name') ?? $user->name }}" required >
|
<input class="mt-3 mr-2 form-control" type="text" id="name" style="font-size:20px;" name="name"
|
||||||
|
value="{{ old('name') ?? $user->name }}" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="mobile" ><h4>Telefonnummer:</h4></label>
|
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="mobile"><h4>Telefonnummer:</h4>
|
||||||
<input type="text" class="mt-3 mr-2 form-control" id="mobile" style="font-size:20px;" name="mobile" value="{{ old('mobile') ?? $user->mobile }}" required >
|
</label>
|
||||||
|
<input type="text" class="mt-3 mr-2 form-control" id="mobile" style="font-size:20px;" name="mobile"
|
||||||
|
value="{{ old('mobile') ?? $user->mobile }}" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="name" ><h4>EMail:</h4></label>
|
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="name"><h4>EMail:</h4></label>
|
||||||
<input type="text" class="mt-3 mr-2 form-control" id="lastname" style="font-size:20px;" name="email" value="{{ old('email') ?? $user->email }}" required >
|
<input type="text" class="mt-3 mr-2 form-control" id="lastname" style="font-size:20px;" name="email"
|
||||||
|
value="{{ old('email') ?? $user->email }}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="bild" ><h4>Bild:</h4></label>
|
<label class="ml-2 mt-4" style="width:150px; text-align:left;" for="bild"><h4>Bild:</h4></label>
|
||||||
|
|
||||||
@if(file_exists (storage_path().'/img_storage/user/'.$user->id.'.jpg'))
|
@if(file_exists (storage_path().'/img_storage/user/'.$user->id.'.jpg'))
|
||||||
<!--File exists -->
|
<!--File exists -->
|
||||||
<a href="/img_storage/user/{{$user->id}}_gross.jpg" data-lightbox="{{$user->id}}_gross.jpg" data-title="{{ $user->name }}">
|
<a href="/img_storage/user/{{$user->id}}_gross.jpg" data-lightbox="{{$user->id}}_gross.jpg"
|
||||||
<img src="/img_storage/user/{{$user->id}}.jpg" id="bild" class="mt-3 ml-3" style="width:256px;height:256px">
|
data-title="{{ $user->name }}">
|
||||||
|
<img src="/img_storage/user/{{$user->id}}.jpg" id="bild" class="mt-3 ml-3"
|
||||||
|
style="width:256px;height:256px">
|
||||||
</a>
|
</a>
|
||||||
@else
|
@else
|
||||||
<img src="/img/placeholder/user64x96.jpg" id="bild" class="mt-3 ml-3" >
|
<img src="/img/placeholder/user64x96.jpg" id="bild" class="mt-3 ml-3">
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<input type="file" class="mt-3 mr-2 form-control" style="font-size:20px;" name="bild" value="" accept="image/*" onchange="preview_image(event)">
|
<input type="file" class="mt-3 mr-2 form-control" style="font-size:20px;" name="bild" value=""
|
||||||
|
accept="image/*" onchange="preview_image(event)">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@if(Auth::user()->role=="ADMIN")
|
@if(Auth::user()->role=="ADMIN")
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-4" style="width:130px; text-align:left;" for="name" ><h4>Rolle:</h4></label>
|
<label class="ml-2 mt-4" style="width:130px; text-align:left;" for="name"><h4>Rolle:</h4></label>
|
||||||
|
|
||||||
<select name="role" class="dropdown-item ml-3 border form-control mt-3 mr-2" style="font-size:18px;" selected="{{ old('role') ?? $user->role }}">
|
<select name="role" class="dropdown-item ml-3 border form-control mt-3 mr-2" style="font-size:18px;"
|
||||||
<option value="GUEST" style="font-size:18px;" class="dropdown-item bg-light form-control" {{ $user->role=="GUEST" ? "selected" : "" }} >GUEST</option>
|
selected="{{ old('role') ?? $user->role }}">
|
||||||
<option value="MEMBER" style="font-size:18px;" class="dropdown-item bg-light" {{ $user->role=="MEMBER" ? "selected" : "" }} >MEMBER</option>
|
<option value="GUEST" style="font-size:18px;"
|
||||||
<option value="ADMIN" style="font-size:18px;" class="dropdown-item bg-light" {{ $user->role=="ADMIN" ? "selected" : "" }} >ADMIN</option>
|
class="dropdown-item bg-light form-control" {{ $user->role=="GUEST" ? "selected" : "" }} >
|
||||||
|
GUEST
|
||||||
|
</option>
|
||||||
|
<option value="MEMBER" style="font-size:18px;"
|
||||||
|
class="dropdown-item bg-light" {{ $user->role=="MEMBER" ? "selected" : "" }} >MEMBER
|
||||||
|
</option>
|
||||||
|
<option value="ADMIN" style="font-size:18px;"
|
||||||
|
class="dropdown-item bg-light" {{ $user->role=="ADMIN" ? "selected" : "" }} >ADMIN
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<div class="form-group" style="display:flex;">
|
<div class="form-group" style="display:flex;">
|
||||||
<label class="ml-2 mt-4" style="width:130px; text-align:left;" for="name" ><h4>Rolle:</h4></label>
|
<label class="ml-2 mt-4" style="width:130px; text-align:left;" for="name"><h4>Rolle:</h4></label>
|
||||||
<h4 class="mt-4">{{$user->role}}</h4>
|
<h4 class="mt-4">{{$user->role}}</h4>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
<a href="/member" class="btn btn-primary col-2 mb-2 float-left" style="margin-right:20px;">Zurück</a>
|
||||||
|
|
||||||
@if(Auth::user()->role=="ADMIN" || Auth::user()->id==$user->id)
|
@if(Auth::user()->role=="ADMIN" || Auth::user()->id==$user->id)
|
||||||
<button type="submit" class="btn btn-danger col-2 mb-2 float-right mr-2">Speichern</button>
|
<button type="submit" class="btn btn-danger col-2 mb-2 float-right mr-2">Speichern</button>
|
||||||
|
<a href="/admin/destroy_user/{{$user->id}}" class="btn btn-primary col-2 mb-2 float-left"
|
||||||
|
style="margin-right:20px;">Löschen</a>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
<a href="/member" class="btn btn-primary col-2 mb-2 float-left">Zurück</a>
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
@ -69,12 +88,10 @@
|
||||||
<!-------------------------------- ----------------------------->
|
<!-------------------------------- ----------------------------->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function preview_image(event)
|
function preview_image(event) {
|
||||||
{
|
|
||||||
console.log("Preview triggered.")
|
console.log("Preview triggered.")
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = function()
|
reader.onload = function () {
|
||||||
{
|
|
||||||
console.log("onload")
|
console.log("onload")
|
||||||
var output = document.getElementById('bild');
|
var output = document.getElementById('bild');
|
||||||
console.log(output);
|
console.log(output);
|
||||||
|
|
|
||||||
|
|
@ -1,63 +1,74 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Web Routes
|
| Web Routes
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| Here is where you can register web routes for your application. These
|
| Here is where you can register web routes for your application. These
|
||||||
| routes are loaded by the RouteServiceProvider within a group which
|
| routes are loaded by the RouteServiceProvider within a group which
|
||||||
| contains the "web" middleware group. Now create something great!
|
| contains the "web" middleware group. Now create something great!
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return view('home');
|
return view('home');
|
||||||
});
|
});
|
||||||
|
|
||||||
Route::get('/test', 'PageController@page_home');
|
Route::get('/test', 'PageController@page_home');
|
||||||
|
|
||||||
* */
|
* */
|
||||||
|
|
||||||
Route::get('/', 'PageController@page_home');
|
Route::get('/', 'PageController@page_home');
|
||||||
Route::get('/home', 'PageController@page_home')->name('home');
|
Route::get('/home', 'PageController@page_home')->name('home');
|
||||||
Route::post('/admin/store_home','AdminController@store_home')->middleware('auth');
|
Route::post('/admin/store_home', 'AdminController@store_home')->middleware('auth');
|
||||||
Route::get('/activities', 'PageController@page_activities');
|
Route::get('/activities', 'PageController@page_activities');
|
||||||
|
|
||||||
Route::get('/become_member', function () { return view('users.become_member'); });
|
Route::get('/become_member', function () {
|
||||||
Route::get('/meetings', function () { return view('meetings'); })->middleware('auth');
|
return view('users.become_member');
|
||||||
|
});
|
||||||
|
Route::get('/meetings', function () {
|
||||||
|
return view('meetings');
|
||||||
|
})->middleware('auth');
|
||||||
|
|
||||||
Route::resource('/member',UserController::class);
|
Route::resource('/member', UserController::class);
|
||||||
|
|
||||||
Route::get('/admin/upload_tourplan', 'AdminController@upload_tourplan')->middleware('auth');
|
Route::get('/admin/destroy_user/{user_id}', 'UserController@destroy')->middleware('auth');
|
||||||
Route::post('/admin/store_tourplan','AdminController@store_tourplan')->middleware('auth');
|
Route::get('/admin/upload_tourplan', 'AdminController@upload_tourplan')->middleware('auth');
|
||||||
|
Route::post('/admin/store_tourplan', 'AdminController@store_tourplan')->middleware('auth');
|
||||||
|
|
||||||
Route::get('/admin/upload_mitgliedsantrag', 'AdminController@upload_mitgliedsantrag')->middleware('auth');
|
Route::get('/admin/upload_mitgliedsantrag', 'AdminController@upload_mitgliedsantrag')->middleware('auth');
|
||||||
Route::post('/admin/store_mitgliedsantrag','AdminController@store_mitgliedsantrag')->middleware('auth');
|
Route::post('/admin/store_mitgliedsantrag', 'AdminController@store_mitgliedsantrag')->middleware('auth');
|
||||||
|
|
||||||
Route::get('/admin/edit_home', 'AdminController@edit_home')->middleware('auth');
|
Route::get('/admin/edit_home', 'AdminController@edit_home')->middleware('auth');
|
||||||
Route::get('/admin/edit_activities', 'AdminController@edit_activities')->middleware('auth');
|
Route::get('/admin/edit_activities', 'AdminController@edit_activities')->middleware('auth');
|
||||||
Route::post('/admin/store_activities', 'AdminController@store_activities')->middleware('auth');
|
Route::post('/admin/store_activities', 'AdminController@store_activities')->middleware('auth');
|
||||||
|
|
||||||
Route::get('/tour/index_old', 'TourController@index_old')->middleware('auth');
|
Route::get('/tour/index_old', 'TourController@index_old')->middleware('auth');
|
||||||
Route::post('/tour/store', 'TourController@store')->middleware('auth');
|
Route::post('/tour/store', 'TourController@store')->middleware('auth');
|
||||||
Route::post('/tour/update', 'TourController@store')->middleware('auth');
|
Route::post('/tour/update', 'TourController@store')->middleware('auth');
|
||||||
Route::post('/tour/upload_gallery/{tour_id}', 'TourController@upload_gallery');
|
Route::post('/tour/upload_gallery/{tour_id}', 'TourController@upload_gallery');
|
||||||
Route::resource('/tour', TourController::class)->middleware('auth');
|
Route::resource('/tour', TourController::class)->middleware('auth');
|
||||||
|
|
||||||
Route::get('/tour/{tour_id}/join/{room_id}', 'TourController@join_room')->middleware('auth');
|
Route::get('/tour/{tour_id}/join/{room_id}', 'TourController@join_room')->middleware('auth');
|
||||||
Route::get('/tour/{tour_id}/cancelBooking', 'TourController@cancelBooking')->middleware('auth');
|
Route::get('/tour/{tour_id}/join4user/{room_id}/{user_id}', 'TourController@join_room4user')->middleware('auth');
|
||||||
Route::get('/tour/{tour_id}/cancelBookingAdmin/{user_id}', 'TourController@cancelBookingAdmin')->middleware('auth');
|
Route::get('/tour/{tour_id}/cancelBooking', 'TourController@cancelBooking')->middleware('auth');
|
||||||
Route::get('/tour/{tour_id}/create_room/{capacity}', 'TourController@create_room')->middleware('auth');
|
Route::get('/tour/{tour_id}/cancelBookingAdmin/{user_id}', 'TourController@cancelBookingAdmin')->middleware('auth');
|
||||||
Route::get('/tour/{tour_id}/delete_room/{room_id}', 'TourController@delete_room')->middleware('auth');
|
Route::get('/tour/{tour_id}/create_room/{capacity}', 'TourController@create_room')->middleware('auth');
|
||||||
|
Route::get('/tour/{tour_id}/delete_room/{room_id}', 'TourController@delete_room')->middleware('auth');
|
||||||
|
Route::get('/tour/{tour_id}/assign_room_for_user/{user_id}', 'TourController@delete_room')->middleware('auth');
|
||||||
|
|
||||||
Route::get('/img_storage/{category}/{imageName}','ImageController@getImage'); // no middleware auth needed, its checked in Controller
|
Route::get('/img_storage/{category}/{imageName}', 'ImageController@getImage'); // no middleware auth needed, its checked in Controller
|
||||||
|
|
||||||
Auth::routes();
|
Auth::routes();
|
||||||
|
|
||||||
/* Cache clearing on remote server */
|
/* Cache clearing on remote server */
|
||||||
Route::get('/clear-cache', function() { Artisan::call('cache:clear');Artisan::call('config:clear'); return "Cache cleared, Config reloaded"; });
|
Route::get('/clear-cache', function () {
|
||||||
//Route::get('/home', 'HomeController@index')->name('home');
|
Artisan::call('cache:clear');
|
||||||
|
Artisan::call('config:clear');
|
||||||
|
return "Cache cleared, Config reloaded";
|
||||||
|
});
|
||||||
|
//Route::get('/home', 'HomeController@index')->name('home');
|
||||||
|
|
|
||||||
4
motorradig/setenv.sh
Normal file → Executable file
4
motorradig/setenv.sh
Normal file → Executable file
|
|
@ -1,3 +1,3 @@
|
||||||
alias phpunit="docker-compose exec app vendor/bin/phpunit"
|
alias phpunit="docker-compose exec app vendor/bin/phpunit"
|
||||||
alias artisan="docker-compose exec app php artisan"
|
alias artisan="sudo docker-compose exec app php artisan"
|
||||||
alias composer="docker-compose exec app composer"
|
alias composer="sudo docker-compose exec app composer"
|
||||||
|
|
|
||||||
1
tools/dump_motorradig.py
Normal file → Executable file
1
tools/dump_motorradig.py
Normal file → Executable file
|
|
@ -1,3 +1,4 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
# This script needs mysqldump to be installed
|
# This script needs mysqldump to be installed
|
||||||
# apt install mysql-client
|
# apt install mysql-client
|
||||||
|
|
||||||
|
|
|
||||||
225
tools/motorradig_2023-01-08_095331.sql
Normal file
225
tools/motorradig_2023-01-08_095331.sql
Normal file
File diff suppressed because one or more lines are too long
306
tools/motorradig_2023-01-11_165941.sql
Normal file
306
tools/motorradig_2023-01-11_165941.sql
Normal file
File diff suppressed because one or more lines are too long
306
tools/motorradig_2023-01-13_092650.sql
Normal file
306
tools/motorradig_2023-01-13_092650.sql
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue