[Done] PendinMessage works on every tab

This commit is contained in:
guillaume91 2024-05-29 16:59:56 +02:00
parent c349a78f14
commit 43dd3c5e09
6 changed files with 4 additions and 21 deletions

View file

@ -17,17 +17,11 @@ class PendingMessage extends Component
public function mount(Project $project,string $type = null): void
{
logger('in PendingMessage->mount();');
$this->project = Project::find($project->id);
$this->type = $type;
$this->count = static::getPendingCount($project,$type);
}
public function boot()
{
logger('in PendingMessage->boot();');
}
public static function getPendingCount(Project $p,string $t): int
{
return (match($t){
@ -40,7 +34,6 @@ public static function getPendingCount(Project $p,string $t): int
public function updateSelf()
{
logger($this->attributes->toJson());
$this->count = static::getPendingCount($this->project, $this->type);
}

View file

@ -87,6 +87,7 @@ public function render()
$query = $this->applySearch($query);
$downloads = $query->paginate(10, pageName: 'downloadPage');
logger(sprintf('%s %s', __CLASS__, now()));
return view('livewire.projects.tabs.download',
compact('downloads')
);

View file

@ -2,11 +2,7 @@
<div class="sm:flex sm:flex-col">
<div class="flex flex-col md:flex-row md:justify-between items-center w-full my-4">
<h1 class="text-base font-semibold leading-6 text-gray-900">Downloads</h1>
@if ($project->hasPendingDownload())
<p class="text-base text-gray-700 animate-pulse">
Pending downloads for this project: {{ $project->downloads()->statusPending()->count() }}
</p>
@endif
<livewire:components.pending-message :project="$project" type="downloads"></livewire:components.pending-message>
</div>
<div class="mt-4 sm:mt-0 flex flex-col sm:flex-row sm:justify-between gap-2">
<x-search class="flex-1 w-full"></x-search>

View file

@ -3,7 +3,7 @@
<div class="sm:flex sm:flex-col sm:items-center">
<div class="w-full flex justify-between my-4">
<h1 class="text-base font-semibold leading-6 text-gray-900">{{ __('Mailing') }}</h1>
<p class="mt-2 text-sm text-gray-700"></p>
<livewire:components.pending-message :project="$project" type="mailings"></livewire:components.pending-message>
</div>
<div class="mt-4 sm:mt-0 sm:flex sm:justify-between w-full">
<x-search></x-search>

View file

@ -3,11 +3,7 @@
<div class="sm:flex sm:flex-col sm:items-center">
<div class="flex justify-between w-full my-4">
<h1 class="text-base font-semibold leading-6 text-gray-900">Mosaics</h1>
@if ($project->hasPendingMosaic())
<p class="text-base text-gray-700 animate-pulse">
Pending mosaics for this project: {{ $project->mosaics()->statusPending()->count() }}
</p>
@endif
<livewire:components.pending-message :project="$project" type="mosaics"></livewire:components.pending-message>
</div>
<div class="flex flex-col md:flex-row mt-4 items-center md:justify-between w-full gap-2">
<x-search class="flex-1 w-full"></x-search>

View file

@ -3,10 +3,7 @@
<div class="sm:flex sm:flex-col sm:items-center">
<div class="w-full flex justify-between my-4">
<h1 class="text-base font-semibold leading-6 text-gray-900">Reports</h1>
{{-- @if($project->hasPendingReport())--}}
{{-- <p class="text-base text-gray-700 animate-pulse"> Pending reports for this project: {{ $project->reports()->statusPending()->count() }}</p>--}}
<livewire:components.pending-message :project="$project" type="reports"></livewire:components.pending-message>
{{-- @endif--}}
</div>
<div class="mt-4 md:mt-0 flex flex-col md:flex md:justify-between md:flex-row w-full gap-2">
<x-search></x-search>