|
@@ -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
|