Andrew Wallo vor 7 Monaten
Ursprung
Commit
e3223fcbd2

+ 2
- 6
app/Filament/Forms/Components/DocumentHeaderSection.php Datei anzeigen

@@ -2,6 +2,7 @@
2 2
 
3 3
 namespace App\Filament\Forms\Components;
4 4
 
5
+use App\DTO\CompanyDTO;
5 6
 use Closure;
6 7
 use Filament\Forms\Components\FileUpload;
7 8
 use Filament\Forms\Components\Group;
@@ -73,12 +74,7 @@ class DocumentHeaderSection extends Section
73 74
                         ->default(fn () => $this->getDefaultSubheader()),
74 75
                     View::make('filament.forms.components.company-info')
75 76
                         ->viewData([
76
-                            'company_name' => $company->name,
77
-                            'company_address' => $company->profile->address,
78
-                            'company_city' => $company->profile->city?->name,
79
-                            'company_state' => $company->profile->state?->name,
80
-                            'company_zip' => $company->profile->zip_code,
81
-                            'company_country' => $company->profile->state?->country->name,
77
+                            'companyDTO' => CompanyDTO::fromModel($company),
82 78
                         ]),
83 79
                 ])->grow(true),
84 80
             ])->from('md'),

+ 1
- 1
app/Listeners/CreateConnectedAccount.php Datei anzeigen

@@ -35,7 +35,7 @@ class CreateConnectedAccount
35 35
 
36 36
         $authResponse = $this->plaidService->getAccounts($accessToken);
37 37
 
38
-        $institutionResponse = $this->plaidService->getInstitution($authResponse->item->institution_id, $company->profile->country);
38
+        $institutionResponse = $this->plaidService->getInstitution($authResponse->item->institution_id, $company->profile?->address?->country_code);
39 39
 
40 40
         $this->processInstitution($authResponse, $institutionResponse, $company, $accessToken);
41 41
     }

+ 1
- 1
app/Listeners/HandleTransactionImport.php Datei anzeigen

@@ -47,6 +47,6 @@ class HandleTransactionImport
47 47
             $bankAccount,
48 48
             $connectedBankAccount,
49 49
             $startDate,
50
-        )->onQueue('transactions');
50
+        );
51 51
     }
52 52
 }

+ 1
- 1
app/Livewire/Company/Service/ConnectedAccount/ListInstitutions.php Datei anzeigen

@@ -245,7 +245,7 @@ class ListInstitutions extends Component implements HasActions, HasForms
245 245
             $company = $this->user->currentCompany;
246 246
 
247 247
             $companyLanguage = $company->locale->language ?? 'en';
248
-            $companyCountry = $company->profile->country ?? 'US';
248
+            $companyCountry = $company->profile?->address?->country_code ?? 'US';
249 249
 
250 250
             $plaidUser = $this->plaidService->createPlaidUser($company);
251 251
 

+ 1
- 1
app/Services/PlaidService.php Datei anzeigen

@@ -157,7 +157,7 @@ class PlaidService
157 157
         return 'en';
158 158
     }
159 159
 
160
-    public function getCountry(string $country): string
160
+    public function getCountry(?string $country = null): string
161 161
     {
162 162
         if (in_array($country, $this->plaidSupportedCountries, true)) {
163 163
             return $country;

+ 3
- 1
app/Services/TransactionService.php Datei anzeigen

@@ -45,7 +45,9 @@ class TransactionService
45 45
     public function createStartingBalanceTransaction(Company $company, Account $account, BankAccount $bankAccount, float $startingBalance, string $startDate): void
46 46
     {
47 47
         $transactionType = $startingBalance >= 0 ? TransactionType::Deposit : TransactionType::Withdrawal;
48
-        $chartAccount = $account->where('category', AccountCategory::Equity)->where('name', 'Owner\'s Equity')->first();
48
+        $accountName = $startingBalance >= 0 ? "Owner's Investment" : "Owner's Drawings";
49
+        $chartAccount = $account->where('category', AccountCategory::Equity)->where('name', $accountName)->first();
50
+
49 51
         $postedAt = Carbon::parse($startDate)->subDay()->toDateTimeString();
50 52
 
51 53
         Transaction::create([

+ 3
- 5
resources/views/filament/forms/components/company-info.blade.php Datei anzeigen

@@ -1,8 +1,6 @@
1 1
 <div class="text-xs text-right">
2
-    <h2 class="text-base font-semibold">{{ $company_name }}</h2>
3
-    @if($company_address && $company_city && $company_state && $company_zip)
4
-        <p>{{ $company_address }}</p>
5
-        <p>{{ $company_city }}, {{ $company_state }} {{ $company_zip }}</p>
6
-        <p>{{ $company_country }}</p>
2
+    <h2 class="text-base font-semibold">{{ $companyDTO->name }}</h2>
3
+    @if($formattedAddress = $companyDTO->getFormattedAddressHtml())
4
+        {!! $formattedAddress !!}
7 5
     @endif
8 6
 </div>

Laden…
Abbrechen
Speichern