diff --git a/timeliner/app/Http/Controllers/TimelineController.php b/timeliner/app/Http/Controllers/TimelineController.php
index 3c8e9f1..6166697 100644
--- a/timeliner/app/Http/Controllers/TimelineController.php
+++ b/timeliner/app/Http/Controllers/TimelineController.php
@@ -11,6 +11,7 @@
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
+use Illuminate\Support\Facades\DB;
use function Psy\debug;
@@ -22,11 +23,6 @@ public function index()
return view('index', ['timelines' => $timelines]);
}
- public function timelinelist()
- {
- return view('timeline.timelinelist');
- }
-
public function show($id)
{
$timeline = Timeline::findOrFail($id);
@@ -37,8 +33,6 @@ public function show($id)
->with('milestones')
->get();
- Log::info('nodes: '.$nodes->count());
-
$comments = Comment::where('timeline_id', '=', $timeline->id)
->with('user')
->get();
@@ -56,6 +50,21 @@ public function show($id)
->withErrors(["You don't have access."]);
}
+ public function showDashboard()
+ {
+ $user = Auth::user();
+
+ $timelines = DB::select("
+ SELECT timelines.*
+ FROM timelines
+ JOIN ownerships
+ ON CAST(SUBSTR(ownerships.id, 1, LENGTH(ownerships.id) - LENGTH(?)) AS INTEGER) = timelines.id
+ WHERE CAST(SUBSTR(ownerships.id, -LENGTH(?)) AS INTEGER) = ?
+ ", [$user->id, $user->id, $user->id]);
+
+ return view('dashboard',['timelines' => $timelines]);
+ }
+
public function create()
{
return view('timeline.create');
diff --git a/timeliner/app/Models/User.php b/timeliner/app/Models/User.php
index def621f..3da1945 100644
--- a/timeliner/app/Models/User.php
+++ b/timeliner/app/Models/User.php
@@ -44,4 +44,9 @@ protected function casts(): array
'password' => 'hashed',
];
}
+
+ public function ownerships()
+ {
+ return $this->hasMany(Ownership::class, 'id', 'id');
+ }
}
diff --git a/timeliner/resources/js/createformfunctions.js b/timeliner/resources/js/createformfunctions.js
index 4e0d469..91e8f2a 100644
--- a/timeliner/resources/js/createformfunctions.js
+++ b/timeliner/resources/js/createformfunctions.js
@@ -95,7 +95,7 @@ if (nodeCreateButton) {
let row_id = "node-" + ni;
let ms_table_id = "ms-table-" + ni;
tr_node_form.setAttribute("id", row_id);
- tr_node_form.setAttribute("class", "form-row mt-3");
+ tr_node_form.setAttribute("class", "form-row mt-3 border-4 border-blue-100 rounded-md p-2");
tr_milestone_table.setAttribute("id", ms_table_id);
tr_milestone_table.setAttribute("class", "form-group col-9");
diff --git a/timeliner/resources/views/dashboard.blade.php b/timeliner/resources/views/dashboard.blade.php
index 4024c64..a6da339 100644
--- a/timeliner/resources/views/dashboard.blade.php
+++ b/timeliner/resources/views/dashboard.blade.php
@@ -13,5 +13,21 @@
+
+
+
+
@@ -78,5 +80,7 @@ |