Andrew Wallo před 4 měsíci
rodič
revize
d36f466115

+ 15
- 7
app/Services/ReportService.php Zobrazit soubor

@@ -21,6 +21,7 @@ use App\Enums\Accounting\BillStatus;
21 21
 use App\Enums\Accounting\DocumentEntityType;
22 22
 use App\Enums\Accounting\InvoiceStatus;
23 23
 use App\Enums\Accounting\TransactionType;
24
+use App\Filament\Company\Resources\Accounting\TransactionResource\Pages\ViewTransaction;
24 25
 use App\Models\Accounting\Account;
25 26
 use App\Models\Accounting\Bill;
26 27
 use App\Models\Accounting\Invoice;
@@ -274,9 +275,10 @@ class ReportService
274 275
         return new ReportDTO(categories: $reportCategories, fields: $columns);
275 276
     }
276 277
 
278
+    // TODO: Refactor and potentially only use the url
277 279
     private function determineTableAction(Transaction $transaction): array
278 280
     {
279
-        if ($transaction->transactionable_type === null || $transaction->is_payment) {
281
+        if ($transaction->transactionable_type === null) {
280 282
             return [
281 283
                 'type' => 'transaction',
282 284
                 'action' => match ($transaction->type) {
@@ -286,13 +288,19 @@ class ReportService
286 288
                 },
287 289
                 'id' => $transaction->id,
288 290
             ];
291
+        } elseif ($transaction->is_payment) {
292
+            return [
293
+                'type' => 'view_transaction',
294
+                'url' => ViewTransaction::getUrl(['record' => $transaction->id]),
295
+                'id' => $transaction->id,
296
+            ];
297
+        } else {
298
+            return [
299
+                'type' => 'transactionable',
300
+                'model' => $transaction->transactionable_type,
301
+                'id' => $transaction->transactionable_id,
302
+            ];
289 303
         }
290
-
291
-        return [
292
-            'type' => 'transactionable',
293
-            'model' => $transaction->transactionable_type,
294
-            'id' => $transaction->transactionable_id,
295
-        ];
296 304
     }
297 305
 
298 306
     public function buildTrialBalanceReport(string $trialBalanceType, string $asOfDate, array $columns = []): ReportDTO

+ 11
- 0
resources/views/components/company/tables/reports/account-transactions.blade.php Zobrazit soubor

@@ -64,6 +64,17 @@
64 64
                                         >
65 65
                                             {{ $cell['description'] }}
66 66
                                         </x-filament::link>
67
+                                    @elseif($cell['tableAction']['type'] === 'view_transaction')
68
+                                        <x-filament::link
69
+                                            :href="$cell['tableAction']['url']"
70
+                                            target="_blank"
71
+                                            color="primary"
72
+                                            icon="heroicon-o-arrow-top-right-on-square"
73
+                                            :icon-position="$iconPosition"
74
+                                            icon-size="w-4 h-4 min-w-4 min-h-4"
75
+                                        >
76
+                                            {{ $cell['description'] }}
77
+                                        </x-filament::link>
67 78
                                     @else
68 79
                                         <x-filament::link
69 80
                                             :href="$cell['tableAction']['model'] === Bill::class

Načítá se…
Zrušit
Uložit