Skip to content

Commit

Permalink
Merge pull request #1558 from Ecodenl/feature/export-date
Browse files Browse the repository at this point in the history
Add last updated at
  • Loading branch information
Yinci authored Jan 10, 2024
2 parents 36afacd + 6645d7b commit 7660479
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 48 deletions.
10 changes: 8 additions & 2 deletions app/Services/DumpService.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public function createHeaderStructure(string $short): self
if ($this->anonymize) {
$headers = [
__('woningdossier.cooperation.admin.cooperation.reports.csv-columns.created-at'),
__('woningdossier.cooperation.admin.cooperation.reports.csv-columns.updated-at'),
__('woningdossier.cooperation.admin.cooperation.reports.csv-columns.status'),

__('woningdossier.cooperation.admin.cooperation.reports.csv-columns.zip-code'),
Expand All @@ -139,6 +140,7 @@ public function createHeaderStructure(string $short): self
} else {
$headers = [
__('woningdossier.cooperation.admin.cooperation.reports.csv-columns.created-at'),
__('woningdossier.cooperation.admin.cooperation.reports.csv-columns.updated-at'),
__('woningdossier.cooperation.admin.cooperation.reports.csv-columns.coach-appointment-date'),
__('woningdossier.cooperation.admin.cooperation.reports.csv-columns.status'),

Expand Down Expand Up @@ -189,6 +191,10 @@ public function generateDump(bool $withConditionalLogic = true): array
$inputSource = $this->inputSource;

$createdAt = optional($user->created_at)->format('Y-m-d');
$updatedAt = $this->user->userActionPlanAdvices()
->forInputSource($inputSource)
->orderByDesc('updated_at')
->value('updated_at');
$mostRecentStatus = $building->getMostRecentBuildingStatus();

if (! $mostRecentStatus instanceof BuildingStatus) {
Expand All @@ -205,7 +211,7 @@ public function generateDump(bool $withConditionalLogic = true): array

if ($this->anonymize) {
$data = [
$createdAt, $buildingStatus, $postalCode, $city,
$createdAt, $updatedAt, $buildingStatus, $postalCode, $city,
];
} else {
$allowAccess = $user->allowedAccess() ? 'Ja' : 'Nee';
Expand All @@ -228,7 +234,7 @@ public function generateDump(bool $withConditionalLogic = true): array
$appointmentDate = optional($mostRecentStatus->appointment_date)->format('Y-m-d');

$data = [
$createdAt, $appointmentDate, $buildingStatus, $allowAccess, $connectedCoachNames,
$createdAt, $updatedAt, $appointmentDate, $buildingStatus, $allowAccess, $connectedCoachNames,
$firstName, $lastName, $email, $phoneNumber,
$street, trim($number . ' ' . $extension), $postalCode, $city,
];
Expand Down
1 change: 1 addition & 0 deletions resources/lang/nl/woningdossier.php
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@
'csv-columns' => [
'input-source' => 'Rol',
'created-at' => 'Datum account',
'updated-at' => 'Laatste wijziging',
'coach-appointment-date' => 'Datum afspraak coachgesprek',
'status' => 'Status',
'allow-access' => 'Toestemming aanwezig',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,56 +31,55 @@
<table id="table" class="table table-striped table-bordered compact nowrap table-responsive"
style="width: 100%">
<thead>
<tr>
<th>{{\App\Helpers\Translation::translate('woningdossier.cooperation.admin.cooperation.reports.index.table.columns.name')}}</th>
<th>{{\App\Helpers\Translation::translate('woningdossier.cooperation.admin.cooperation.reports.index.table.columns.download')}}</th>
</tr>
<tr>
<th>{{\App\Helpers\Translation::translate('woningdossier.cooperation.admin.cooperation.reports.index.table.columns.name')}}</th>
<th>{{\App\Helpers\Translation::translate('woningdossier.cooperation.admin.cooperation.reports.index.table.columns.download')}}</th>
</tr>
</thead>
<tbody>
@foreach($reportFileTypeCategory->fileTypes as $fileType)
@if(in_array($fileType->short, ['custom-questionnaire-report-anonymized', 'custom-questionnaire-report']))
@include('cooperation.admin.cooperation.reports.parts.file-type-questionnaire-table-row')
@else
<tr>
<td>
{{$fileType->name}}
<ul>
@php $fileStorage = $fileType->files()->mostRecent()->first(); @endphp
@if($fileStorage instanceof \App\Models\FileStorage)
<li>
<a @if(!$fileType->isBeingProcessed() )
href="{{route('cooperation.file-storage.download', compact('fileStorage'))}}" @endif>
{{$fileType->name}}
({{$fileStorage->created_at->format('Y-m-d H:i')}})
</a>
</li>
@endif
</ul>
</td>
@foreach($reportFileTypeCategory->fileTypes as $fileType)
@if(in_array($fileType->short, ['custom-questionnaire-report-anonymized', 'custom-questionnaire-report']))
@include('cooperation.admin.cooperation.reports.parts.file-type-questionnaire-table-row')
@else
<tr>
<td>
{{$fileType->name}}
<ul>
@php $fileStorage = $fileType->files()->mostRecent()->first(); @endphp
@if($fileStorage instanceof \App\Models\FileStorage)
<li>
<a @if(! $fileType->isBeingProcessed()) href="{{route('cooperation.file-storage.download', compact('fileStorage'))}}" @endif>
{{$fileType->name}}
({{$fileStorage->created_at->format('Y-m-d H:i')}})
</a>
</li>
@endif
</ul>
</td>

<td>
<form action="{{route('cooperation.file-storage.store', ['fileType' => $fileType->short])}}"
method="post">
@csrf
<button
@if($fileType->isBeingProcessed()) disabled="disabled" type="button"
data-toggle="tooltip"
title="@lang('woningdossier.cooperation.admin.cooperation.reports.index.table.report-in-queue')"
@else
type="submit"
<td>
<form action="{{route('cooperation.file-storage.store', ['fileType' => $fileType->short])}}"
method="post">
@csrf
<button class="btn btn-{{$fileType->isBeingProcessed() ? 'warning' : 'primary'}}"
@if($fileType->isBeingProcessed()) disabled="disabled"
type="button"
data-toggle="tooltip"
title="@lang('woningdossier.cooperation.admin.cooperation.reports.index.table.report-in-queue')"
@else
type="submit"
@endif
>
@lang('cooperation/frontend/tool.my-plan.downloads.create-report')
@if($fileType->isBeingProcessed() )
<span class="glyphicon glyphicon-repeat fast-right-spinner"></span>
@endif
class="btn btn-{{$fileType->isBeingProcessed() ? 'warning' : 'primary'}}"
>
@lang('cooperation/frontend/tool.my-plan.downloads.create-report')
@if($fileType->isBeingProcessed() )
<span class="glyphicon glyphicon-repeat fast-right-spinner"></span>
@endif
</button>
</form>
</td>
</tr>
@endif
@endforeach
</button>
</form>
</td>
</tr>
@endif
@endforeach
</tbody>
</table>
</div>
Expand Down

0 comments on commit 7660479

Please sign in to comment.