Skip to content

Commit

Permalink
Link project view page and create project edit page
Browse files Browse the repository at this point in the history
  • Loading branch information
MuchQuak committed Feb 11, 2025
1 parent f608cd6 commit a618a73
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 19 deletions.
6 changes: 5 additions & 1 deletion app/Http/Controllers/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static function getProjectData(int $pid) {
}

public static function project(int $pid) {
view('pages/project', self::getProjectData($pid));
return view('pages/project', self::getProjectData($pid));
}

public static function EditProject(int $pid) {
return view('pages/projects/edit', self::getProjectData($pid));
}
}
2 changes: 1 addition & 1 deletion resources/views/core/pages/checklists.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div class="flex items-center gap-4">
@if($checklist->projname)
<x-link
href="{{url(config('portal.name') . '/projects/index.php?pid='.$checklist->pid)}}"
href="{{url('/projects/' . $checklist->pid)}}"
class="text-2xl font-bold text-primary">
{{$checklist->projname ?? 'Misc'}}
</x-link>
Expand Down
52 changes: 37 additions & 15 deletions resources/views/core/pages/project.blade.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
@props(['project', 'checklists' => []])
<x-layout>
<h1 class="text-4xl font-boldt text-primary">{{$project->projname}}</h1>
{{-- Todo Add Edit and when to show mapping button logic --}}
<div>
<span class="font-bold">Projects Mangers:</span>
{{$project->managers }}
<div class="mb-4">
<x-breadcrumbs :items="[
['title' => 'Home', 'href' => url('') ],
['title' => 'Species Inventories', 'href' => url('/checklists') ],
$project->projname
]" />
</div>
<div class="text-lg font-bold">Research checklists</div>

<div class="flex items-center mb-4">
<h1 class="text-4xl font-bold text-primary">{{ $project->projname }}</h1>
<div class="flex flex-grow justify-end gap-4">
<a href="{{ url('projects/' . $project->pid . '/edit') }}">
<i class="flex-end fas fa-edit"></i>
Edit
</a>
</div>
</div>
{{-- Todo Add Edit and when to show mapping button logic --}}
<div>
@foreach ($checklists as $checklist)
<li>
<x-link href="{{url(config('portal.name') . '/checklists/checklist.php?clid=' . $checklist->clid . '&pid=' . $project->pid) }}">{{$checklist->name}}</x-link>
|
{{-- Todo find conditions for when this would not exist if any --}}
<x-link href="{{url(config('portal.name') . '/ident/key.php?clid=' . $checklist->clid . '&pid=' . $project->pid . '&taxon=All+Species')}}">
Key<i class="pl-1 text-base-content fa-solid fa-key"></i></x-link>
</li>
@endforeach
@if(isset($project->managers) && $project->managers)
<div>
<span class="text-lg font-bold">Projects Mangers:</span>
{{$project->managers }}
</div>
@endif
<div class="text-lg font-bold">Research checklists</div>

<div class="flex flex-col gap-2">
@foreach ($checklists as $checklist)
<li>
<x-link
href="{{url(config('portal.name') . '/checklists/checklist.php?clid=' . $checklist->clid . '&pid=' . $project->pid) }}">{{$checklist->name}}</x-link>
|
{{-- Todo find conditions for when this would not exist if any --}}
<x-link
href="{{url(config('portal.name') . '/ident/key.php?clid=' . $checklist->clid . '&pid=' . $project->pid . '&taxon=All+Species')}}">
Key<i class="pl-1 text-base-content fa-solid fa-key"></i></x-link>
</li>
@endforeach
</div>
</div>
</x-layout>
58 changes: 58 additions & 0 deletions resources/views/core/pages/projects/edit.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@props(['project'])
<x-layout>
<div class="mb-4">
<x-breadcrumbs :items="[
['title' => 'Home', 'href' => url('') ],
['title' => 'Species Inventories', 'href' => url('/checklists') ],
$project->projname
]" />
</div>

<div class="flex items-center mb-4">
<h1 class="text-4xl font-bold text-primary">{{ $project->projname }}</h1>
<div class="flex flex-grow justify-end gap-4">
<a href="{{ url('projects/' . $project->pid) }}">
<i class="flex-end fas fa-edit"></i>
Public View
</a>
</div>
</div>

<x-tabs :tabs="['Metadata', 'Inventory Managers', 'Checklist Management']">
<div>
TODO metadata
</div>
<div>
TODO Inventory Managers
</div>
<div>
Checklist Management
</div>
</x-tabs>


{{-- Todo Add Edit and when to show mapping button logic --}}
<div>
@if(isset($project->managers) && $project->managers)
<div>
<span class="text-lg font-bold">Projects Mangers:</span>
{{$project->managers }}
</div>
@endif
<div class="text-lg font-bold">Research checklists</div>

<div class="flex flex-col gap-2">
@foreach ($checklists as $checklist)
<li>
<x-link
href="{{url(config('portal.name') . '/checklists/checklist.php?clid=' . $checklist->clid . '&pid=' . $project->pid) }}">{{$checklist->name}}</x-link>
|
{{-- Todo find conditions for when this would not exist if any --}}
<x-link
href="{{url(config('portal.name') . '/ident/key.php?clid=' . $checklist->clid . '&pid=' . $project->pid . '&taxon=All+Species')}}">
Key<i class="pl-1 text-base-content fa-solid fa-key"></i></x-link>
</li>
@endforeach
</div>
</div>
</x-layout>
5 changes: 3 additions & 2 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@
| Project Routes
|--------------------------------------------------------------------------
*/
Route::group(['prefix' => '/project'], function () {
Route::get('/{clid}', [ProjectController::class, 'project']);
Route::group(['prefix' => '/projects'], function () {
Route::get('/{pid}', [ProjectController::class, 'project']);
Route::get('/{pid}/edit', [ProjectController::class, 'editProject']);
});

/*
Expand Down

0 comments on commit a618a73

Please sign in to comment.