Andrew Wallo 7 个月前
父节点
当前提交
e3223fcbd2

+ 2
- 6
app/Filament/Forms/Components/DocumentHeaderSection.php 查看文件

2
 
2
 
3
 namespace App\Filament\Forms\Components;
3
 namespace App\Filament\Forms\Components;
4
 
4
 
5
+use App\DTO\CompanyDTO;
5
 use Closure;
6
 use Closure;
6
 use Filament\Forms\Components\FileUpload;
7
 use Filament\Forms\Components\FileUpload;
7
 use Filament\Forms\Components\Group;
8
 use Filament\Forms\Components\Group;
73
                         ->default(fn () => $this->getDefaultSubheader()),
74
                         ->default(fn () => $this->getDefaultSubheader()),
74
                     View::make('filament.forms.components.company-info')
75
                     View::make('filament.forms.components.company-info')
75
                         ->viewData([
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
                 ])->grow(true),
79
                 ])->grow(true),
84
             ])->from('md'),
80
             ])->from('md'),

+ 1
- 1
app/Listeners/CreateConnectedAccount.php 查看文件

35
 
35
 
36
         $authResponse = $this->plaidService->getAccounts($accessToken);
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
         $this->processInstitution($authResponse, $institutionResponse, $company, $accessToken);
40
         $this->processInstitution($authResponse, $institutionResponse, $company, $accessToken);
41
     }
41
     }

+ 1
- 1
app/Listeners/HandleTransactionImport.php 查看文件

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

+ 1
- 1
app/Livewire/Company/Service/ConnectedAccount/ListInstitutions.php 查看文件

245
             $company = $this->user->currentCompany;
245
             $company = $this->user->currentCompany;
246
 
246
 
247
             $companyLanguage = $company->locale->language ?? 'en';
247
             $companyLanguage = $company->locale->language ?? 'en';
248
-            $companyCountry = $company->profile->country ?? 'US';
248
+            $companyCountry = $company->profile?->address?->country_code ?? 'US';
249
 
249
 
250
             $plaidUser = $this->plaidService->createPlaidUser($company);
250
             $plaidUser = $this->plaidService->createPlaidUser($company);
251
 
251
 

+ 1
- 1
app/Services/PlaidService.php 查看文件

157
         return 'en';
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
         if (in_array($country, $this->plaidSupportedCountries, true)) {
162
         if (in_array($country, $this->plaidSupportedCountries, true)) {
163
             return $country;
163
             return $country;

+ 3
- 1
app/Services/TransactionService.php 查看文件

45
     public function createStartingBalanceTransaction(Company $company, Account $account, BankAccount $bankAccount, float $startingBalance, string $startDate): void
45
     public function createStartingBalanceTransaction(Company $company, Account $account, BankAccount $bankAccount, float $startingBalance, string $startDate): void
46
     {
46
     {
47
         $transactionType = $startingBalance >= 0 ? TransactionType::Deposit : TransactionType::Withdrawal;
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
         $postedAt = Carbon::parse($startDate)->subDay()->toDateTimeString();
51
         $postedAt = Carbon::parse($startDate)->subDay()->toDateTimeString();
50
 
52
 
51
         Transaction::create([
53
         Transaction::create([

+ 3
- 5
resources/views/filament/forms/components/company-info.blade.php 查看文件

1
 <div class="text-xs text-right">
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
     @endif
5
     @endif
8
 </div>
6
 </div>

正在加载...
取消
保存