Przeglądaj źródła

feat: multi-currency double-entry accounting

3.x
wallo 1 rok temu
rodzic
commit
a488d0c37d

+ 43
- 0
app/Casts/TransactionAmountCast.php Wyświetl plik

@@ -0,0 +1,43 @@
1
+<?php
2
+
3
+namespace App\Casts;
4
+
5
+use App\Utilities\Currency\CurrencyAccessor;
6
+use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
7
+use Illuminate\Database\Eloquent\Model;
8
+use UnexpectedValueException;
9
+
10
+class TransactionAmountCast implements CastsAttributes
11
+{
12
+    public function get(Model $model, string $key, mixed $value, array $attributes): string
13
+    {
14
+        // Attempt to retrieve the currency code from the related bankAccount->account model
15
+        $currency_code = $model->bankAccount?->account?->currency_code ?? CurrencyAccessor::getDefaultCurrency();
16
+
17
+        if ($value !== null) {
18
+            return money($value, $currency_code)->formatSimple();
19
+        }
20
+
21
+        return '';
22
+    }
23
+
24
+    /**
25
+     * @throws UnexpectedValueException
26
+     */
27
+    public function set(Model $model, string $key, mixed $value, array $attributes): int
28
+    {
29
+        $currency_code = $model->bankAccount?->account?->currency_code ?? CurrencyAccessor::getDefaultCurrency();
30
+
31
+        if (! $currency_code) {
32
+            throw new UnexpectedValueException('Currency code is not set');
33
+        }
34
+
35
+        if (is_numeric($value)) {
36
+            $value = (string) $value;
37
+        } elseif (! is_string($value)) {
38
+            throw new UnexpectedValueException('Expected string or numeric value for money cast');
39
+        }
40
+
41
+        return money($value, $currency_code, true)->getAmount();
42
+    }
43
+}

+ 1
- 3
app/Contracts/AccountHandler.php Wyświetl plik

@@ -24,9 +24,7 @@ interface AccountHandler
24 24
 
25 25
     public function getBalances(Account $account, string $startDate, string $endDate): array;
26 26
 
27
-    public function getBalancesFormatted(Account $account, string $startDate, string $endDate): AccountBalanceDTO;
28
-
29
-    public function formatBalances(array $balances, string $currency): AccountBalanceDTO;
27
+    public function formatBalances(array $balances): AccountBalanceDTO;
30 28
 
31 29
     public function buildAccountBalanceReport(string $startDate, string $endDate): AccountBalanceReportDTO;
32 30
 

+ 1
- 2
app/Facades/Accounting.php Wyświetl plik

@@ -18,8 +18,7 @@ use Illuminate\Support\Facades\Facade;
18 18
  * @method static BalanceValue|null getEndingBalance(Account $account, string $startDate, string $endDate)
19 19
  * @method static int calculateNetMovementByCategory(AccountCategory $category, int $debitBalance, int $creditBalance)
20 20
  * @method static array getBalances(Account $account, string $startDate, string $endDate)
21
- * @method static AccountBalanceDTO getBalancesFormatted(Account $account, string $startDate, string $endDate)
22
- * @method static AccountBalanceDTO formatBalances(array $balances, string $currency)
21
+ * @method static AccountBalanceDTO formatBalances(array $balances)
23 22
  * @method static AccountBalanceReportDTO buildAccountBalanceReport(string $startDate, string $endDate)
24 23
  * @method static BalanceValue getTotalBalanceForAllBankAccounts(string $startDate, string $endDate)
25 24
  * @method static array getAccountCategoryOrder()

+ 1
- 1
app/Filament/Company/Pages/Accounting/Transactions.php Wyświetl plik

@@ -730,7 +730,7 @@ class Transactions extends Page implements HasTable
730 730
 
731 731
     protected function getAccountBalance(Account $account): ?string
732 732
     {
733
-        return Accounting::getEndingBalance($account, $this->fiscalYearStartDate, $this->fiscalYearEndDate)?->formatted();
733
+        return Accounting::getEndingBalance($account, $this->fiscalYearStartDate, $this->fiscalYearEndDate)?->formattedForDisplay();
734 734
     }
735 735
 
736 736
     protected function getBalanceForAllAccounts(): string

+ 2
- 67
app/Filament/Company/Resources/Banking/AccountResource.php Wyświetl plik

@@ -9,12 +9,10 @@ use App\Facades\Forex;
9 9
 use App\Filament\Company\Resources\Banking\AccountResource\Pages;
10 10
 use App\Models\Accounting\AccountSubtype;
11 11
 use App\Models\Banking\BankAccount;
12
-use App\Services\AccountService;
13 12
 use App\Utilities\Currency\CurrencyAccessor;
14 13
 use BackedEnum;
15 14
 use Filament\Forms;
16 15
 use Filament\Forms\Form;
17
-use Filament\Notifications\Notification;
18 16
 use Filament\Resources\Resource;
19 17
 use Filament\Support\Enums\FontWeight;
20 18
 use Filament\Tables;
@@ -176,78 +174,15 @@ class AccountResource extends Resource
176 174
                     ->iconPosition('after')
177 175
                     ->description(static fn (BankAccount $record) => $record->mask ?: 'N/A')
178 176
                     ->sortable(),
179
-                Tables\Columns\TextColumn::make('account.code') // Just so I could display the balance in the table for now
177
+                Tables\Columns\TextColumn::make('account.ending_balance')
180 178
                     ->localizeLabel('Current Balance')
181
-                    ->sortable()
182
-                    ->formatStateUsing(function (BankAccount $record) {
183
-                        $accountService = app(AccountService::class);
184
-                        $startDate = $record->account->company->locale->fiscalYearStartDate();
185
-                        $endDate = $record->account->company->locale->fiscalYearEndDate();
186
-
187
-                        return $accountService->getEndingBalance($record->account, $startDate, $endDate)?->formatted();
188
-                    }),
179
+                    ->sortable(),
189 180
             ])
190 181
             ->filters([
191 182
                 //
192 183
             ])
193 184
             ->actions([
194 185
                 Tables\Actions\EditAction::make(),
195
-                Tables\Actions\Action::make('update_balance')
196
-                    ->hidden(function (BankAccount $record) {
197
-                        $usesDefaultCurrency = $record->account->currency->isEnabled();
198
-                        $forexDisabled = Forex::isDisabled();
199
-                        $sameExchangeRate = $record->account->currency->rate === $record->account->currency->live_rate;
200
-
201
-                        return $usesDefaultCurrency || $forexDisabled || $sameExchangeRate;
202
-                    })
203
-                    ->label('Update Balance')
204
-                    ->icon('heroicon-o-currency-dollar')
205
-                    ->requiresConfirmation()
206
-                    ->modalDescription('Are you sure you want to update the balance with the latest exchange rate?')
207
-                    ->before(static function (Tables\Actions\Action $action, BankAccount $record) {
208
-                        if ($record->account->currency->isDisabled()) {
209
-                            $defaultCurrency = CurrencyAccessor::getDefaultCurrency();
210
-                            $exchangeRate = Forex::getCachedExchangeRate($defaultCurrency, $record->account->currency_code);
211
-                            if ($exchangeRate === null) {
212
-                                Notification::make()
213
-                                    ->warning()
214
-                                    ->title(__('Exchange Rate Unavailable'))
215
-                                    ->body(__('The exchange rate for this account is currently unavailable. Please try again later.'))
216
-                                    ->persistent()
217
-                                    ->send();
218
-
219
-                                $action->cancel();
220
-                            }
221
-                        }
222
-                    })
223
-                    ->action(static function (BankAccount $record) {
224
-                        if ($record->account->currency->isDisabled()) {
225
-                            $defaultCurrency = CurrencyAccessor::getDefaultCurrency();
226
-                            $exchangeRate = Forex::getCachedExchangeRate($defaultCurrency, $record->account->currency_code);
227
-                            $oldExchangeRate = $record->account->currency->rate;
228
-
229
-                            if ($exchangeRate !== null && $exchangeRate !== $oldExchangeRate) {
230
-
231
-                                $scale = 10 ** $record->account->currency->precision;
232
-                                $cleanedBalance = (int) filter_var($record->account->starting_balance, FILTER_SANITIZE_NUMBER_INT);
233
-
234
-                                $newBalance = ($exchangeRate / $oldExchangeRate) * $cleanedBalance;
235
-                                $newBalanceInt = (int) round($newBalance, $scale);
236
-
237
-                                $record->account->starting_balance = money($newBalanceInt, $record->account->currency_code)->getValue();
238
-                                $record->account->currency->rate = $exchangeRate;
239
-
240
-                                $record->account->currency->save();
241
-                                $record->save();
242
-
243
-                                Notification::make()
244
-                                    ->success()
245
-                                    ->title('Balance Updated Successfully')
246
-                                    ->body(__('The :name account balance has been updated to reflect the current exchange rate.', ['name' => $record->account->name]))
247
-                                    ->send();
248
-                            }
249
-                        }
250
-                    }),
251 186
             ])
252 187
             ->bulkActions([
253 188
                 Tables\Actions\BulkActionGroup::make([

+ 42
- 31
app/Livewire/Company/Service/ConnectedAccount/ListInstitutions.php Wyświetl plik

@@ -4,12 +4,10 @@ namespace App\Livewire\Company\Service\ConnectedAccount;
4 4
 
5 5
 use App\Events\PlaidSuccess;
6 6
 use App\Events\StartTransactionImport;
7
-use App\Models\Accounting\Account;
8 7
 use App\Models\Banking\BankAccount;
9 8
 use App\Models\Banking\ConnectedBankAccount;
10 9
 use App\Models\Banking\Institution;
11 10
 use App\Models\User;
12
-use App\Services\AccountService;
13 11
 use App\Services\PlaidService;
14 12
 use Filament\Actions\Action;
15 13
 use Filament\Actions\Concerns\InteractsWithActions;
@@ -25,7 +23,9 @@ use Filament\Support\Enums\Alignment;
25 23
 use Illuminate\Contracts\View\View;
26 24
 use Illuminate\Database\Eloquent\Collection;
27 25
 use Illuminate\Support\Facades\Auth;
26
+use Illuminate\Support\Facades\DB;
28 27
 use Illuminate\Support\Facades\Log;
28
+use Illuminate\Support\Str;
29 29
 use Livewire\Attributes\Computed;
30 30
 use Livewire\Attributes\On;
31 31
 use Livewire\Component;
@@ -38,16 +38,13 @@ class ListInstitutions extends Component implements HasActions, HasForms
38 38
 
39 39
     protected PlaidService $plaidService;
40 40
 
41
-    protected AccountService $accountService;
42
-
43 41
     public User $user;
44 42
 
45 43
     public string $modalWidth;
46 44
 
47
-    public function boot(PlaidService $plaidService, AccountService $accountService): void
45
+    public function boot(PlaidService $plaidService): void
48 46
     {
49 47
         $this->plaidService = $plaidService;
50
-        $this->accountService = $accountService;
51 48
     }
52 49
 
53 50
     public function mount(): void
@@ -62,15 +59,6 @@ class ListInstitutions extends Component implements HasActions, HasForms
62 59
             ->get();
63 60
     }
64 61
 
65
-    public function getAccountBalance(Account $account): ?string
66
-    {
67
-        $company = $account->company;
68
-        $startDate = $company->locale->fiscalYearStartDate();
69
-        $endDate = $company->locale->fiscalYearEndDate();
70
-
71
-        return $this->accountService->getEndingBalance($account, $startDate, $endDate)?->formatted();
72
-    }
73
-
74 62
     public function startImportingTransactions(): Action
75 63
     {
76 64
         return Action::make('startImportingTransactions')
@@ -177,14 +165,24 @@ class ListInstitutions extends Component implements HasActions, HasForms
177 165
                     ->content('Refreshing transactions will update the selected account with the latest transactions from the bank if there are any new transactions available. This may take a few moments.'),
178 166
                 Select::make('connected_bank_account_id')
179 167
                     ->label('Select Account')
168
+                    ->softRequired()
169
+                    ->selectablePlaceholder(false)
170
+                    ->hint(
171
+                        fn (Institution $institution) => $institution->getEnabledConnectedBankAccounts()->count() . ' ' .
172
+                        Str::plural('account', $institution->getEnabledConnectedBankAccounts()->count()) . ' available'
173
+                    )
174
+                    ->hintColor('primary')
180 175
                     ->options(fn (Institution $institution) => $institution->getEnabledConnectedBankAccounts()->pluck('name', 'id')->toArray())
181
-                    ->required(),
176
+                    ->default(fn (Institution $institution) => $institution->getEnabledConnectedBankAccounts()->first()?->id),
182 177
             ])
183 178
             ->action(function (array $data) {
184 179
                 $connectedBankAccountId = $data['connected_bank_account_id'];
185 180
                 $connectedBankAccount = ConnectedBankAccount::find($connectedBankAccountId);
186
-                $access_token = $connectedBankAccount->access_token;
187
-                $this->plaidService->refreshTransactions($access_token);
181
+
182
+                if ($connectedBankAccount) {
183
+                    $access_token = $connectedBankAccount->access_token;
184
+                    $this->plaidService->refreshTransactions($access_token);
185
+                }
188 186
 
189 187
                 unset($this->connectedInstitutions);
190 188
             });
@@ -214,30 +212,43 @@ class ListInstitutions extends Component implements HasActions, HasForms
214 212
                     ->markAsRequired(false)
215 213
                     ->required(),
216 214
             ])
217
-            ->action(function (array $arguments) {
218
-                $institutionId = $arguments['institution'];
215
+            ->action(function (array $arguments, Institution $institution) {
216
+                try {
217
+                    $this->processBankConnectionDeletion($institution);
218
+                } catch (RuntimeException $e) {
219
+                    Log::error('Error deleting bank connection ' . $e->getMessage());
220
+
221
+                    $this->sendErrorNotification("We're currently experiencing issues deleting your bank connection. Please try again in a few moments.");
222
+                } finally {
223
+                    unset($this->connectedInstitutions);
224
+                }
225
+            });
226
+    }
219 227
 
220
-                $institution = Institution::find($institutionId);
228
+    private function processBankConnectionDeletion(Institution $institution): void
229
+    {
230
+        DB::transaction(function () use ($institution) {
231
+            $accessTokens = $institution->connectedBankAccounts->pluck('access_token')->unique()->toArray();
221 232
 
222
-                if ($institution) {
223
-                    $institution->connectedBankAccounts()->delete();
224
-                }
233
+            foreach ($accessTokens as $accessToken) {
234
+                $this->plaidService->removeItem($accessToken);
235
+            }
225 236
 
226
-                unset($this->connectedInstitutions);
227
-            });
237
+            $institution->connectedBankAccounts()->each(fn (ConnectedBankAccount $connectedBankAccount) => $connectedBankAccount->delete());
238
+        });
228 239
     }
229 240
 
230 241
     #[On('createToken')]
231 242
     public function createLinkToken(): void
232 243
     {
233
-        $company = $this->user->currentCompany;
244
+        try {
245
+            $company = $this->user->currentCompany;
234 246
 
235
-        $companyLanguage = $company->locale->language ?? 'en';
236
-        $companyCountry = $company->profile->country ?? 'US';
247
+            $companyLanguage = $company->locale->language ?? 'en';
248
+            $companyCountry = $company->profile->country ?? 'US';
237 249
 
238
-        $plaidUser = $this->plaidService->createPlaidUser($company);
250
+            $plaidUser = $this->plaidService->createPlaidUser($company);
239 251
 
240
-        try {
241 252
             $response = $this->plaidService->createToken($companyLanguage, $companyCountry, $plaidUser, ['transactions']);
242 253
 
243 254
             $plaidLinkToken = $response->link_token;

+ 13
- 0
app/Models/Accounting/Account.php Wyświetl plik

@@ -6,10 +6,12 @@ use App\Concerns\Blamable;
6 6
 use App\Concerns\CompanyOwned;
7 7
 use App\Enums\Accounting\AccountCategory;
8 8
 use App\Enums\Accounting\AccountType;
9
+use App\Facades\Accounting;
9 10
 use App\Models\Setting\Currency;
10 11
 use App\Observers\AccountObserver;
11 12
 use Database\Factories\Accounting\AccountFactory;
12 13
 use Illuminate\Database\Eloquent\Attributes\ObservedBy;
14
+use Illuminate\Database\Eloquent\Casts\Attribute;
13 15
 use Illuminate\Database\Eloquent\Factories\Factory;
14 16
 use Illuminate\Database\Eloquent\Factories\HasFactory;
15 17
 use Illuminate\Database\Eloquent\Model;
@@ -91,6 +93,17 @@ class Account extends Model
91 93
         return null;
92 94
     }
93 95
 
96
+    protected function endingBalance(): Attribute
97
+    {
98
+        return Attribute::get(function () {
99
+            $company = $this->company;
100
+            $fiscalYearStart = $company->locale->fiscalYearStartDate();
101
+            $fiscalYearEnd = $company->locale->fiscalYearEndDate();
102
+
103
+            return Accounting::getEndingBalance($this, $fiscalYearStart, $fiscalYearEnd)?->formattedForDisplay();
104
+        });
105
+    }
106
+
94 107
     public function isUncategorized(): bool
95 108
     {
96 109
         return $this->type->isUncategorized();

+ 2
- 2
app/Models/Accounting/Transaction.php Wyświetl plik

@@ -2,7 +2,7 @@
2 2
 
3 3
 namespace App\Models\Accounting;
4 4
 
5
-use App\Casts\MoneyCast;
5
+use App\Casts\TransactionAmountCast;
6 6
 use App\Concerns\Blamable;
7 7
 use App\Concerns\CompanyOwned;
8 8
 use App\Enums\Accounting\TransactionType;
@@ -45,7 +45,7 @@ class Transaction extends Model
45 45
 
46 46
     protected $casts = [
47 47
         'type' => TransactionType::class,
48
-        'amount' => MoneyCast::class,
48
+        'amount' => TransactionAmountCast::class,
49 49
         'pending' => 'boolean',
50 50
         'reviewed' => 'boolean',
51 51
         'posted_at' => 'datetime',

+ 34
- 7
app/Observers/TransactionObserver.php Wyświetl plik

@@ -7,6 +7,8 @@ use App\Enums\Accounting\TransactionType;
7 7
 use App\Models\Accounting\Account;
8 8
 use App\Models\Accounting\JournalEntry;
9 9
 use App\Models\Accounting\Transaction;
10
+use App\Utilities\Currency\CurrencyAccessor;
11
+use App\Utilities\Currency\CurrencyConverter;
10 12
 use Illuminate\Support\Facades\DB;
11 13
 
12 14
 class TransactionObserver
@@ -31,11 +33,20 @@ class TransactionObserver
31 33
 
32 34
     private function createJournalEntries(Transaction $transaction, Account $debitAccount, Account $creditAccount): void
33 35
     {
36
+        $defaultCurrency = CurrencyAccessor::getDefaultCurrency();
37
+        $transactionCurrency = $transaction->bankAccount->account->currency_code; // only account which would have a different currency compared to the default currency
38
+
39
+        if ($transactionCurrency !== $defaultCurrency) {
40
+            $convertedTransactionAmount = $this->convertToDefaultCurrency($transaction->amount, $transactionCurrency, $defaultCurrency);
41
+        } else {
42
+            $convertedTransactionAmount = $transaction->amount;
43
+        }
44
+
34 45
         $debitAccount->journalEntries()->create([
35 46
             'company_id' => $transaction->company_id,
36 47
             'transaction_id' => $transaction->id,
37 48
             'type' => JournalEntryType::Debit,
38
-            'amount' => $transaction->amount,
49
+            'amount' => $convertedTransactionAmount,
39 50
             'description' => $transaction->description,
40 51
         ]);
41 52
 
@@ -43,11 +54,18 @@ class TransactionObserver
43 54
             'company_id' => $transaction->company_id,
44 55
             'transaction_id' => $transaction->id,
45 56
             'type' => JournalEntryType::Credit,
46
-            'amount' => $transaction->amount,
57
+            'amount' => $convertedTransactionAmount,
47 58
             'description' => $transaction->description,
48 59
         ]);
49 60
     }
50 61
 
62
+    private function convertToDefaultCurrency(string $amount, string $fromCurrency, string $toCurrency): string
63
+    {
64
+        $amountInCents = CurrencyConverter::convertFormattedBalance($amount, $fromCurrency, $toCurrency);
65
+
66
+        return money($amountInCents, $toCurrency)->formatSimple();
67
+    }
68
+
51 69
     /**
52 70
      * Handle the Transaction "updated" event.
53 71
      */
@@ -73,11 +91,20 @@ class TransactionObserver
73 91
             return;
74 92
         }
75 93
 
94
+        $defaultCurrency = CurrencyAccessor::getDefaultCurrency();
95
+        $transactionCurrency = $transaction->bankAccount->account->currency_code; // only account which would have a different currency compared to the default currency
96
+
97
+        if ($transactionCurrency !== $defaultCurrency) {
98
+            $convertedTransactionAmount = $this->convertToDefaultCurrency($transaction->amount, $transactionCurrency, $defaultCurrency);
99
+        } else {
100
+            $convertedTransactionAmount = $transaction->amount;
101
+        }
102
+
76 103
         $debitAccount = $transaction->type === TransactionType::Withdrawal ? $chartAccount : $bankAccount;
77 104
         $creditAccount = $transaction->type === TransactionType::Withdrawal ? $bankAccount : $chartAccount;
78 105
 
79
-        $this->updateJournalEntriesForTransaction($debitEntry, $debitAccount, $transaction);
80
-        $this->updateJournalEntriesForTransaction($creditEntry, $creditAccount, $transaction);
106
+        $this->updateJournalEntriesForTransaction($debitEntry, $debitAccount, $convertedTransactionAmount);
107
+        $this->updateJournalEntriesForTransaction($creditEntry, $creditAccount, $convertedTransactionAmount);
81 108
     }
82 109
 
83 110
     protected function hasRelevantChanges(Transaction $transaction): bool
@@ -85,12 +112,12 @@ class TransactionObserver
85 112
         return $transaction->wasChanged(['amount', 'account_id', 'bank_account_id', 'type']);
86 113
     }
87 114
 
88
-    protected function updateJournalEntriesForTransaction(JournalEntry $journalEntry, Account $account, Transaction $transaction): void
115
+    protected function updateJournalEntriesForTransaction(JournalEntry $journalEntry, Account $account, string $convertedTransactionAmount): void
89 116
     {
90
-        DB::transaction(static function () use ($journalEntry, $account, $transaction) {
117
+        DB::transaction(static function () use ($journalEntry, $account, $convertedTransactionAmount) {
91 118
             $journalEntry->update([
92 119
                 'account_id' => $account->id,
93
-                'amount' => $transaction->amount,
120
+                'amount' => $convertedTransactionAmount,
94 121
             ]);
95 122
         });
96 123
     }

+ 15
- 1
app/Providers/MacroServiceProvider.php Wyświetl plik

@@ -59,7 +59,7 @@ class MacroServiceProvider extends ServiceProvider
59 59
                 $currency = $column->evaluate($currency);
60 60
                 $convert = $column->evaluate($convert);
61 61
 
62
-                return money($state, $currency, $convert)->formatWithCode();
62
+                return money($state, $currency, $convert)->format();
63 63
             });
64 64
 
65 65
             return $this;
@@ -142,6 +142,20 @@ class MacroServiceProvider extends ServiceProvider
142 142
         });
143 143
 
144 144
         Money::macro('swapAmountFor', function ($newCurrency) {
145
+            $oldCurrency = $this->currency->getCurrency();
146
+            $balanceInMajorUnits = $this->getAmount();
147
+
148
+            $oldRate = currency($oldCurrency)->getRate();
149
+            $newRate = currency($newCurrency)->getRate();
150
+
151
+            $ratio = $newRate / $oldRate;
152
+
153
+            $convertedBalance = money($balanceInMajorUnits, $oldCurrency)->multiply($ratio)->getAmount();
154
+
155
+            return (int) round($convertedBalance);
156
+        });
157
+
158
+        Money::macro('swapFormattedAmountFor', function ($newCurrency) {
145 159
             $oldCurrency = $this->currency->getCurrency();
146 160
             $balance = $this->getAmount();
147 161
 

+ 14
- 19
app/Services/AccountService.php Wyświetl plik

@@ -2,7 +2,6 @@
2 2
 
3 3
 namespace App\Services;
4 4
 
5
-use Akaunting\Money\Money;
6 5
 use App\Contracts\AccountHandler;
7 6
 use App\DTO\AccountBalanceDTO;
8 7
 use App\DTO\AccountBalanceReportDTO;
@@ -13,6 +12,7 @@ use App\Models\Accounting\Account;
13 12
 use App\Models\Accounting\Transaction;
14 13
 use App\Models\Banking\BankAccount;
15 14
 use App\Repositories\Accounting\JournalEntryRepository;
15
+use App\Utilities\Currency\CurrencyAccessor;
16 16
 use App\ValueObjects\BalanceValue;
17 17
 use Illuminate\Database\Eloquent\Collection;
18 18
 
@@ -29,14 +29,14 @@ class AccountService implements AccountHandler
29 29
     {
30 30
         $amount = $this->journalEntryRepository->sumDebitAmounts($account, $startDate, $endDate);
31 31
 
32
-        return new BalanceValue($amount, $account->currency_code ?? 'USD');
32
+        return new BalanceValue($amount, $account->currency_code);
33 33
     }
34 34
 
35 35
     public function getCreditBalance(Account $account, string $startDate, string $endDate): BalanceValue
36 36
     {
37 37
         $amount = $this->journalEntryRepository->sumCreditAmounts($account, $startDate, $endDate);
38 38
 
39
-        return new BalanceValue($amount, $account->currency_code ?? 'USD');
39
+        return new BalanceValue($amount, $account->currency_code);
40 40
     }
41 41
 
42 42
     public function getNetMovement(Account $account, string $startDate, string $endDate): BalanceValue
@@ -45,7 +45,7 @@ class AccountService implements AccountHandler
45 45
         $creditBalance = $this->journalEntryRepository->sumCreditAmounts($account, $startDate, $endDate);
46 46
         $netMovement = $this->calculateNetMovementByCategory($account->category, $debitBalance, $creditBalance);
47 47
 
48
-        return new BalanceValue($netMovement, $account->currency_code ?? 'USD');
48
+        return new BalanceValue($netMovement, $account->currency_code);
49 49
     }
50 50
 
51 51
     public function getStartingBalance(Account $account, string $startDate): ?BalanceValue
@@ -58,7 +58,7 @@ class AccountService implements AccountHandler
58 58
         $creditBalanceBefore = $this->journalEntryRepository->sumCreditAmounts($account, $startDate);
59 59
         $startingBalance = $this->calculateNetMovementByCategory($account->category, $debitBalanceBefore, $creditBalanceBefore);
60 60
 
61
-        return new BalanceValue($startingBalance, $account->currency_code ?? 'USD');
61
+        return new BalanceValue($startingBalance, $account->currency_code);
62 62
     }
63 63
 
64 64
     public function getEndingBalance(Account $account, string $startDate, string $endDate): ?BalanceValue
@@ -71,7 +71,7 @@ class AccountService implements AccountHandler
71 71
         $netMovement = $this->getNetMovement($account, $startDate, $endDate)->getValue();
72 72
         $endingBalance = $startingBalance + $netMovement;
73 73
 
74
-        return new BalanceValue($endingBalance, $account->currency_code ?? 'USD');
74
+        return new BalanceValue($endingBalance, $account->currency_code);
75 75
     }
76 76
 
77 77
     public function calculateNetMovementByCategory(AccountCategory $category, int $debitBalance, int $creditBalance): int
@@ -102,18 +102,12 @@ class AccountService implements AccountHandler
102 102
         return $balances;
103 103
     }
104 104
 
105
-    public function getBalancesFormatted(Account $account, string $startDate, string $endDate): AccountBalanceDTO
105
+    public function formatBalances(array $balances): AccountBalanceDTO
106 106
     {
107
-        $balances = $this->getBalances($account, $startDate, $endDate);
108
-        $currency = $account->currency_code ?? 'USD';
107
+        $defaultCurrency = CurrencyAccessor::getDefaultCurrency();
109 108
 
110
-        return $this->formatBalances($balances, $currency);
111
-    }
112
-
113
-    public function formatBalances(array $balances, string $currency): AccountBalanceDTO
114
-    {
115 109
         foreach ($balances as $key => $balance) {
116
-            $balances[$key] = Money::{$currency}($balance)->format();
110
+            $balances[$key] = money($balance, $defaultCurrency)->format();
117 111
         }
118 112
 
119 113
         return new AccountBalanceDTO(
@@ -157,6 +151,7 @@ class AccountService implements AccountHandler
157 151
             $categoryAccounts = [];
158 152
 
159 153
             foreach ($accountsInCategory as $account) {
154
+                /** @var Account $account */
160 155
                 $accountBalances = $this->getBalances($account, $startDate, $endDate);
161 156
 
162 157
                 if (array_sum($accountBalances) === 0) {
@@ -167,7 +162,7 @@ class AccountService implements AccountHandler
167 162
                     $categorySummaryBalances[$accountBalanceType] += $accountBalance;
168 163
                 }
169 164
 
170
-                $formattedAccountBalances = $this->formatBalances($accountBalances, $account->currency_code ?? 'USD');
165
+                $formattedAccountBalances = $this->formatBalances($accountBalances);
171 166
 
172 167
                 $categoryAccounts[] = new AccountDTO(
173 168
                     $account->name,
@@ -179,7 +174,7 @@ class AccountService implements AccountHandler
179 174
             $reportTotalBalances['debit_balance'] += $categorySummaryBalances['debit_balance'];
180 175
             $reportTotalBalances['credit_balance'] += $categorySummaryBalances['credit_balance'];
181 176
 
182
-            $formattedCategorySummaryBalances = $this->formatBalances($categorySummaryBalances, $accountsInCategory->first()->currency_code ?? 'USD');
177
+            $formattedCategorySummaryBalances = $this->formatBalances($categorySummaryBalances);
183 178
 
184 179
             $accountCategories[$categoryName] = new AccountCategoryDTO(
185 180
                 $categoryAccounts,
@@ -187,7 +182,7 @@ class AccountService implements AccountHandler
187 182
             );
188 183
         }
189 184
 
190
-        $formattedReportTotalBalances = $this->formatBalances($reportTotalBalances, 'USD');
185
+        $formattedReportTotalBalances = $this->formatBalances($reportTotalBalances);
191 186
 
192 187
         return new AccountBalanceReportDTO($accountCategories, $formattedReportTotalBalances);
193 188
     }
@@ -205,7 +200,7 @@ class AccountService implements AccountHandler
205 200
             $totalBalance += $endingBalance;
206 201
         }
207 202
 
208
-        return new BalanceValue($totalBalance, 'USD');
203
+        return new BalanceValue($totalBalance, CurrencyAccessor::getDefaultCurrency());
209 204
     }
210 205
 
211 206
     public function getAccountCategoryOrder(): array

+ 7
- 0
app/Services/PlaidService.php Wyświetl plik

@@ -265,4 +265,11 @@ class PlaidService
265 265
 
266 266
         return $this->sendRequest('transactions/refresh', $data);
267 267
     }
268
+
269
+    public function removeItem(string $access_token): object
270
+    {
271
+        $data = compact('access_token');
272
+
273
+        return $this->sendRequest('item/remove', $data);
274
+    }
268 275
 }

+ 5
- 0
app/Utilities/Currency/CurrencyConverter.php Wyświetl plik

@@ -21,4 +21,9 @@ class CurrencyConverter
21 21
     {
22 22
         return money($balance, $oldCurrency)->swapAmountFor($newCurrency);
23 23
     }
24
+
25
+    public static function convertFormattedBalance($balance, $oldCurrency, $newCurrency): int
26
+    {
27
+        return money($balance, $oldCurrency)->swapFormattedAmountFor($newCurrency);
28
+    }
24 29
 }

+ 23
- 1
app/ValueObjects/BalanceValue.php Wyświetl plik

@@ -2,13 +2,16 @@
2 2
 
3 3
 namespace App\ValueObjects;
4 4
 
5
+use App\Utilities\Currency\CurrencyAccessor;
6
+use App\Utilities\Currency\CurrencyConverter;
7
+
5 8
 class BalanceValue
6 9
 {
7 10
     private int $value;
8 11
 
9 12
     private string $currency;
10 13
 
11
-    public function __construct(int $value, string $currency = 'USD')
14
+    public function __construct(int $value, string $currency)
12 15
     {
13 16
         $this->value = $value;
14 17
         $this->currency = $currency;
@@ -23,4 +26,23 @@ class BalanceValue
23 26
     {
24 27
         return money($this->value, $this->currency)->format();
25 28
     }
29
+
30
+    public function formattedSimple(): string
31
+    {
32
+        return money($this->value, $this->currency)->formatSimple();
33
+    }
34
+
35
+    public function formattedForDisplay(): string
36
+    {
37
+        $defaultCurrency = CurrencyAccessor::getDefaultCurrency();
38
+        $accountCurrency = $this->currency;
39
+
40
+        if ($accountCurrency === $defaultCurrency) {
41
+            return $this->formatted();
42
+        }
43
+
44
+        $convertedBalance = CurrencyConverter::convertBalance($this->value, $defaultCurrency, $accountCurrency);
45
+
46
+        return money($convertedBalance, $accountCurrency)->formatWithCode();
47
+    }
26 48
 }

+ 74
- 74
composer.lock Wyświetl plik

@@ -443,16 +443,16 @@
443 443
         },
444 444
         {
445 445
             "name": "aws/aws-crt-php",
446
-            "version": "v1.2.4",
446
+            "version": "v1.2.5",
447 447
             "source": {
448 448
                 "type": "git",
449 449
                 "url": "https://github.com/awslabs/aws-crt-php.git",
450
-                "reference": "eb0c6e4e142224a10b08f49ebf87f32611d162b2"
450
+                "reference": "0ea1f04ec5aa9f049f97e012d1ed63b76834a31b"
451 451
             },
452 452
             "dist": {
453 453
                 "type": "zip",
454
-                "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/eb0c6e4e142224a10b08f49ebf87f32611d162b2",
455
-                "reference": "eb0c6e4e142224a10b08f49ebf87f32611d162b2",
454
+                "url": "https://api.github.com/repos/awslabs/aws-crt-php/zipball/0ea1f04ec5aa9f049f97e012d1ed63b76834a31b",
455
+                "reference": "0ea1f04ec5aa9f049f97e012d1ed63b76834a31b",
456 456
                 "shasum": ""
457 457
             },
458 458
             "require": {
@@ -491,22 +491,22 @@
491 491
             ],
492 492
             "support": {
493 493
                 "issues": "https://github.com/awslabs/aws-crt-php/issues",
494
-                "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.4"
494
+                "source": "https://github.com/awslabs/aws-crt-php/tree/v1.2.5"
495 495
             },
496
-            "time": "2023-11-08T00:42:13+00:00"
496
+            "time": "2024-04-19T21:30:56+00:00"
497 497
         },
498 498
         {
499 499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.304.6",
500
+            "version": "3.305.1",
501 501
             "source": {
502 502
                 "type": "git",
503 503
                 "url": "https://github.com/aws/aws-sdk-php.git",
504
-                "reference": "02abf9b8e2afbdf281e28757c582049d3db16df7"
504
+                "reference": "3af1c6925b95a0f4303a1859dd56aa8374560c42"
505 505
             },
506 506
             "dist": {
507 507
                 "type": "zip",
508
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/02abf9b8e2afbdf281e28757c582049d3db16df7",
509
-                "reference": "02abf9b8e2afbdf281e28757c582049d3db16df7",
508
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3af1c6925b95a0f4303a1859dd56aa8374560c42",
509
+                "reference": "3af1c6925b95a0f4303a1859dd56aa8374560c42",
510 510
                 "shasum": ""
511 511
             },
512 512
             "require": {
@@ -586,9 +586,9 @@
586 586
             "support": {
587 587
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
588 588
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
589
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.304.6"
589
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.305.1"
590 590
             },
591
-            "time": "2024-04-17T18:27:31+00:00"
591
+            "time": "2024-04-23T18:10:07+00:00"
592 592
         },
593 593
         {
594 594
             "name": "aws/aws-sdk-php-laravel",
@@ -1980,16 +1980,16 @@
1980 1980
         },
1981 1981
         {
1982 1982
             "name": "filament/actions",
1983
-            "version": "v3.2.69",
1983
+            "version": "v3.2.71",
1984 1984
             "source": {
1985 1985
                 "type": "git",
1986 1986
                 "url": "https://github.com/filamentphp/actions.git",
1987
-                "reference": "46decf6a9fc438c60c9fb1c5631820fab49fefb6"
1987
+                "reference": "d3150c3b3f7b9680283194b4a5b362117cd4c4da"
1988 1988
             },
1989 1989
             "dist": {
1990 1990
                 "type": "zip",
1991
-                "url": "https://api.github.com/repos/filamentphp/actions/zipball/46decf6a9fc438c60c9fb1c5631820fab49fefb6",
1992
-                "reference": "46decf6a9fc438c60c9fb1c5631820fab49fefb6",
1991
+                "url": "https://api.github.com/repos/filamentphp/actions/zipball/d3150c3b3f7b9680283194b4a5b362117cd4c4da",
1992
+                "reference": "d3150c3b3f7b9680283194b4a5b362117cd4c4da",
1993 1993
                 "shasum": ""
1994 1994
             },
1995 1995
             "require": {
@@ -2029,20 +2029,20 @@
2029 2029
                 "issues": "https://github.com/filamentphp/filament/issues",
2030 2030
                 "source": "https://github.com/filamentphp/filament"
2031 2031
             },
2032
-            "time": "2024-04-16T15:42:36+00:00"
2032
+            "time": "2024-04-21T22:23:26+00:00"
2033 2033
         },
2034 2034
         {
2035 2035
             "name": "filament/filament",
2036
-            "version": "v3.2.69",
2036
+            "version": "v3.2.71",
2037 2037
             "source": {
2038 2038
                 "type": "git",
2039 2039
                 "url": "https://github.com/filamentphp/panels.git",
2040
-                "reference": "f9011967b6ea0cd79cf7b210bbb59de6bbe2ce1f"
2040
+                "reference": "e00510fb4edc73b027f784317381f791b47c22de"
2041 2041
             },
2042 2042
             "dist": {
2043 2043
                 "type": "zip",
2044
-                "url": "https://api.github.com/repos/filamentphp/panels/zipball/f9011967b6ea0cd79cf7b210bbb59de6bbe2ce1f",
2045
-                "reference": "f9011967b6ea0cd79cf7b210bbb59de6bbe2ce1f",
2044
+                "url": "https://api.github.com/repos/filamentphp/panels/zipball/e00510fb4edc73b027f784317381f791b47c22de",
2045
+                "reference": "e00510fb4edc73b027f784317381f791b47c22de",
2046 2046
                 "shasum": ""
2047 2047
             },
2048 2048
             "require": {
@@ -2094,20 +2094,20 @@
2094 2094
                 "issues": "https://github.com/filamentphp/filament/issues",
2095 2095
                 "source": "https://github.com/filamentphp/filament"
2096 2096
             },
2097
-            "time": "2024-04-16T15:42:54+00:00"
2097
+            "time": "2024-04-21T22:24:02+00:00"
2098 2098
         },
2099 2099
         {
2100 2100
             "name": "filament/forms",
2101
-            "version": "v3.2.69",
2101
+            "version": "v3.2.71",
2102 2102
             "source": {
2103 2103
                 "type": "git",
2104 2104
                 "url": "https://github.com/filamentphp/forms.git",
2105
-                "reference": "85670891877fd57e322a8a4c8580ebef1d368f87"
2105
+                "reference": "eea1a3ec87bbe62d470dd0a26d9f4b8ef9cb5d39"
2106 2106
             },
2107 2107
             "dist": {
2108 2108
                 "type": "zip",
2109
-                "url": "https://api.github.com/repos/filamentphp/forms/zipball/85670891877fd57e322a8a4c8580ebef1d368f87",
2110
-                "reference": "85670891877fd57e322a8a4c8580ebef1d368f87",
2109
+                "url": "https://api.github.com/repos/filamentphp/forms/zipball/eea1a3ec87bbe62d470dd0a26d9f4b8ef9cb5d39",
2110
+                "reference": "eea1a3ec87bbe62d470dd0a26d9f4b8ef9cb5d39",
2111 2111
                 "shasum": ""
2112 2112
             },
2113 2113
             "require": {
@@ -2150,20 +2150,20 @@
2150 2150
                 "issues": "https://github.com/filamentphp/filament/issues",
2151 2151
                 "source": "https://github.com/filamentphp/filament"
2152 2152
             },
2153
-            "time": "2024-04-16T17:20:05+00:00"
2153
+            "time": "2024-04-21T22:23:42+00:00"
2154 2154
         },
2155 2155
         {
2156 2156
             "name": "filament/infolists",
2157
-            "version": "v3.2.69",
2157
+            "version": "v3.2.71",
2158 2158
             "source": {
2159 2159
                 "type": "git",
2160 2160
                 "url": "https://github.com/filamentphp/infolists.git",
2161
-                "reference": "123bbd4e81cd3e8bcdfad77b9554bf8e4185689f"
2161
+                "reference": "d205fbeacc7faf4430abb05c49334a64fb4d84ae"
2162 2162
             },
2163 2163
             "dist": {
2164 2164
                 "type": "zip",
2165
-                "url": "https://api.github.com/repos/filamentphp/infolists/zipball/123bbd4e81cd3e8bcdfad77b9554bf8e4185689f",
2166
-                "reference": "123bbd4e81cd3e8bcdfad77b9554bf8e4185689f",
2165
+                "url": "https://api.github.com/repos/filamentphp/infolists/zipball/d205fbeacc7faf4430abb05c49334a64fb4d84ae",
2166
+                "reference": "d205fbeacc7faf4430abb05c49334a64fb4d84ae",
2167 2167
                 "shasum": ""
2168 2168
             },
2169 2169
             "require": {
@@ -2201,20 +2201,20 @@
2201 2201
                 "issues": "https://github.com/filamentphp/filament/issues",
2202 2202
                 "source": "https://github.com/filamentphp/filament"
2203 2203
             },
2204
-            "time": "2024-04-16T15:42:38+00:00"
2204
+            "time": "2024-04-18T11:26:13+00:00"
2205 2205
         },
2206 2206
         {
2207 2207
             "name": "filament/notifications",
2208
-            "version": "v3.2.69",
2208
+            "version": "v3.2.71",
2209 2209
             "source": {
2210 2210
                 "type": "git",
2211 2211
                 "url": "https://github.com/filamentphp/notifications.git",
2212
-                "reference": "5731f4b9eb2b3f292b45fbb9ce173ee7d6b7dddb"
2212
+                "reference": "dcc47b498c2a5a89296c2f46da651a8aa5e0bf55"
2213 2213
             },
2214 2214
             "dist": {
2215 2215
                 "type": "zip",
2216
-                "url": "https://api.github.com/repos/filamentphp/notifications/zipball/5731f4b9eb2b3f292b45fbb9ce173ee7d6b7dddb",
2217
-                "reference": "5731f4b9eb2b3f292b45fbb9ce173ee7d6b7dddb",
2216
+                "url": "https://api.github.com/repos/filamentphp/notifications/zipball/dcc47b498c2a5a89296c2f46da651a8aa5e0bf55",
2217
+                "reference": "dcc47b498c2a5a89296c2f46da651a8aa5e0bf55",
2218 2218
                 "shasum": ""
2219 2219
             },
2220 2220
             "require": {
@@ -2253,20 +2253,20 @@
2253 2253
                 "issues": "https://github.com/filamentphp/filament/issues",
2254 2254
                 "source": "https://github.com/filamentphp/filament"
2255 2255
             },
2256
-            "time": "2024-04-16T15:42:43+00:00"
2256
+            "time": "2024-04-18T11:26:15+00:00"
2257 2257
         },
2258 2258
         {
2259 2259
             "name": "filament/support",
2260
-            "version": "v3.2.69",
2260
+            "version": "v3.2.71",
2261 2261
             "source": {
2262 2262
                 "type": "git",
2263 2263
                 "url": "https://github.com/filamentphp/support.git",
2264
-                "reference": "fc9038785de9d49802c36c1aef341af8dfa4dbe0"
2264
+                "reference": "594f8d38e365578b6d91455c5beade6c54def5a4"
2265 2265
             },
2266 2266
             "dist": {
2267 2267
                 "type": "zip",
2268
-                "url": "https://api.github.com/repos/filamentphp/support/zipball/fc9038785de9d49802c36c1aef341af8dfa4dbe0",
2269
-                "reference": "fc9038785de9d49802c36c1aef341af8dfa4dbe0",
2268
+                "url": "https://api.github.com/repos/filamentphp/support/zipball/594f8d38e365578b6d91455c5beade6c54def5a4",
2269
+                "reference": "594f8d38e365578b6d91455c5beade6c54def5a4",
2270 2270
                 "shasum": ""
2271 2271
             },
2272 2272
             "require": {
@@ -2276,7 +2276,7 @@
2276 2276
                 "illuminate/contracts": "^10.45|^11.0",
2277 2277
                 "illuminate/support": "^10.45|^11.0",
2278 2278
                 "illuminate/view": "^10.45|^11.0",
2279
-                "livewire/livewire": "^3.4.9",
2279
+                "livewire/livewire": "^3.4.10",
2280 2280
                 "php": "^8.1",
2281 2281
                 "ryangjchandler/blade-capture-directive": "^0.2|^0.3|^1.0",
2282 2282
                 "spatie/color": "^1.5",
@@ -2311,20 +2311,20 @@
2311 2311
                 "issues": "https://github.com/filamentphp/filament/issues",
2312 2312
                 "source": "https://github.com/filamentphp/filament"
2313 2313
             },
2314
-            "time": "2024-04-16T17:58:12+00:00"
2314
+            "time": "2024-04-21T22:24:20+00:00"
2315 2315
         },
2316 2316
         {
2317 2317
             "name": "filament/tables",
2318
-            "version": "v3.2.69",
2318
+            "version": "v3.2.71",
2319 2319
             "source": {
2320 2320
                 "type": "git",
2321 2321
                 "url": "https://github.com/filamentphp/tables.git",
2322
-                "reference": "87f802bb8bfea1e77ed17ecd86a9d2074786f88a"
2322
+                "reference": "b3bc1d2b5947562eb64748e6d3f59ed1073effe7"
2323 2323
             },
2324 2324
             "dist": {
2325 2325
                 "type": "zip",
2326
-                "url": "https://api.github.com/repos/filamentphp/tables/zipball/87f802bb8bfea1e77ed17ecd86a9d2074786f88a",
2327
-                "reference": "87f802bb8bfea1e77ed17ecd86a9d2074786f88a",
2326
+                "url": "https://api.github.com/repos/filamentphp/tables/zipball/b3bc1d2b5947562eb64748e6d3f59ed1073effe7",
2327
+                "reference": "b3bc1d2b5947562eb64748e6d3f59ed1073effe7",
2328 2328
                 "shasum": ""
2329 2329
             },
2330 2330
             "require": {
@@ -2364,11 +2364,11 @@
2364 2364
                 "issues": "https://github.com/filamentphp/filament/issues",
2365 2365
                 "source": "https://github.com/filamentphp/filament"
2366 2366
             },
2367
-            "time": "2024-04-16T15:43:11+00:00"
2367
+            "time": "2024-04-21T22:24:20+00:00"
2368 2368
         },
2369 2369
         {
2370 2370
             "name": "filament/widgets",
2371
-            "version": "v3.2.69",
2371
+            "version": "v3.2.71",
2372 2372
             "source": {
2373 2373
                 "type": "git",
2374 2374
                 "url": "https://github.com/filamentphp/widgets.git",
@@ -3156,16 +3156,16 @@
3156 3156
         },
3157 3157
         {
3158 3158
             "name": "laravel/framework",
3159
-            "version": "v11.4.0",
3159
+            "version": "v11.5.0",
3160 3160
             "source": {
3161 3161
                 "type": "git",
3162 3162
                 "url": "https://github.com/laravel/framework.git",
3163
-                "reference": "c1dc67c28811dc5be524a30b18f29ce62126716a"
3163
+                "reference": "e3c24268f1404805e15099b9f035fe310cb30753"
3164 3164
             },
3165 3165
             "dist": {
3166 3166
                 "type": "zip",
3167
-                "url": "https://api.github.com/repos/laravel/framework/zipball/c1dc67c28811dc5be524a30b18f29ce62126716a",
3168
-                "reference": "c1dc67c28811dc5be524a30b18f29ce62126716a",
3167
+                "url": "https://api.github.com/repos/laravel/framework/zipball/e3c24268f1404805e15099b9f035fe310cb30753",
3168
+                "reference": "e3c24268f1404805e15099b9f035fe310cb30753",
3169 3169
                 "shasum": ""
3170 3170
             },
3171 3171
             "require": {
@@ -3357,20 +3357,20 @@
3357 3357
                 "issues": "https://github.com/laravel/framework/issues",
3358 3358
                 "source": "https://github.com/laravel/framework"
3359 3359
             },
3360
-            "time": "2024-04-16T14:38:51+00:00"
3360
+            "time": "2024-04-23T15:11:31+00:00"
3361 3361
         },
3362 3362
         {
3363 3363
             "name": "laravel/prompts",
3364
-            "version": "v0.1.19",
3364
+            "version": "v0.1.20",
3365 3365
             "source": {
3366 3366
                 "type": "git",
3367 3367
                 "url": "https://github.com/laravel/prompts.git",
3368
-                "reference": "0ab75ac3434d9f610c5691758a6146a3d1940c18"
3368
+                "reference": "bf9a360c484976692de0f3792f30066f4f4b34a2"
3369 3369
             },
3370 3370
             "dist": {
3371 3371
                 "type": "zip",
3372
-                "url": "https://api.github.com/repos/laravel/prompts/zipball/0ab75ac3434d9f610c5691758a6146a3d1940c18",
3373
-                "reference": "0ab75ac3434d9f610c5691758a6146a3d1940c18",
3372
+                "url": "https://api.github.com/repos/laravel/prompts/zipball/bf9a360c484976692de0f3792f30066f4f4b34a2",
3373
+                "reference": "bf9a360c484976692de0f3792f30066f4f4b34a2",
3374 3374
                 "shasum": ""
3375 3375
             },
3376 3376
             "require": {
@@ -3412,9 +3412,9 @@
3412 3412
             ],
3413 3413
             "support": {
3414 3414
                 "issues": "https://github.com/laravel/prompts/issues",
3415
-                "source": "https://github.com/laravel/prompts/tree/v0.1.19"
3415
+                "source": "https://github.com/laravel/prompts/tree/v0.1.20"
3416 3416
             },
3417
-            "time": "2024-04-16T14:20:35+00:00"
3417
+            "time": "2024-04-18T00:45:25+00:00"
3418 3418
         },
3419 3419
         {
3420 3420
             "name": "laravel/sanctum",
@@ -4845,16 +4845,16 @@
4845 4845
         },
4846 4846
         {
4847 4847
             "name": "nesbot/carbon",
4848
-            "version": "3.2.4",
4848
+            "version": "3.3.0",
4849 4849
             "source": {
4850 4850
                 "type": "git",
4851 4851
                 "url": "https://github.com/briannesbitt/Carbon.git",
4852
-                "reference": "82c28278c1c8f7b82dcdab25692237f052ffc8d8"
4852
+                "reference": "7219739c4e01d4680c980545821733b6ed8ee880"
4853 4853
             },
4854 4854
             "dist": {
4855 4855
                 "type": "zip",
4856
-                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/82c28278c1c8f7b82dcdab25692237f052ffc8d8",
4857
-                "reference": "82c28278c1c8f7b82dcdab25692237f052ffc8d8",
4856
+                "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7219739c4e01d4680c980545821733b6ed8ee880",
4857
+                "reference": "7219739c4e01d4680c980545821733b6ed8ee880",
4858 4858
                 "shasum": ""
4859 4859
             },
4860 4860
             "require": {
@@ -4947,7 +4947,7 @@
4947 4947
                     "type": "tidelift"
4948 4948
                 }
4949 4949
             ],
4950
-            "time": "2024-04-05T09:58:10+00:00"
4950
+            "time": "2024-04-18T16:35:06+00:00"
4951 4951
         },
4952 4952
         {
4953 4953
             "name": "nette/schema",
@@ -9829,16 +9829,16 @@
9829 9829
         },
9830 9830
         {
9831 9831
             "name": "laravel/pint",
9832
-            "version": "v1.15.1",
9832
+            "version": "v1.15.2",
9833 9833
             "source": {
9834 9834
                 "type": "git",
9835 9835
                 "url": "https://github.com/laravel/pint.git",
9836
-                "reference": "5f288b5e79938cc72f5c298d384e639de87507c6"
9836
+                "reference": "2c9f8004899815f3f0ee3cb28ef7281e2b589134"
9837 9837
             },
9838 9838
             "dist": {
9839 9839
                 "type": "zip",
9840
-                "url": "https://api.github.com/repos/laravel/pint/zipball/5f288b5e79938cc72f5c298d384e639de87507c6",
9841
-                "reference": "5f288b5e79938cc72f5c298d384e639de87507c6",
9840
+                "url": "https://api.github.com/repos/laravel/pint/zipball/2c9f8004899815f3f0ee3cb28ef7281e2b589134",
9841
+                "reference": "2c9f8004899815f3f0ee3cb28ef7281e2b589134",
9842 9842
                 "shasum": ""
9843 9843
             },
9844 9844
             "require": {
@@ -9849,13 +9849,13 @@
9849 9849
                 "php": "^8.1.0"
9850 9850
             },
9851 9851
             "require-dev": {
9852
-                "friendsofphp/php-cs-fixer": "^3.52.1",
9853
-                "illuminate/view": "^10.48.4",
9854
-                "larastan/larastan": "^2.9.2",
9852
+                "friendsofphp/php-cs-fixer": "^3.54.0",
9853
+                "illuminate/view": "^10.48.8",
9854
+                "larastan/larastan": "^2.9.5",
9855 9855
                 "laravel-zero/framework": "^10.3.0",
9856 9856
                 "mockery/mockery": "^1.6.11",
9857 9857
                 "nunomaduro/termwind": "^1.15.1",
9858
-                "pestphp/pest": "^2.34.5"
9858
+                "pestphp/pest": "^2.34.7"
9859 9859
             },
9860 9860
             "bin": [
9861 9861
                 "builds/pint"
@@ -9891,7 +9891,7 @@
9891 9891
                 "issues": "https://github.com/laravel/pint/issues",
9892 9892
                 "source": "https://github.com/laravel/pint"
9893 9893
             },
9894
-            "time": "2024-04-02T14:28:47+00:00"
9894
+            "time": "2024-04-23T15:42:34+00:00"
9895 9895
         },
9896 9896
         {
9897 9897
             "name": "laravel/sail",

+ 79
- 79
package-lock.json Wyświetl plik

@@ -507,9 +507,9 @@
507 507
             }
508 508
         },
509 509
         "node_modules/@rollup/rollup-android-arm-eabi": {
510
-            "version": "4.14.3",
511
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.14.3.tgz",
512
-            "integrity": "sha512-X9alQ3XM6I9IlSlmC8ddAvMSyG1WuHk5oUnXGw+yUBs3BFoTizmG1La/Gr8fVJvDWAq+zlYTZ9DBgrlKRVY06g==",
510
+            "version": "4.16.4",
511
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.16.4.tgz",
512
+            "integrity": "sha512-GkhjAaQ8oUTOKE4g4gsZ0u8K/IHU1+2WQSgS1TwTcYvL+sjbaQjNHFXbOJ6kgqGHIO1DfUhI/Sphi9GkRT9K+Q==",
513 513
             "cpu": [
514 514
                 "arm"
515 515
             ],
@@ -520,9 +520,9 @@
520 520
             ]
521 521
         },
522 522
         "node_modules/@rollup/rollup-android-arm64": {
523
-            "version": "4.14.3",
524
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.14.3.tgz",
525
-            "integrity": "sha512-eQK5JIi+POhFpzk+LnjKIy4Ks+pwJ+NXmPxOCSvOKSNRPONzKuUvWE+P9JxGZVxrtzm6BAYMaL50FFuPe0oWMQ==",
523
+            "version": "4.16.4",
524
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.16.4.tgz",
525
+            "integrity": "sha512-Bvm6D+NPbGMQOcxvS1zUl8H7DWlywSXsphAeOnVeiZLQ+0J6Is8T7SrjGTH29KtYkiY9vld8ZnpV3G2EPbom+w==",
526 526
             "cpu": [
527 527
                 "arm64"
528 528
             ],
@@ -533,9 +533,9 @@
533 533
             ]
534 534
         },
535 535
         "node_modules/@rollup/rollup-darwin-arm64": {
536
-            "version": "4.14.3",
537
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.14.3.tgz",
538
-            "integrity": "sha512-Od4vE6f6CTT53yM1jgcLqNfItTsLt5zE46fdPaEmeFHvPs5SjZYlLpHrSiHEKR1+HdRfxuzXHjDOIxQyC3ptBA==",
536
+            "version": "4.16.4",
537
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.16.4.tgz",
538
+            "integrity": "sha512-i5d64MlnYBO9EkCOGe5vPR/EeDwjnKOGGdd7zKFhU5y8haKhQZTN2DgVtpODDMxUr4t2K90wTUJg7ilgND6bXw==",
539 539
             "cpu": [
540 540
                 "arm64"
541 541
             ],
@@ -546,9 +546,9 @@
546 546
             ]
547 547
         },
548 548
         "node_modules/@rollup/rollup-darwin-x64": {
549
-            "version": "4.14.3",
550
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.14.3.tgz",
551
-            "integrity": "sha512-0IMAO21axJeNIrvS9lSe/PGthc8ZUS+zC53O0VhF5gMxfmcKAP4ESkKOCwEi6u2asUrt4mQv2rjY8QseIEb1aw==",
549
+            "version": "4.16.4",
550
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.16.4.tgz",
551
+            "integrity": "sha512-WZupV1+CdUYehaZqjaFTClJI72fjJEgTXdf4NbW69I9XyvdmztUExBtcI2yIIU6hJtYvtwS6pkTkHJz+k08mAQ==",
552 552
             "cpu": [
553 553
                 "x64"
554 554
             ],
@@ -559,9 +559,9 @@
559 559
             ]
560 560
         },
561 561
         "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
562
-            "version": "4.14.3",
563
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.14.3.tgz",
564
-            "integrity": "sha512-ge2DC7tHRHa3caVEoSbPRJpq7azhG+xYsd6u2MEnJ6XzPSzQsTKyXvh6iWjXRf7Rt9ykIUWHtl0Uz3T6yXPpKw==",
562
+            "version": "4.16.4",
563
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.16.4.tgz",
564
+            "integrity": "sha512-ADm/xt86JUnmAfA9mBqFcRp//RVRt1ohGOYF6yL+IFCYqOBNwy5lbEK05xTsEoJq+/tJzg8ICUtS82WinJRuIw==",
565 565
             "cpu": [
566 566
                 "arm"
567 567
             ],
@@ -572,9 +572,9 @@
572 572
             ]
573 573
         },
574 574
         "node_modules/@rollup/rollup-linux-arm-musleabihf": {
575
-            "version": "4.14.3",
576
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.14.3.tgz",
577
-            "integrity": "sha512-ljcuiDI4V3ySuc7eSk4lQ9wU8J8r8KrOUvB2U+TtK0TiW6OFDmJ+DdIjjwZHIw9CNxzbmXY39wwpzYuFDwNXuw==",
575
+            "version": "4.16.4",
576
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.16.4.tgz",
577
+            "integrity": "sha512-tJfJaXPiFAG+Jn3cutp7mCs1ePltuAgRqdDZrzb1aeE3TktWWJ+g7xK9SNlaSUFw6IU4QgOxAY4rA+wZUT5Wfg==",
578 578
             "cpu": [
579 579
                 "arm"
580 580
             ],
@@ -585,9 +585,9 @@
585 585
             ]
586 586
         },
587 587
         "node_modules/@rollup/rollup-linux-arm64-gnu": {
588
-            "version": "4.14.3",
589
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.14.3.tgz",
590
-            "integrity": "sha512-Eci2us9VTHm1eSyn5/eEpaC7eP/mp5n46gTRB3Aar3BgSvDQGJZuicyq6TsH4HngNBgVqC5sDYxOzTExSU+NjA==",
588
+            "version": "4.16.4",
589
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.16.4.tgz",
590
+            "integrity": "sha512-7dy1BzQkgYlUTapDTvK997cgi0Orh5Iu7JlZVBy1MBURk7/HSbHkzRnXZa19ozy+wwD8/SlpJnOOckuNZtJR9w==",
591 591
             "cpu": [
592 592
                 "arm64"
593 593
             ],
@@ -598,9 +598,9 @@
598 598
             ]
599 599
         },
600 600
         "node_modules/@rollup/rollup-linux-arm64-musl": {
601
-            "version": "4.14.3",
602
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.14.3.tgz",
603
-            "integrity": "sha512-UrBoMLCq4E92/LCqlh+blpqMz5h1tJttPIniwUgOFJyjWI1qrtrDhhpHPuFxULlUmjFHfloWdixtDhSxJt5iKw==",
601
+            "version": "4.16.4",
602
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.16.4.tgz",
603
+            "integrity": "sha512-zsFwdUw5XLD1gQe0aoU2HVceI6NEW7q7m05wA46eUAyrkeNYExObfRFQcvA6zw8lfRc5BHtan3tBpo+kqEOxmg==",
604 604
             "cpu": [
605 605
                 "arm64"
606 606
             ],
@@ -611,9 +611,9 @@
611 611
             ]
612 612
         },
613 613
         "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
614
-            "version": "4.14.3",
615
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.14.3.tgz",
616
-            "integrity": "sha512-5aRjvsS8q1nWN8AoRfrq5+9IflC3P1leMoy4r2WjXyFqf3qcqsxRCfxtZIV58tCxd+Yv7WELPcO9mY9aeQyAmw==",
614
+            "version": "4.16.4",
615
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.16.4.tgz",
616
+            "integrity": "sha512-p8C3NnxXooRdNrdv6dBmRTddEapfESEUflpICDNKXpHvTjRRq1J82CbU5G3XfebIZyI3B0s074JHMWD36qOW6w==",
617 617
             "cpu": [
618 618
                 "ppc64"
619 619
             ],
@@ -624,9 +624,9 @@
624 624
             ]
625 625
         },
626 626
         "node_modules/@rollup/rollup-linux-riscv64-gnu": {
627
-            "version": "4.14.3",
628
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.14.3.tgz",
629
-            "integrity": "sha512-sk/Qh1j2/RJSX7FhEpJn8n0ndxy/uf0kI/9Zc4b1ELhqULVdTfN6HL31CDaTChiBAOgLcsJ1sgVZjWv8XNEsAQ==",
627
+            "version": "4.16.4",
628
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.16.4.tgz",
629
+            "integrity": "sha512-Lh/8ckoar4s4Id2foY7jNgitTOUQczwMWNYi+Mjt0eQ9LKhr6sK477REqQkmy8YHY3Ca3A2JJVdXnfb3Rrwkng==",
630 630
             "cpu": [
631 631
                 "riscv64"
632 632
             ],
@@ -637,9 +637,9 @@
637 637
             ]
638 638
         },
639 639
         "node_modules/@rollup/rollup-linux-s390x-gnu": {
640
-            "version": "4.14.3",
641
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.14.3.tgz",
642
-            "integrity": "sha512-jOO/PEaDitOmY9TgkxF/TQIjXySQe5KVYB57H/8LRP/ux0ZoO8cSHCX17asMSv3ruwslXW/TLBcxyaUzGRHcqg==",
640
+            "version": "4.16.4",
641
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.16.4.tgz",
642
+            "integrity": "sha512-1xwwn9ZCQYuqGmulGsTZoKrrn0z2fAur2ujE60QgyDpHmBbXbxLaQiEvzJWDrscRq43c8DnuHx3QorhMTZgisQ==",
643 643
             "cpu": [
644 644
                 "s390x"
645 645
             ],
@@ -650,9 +650,9 @@
650 650
             ]
651 651
         },
652 652
         "node_modules/@rollup/rollup-linux-x64-gnu": {
653
-            "version": "4.14.3",
654
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.14.3.tgz",
655
-            "integrity": "sha512-8ybV4Xjy59xLMyWo3GCfEGqtKV5M5gCSrZlxkPGvEPCGDLNla7v48S662HSGwRd6/2cSneMQWiv+QzcttLrrOA==",
653
+            "version": "4.16.4",
654
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.16.4.tgz",
655
+            "integrity": "sha512-LuOGGKAJ7dfRtxVnO1i3qWc6N9sh0Em/8aZ3CezixSTM+E9Oq3OvTsvC4sm6wWjzpsIlOCnZjdluINKESflJLA==",
656 656
             "cpu": [
657 657
                 "x64"
658 658
             ],
@@ -663,9 +663,9 @@
663 663
             ]
664 664
         },
665 665
         "node_modules/@rollup/rollup-linux-x64-musl": {
666
-            "version": "4.14.3",
667
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.14.3.tgz",
668
-            "integrity": "sha512-s+xf1I46trOY10OqAtZ5Rm6lzHre/UiLA1J2uOhCFXWkbZrJRkYBPO6FhvGfHmdtQ3Bx793MNa7LvoWFAm93bg==",
666
+            "version": "4.16.4",
667
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.16.4.tgz",
668
+            "integrity": "sha512-ch86i7KkJKkLybDP2AtySFTRi5fM3KXp0PnHocHuJMdZwu7BuyIKi35BE9guMlmTpwwBTB3ljHj9IQXnTCD0vA==",
669 669
             "cpu": [
670 670
                 "x64"
671 671
             ],
@@ -676,9 +676,9 @@
676 676
             ]
677 677
         },
678 678
         "node_modules/@rollup/rollup-win32-arm64-msvc": {
679
-            "version": "4.14.3",
680
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.14.3.tgz",
681
-            "integrity": "sha512-+4h2WrGOYsOumDQ5S2sYNyhVfrue+9tc9XcLWLh+Kw3UOxAvrfOrSMFon60KspcDdytkNDh7K2Vs6eMaYImAZg==",
679
+            "version": "4.16.4",
680
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.16.4.tgz",
681
+            "integrity": "sha512-Ma4PwyLfOWZWayfEsNQzTDBVW8PZ6TUUN1uFTBQbF2Chv/+sjenE86lpiEwj2FiviSmSZ4Ap4MaAfl1ciF4aSA==",
682 682
             "cpu": [
683 683
                 "arm64"
684 684
             ],
@@ -689,9 +689,9 @@
689 689
             ]
690 690
         },
691 691
         "node_modules/@rollup/rollup-win32-ia32-msvc": {
692
-            "version": "4.14.3",
693
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.14.3.tgz",
694
-            "integrity": "sha512-T1l7y/bCeL/kUwh9OD4PQT4aM7Bq43vX05htPJJ46RTI4r5KNt6qJRzAfNfM+OYMNEVBWQzR2Gyk+FXLZfogGw==",
692
+            "version": "4.16.4",
693
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.16.4.tgz",
694
+            "integrity": "sha512-9m/ZDrQsdo/c06uOlP3W9G2ENRVzgzbSXmXHT4hwVaDQhYcRpi9bgBT0FTG9OhESxwK0WjQxYOSfv40cU+T69w==",
695 695
             "cpu": [
696 696
                 "ia32"
697 697
             ],
@@ -702,9 +702,9 @@
702 702
             ]
703 703
         },
704 704
         "node_modules/@rollup/rollup-win32-x64-msvc": {
705
-            "version": "4.14.3",
706
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.14.3.tgz",
707
-            "integrity": "sha512-/BypzV0H1y1HzgYpxqRaXGBRqfodgoBBCcsrujT6QRcakDQdfU+Lq9PENPh5jB4I44YWq+0C2eHsHya+nZY1sA==",
705
+            "version": "4.16.4",
706
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.16.4.tgz",
707
+            "integrity": "sha512-YunpoOAyGLDseanENHmbFvQSfVL5BxW3k7hhy0eN4rb3gS/ct75dVD0EXOWIqFT/nE8XYW6LP6vz6ctKRi0k9A==",
708 708
             "cpu": [
709 709
                 "x64"
710 710
             ],
@@ -931,9 +931,9 @@
931 931
             }
932 932
         },
933 933
         "node_modules/caniuse-lite": {
934
-            "version": "1.0.30001610",
935
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001610.tgz",
936
-            "integrity": "sha512-QFutAY4NgaelojVMjY63o6XlZyORPaLfyMnsl3HgnWdJUcX6K0oaJymHjH8PT5Gk7sTm8rvC/c5COUQKXqmOMA==",
934
+            "version": "1.0.30001612",
935
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001612.tgz",
936
+            "integrity": "sha512-lFgnZ07UhaCcsSZgWW0K5j4e69dK1u/ltrL9lTUiFOwNHs12S3UMIEYgBV0Z6C6hRDev7iRnMzzYmKabYdXF9g==",
937 937
             "dev": true,
938 938
             "funding": [
939 939
                 {
@@ -1079,9 +1079,9 @@
1079 1079
             "dev": true
1080 1080
         },
1081 1081
         "node_modules/electron-to-chromium": {
1082
-            "version": "1.4.739",
1083
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.739.tgz",
1084
-            "integrity": "sha512-koRkawXOuN9w/ymhTNxGfB8ta4MRKVW0nzifU17G1UwTWlBg0vv7xnz4nxDnRFSBe9nXMGRgICcAzqXc0PmLeA==",
1082
+            "version": "1.4.747",
1083
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.747.tgz",
1084
+            "integrity": "sha512-+FnSWZIAvFHbsNVmUxhEqWiaOiPMcfum1GQzlWCg/wLigVtshOsjXHyEFfmt6cFK6+HkS3QOJBv6/3OPumbBfw==",
1085 1085
             "dev": true
1086 1086
         },
1087 1087
         "node_modules/emoji-regex": {
@@ -1833,9 +1833,9 @@
1833 1833
             }
1834 1834
         },
1835 1835
         "node_modules/postcss-nesting": {
1836
-            "version": "12.1.1",
1837
-            "resolved": "https://registry.npmjs.org/postcss-nesting/-/postcss-nesting-12.1.1.tgz",
1838
-            "integrity": "sha512-qc74KvIAQNa5ujZKG1UV286dhaDW6basbUy2i9AzNU/T8C9hpvGu9NZzm1SfePe2yP7sPYgpA8d4sPVopn2Hhw==",
1836
+            "version": "12.1.2",
1837
+            "resolved": "https://registry.npmjs.org/postcss-nesting/-/postcss-nesting-12.1.2.tgz",
1838
+            "integrity": "sha512-FUmTHGDNundodutB4PUBxt/EPuhgtpk8FJGRsBhOuy+6FnkR2A8RZWIsyyy6XmhvX2DZQQWIkvu+HB4IbJm+Ew==",
1839 1839
             "dev": true,
1840 1840
             "funding": [
1841 1841
                 {
@@ -2010,9 +2010,9 @@
2010 2010
             }
2011 2011
         },
2012 2012
         "node_modules/rollup": {
2013
-            "version": "4.14.3",
2014
-            "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.14.3.tgz",
2015
-            "integrity": "sha512-ag5tTQKYsj1bhrFC9+OEWqb5O6VYgtQDO9hPDBMmIbePwhfSr+ExlcU741t8Dhw5DkPCQf6noz0jb36D6W9/hw==",
2013
+            "version": "4.16.4",
2014
+            "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.16.4.tgz",
2015
+            "integrity": "sha512-kuaTJSUbz+Wsb2ATGvEknkI12XV40vIiHmLuFlejoo7HtDok/O5eDDD0UpCVY5bBX5U5RYo8wWP83H7ZsqVEnA==",
2016 2016
             "dev": true,
2017 2017
             "dependencies": {
2018 2018
                 "@types/estree": "1.0.5"
@@ -2025,22 +2025,22 @@
2025 2025
                 "npm": ">=8.0.0"
2026 2026
             },
2027 2027
             "optionalDependencies": {
2028
-                "@rollup/rollup-android-arm-eabi": "4.14.3",
2029
-                "@rollup/rollup-android-arm64": "4.14.3",
2030
-                "@rollup/rollup-darwin-arm64": "4.14.3",
2031
-                "@rollup/rollup-darwin-x64": "4.14.3",
2032
-                "@rollup/rollup-linux-arm-gnueabihf": "4.14.3",
2033
-                "@rollup/rollup-linux-arm-musleabihf": "4.14.3",
2034
-                "@rollup/rollup-linux-arm64-gnu": "4.14.3",
2035
-                "@rollup/rollup-linux-arm64-musl": "4.14.3",
2036
-                "@rollup/rollup-linux-powerpc64le-gnu": "4.14.3",
2037
-                "@rollup/rollup-linux-riscv64-gnu": "4.14.3",
2038
-                "@rollup/rollup-linux-s390x-gnu": "4.14.3",
2039
-                "@rollup/rollup-linux-x64-gnu": "4.14.3",
2040
-                "@rollup/rollup-linux-x64-musl": "4.14.3",
2041
-                "@rollup/rollup-win32-arm64-msvc": "4.14.3",
2042
-                "@rollup/rollup-win32-ia32-msvc": "4.14.3",
2043
-                "@rollup/rollup-win32-x64-msvc": "4.14.3",
2028
+                "@rollup/rollup-android-arm-eabi": "4.16.4",
2029
+                "@rollup/rollup-android-arm64": "4.16.4",
2030
+                "@rollup/rollup-darwin-arm64": "4.16.4",
2031
+                "@rollup/rollup-darwin-x64": "4.16.4",
2032
+                "@rollup/rollup-linux-arm-gnueabihf": "4.16.4",
2033
+                "@rollup/rollup-linux-arm-musleabihf": "4.16.4",
2034
+                "@rollup/rollup-linux-arm64-gnu": "4.16.4",
2035
+                "@rollup/rollup-linux-arm64-musl": "4.16.4",
2036
+                "@rollup/rollup-linux-powerpc64le-gnu": "4.16.4",
2037
+                "@rollup/rollup-linux-riscv64-gnu": "4.16.4",
2038
+                "@rollup/rollup-linux-s390x-gnu": "4.16.4",
2039
+                "@rollup/rollup-linux-x64-gnu": "4.16.4",
2040
+                "@rollup/rollup-linux-x64-musl": "4.16.4",
2041
+                "@rollup/rollup-win32-arm64-msvc": "4.16.4",
2042
+                "@rollup/rollup-win32-ia32-msvc": "4.16.4",
2043
+                "@rollup/rollup-win32-x64-msvc": "4.16.4",
2044 2044
                 "fsevents": "~2.3.2"
2045 2045
             }
2046 2046
         },
@@ -2365,9 +2365,9 @@
2365 2365
             "dev": true
2366 2366
         },
2367 2367
         "node_modules/vite": {
2368
-            "version": "5.2.9",
2369
-            "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.9.tgz",
2370
-            "integrity": "sha512-uOQWfuZBlc6Y3W/DTuQ1Sr+oIXWvqljLvS881SVmAj00d5RdgShLcuXWxseWPd4HXwiYBFW/vXHfKFeqj9uQnw==",
2368
+            "version": "5.2.10",
2369
+            "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.10.tgz",
2370
+            "integrity": "sha512-PAzgUZbP7msvQvqdSD+ErD5qGnSFiGOoWmV5yAKUEI0kdhjbH6nMWVyZQC/hSc4aXwc0oJ9aEdIiF9Oje0JFCw==",
2371 2371
             "dev": true,
2372 2372
             "dependencies": {
2373 2373
                 "esbuild": "^0.20.1",

+ 27
- 12
resources/views/livewire/company/service/connected-account/list-institutions.blade.php Wyświetl plik

@@ -11,7 +11,11 @@
11 11
                             />
12 12
                         </div>
13 13
                     @else
14
-                        <img src="{{ $institution->logo_url }}" alt="{{ $institution->name }}" class="h-10 object-contain object-left">
14
+                        <img
15
+                            src="{{ $institution->logo_url }}"
16
+                            alt="{{ $institution->name }}"
17
+                            class="h-10 object-contain object-left"
18
+                        >
15 19
                     @endif
16 20
 
17 21
                     <div class="flex-auto">
@@ -36,17 +40,24 @@
36 40
                 </header>
37 41
 
38 42
                 @foreach($institution->connectedBankAccounts as $connectedBankAccount)
43
+                    @php
44
+                        $account = $connectedBankAccount->bankAccount?->account;
45
+                    @endphp
39 46
                     <div class="border-t-2 border-gray-200 dark:border-white/10 px-6 py-4">
40 47
                         <div class="flex flex-col sm:flex-row items-start gap-y-2">
41 48
                             <div class="grid flex-auto gap-y-2">
42
-                                <span class="account-name text-base font-medium leading-6 text-gray-900 dark:text-white">{{ $connectedBankAccount->name }}</span>
43
-                                <span class="account-type text-sm leading-6 text-gray-600 dark:text-gray-200">{{  ucwords($connectedBankAccount->subtype) }} {{ $connectedBankAccount->masked_number }}</span>
49
+                                <span class="account-name text-base font-medium leading-6 text-gray-900 dark:text-white">
50
+                                    {{ $connectedBankAccount->name }}
51
+                                </span>
52
+                                <span class="account-type text-sm leading-6 text-gray-600 dark:text-gray-200">
53
+                                    {{  ucwords($connectedBankAccount->subtype) }} {{ $connectedBankAccount->masked_number }}
54
+                                </span>
44 55
                             </div>
45 56
 
46
-                            @if($connectedBankAccount->bankAccount?->account)
57
+                            @if($account?->ending_balance)
47 58
                                 <div class="account-balance flex text-base leading-6 text-gray-700 dark:text-gray-200 space-x-1">
48
-                                    <strong wire:poll.visible>{{ $this->getAccountBalance($connectedBankAccount->bankAccount->account) }}</strong>
49
-                                    <p>{{ $connectedBankAccount->bankAccount->account->currency_code }}</p>
59
+                                    <strong wire:poll.visible>{{ $account->ending_balance }}</strong>
60
+                                    <p>{{ $account->currency_code }}</p>
50 61
                                 </div>
51 62
                             @endif
52 63
                         </div>
@@ -91,19 +102,20 @@
91 102
             </section>
92 103
         @endforelse
93 104
 
94
-        <x-filament-actions::modals />
105
+        <x-filament-actions::modals/>
95 106
     </div>
96
-    {{-- Include Plaid's JavaScript SDK --}}
107
+    {{-- Include Plaid's JavaScript SDK CDN --}}
97 108
     @assets
98 109
     <script src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>
99 110
     @endassets
100 111
 
101
-    {{-- Initialize Plaid Link --}}
112
+    {{-- Include the Plaid script --}}
102 113
     @script
103 114
     <script>
115
+        {{-- Adjust the modal width based on the screen size --}}
104 116
         const mobileSize = window.matchMedia("(max-width: 480px)");
105 117
 
106
-        let data = Alpine.reactive({ windowWidth: 'max-w-2xl' });
118
+        let data = Alpine.reactive({windowWidth: 'max-w-2xl'});
107 119
 
108 120
         // Add a media query change listener
109 121
         mobileSize.addEventListener('change', (e) => {
@@ -114,14 +126,17 @@
114 126
             $wire.$set('modalWidth', data.windowWidth);
115 127
         });
116 128
 
129
+        {{-- Initialize Plaid Link --}}
117 130
         $wire.on('initializeLink', token => {
118 131
             const handler = Plaid.create({
119 132
                 token: token,
120 133
                 onSuccess: (publicToken, metadata) => {
121 134
                     $wire.dispatchSelf('linkSuccess', {publicToken: publicToken, metadata: metadata});
122 135
                 },
123
-                onExit: (err, metadata) => {},
124
-                onEvent: (eventName, metadata) => {},
136
+                onExit: (err, metadata) => {
137
+                },
138
+                onEvent: (eventName, metadata) => {
139
+                },
125 140
             });
126 141
 
127 142
             handler.open();

Ładowanie…
Anuluj
Zapisz