Skip to content

Commit

Permalink
Fix dispaly donation resource (#370)
Browse files Browse the repository at this point in the history
* fix labels

* fix
  • Loading branch information
gheorghelupu17 authored Jun 7, 2024
1 parent 52e24a0 commit e4f0344
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
9 changes: 5 additions & 4 deletions app/Console/Commands/ProcessEuPlatescTransactions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Console\Commands;

use App\Enums\EuPlatescStatus;
Expand Down Expand Up @@ -32,17 +34,18 @@ public function handle(): void
{
$organizations = $this->getOrganizationsWithOpenDonations();

Log::info('Processing EuPlatesc transactions'.count($organizations));
Log::info('Processing EuPlatesc transactions' . \count($organizations));
foreach ($organizations as $organization) {
$organizationID = $organization->id;
$service = new EuPlatescService($organizationID);
if (!$service->canCaptureTransaction()) {
if (! $service->canCaptureTransaction()) {
continue;
}

foreach ($organization->donations as $donation) {
if ($service->recipeTransaction($donation)) {
$donation->update(['status' => EuPlatescStatus::CAPTURE]);
$donation->update(['status_updated_at' => now()]);
}
}
}
Expand All @@ -53,7 +56,5 @@ private function getOrganizationsWithOpenDonations(): Collection|array
return Organization::query()
->withWhereHas('donations', fn ($query) => $query->whereNotNull('ep_id')->where('donations.status', EuPlatescStatus::AUTHORIZED))
->get();

}

}
11 changes: 3 additions & 8 deletions app/Filament/Resources/DonationResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,13 @@ public static function table(Table $table): Table
->label(__('donation.labels.created_at'))
->searchable()
->sortable(),
TextColumn::make('created_at')
->formatStateUsing(fn (Donation $record) => $record->created_at->format('Y-m-d H:i'))
->label(__('donation.labels.created_at'))
->searchable()
->sortable(),
TextColumn::make('charge_date')
TextColumn::make('status_updated_at')
->formatStateUsing(fn (Donation $record) => $record->charge_date?->format('Y-m-d H:i'))
->label(__('donation.labels.charge_date'))
->label(__('donation.labels.status_updated_at'))
->searchable()
->sortable(),
TextColumn::make('status')
->label(__('donation.labels.organization'))
->label(__('donation.labels.status'))
->formatStateUsing(fn (Donation $record) => __($record->status->label()))
->searchable()
->sortable(),
Expand Down
1 change: 1 addition & 0 deletions lang/ro/donation.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'count' => 'Numar donatii',
'count_with_amount' => 'Numarul de dontatii :count ( :total RON)',
'donors' => 'Donatori',
'status_updated_at' => 'Data actualizării statusului',
],

'statuses' => [
Expand Down

0 comments on commit e4f0344

Please sign in to comment.