This commit is contained in:
Martin Folkerts 2024-02-14 21:26:53 +01:00
parent 645929ae4e
commit 696d2214d3
6 changed files with 49 additions and 14 deletions

View file

@ -56,7 +56,6 @@ public function saveDownloads()
$this->project->startDownload($date); $this->project->startDownload($date);
}); });
$this->showDownloadModal = false; $this->showDownloadModal = false;
} }

View file

@ -55,7 +55,10 @@ private function resetFormData()
public function render() public function render()
{ {
return view('livewire.projects.mailing-manager', [ return view('livewire.projects.mailing-manager', [
'mailings' => $this->project->mailings()->orderBy('created_at', 'desc')->paginate(10, pageName: 'mailingPage'), 'mailings' => $this->project
->mailings()
->orderBy('created_at', 'desc')
->paginate(10, pageName: 'mailingPage'),
]); ]);
} }
} }

View file

@ -5,9 +5,12 @@
use App\Jobs\ProjectMosiacGeneratorJob; use App\Jobs\ProjectMosiacGeneratorJob;
use App\Models\Project; use App\Models\Project;
use Livewire\Component; use Livewire\Component;
use Livewire\WithPagination;
class MosaicManager extends Component class MosaicManager extends Component
{ {
use WithPagination;
public $project; public $project;
public $formData = [ public $formData = [
@ -23,7 +26,10 @@ public function mount(Project $project) {
public function render() public function render()
{ {
return view('livewire.projects.mosaic-manager', [ return view('livewire.projects.mosaic-manager', [
'downloads' => $this->project 'mosaics' => $this->project->mosaics()
->orderBy('year','desc')
->orderBy('week', 'desc')
->paginate(10, pageName: 'mosaicPage')
]); ]);
} }

View file

@ -7,9 +7,12 @@
use App\Models\ProjectReport; use App\Models\ProjectReport;
use App\Rules\AllMosaicsPresentRule; use App\Rules\AllMosaicsPresentRule;
use Livewire\Component; use Livewire\Component;
use Livewire\WithPagination;
class ReportManager extends Component class ReportManager extends Component
{ {
use WithPagination;
public $formData = []; public $formData = [];
public $project_id; public $project_id;
@ -30,8 +33,12 @@ public function mount(Project $project)
public function render() public function render()
{ {
$project = Project::find($this->project_id); $reports = Project::find($this->project_id)
return view('livewire.projects.report-manager')->with(compact('project')); ->reports()
->orderBy('year', 'desc')
->orderBy('week', 'desc')
->paginate(10, pageName: 'reportPage');
return view('livewire.projects.report-manager')->with(compact('reports'));
} }
private function resetFormData() private function resetFormData()

View file

@ -26,6 +26,9 @@ class="block rounded-md bg-indigo-600 px-3 py-2 text-center text-sm font-semibol
class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 lg:pl-8"> class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 lg:pl-8">
Name Name
</th> </th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
Year-Week
</th>
<th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"> <th scope="col" class="px-3 py-3.5 text-left text-sm font-semibold text-gray-900">
Status Status
</th> </th>
@ -35,20 +38,30 @@ class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 lg
</tr> </tr>
</thead> </thead>
<tbody class="divide-y divide-gray-200 bg-white"> <tbody class="divide-y divide-gray-200 bg-white">
@foreach($project->mosaics()->orderBy('year','desc')->orderBy('week', 'desc')->get() as $mosaic) @foreach($mosaics as $mosaic)
<tr> <tr>
<td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6 lg:pl-8">{{ $project->name }}</td> <td class="whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-6 lg:pl-8">{{ $mosaic->name }}</td>
<td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500"> <td class="whitespace-nowrap px-3 py-4 text-sm text-gray-500">
{{ $mosaic->name }}-{{ $mosaic->week}} {{ $mosaic->year }}-{{ $mosaic->week}}
</td>
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-left text-sm font-medium sm:pr-6 lg:pr-8">
<x-badge :status="$mosaic->status"></x-badge>
</td> </td>
<td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6 lg:pr-8"> <td class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-6 lg:pr-8">
<x-badge :status="$mosaic->status"></x-badge>
</td> </td>
</tr> </tr>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="pt-4 flex justify-between items-center">
<div class="text-gray-700 text-sm">
Results: {{ \Illuminate\Support\Number::format($mosaics->total()) }}
</div>
{{ $mosaics->links('livewire.pagination') }}
</div>
</div> </div>
</div> </div>
</div> </div>

View file

@ -37,12 +37,19 @@ class="py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 lg
</tr> </tr>
</thead> </thead>
<tbody class="divide-y divide-gray-200 bg-white"> <tbody class="divide-y divide-gray-200 bg-white">
@foreach($project->reports()->orderBy('year', 'desc')->orderBy('week', 'desc')->get() as $report) @foreach($reports as $report)
<livewire:project.report-row :$report :key="$report->id"/> <livewire:project.report-row :$report :key="$report->id"/>
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="pt-4 flex justify-between items-center">
<div class="text-gray-700 text-sm">
Results: {{ \Illuminate\Support\Number::format($reports->total()) }}
</div>
{{ $reports->links('livewire.pagination') }}
</div>
</div> </div>
</div> </div>
</div> </div>