Skip to content

Commit

Permalink
partial fix for project menu
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Nov 21, 2024
1 parent b5356af commit c20697f
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 146 deletions.
2 changes: 2 additions & 0 deletions app/Core/Controller/Frontcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ public function parseRequestParts(IncomingRequest $request)
public function executeAction(string $controller, string $method): Response
{

$this->incomingRequest->overrideGlobals();

$parameters = $this->incomingRequest->getRequestParams();

$controllerClass = app()->make($controller);
Expand Down
2 changes: 1 addition & 1 deletion app/Domain/Menu/Hxcontrollers/ProjectSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function init(Timesheets $timesheetService, Menu $menuService, \Leantime\
/**
* @throws BindingResolutionException
*/
public function updateMenu(): void
public function updateMenu($params): void
{

$allAssignedprojects =
Expand Down
59 changes: 30 additions & 29 deletions app/Domain/Menu/Templates/includes/projectListFilter.blade.php
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
<div class="projectListFilter">
<div class="py-2">

<form hx-target="#mainProjectSelector" hx-swap="outerHTML" hx-trigger="change">
<i class="fas fa-filter"></i>
<x-global::forms.select data-placeholder="" title=""
hx-post="{{ BASE_URL }}/hx/menu/projectSelector/update-menu" hx-target="#mainProjectSelector"
hx-swap="outerHTML" hx-indicator=".htmx-indicator, .htmx-loaded-content" name="client">
<x-global::forms.select.select-option value="" data-placeholder="true">
All Clients
</x-global::forms.select.select-option>
<form hx-target="#mainProjectSelector" hx-swap="outerHTML" hx-trigger="change" hx-post="{{ BASE_URL }}/hx/menu/projectSelector/update-menu" hx-indicator=".project-loading-indicator">

@foreach ($clients as $client)
@if ($client['id'] > 0)
<x-global::forms.select.select-option :value="$client['id']" :selected="isset($projectSelectFilter['client']) && $projectSelectFilter['client'] == $client['id']">
{{ $client['name'] }}
</x-global::forms.select.select-option>
@endif
@endforeach
</x-global::forms.select>

<i class="fa-solid fa-diagram-project"></i>

<x-global::forms.select data-placeholder="" name="groupBy"
hx-post="{{ BASE_URL }}/hx/menu/projectSelector/update-menu" hx-target="#mainProjectSelector"
hx-indicator=".htmx-indicator, .htmx-loaded-content" hx-swap="outerHTML">
@foreach ($projectSelectGroupOptions as $key => $group)
<x-global::forms.select.select-option :value="$key" :selected="$projectSelectFilter['groupBy'] == $key">
{{ $group }}
<div class="flex flex-row justify-self-start">
<x-global::forms.select data-placeholder="" name="client">
<x-slot:leading-visual>
<i class="fas fa-filter"></i>
</x-slot:leading-visual>
<x-global::forms.select.select-option value="" data-placeholder="true">
All Clients
</x-global::forms.select.select-option>
@endforeach
</x-global::forms.select>

@foreach ($clients as $client)
@if ($client['id'] > 0)
<x-global::forms.select.select-option :value="$client['id']" :selected="isset($projectSelectFilter['client']) && $projectSelectFilter['client'] == $client['id']">
{{ $client['name'] }}
</x-global::forms.select.select-option>
@endif
@endforeach
</x-global::forms.select>

<x-global::forms.select data-placeholder="" name="groupBy">
<x-slot:leading-visual>
<i class="fa-solid fa-diagram-project"></i>
</x-slot:leading-visual>
@foreach ($projectSelectGroupOptions as $key => $group)
<x-global::forms.select.select-option :value="$key" :selected="$projectSelectFilter['groupBy'] == $key">
{{ $group }}
</x-global::forms.select.select-option>
@endforeach
</x-global::forms.select>
</div>
<input type="hidden" name="activeTab" value="" />

</form>

</div>

<div class="htmx-indicator ml-m mr-m pt-l">
<div class="project-loading-indicator htmx-indicator ml-m mr-m pt-l">
<x-global::elements.loadingText type="project" count="5" includeHeadline="false" />
</div>
164 changes: 85 additions & 79 deletions app/Domain/Menu/Templates/includes/projectSelectorDropdown.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,94 +5,100 @@

<div class="dropdown-menu projectselector" id="mainProjectSelector">

@if ($menuType == 'project' || $menuType == 'default')
<div class="head">
<span class="sub">{{ __("menu.current_project") }}</span><br />
<span class="title">{{ session("currentProjectName") }}</span>
</div>
@else
<div class="projectSelectorFooter" style="border:none; border-bottom:1px solid var(--main-border-color)">
<ul class="selectorList projectList" hx-boost="true" hx-indicator="#global-loader">
<li>
<a href="{{ BASE_URL }}/projects/showMy"><strong><i class="fa-solid fa-house-flag"></i> Open Project Hub</strong></a>
@if ($menuType == 'project' || $menuType == 'default')
<div class="head">
<span class="sub">{{ __("menu.current_project") }}</span><br />
<span class="title">{{ session("currentProjectName") }}</span>
</div>
@else
<div class="projectSelectorFooter" style="border:none; border-bottom:1px solid var(--main-border-color)">
<ul class="selectorList projectList" hx-boost="true" hx-indicator="#global-loader">
<li>
<a href="{{ BASE_URL }}/projects/showMy"><strong><i class="fa-solid fa-house-flag"></i> Open Project Hub</strong></a>
</li>

@if ($login::userIsAtLeast("manager"))
@dispatchEvent('beforeProjectCreateLink')
<li><a href="{{ $startSomethingUrl }}">
<span class="fancyLink">
{!! __('menu.create_something_new') !!}
</span>
</a>
</li>
@dispatchEvent('afterProjectCreateLink')
@endif

@if ($login::userIsAtLeast("manager"))
@dispatchEvent('beforeProjectCreateLink')
<li><a href="{{ $startSomethingUrl }}">
<span class="fancyLink">
{!! __('menu.create_something_new') !!}
</span>
</a>
</li>
@dispatchEvent('afterProjectCreateLink')
@endif
</ul>
</div>
@endif

</ul>
</div>
@endif
<x-global::content.tabs class="overflow-y-scroll max-h-[500px] border-b !border-b-gray-500">
<x-slot:headings>
<x-global::content.tabs.heading name="myProjects">{{ __('menu.projectselector.my_projects') }}</x-global::content.tabs.heading>
<x-global::content.tabs.heading name="favorites">{{ __('menu.projectselector.favorites') }}</x-global::content.tabs.heading>
<x-global::content.tabs.heading name="recent">{{ __('menu.projectselector.recent') }}</x-global::content.tabs.heading>
<x-global::content.tabs.heading name="allProjects">{{ __('menu.projectselector.all_projects') }}</x-global::content.tabs.heading>
</x-slot:headings>
<x-slot:contents>
<x-global::content.tabs.content name="myProjects" class="">
@include('menu::includes.projectListFilter', ['clients' => $clients, 'projectSelectFilter' => $projectSelectFilter])
<ul class="selectorList projectList htmx-loaded-content">
@if($projectSelectFilter["groupBy"] == "client")
@include('menu::includes.clientGroup', ['projects' => $allAssignedProjects, 'parent' => 0, 'level'=> 0, "prefix" => "myClientProjects", "currentProject"=>$currentProject])
@elseif($projectSelectFilter["groupBy"] == "structure")
@include('menu::includes.projectGroup', ['projects' => $projectHierarchy, 'parent' => 0, 'level'=> 0, "prefix" => "myProjects", "currentProject"=>$currentProject])
@else
@include('menu::includes.noGroup', ['projects' => $allAssignedProjects, "currentProject"=>$currentProject])
@endif
</ul>
</x-global::content.tabs.content>

<x-global::content.tabs.content name="favorites" class="">
<ul class="selectorList projectList" hx-boost="true" hx-indicator="#global-loader">
@if(count($favoriteProjects) >= 1)
@include('menu::includes.noGroup', ['projects' => $favoriteProjects])
@else
<li><span class='info'>
{{ __("text.you_have_not_favorited_any_projects") }}
</span>
</li>
@endif
</ul>
</x-global::content.tabs.content>

<div class="tabbedwidget tab-primary projectSelectorTabs">
<ul class="tabs">
<li><a href="#myProjects">{{ __('menu.projectselector.my_projects') }}</a></li>
<li><a href="#favorites">{{ __('menu.projectselector.favorites') }}</a></li>
<li><a href="#recentProjects">{{ __('menu.projectselector.recent') }}</a></li>
<li><a href="#allProjects">{{ __('menu.projectselector.all_projects') }}</a></li>
</ul>
<x-global::content.tabs.content name="allProjects" class="">
@include('menu::includes.projectListFilter', ['clients' => $clients, 'projectSelectFilter' => $projectSelectFilter])
<ul class="selectorList projectList htmx-loaded-content" hx-boost="true" hx-indicator="#global-loader">
@if($projectSelectFilter["groupBy"] == "client")
@include('menu::includes.clientGroup', ['projects' => $allAvailableProjects, 'parent' => 0, 'level'=> 0, "prefix" => "allClientProjects", "currentProject"=>$currentProject])
@elseif($projectSelectFilter["groupBy"] == "structure")
@include('menu::includes.projectGroup', ['projects' => $allAvailableProjectsHierarchy, 'parent' => 0, 'level'=> 0, "prefix" => "allProjects", "currentProject"=>$currentProject])
@else
@include('menu::includes.noGroup', ['projects' => $allAvailableProjects, "currentProject"=>$currentProject])
@endif
</ul>
</x-global::content.tabs.content>

<div id="myProjects" class="scrollingTab">
@include('menu::includes.projectListFilter', ['clients' => $clients, 'projectSelectFilter' => $projectSelectFilter])
<ul class="selectorList projectList htmx-loaded-content">
@if($projectSelectFilter["groupBy"] == "client")
@include('menu::includes.clientGroup', ['projects' => $allAssignedProjects, 'parent' => 0, 'level'=> 0, "prefix" => "myClientProjects", "currentProject"=>$currentProject])
@elseif($projectSelectFilter["groupBy"] == "structure")
@include('menu::includes.projectGroup', ['projects' => $projectHierarchy, 'parent' => 0, 'level'=> 0, "prefix" => "myProjects", "currentProject"=>$currentProject])
@else
@include('menu::includes.noGroup', ['projects' => $allAssignedProjects, "currentProject"=>$currentProject])
@endif
</ul>
</div>
<div id="allProjects" class="scrollingTab">
@include('menu::includes.projectListFilter', ['clients' => $clients, 'projectSelectFilter' => $projectSelectFilter])
<ul class="selectorList projectList htmx-loaded-content" hx-boost="true" hx-indicator="#global-loader">
@if($projectSelectFilter["groupBy"] == "client")
@include('menu::includes.clientGroup', ['projects' => $allAvailableProjects, 'parent' => 0, 'level'=> 0, "prefix" => "allClientProjects", "currentProject"=>$currentProject])
@elseif($projectSelectFilter["groupBy"] == "structure")
@include('menu::includes.projectGroup', ['projects' => $allAvailableProjectsHierarchy, 'parent' => 0, 'level'=> 0, "prefix" => "allProjects", "currentProject"=>$currentProject])
@else
@include('menu::includes.noGroup', ['projects' => $allAvailableProjects, "currentProject"=>$currentProject])
@endif
</ul>
</div>
<div id="recentProjects" class="scrollingTab">
<ul class="selectorList projectList" hx-boost="true" hx-indicator="#global-loader">
@if(count($recentProjects) >= 1)
@include('menu::includes.noGroup', ['projects' => $recentProjects])
@else
<li class='nav-header'></li>
<li><span class='info'>
<x-global::content.tabs.content name="recent" class="">
<ul class="selectorList projectList" hx-boost="true" hx-indicator="#global-loader">
@if(count($recentProjects) >= 1)
@include('menu::includes.noGroup', ['projects' => $recentProjects])
@else
<li class='nav-header'></li>
<li><span class='info'>
{{ __("menu.you_dont_have_projects") }}
</span>
</li>
@endif
</ul>
</div>
<div id="favorites" class="scrollingTab">
<ul class="selectorList projectList" hx-boost="true" hx-indicator="#global-loader">
@if(count($favoriteProjects) >= 1)
@include('menu::includes.noGroup', ['projects' => $favoriteProjects])
@else
<li><span class='info'>
{{ __("text.you_have_not_favorited_any_projects") }}
</span>
</li>
@endif
</ul>
</div>
</div>
</li>
@endif
</ul>
</x-global::content.tabs.content>

</x-slot:contents>
</x-global::content.tabs>



@if ($menuType == 'project' || $menuType == 'default')
@if ($menuType == 'project' || $menuType == 'default')
<div class="projectSelectorFooter">
<ul class="selectorList projectList" hx-boost="true" hx-indicator="#global-loader">

Expand Down
10 changes: 5 additions & 5 deletions app/Views/Templates/components/elements/leadingVisual.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
'leadingVisual' => ''
])

@if($leadingVisual)
<span class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
{!! $leadingVisual !!}
</span>
@endif

<span class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
{!! $slot !!}
</span>

30 changes: 17 additions & 13 deletions app/Views/Templates/components/forms/select/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
'autocompleteTags' => false,
'formHash' => md5(CURRENT_URL."selectChoices".mt_rand(0,100)),
'value' => '',
'maxItemCount' => ''
'maxItemCount' => '',
'name' => '',
])

@php
Expand Down Expand Up @@ -79,18 +80,21 @@
@endif

<div {{$attributes->merge(['class' => ($variant === 'tags' ? 'tags inline-block w-full' : '')])}} >
@if($leadingVisual)
<span class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
{{ $leadingVisual }}>
</span>
@endif

<select
{{$attributes->merge(['class' => $selectClassBuilder ])}}
{{ $state === 'disabled' ? 'disabled' : '' }}
{{ $variant === 'multiple' || $variant === 'tags' ? 'multiple' : '' }}>
{{ $slot }}
</select>
<div class="flex flex-row">
@if($leadingVisual)
<x-global::elements.leadingVisual>
{{ $leadingVisual }}
</x-global::elements.leadingVisual>
@endif

<select
{{$attributes->merge(['class' => $selectClassBuilder ])}}
name="{{ $name }}"
{{ $state === 'disabled' ? 'disabled' : '' }}
{{ $variant === 'multiple' || $variant === 'tags' ? 'multiple' : '' }}>
{{ $slot }}
</select>
</div>

</div>

Expand Down
Loading

0 comments on commit c20697f

Please sign in to comment.