Merge branch 'develop' into trunk

This commit is contained in:
Vincent BRIDIER 2022-05-23 13:09:19 +02:00
commit 6f78838a4c
No known key found for this signature in database
GPG key ID: 8571BFA20420D512
3 changed files with 20 additions and 1 deletions

View file

@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Models\MacroSchedule\Marker;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\View;
@ -22,6 +23,23 @@ class MarkerController extends Controller
*/
public static $layout = 'layout.app';
/**
* Crud index Hook
*
* @param Builder $query
* @return Builder
*/
public function indexQuery(Builder $query): Builder
{
$parent = request()->project;
if ($parent) {
$query->whereHas('project', function ($q) use ($parent) {
return $q->whereId($parent->id);
});
}
return $query;
}
/**
* Show create page middleware
*

View file

@ -61,7 +61,7 @@
<template v-if="isAdmin">
<tr v-for="project of projects" :key="project.id" class="projectRow">
<th scope="col">
<span :class="'rounded-1 p-1 project text-nowrap text-truncate overflow-hidden bg-enum-'+project.status">{{ project.name | str_limit(45) }}</span>
<a :href="route('projects.show', {PROJECT: project.id })" :class="'rounded-1 p-1 project text-nowrap text-truncate overflow-hidden bg-enum-'+project.status">{{ project.name | str_limit(45) }}</a>
</th>
<td>
<span class="fw-bold text-nowrap text-truncate overflow-hidden">{{ projectStatusEnum[project.status].label }}</span>

View file

@ -21,6 +21,7 @@
<script>
window._routes = {
"macroplanning.activity": "{{ route('macroplanning.activity') }}",
"projects.show": "{{ route('projects.show', ['project' => 'PROJECT']) }}",
};
</script>
@endpush