瀏覽代碼

refactor: pre-release refactor

3.x
wallo 1 年之前
父節點
當前提交
e60fdd59de

+ 2
- 2
app/Filament/Company/Clusters/Settings/Resources/DiscountResource.php 查看文件

101
                         Forms\Components\DateTimePicker::make('start_date')
101
                         Forms\Components\DateTimePicker::make('start_date')
102
                             ->localizeLabel()
102
                             ->localizeLabel()
103
                             ->minDate(static function ($context, ?Discount $record = null) {
103
                             ->minDate(static function ($context, ?Discount $record = null) {
104
-                                if ($context === 'create') {
104
+                                if ($context === 'create' || $record?->start_date?->isFuture()) {
105
                                     return today()->addDay();
105
                                     return today()->addDay();
106
                                 }
106
                                 }
107
 
107
 
108
-                                return $record?->start_date?->isFuture() ? today()->addDay() : $record?->start_date;
108
+                                return $record?->start_date;
109
                             })
109
                             })
110
                             ->maxDate(static function (callable $get, ?Discount $record = null) {
110
                             ->maxDate(static function (callable $get, ?Discount $record = null) {
111
                                 $end_date = $get('end_date') ?? $record?->end_date;
111
                                 $end_date = $get('end_date') ?? $record?->end_date;

+ 89
- 72
app/Filament/Company/Pages/Accounting/AccountChart.php 查看文件

3
 namespace App\Filament\Company\Pages\Accounting;
3
 namespace App\Filament\Company\Pages\Accounting;
4
 
4
 
5
 use App\Enums\Accounting\AccountCategory;
5
 use App\Enums\Accounting\AccountCategory;
6
-use App\Models\Accounting\Account as ChartModel;
6
+use App\Models\Accounting\Account;
7
 use App\Models\Accounting\AccountSubtype;
7
 use App\Models\Accounting\AccountSubtype;
8
 use App\Utilities\Accounting\AccountCode;
8
 use App\Utilities\Accounting\AccountCode;
9
 use App\Utilities\Currency\CurrencyAccessor;
9
 use App\Utilities\Currency\CurrencyAccessor;
10
 use Filament\Actions\Action;
10
 use Filament\Actions\Action;
11
 use Filament\Actions\CreateAction;
11
 use Filament\Actions\CreateAction;
12
 use Filament\Actions\EditAction;
12
 use Filament\Actions\EditAction;
13
+use Filament\Forms\Components\Component;
13
 use Filament\Forms\Components\Select;
14
 use Filament\Forms\Components\Select;
14
 use Filament\Forms\Components\Textarea;
15
 use Filament\Forms\Components\Textarea;
15
 use Filament\Forms\Components\TextInput;
16
 use Filament\Forms\Components\TextInput;
30
 
31
 
31
     protected static string $view = 'filament.company.pages.accounting.chart';
32
     protected static string $view = 'filament.company.pages.accounting.chart';
32
 
33
 
33
-    public ?ChartModel $chart = null;
34
-
35
     #[Url]
34
     #[Url]
36
     public ?string $activeTab = null;
35
     public ?string $activeTab = null;
37
 
36
 
43
     protected function configureAction(Action $action): void
42
     protected function configureAction(Action $action): void
44
     {
43
     {
45
         $action
44
         $action
46
-            ->modalWidth(MaxWidth::TwoExtraLarge)
47
-            ->stickyModalHeader()
48
-            ->stickyModalFooter();
45
+            ->modal()
46
+            ->modalWidth(MaxWidth::TwoExtraLarge);
49
     }
47
     }
50
 
48
 
51
     #[Computed]
49
     #[Computed]
60
     {
58
     {
61
         return EditAction::make()
59
         return EditAction::make()
62
             ->iconButton()
60
             ->iconButton()
63
-            ->record($this->chart)
64
             ->name('editChart')
61
             ->name('editChart')
65
             ->label('Edit account')
62
             ->label('Edit account')
66
             ->modalHeading('Edit Account')
63
             ->modalHeading('Edit Account')
67
             ->icon('heroicon-m-pencil-square')
64
             ->icon('heroicon-m-pencil-square')
68
-            ->mountUsing(function (array $arguments, Form $form) {
69
-                $chartId = $arguments['chart'];
70
-                $this->chart = ChartModel::find($chartId);
71
-
72
-                $form
73
-                    ->fill($this->chart->toArray())
74
-                    ->operation('edit')
75
-                    ->model($this->chart); // This is needed for form relationships to work (maybe a bug in Filament regarding passed arguments related to timing)
76
-            })
77
-            ->form($this->getChartForm());
65
+            ->record(fn (array $arguments) => Account::find($arguments['chart']))
66
+            ->form(fn (Form $form) => $this->getChartForm($form)->operation('edit'));
78
     }
67
     }
79
 
68
 
80
     public function createChartAction(): Action
69
     public function createChartAction(): Action
82
         return CreateAction::make()
71
         return CreateAction::make()
83
             ->link()
72
             ->link()
84
             ->name('createChart')
73
             ->name('createChart')
85
-            ->form($this->getChartForm())
86
-            ->model(ChartModel::class)
74
+            ->model(Account::class)
87
             ->label('Add a new account')
75
             ->label('Add a new account')
88
             ->icon('heroicon-o-plus-circle')
76
             ->icon('heroicon-o-plus-circle')
89
-            ->mountUsing(function (array $arguments, Form $form) {
90
-                $subtypeId = $arguments['subtype'];
91
-                $this->chart = new ChartModel([
92
-                    'subtype_id' => $subtypeId,
93
-                ]);
94
-
95
-                if ($subtypeId) {
96
-                    $companyId = auth()->user()->currentCompany->id;
97
-                    $generatedCode = AccountCode::generate($companyId, $subtypeId);
98
-                    $this->chart->code = $generatedCode;
99
-                }
100
-
101
-                $form->fill($this->chart->toArray())
102
-                    ->operation('create');
103
-            });
77
+            ->form(fn (Form $form) => $this->getChartForm($form)->operation('create'))
78
+            ->fillForm(fn (array $arguments): array => $this->getChartFormDefaults($arguments['subtype']));
104
     }
79
     }
105
 
80
 
106
-    private function getChartForm(bool $useActiveTab = true): array
81
+    private function getChartFormDefaults(int $subtypeId): array
107
     {
82
     {
83
+        $accountSubtype = AccountSubtype::find($subtypeId);
84
+        $generatedCode = AccountCode::generate($accountSubtype);
85
+
108
         return [
86
         return [
109
-            Select::make('subtype_id')
110
-                ->label('Type')
111
-                ->required()
112
-                ->live()
113
-                ->disabled(static fn (string $operation, ?ChartModel $record) => $operation === 'edit' && $record?->default === true)
114
-                ->options($this->getChartSubtypeOptions($useActiveTab))
115
-                ->afterStateUpdated(static function (?string $state, Set $set): void {
116
-                    if ($state) {
117
-                        $companyId = auth()->user()->currentCompany->id;
118
-                        $generatedCode = AccountCode::generate($companyId, $state);
119
-                        $set('code', $generatedCode);
120
-                    }
121
-                }),
122
-            TextInput::make('code')
123
-                ->label('Code')
124
-                ->required()
125
-                ->validationAttribute('account code')
126
-                ->unique(table: ChartModel::class, column: 'code', ignoreRecord: true)
127
-                ->validateAccountCode(static fn (Get $get) => $get('subtype_id')),
128
-            TextInput::make('name')
129
-                ->label('Name')
130
-                ->required(),
131
-            Select::make('currency_code')
132
-                ->localizeLabel('Currency')
133
-                ->relationship('currency', 'name')
134
-                ->default(CurrencyAccessor::getDefaultCurrency())
135
-                ->preload()
136
-                ->searchable()
137
-                ->visible(function (Get $get): bool {
138
-                    return filled($get('subtype_id')) && AccountSubtype::find($get('subtype_id'))->multi_currency;
139
-                })
140
-                ->live(),
141
-            Textarea::make('description')
142
-                ->label('Description')
143
-                ->autosize(),
87
+            'subtype_id' => $subtypeId,
88
+            'code' => $generatedCode,
144
         ];
89
         ];
145
     }
90
     }
146
 
91
 
92
+    private function getChartForm(Form $form, bool $useActiveTab = true): Form
93
+    {
94
+        return $form
95
+            ->schema([
96
+                $this->getTypeFormComponent($useActiveTab),
97
+                $this->getCodeFormComponent(),
98
+                $this->getNameFormComponent(),
99
+                $this->getCurrencyFormComponent(),
100
+                $this->getDescriptionFormComponent(),
101
+            ]);
102
+    }
103
+
104
+    protected function getTypeFormComponent(bool $useActiveTab = true): Component
105
+    {
106
+        return Select::make('subtype_id')
107
+            ->label('Type')
108
+            ->required()
109
+            ->live()
110
+            ->disabled(static function (string $operation): bool {
111
+                return $operation === 'edit';
112
+            })
113
+            ->options($this->getChartSubtypeOptions($useActiveTab))
114
+            ->afterStateUpdated(static function (?string $state, Set $set): void {
115
+                if ($state) {
116
+                    $accountSubtype = AccountSubtype::find($state);
117
+                    $generatedCode = AccountCode::generate($accountSubtype);
118
+                    $set('code', $generatedCode);
119
+                }
120
+            });
121
+    }
122
+
123
+    protected function getCodeFormComponent(): Component
124
+    {
125
+        return TextInput::make('code')
126
+            ->label('Code')
127
+            ->required()
128
+            ->validationAttribute('account code')
129
+            ->unique(table: Account::class, column: 'code', ignoreRecord: true)
130
+            ->validateAccountCode(static fn (Get $get) => $get('subtype_id'));
131
+    }
132
+
133
+    protected function getNameFormComponent(): Component
134
+    {
135
+        return TextInput::make('name')
136
+            ->label('Name')
137
+            ->required();
138
+    }
139
+
140
+    protected function getCurrencyFormComponent()
141
+    {
142
+        return Select::make('currency_code')
143
+            ->localizeLabel('Currency')
144
+            ->relationship('currency', 'name')
145
+            ->default(CurrencyAccessor::getDefaultCurrency())
146
+            ->preload()
147
+            ->searchable()
148
+            ->disabled(static function (string $operation): bool {
149
+                return $operation === 'edit';
150
+            })
151
+            ->visible(function (Get $get): bool {
152
+                return filled($get('subtype_id')) && AccountSubtype::find($get('subtype_id'))->multi_currency;
153
+            })
154
+            ->live();
155
+    }
156
+
157
+    protected function getDescriptionFormComponent(): Component
158
+    {
159
+        return Textarea::make('description')
160
+            ->label('Description')
161
+            ->autosize();
162
+    }
163
+
147
     private function getChartSubtypeOptions($useActiveTab = true): array
164
     private function getChartSubtypeOptions($useActiveTab = true): array
148
     {
165
     {
149
         $subtypes = $useActiveTab ?
166
         $subtypes = $useActiveTab ?
161
             CreateAction::make()
178
             CreateAction::make()
162
                 ->button()
179
                 ->button()
163
                 ->label('Add New Account')
180
                 ->label('Add New Account')
164
-                ->model(ChartModel::class)
165
-                ->form($this->getChartForm(false)),
181
+                ->model(Account::class)
182
+                ->form(fn (Form $form) => $this->getChartForm($form, false)->operation('create')),
166
         ];
183
         ];
167
     }
184
     }
168
 
185
 

+ 0
- 3
app/Models/Accounting/JournalEntry.php 查看文件

8
 use App\Concerns\CompanyOwned;
8
 use App\Concerns\CompanyOwned;
9
 use App\Enums\Accounting\JournalEntryType;
9
 use App\Enums\Accounting\JournalEntryType;
10
 use App\Models\Banking\BankAccount;
10
 use App\Models\Banking\BankAccount;
11
-use App\Observers\JournalEntryObserver;
12
 use Database\Factories\Accounting\JournalEntryFactory;
11
 use Database\Factories\Accounting\JournalEntryFactory;
13
-use Illuminate\Database\Eloquent\Attributes\ObservedBy;
14
 use Illuminate\Database\Eloquent\Factories\Factory;
12
 use Illuminate\Database\Eloquent\Factories\Factory;
15
 use Illuminate\Database\Eloquent\Factories\HasFactory;
13
 use Illuminate\Database\Eloquent\Factories\HasFactory;
16
 use Illuminate\Database\Eloquent\Model;
14
 use Illuminate\Database\Eloquent\Model;
17
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
15
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
18
 
16
 
19
-#[ObservedBy(JournalEntryObserver::class)]
20
 class JournalEntry extends Model
17
 class JournalEntry extends Model
21
 {
18
 {
22
     use Blamable;
19
     use Blamable;

+ 0
- 14
app/Models/Banking/ConnectedBankAccount.php 查看文件

6
 use App\Concerns\Blamable;
6
 use App\Concerns\Blamable;
7
 use App\Concerns\CompanyOwned;
7
 use App\Concerns\CompanyOwned;
8
 use App\Enums\Banking\BankAccountType;
8
 use App\Enums\Banking\BankAccountType;
9
-use App\Models\Accounting\Account;
10
 use Illuminate\Database\Eloquent\Casts\Attribute;
9
 use Illuminate\Database\Eloquent\Casts\Attribute;
11
 use Illuminate\Database\Eloquent\Model;
10
 use Illuminate\Database\Eloquent\Model;
12
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
11
 use Illuminate\Database\Eloquent\Relations\BelongsTo;
13
-use Illuminate\Database\Eloquent\Relations\HasOneThrough;
14
 
12
 
15
 class ConnectedBankAccount extends Model
13
 class ConnectedBankAccount extends Model
16
 {
14
 {
61
         return $this->belongsTo(BankAccount::class, 'bank_account_id');
59
         return $this->belongsTo(BankAccount::class, 'bank_account_id');
62
     }
60
     }
63
 
61
 
64
-    public function account(): HasOneThrough
65
-    {
66
-        return $this->hasOneThrough(
67
-            Account::class,
68
-            BankAccount::class,
69
-            'id',
70
-            'accountable_id',
71
-            'bank_account_id',
72
-            'id'
73
-        );
74
-    }
75
-
76
     protected function maskedNumber(): Attribute
62
     protected function maskedNumber(): Attribute
77
     {
63
     {
78
         return Attribute::get(static function (mixed $value, array $attributes): ?string {
64
         return Attribute::get(static function (mixed $value, array $attributes): ?string {

+ 0
- 6
app/Models/Company.php 查看文件

8
 use App\Models\Banking\ConnectedBankAccount;
8
 use App\Models\Banking\ConnectedBankAccount;
9
 use App\Models\Common\Contact;
9
 use App\Models\Common\Contact;
10
 use App\Models\Core\Department;
10
 use App\Models\Core\Department;
11
-use App\Models\History\AccountHistory;
12
 use App\Models\Setting\Appearance;
11
 use App\Models\Setting\Appearance;
13
 use App\Models\Setting\CompanyDefault;
12
 use App\Models\Setting\CompanyDefault;
14
 use App\Models\Setting\CompanyProfile;
13
 use App\Models\Setting\CompanyProfile;
75
         return $this->hasMany(Accounting\Account::class, 'company_id');
74
         return $this->hasMany(Accounting\Account::class, 'company_id');
76
     }
75
     }
77
 
76
 
78
-    public function accountHistories(): HasMany
79
-    {
80
-        return $this->hasMany(AccountHistory::class, 'company_id');
81
-    }
82
-
83
     public function bankAccounts(): HasMany
77
     public function bankAccounts(): HasMany
84
     {
78
     {
85
         return $this->hasMany(BankAccount::class, 'company_id');
79
         return $this->hasMany(BankAccount::class, 'company_id');

+ 0
- 64
app/Models/History/AccountHistory.php 查看文件

1
-<?php
2
-
3
-namespace App\Models\History;
4
-
5
-use App\Casts\CurrencyRateCast;
6
-use App\Casts\MoneyCast;
7
-use App\Models\Banking\Account;
8
-use App\Models\Setting\Currency;
9
-use Illuminate\Database\Eloquent\Factories\HasFactory;
10
-use Illuminate\Database\Eloquent\Model;
11
-use Illuminate\Database\Eloquent\Relations\BelongsTo;
12
-use Wallo\FilamentCompanies\FilamentCompanies;
13
-
14
-class AccountHistory extends Model
15
-{
16
-    use HasFactory;
17
-
18
-    protected $table = 'account_histories';
19
-
20
-    protected $fillable = [
21
-        'company_id',
22
-        'account_id',
23
-        'type',
24
-        'name',
25
-        'number',
26
-        'currency_code',
27
-        'opening_balance',
28
-        'balance',
29
-        'exchange_rate',
30
-        'status',
31
-        'actions',
32
-        'description',
33
-        'enabled',
34
-        'changed_by',
35
-    ];
36
-
37
-    protected $casts = [
38
-        'enabled' => 'boolean',
39
-        'opening_balance' => MoneyCast::class,
40
-        'balance' => MoneyCast::class,
41
-        'exchange_rate' => CurrencyRateCast::class,
42
-        'actions' => 'array',
43
-    ];
44
-
45
-    public function company(): BelongsTo
46
-    {
47
-        return $this->belongsTo(FilamentCompanies::companyModel(), 'company_id');
48
-    }
49
-
50
-    public function account(): BelongsTo
51
-    {
52
-        return $this->belongsTo(Account::class, 'account_id');
53
-    }
54
-
55
-    public function currency(): BelongsTo
56
-    {
57
-        return $this->belongsTo(Currency::class, 'currency_code', 'code');
58
-    }
59
-
60
-    public function changedBy(): BelongsTo
61
-    {
62
-        return $this->belongsTo(FilamentCompanies::userModel(), 'changed_by');
63
-    }
64
-}

+ 0
- 6
app/Models/Setting/Currency.php 查看文件

9
 use App\Concerns\SyncsWithCompanyDefaults;
9
 use App\Concerns\SyncsWithCompanyDefaults;
10
 use App\Facades\Forex;
10
 use App\Facades\Forex;
11
 use App\Models\Accounting\Account;
11
 use App\Models\Accounting\Account;
12
-use App\Models\History\AccountHistory;
13
 use App\Observers\CurrencyObserver;
12
 use App\Observers\CurrencyObserver;
14
 use App\Utilities\Currency\CurrencyAccessor;
13
 use App\Utilities\Currency\CurrencyAccessor;
15
 use Database\Factories\Setting\CurrencyFactory;
14
 use Database\Factories\Setting\CurrencyFactory;
81
         return $this->hasMany(Account::class, 'currency_code', 'code');
80
         return $this->hasMany(Account::class, 'currency_code', 'code');
82
     }
81
     }
83
 
82
 
84
-    public function accountHistories(): HasMany
85
-    {
86
-        return $this->hasMany(AccountHistory::class, 'currency_code', 'code');
87
-    }
88
-
89
     protected static function newFactory(): Factory
83
     protected static function newFactory(): Factory
90
     {
84
     {
91
         return CurrencyFactory::new();
85
         return CurrencyFactory::new();

+ 1
- 33
app/Observers/AccountObserver.php 查看文件

38
 
38
 
39
     private function setFieldsForBankAccount(Account $account): void
39
     private function setFieldsForBankAccount(Account $account): void
40
     {
40
     {
41
-        $generatedAccountCode = AccountCode::generate($account->company_id, $account->subtype_id);
41
+        $generatedAccountCode = AccountCode::generate($account->subtype_id);
42
 
42
 
43
         $account->code = $generatedAccountCode;
43
         $account->code = $generatedAccountCode;
44
 
44
 
54
             $this->setFieldsForBankAccount($account);
54
             $this->setFieldsForBankAccount($account);
55
         }
55
         }
56
     }
56
     }
57
-
58
-    /**
59
-     * Handle the Account "updated" event.
60
-     */
61
-    public function updated(Account $account): void
62
-    {
63
-        //
64
-    }
65
-
66
-    /**
67
-     * Handle the Account "deleted" event.
68
-     */
69
-    public function deleted(Account $account): void
70
-    {
71
-        //
72
-    }
73
-
74
-    /**
75
-     * Handle the Account "restored" event.
76
-     */
77
-    public function restored(Account $account): void
78
-    {
79
-        //
80
-    }
81
-
82
-    /**
83
-     * Handle the Account "force deleted" event.
84
-     */
85
-    public function forceDeleted(Account $account): void
86
-    {
87
-        //
88
-    }
89
 }
57
 }

+ 0
- 69
app/Observers/BankAccountObserver.php 查看文件

2
 
2
 
3
 namespace App\Observers;
3
 namespace App\Observers;
4
 
4
 
5
-use App\Enums\Accounting\AccountType;
6
-use App\Models\Accounting\AccountSubtype;
7
 use App\Models\Accounting\Transaction;
5
 use App\Models\Accounting\Transaction;
8
 use App\Models\Banking\BankAccount;
6
 use App\Models\Banking\BankAccount;
9
 use Illuminate\Support\Facades\DB;
7
 use Illuminate\Support\Facades\DB;
10
 
8
 
11
 class BankAccountObserver
9
 class BankAccountObserver
12
 {
10
 {
13
-    /**
14
-     * Handle the BankAccount "created" event.
15
-     */
16
-    public function created(BankAccount $bankAccount): void
17
-    {
18
-        //
19
-    }
20
-
21
-    /**
22
-     * Handle the BankAccount "creating" event.
23
-     */
24
-    public function creating(BankAccount $bankAccount): void
25
-    {
26
-        //
27
-    }
28
-
29
-    /**
30
-     * Get the default bank account subtype.
31
-     */
32
-    protected function getDefaultBankAccountSubtype(int $companyId, AccountType $type)
33
-    {
34
-        $subType = AccountSubtype::where('company_id', $companyId)
35
-            ->where('name', 'Cash and Cash Equivalents')
36
-            ->where('type', $type)
37
-            ->first();
38
-
39
-        if (! $subType) {
40
-            $subType = AccountSubtype::where('company_id', $companyId)
41
-                ->where('type', $type)
42
-                ->first();
43
-        }
44
-
45
-        return $subType?->id;
46
-    }
47
-
48
-    /**
49
-     * Handle the BankAccount "updated" event.
50
-     */
51
-    public function updated(BankAccount $bankAccount): void
52
-    {
53
-        //
54
-    }
55
-
56
     /**
11
     /**
57
      * Handle the BankAccount "deleting" event.
12
      * Handle the BankAccount "deleting" event.
58
      */
13
      */
72
             }
27
             }
73
         });
28
         });
74
     }
29
     }
75
-
76
-    /**
77
-     * Handle the BankAccount "deleted" event.
78
-     */
79
-    public function deleted(BankAccount $bankAccount): void
80
-    {
81
-        //
82
-    }
83
-
84
-    /**
85
-     * Handle the BankAccount "restored" event.
86
-     */
87
-    public function restored(BankAccount $bankAccount): void
88
-    {
89
-        //
90
-    }
91
-
92
-    /**
93
-     * Handle the BankAccount "force deleted" event.
94
-     */
95
-    public function forceDeleted(BankAccount $bankAccount): void
96
-    {
97
-        //
98
-    }
99
 }
30
 }

+ 0
- 32
app/Observers/CurrencyObserver.php 查看文件

8
 
8
 
9
 class CurrencyObserver
9
 class CurrencyObserver
10
 {
10
 {
11
-    /**
12
-     * Handle the Currency "created" event.
13
-     */
14
-    public function created(Currency $currency): void
15
-    {
16
-        //
17
-    }
18
-
19
     /**
11
     /**
20
      * Handle the Currency "updated" event.
12
      * Handle the Currency "updated" event.
21
      */
13
      */
29
             event(new CurrencyRateChanged($currency, $currency->getOriginal('rate'), $currency->rate));
21
             event(new CurrencyRateChanged($currency, $currency->getOriginal('rate'), $currency->rate));
30
         }
22
         }
31
     }
23
     }
32
-
33
-    /**
34
-     * Handle the Currency "deleted" event.
35
-     */
36
-    public function deleted(Currency $currency): void
37
-    {
38
-        //
39
-    }
40
-
41
-    /**
42
-     * Handle the Currency "restored" event.
43
-     */
44
-    public function restored(Currency $currency): void
45
-    {
46
-        //
47
-    }
48
-
49
-    /**
50
-     * Handle the Currency "force deleted" event.
51
-     */
52
-    public function forceDeleted(Currency $currency): void
53
-    {
54
-        //
55
-    }
56
 }
24
 }

+ 0
- 40
app/Observers/JournalEntryObserver.php 查看文件

1
-<?php
2
-
3
-namespace App\Observers;
4
-
5
-use App\Models\Accounting\JournalEntry;
6
-
7
-class JournalEntryObserver
8
-{
9
-    /**
10
-     * Handle the JournalEntry "created" event.
11
-     */
12
-    public function created(JournalEntry $journalEntry): void
13
-    {
14
-        //
15
-    }
16
-
17
-    /**
18
-     * Handle the JournalEntry "updated" event.
19
-     */
20
-    public function updated(JournalEntry $journalEntry): void
21
-    {
22
-        //
23
-    }
24
-
25
-    /**
26
-     * Handle the JournalEntry "deleting" event.
27
-     */
28
-    public function deleting(JournalEntry $journalEntry): void
29
-    {
30
-        //
31
-    }
32
-
33
-    /**
34
-     * Handle the JournalEntry "deleted" event.
35
-     */
36
-    public function deleted(JournalEntry $journalEntry): void
37
-    {
38
-        //
39
-    }
40
-}

+ 15
- 14
app/Utilities/Accounting/AccountCode.php 查看文件

3
 namespace App\Utilities\Accounting;
3
 namespace App\Utilities\Accounting;
4
 
4
 
5
 use App\Enums\Accounting\AccountType;
5
 use App\Enums\Accounting\AccountType;
6
-use App\Models\Accounting\Account;
7
 use App\Models\Accounting\AccountSubtype;
6
 use App\Models\Accounting\AccountSubtype;
8
 use RuntimeException;
7
 use RuntimeException;
9
 
8
 
49
         };
48
         };
50
     }
49
     }
51
 
50
 
52
-    public static function generate(int $companyId, string $subtypeId): string
51
+    public static function generate(AccountSubtype $accountSubtype): string
53
     {
52
     {
54
-        $subtype = AccountSubtype::find($subtypeId);
55
-        $subtypeName = $subtype->name;
56
-        $typeEnum = $subtype->type;
53
+        $subtypeName = $accountSubtype->name;
54
+        $typeEnum = $accountSubtype->type;
57
         $typeValue = $typeEnum->value;
55
         $typeValue = $typeEnum->value;
58
 
56
 
59
         $baseCode = config("chart-of-accounts.default.{$typeValue}.{$subtypeName}.base_code");
57
         $baseCode = config("chart-of-accounts.default.{$typeValue}.{$subtypeName}.base_code");
60
         $range = self::getRangeForType($typeEnum);
58
         $range = self::getRangeForType($typeEnum);
61
 
59
 
62
-        $lastAccount = Account::where('subtype_id', $subtypeId)
63
-            ->where('company_id', $companyId)
60
+        $lastAccount = $accountSubtype->accounts()
64
             ->whereNotNull('code')
61
             ->whereNotNull('code')
65
             ->orderBy('code', 'desc')
62
             ->orderBy('code', 'desc')
66
             ->first();
63
             ->first();
67
 
64
 
68
-        $numericValue = $lastAccount ? (int) explode('-', $lastAccount->code)[0] + 1 : (int) $baseCode;
65
+        $nextNumericValue = $lastAccount ? (int) explode('-', $lastAccount->code)[0] + 1 : (int) $baseCode;
69
 
66
 
70
-        // Ensure the new code does not exist and is within the acceptable range
71
-        while (Account::where('company_id', $companyId)->where('code', '=', (string) $numericValue)->exists() || $numericValue > $range[1]) {
72
-            if ($numericValue > $range[1]) {
73
-                throw new RuntimeException('No more account codes available within the allowed range for this type.');
67
+        if ($nextNumericValue > $range[1]) {
68
+            throw new RuntimeException("The account code range for a {$typeEnum->getLabel()} has been exceeded.");
69
+        }
70
+
71
+        while ($accountSubtype->accounts()->where('code', '=', (string) $nextNumericValue)->exists()) {
72
+            $nextNumericValue++;
73
+
74
+            if ($nextNumericValue > $range[1]) {
75
+                throw new RuntimeException("The account code range for a {$typeEnum->getLabel()} has been exceeded.");
74
             }
76
             }
75
-            $numericValue++;
76
         }
77
         }
77
 
78
 
78
-        return (string) $numericValue;
79
+        return (string) $nextNumericValue;
79
     }
80
     }
80
 }
81
 }

+ 1
- 1
composer.json 查看文件

1
 {
1
 {
2
-    "name": "laravel/laravel",
2
+    "name": "andrewdwallo/erpsaas",
3
     "type": "project",
3
     "type": "project",
4
     "description": "The skeleton application for the Laravel framework.",
4
     "description": "The skeleton application for the Laravel framework.",
5
     "keywords": [
5
     "keywords": [

+ 270
- 266
composer.lock
文件差異過大導致無法顯示
查看文件


+ 4
- 4
config/chart-of-accounts.php 查看文件

31
             ],
31
             ],
32
             'Prepaid and Deferred Charges' => [
32
             'Prepaid and Deferred Charges' => [
33
                 'description' => 'Payments made in advance for future goods or services, such as insurance premiums, rent, and prepaid taxes.',
33
                 'description' => 'Payments made in advance for future goods or services, such as insurance premiums, rent, and prepaid taxes.',
34
-                'multi_currency' => false,
34
+                'multi_currency' => true,
35
                 'base_code' => '1300',
35
                 'base_code' => '1300',
36
             ],
36
             ],
37
             'Other Current Assets' => [
37
             'Other Current Assets' => [
48
             ],
48
             ],
49
             'Fixed Assets' => [
49
             'Fixed Assets' => [
50
                 'description' => 'Physical, tangible assets used in the business\'s operations with a useful life exceeding one year, such as buildings, machinery, and vehicles. These assets are subject to depreciation.',
50
                 'description' => 'Physical, tangible assets used in the business\'s operations with a useful life exceeding one year, such as buildings, machinery, and vehicles. These assets are subject to depreciation.',
51
-                'multi_currency' => false,
51
+                'multi_currency' => true,
52
                 'base_code' => '1600',
52
                 'base_code' => '1600',
53
             ],
53
             ],
54
             'Intangible Assets' => [
54
             'Intangible Assets' => [
55
                 'description' => 'Assets lacking physical substance but offering value to the business, like patents, copyrights, trademarks, software, and goodwill.',
55
                 'description' => 'Assets lacking physical substance but offering value to the business, like patents, copyrights, trademarks, software, and goodwill.',
56
-                'multi_currency' => false,
56
+                'multi_currency' => true,
57
                 'base_code' => '1700',
57
                 'base_code' => '1700',
58
             ],
58
             ],
59
             'Other Non-Current Assets' => [
59
             'Other Non-Current Assets' => [
69
                 'base_code' => '1900',
69
                 'base_code' => '1900',
70
             ],
70
             ],
71
             'Allowances for Receivables' => [
71
             'Allowances for Receivables' => [
72
-                'description' => 'Accounts representing estimated uncollectible receivables, used to adjust the value of gross receivables to a realistic collectible amount.',
72
+                'description' => 'Accounts representing estimated uncollected receivables, used to adjust the value of gross receivables to a realistic collectible amount.',
73
                 'multi_currency' => false,
73
                 'multi_currency' => false,
74
                 'base_code' => '1940',
74
                 'base_code' => '1940',
75
             ],
75
             ],

+ 0
- 24
database/factories/History/AccountHistoryFactory.php 查看文件

1
-<?php
2
-
3
-namespace Database\Factories\History;
4
-
5
-use App\Models\History\AccountHistory;
6
-use Illuminate\Database\Eloquent\Factories\Factory;
7
-
8
-/**
9
- * @extends Factory<AccountHistory>
10
- */
11
-class AccountHistoryFactory extends Factory
12
-{
13
-    /**
14
-     * Define the model's default state.
15
-     *
16
-     * @return array<string, mixed>
17
-     */
18
-    public function definition(): array
19
-    {
20
-        return [
21
-            //
22
-        ];
23
-    }
24
-}

+ 27
- 11
database/factories/UserFactory.php 查看文件

2
 
2
 
3
 namespace Database\Factories;
3
 namespace Database\Factories;
4
 
4
 
5
+use App\Events\CompanyGenerated;
5
 use App\Models\Company;
6
 use App\Models\Company;
6
-use App\Models\Setting\CompanyDefault;
7
 use App\Models\Setting\CompanyProfile;
7
 use App\Models\Setting\CompanyProfile;
8
 use App\Models\User;
8
 use App\Models\User;
9
 use Illuminate\Database\Eloquent\Factories\Factory;
9
 use Illuminate\Database\Eloquent\Factories\Factory;
56
     /**
56
     /**
57
      * Indicate that the user should have a personal company.
57
      * Indicate that the user should have a personal company.
58
      */
58
      */
59
-    public function withPersonalCompany(?callable $callback = null): static
59
+    public function withPersonalCompany(): static
60
     {
60
     {
61
         if (! FilamentCompanies::hasCompanyFeatures()) {
61
         if (! FilamentCompanies::hasCompanyFeatures()) {
62
             return $this->state([]);
62
             return $this->state([]);
64
 
64
 
65
         $countryCode = $this->faker->countryCode;
65
         $countryCode = $this->faker->countryCode;
66
 
66
 
67
-        return $this->afterCreating(function (User $user) use ($countryCode, $callback) {
67
+        return $this->afterCreating(function (User $user) use ($countryCode) {
68
             Company::factory()
68
             Company::factory()
69
-                ->state(static fn (array $attributes, User $user) => [
70
-                    'name' => $user->name . '\'s Company',
71
-                    'user_id' => $user->id,
72
-                    'personal_company' => true,
73
-                ])
74
                 ->has(CompanyProfile::factory()->withCountry($countryCode), 'profile')
69
                 ->has(CompanyProfile::factory()->withCountry($countryCode), 'profile')
75
                 ->afterCreating(function (Company $company) use ($user, $countryCode) {
70
                 ->afterCreating(function (Company $company) use ($user, $countryCode) {
76
-                    CompanyDefault::factory()->withDefault($user, $company, $countryCode)->create();
71
+                    CompanyGenerated::dispatch($user, $company, $countryCode);
72
+
73
+                    $defaultBankAccount = $company->bankAccounts()->where('enabled', true)->first();
74
+                    $defaultCurrency = $company->currencies()->where('enabled', true)->first();
75
+                    $defaultSalesTax = $company->taxes()->where('type', 'sales')->where('enabled', true)->first();
76
+                    $defaultPurchaseTax = $company->taxes()->where('type', 'purchase')->where('enabled', true)->first();
77
+                    $defaultSalesDiscount = $company->discounts()->where('type', 'sales')->where('enabled', true)->first();
78
+                    $defaultPurchaseDiscount = $company->discounts()->where('type', 'purchase')->where('enabled', true)->first();
79
+
80
+                    $company->default()->create([
81
+                        'bank_account_id' => $defaultBankAccount?->id,
82
+                        'currency_code' => $defaultCurrency?->code,
83
+                        'sales_tax_id' => $defaultSalesTax?->id,
84
+                        'purchase_tax_id' => $defaultPurchaseTax?->id,
85
+                        'sales_discount_id' => $defaultSalesDiscount?->id,
86
+                        'purchase_discount_id' => $defaultPurchaseDiscount?->id,
87
+                        'created_by' => $user->id,
88
+                        'updated_by' => $user->id,
89
+                    ]);
77
                 })
90
                 })
78
-                ->when(is_callable($callback), $callback)
79
-                ->create();
91
+                ->create([
92
+                    'name' => $user->name . '\'s Company',
93
+                    'user_id' => $user->id,
94
+                    'personal_company' => true,
95
+                ]);
80
         });
96
         });
81
     }
97
     }
82
 }
98
 }

+ 1
- 4
database/migrations/0001_01_01_000000_create_users_table.php 查看文件

3
 use Illuminate\Database\Migrations\Migration;
3
 use Illuminate\Database\Migrations\Migration;
4
 use Illuminate\Database\Schema\Blueprint;
4
 use Illuminate\Database\Schema\Blueprint;
5
 use Illuminate\Support\Facades\Schema;
5
 use Illuminate\Support\Facades\Schema;
6
-use Wallo\FilamentCompanies\FilamentCompanies;
7
 
6
 
8
 return new class extends Migration
7
 return new class extends Migration
9
 {
8
 {
17
             $table->string('name');
16
             $table->string('name');
18
             $table->string('email')->unique();
17
             $table->string('email')->unique();
19
             $table->timestamp('email_verified_at')->nullable();
18
             $table->timestamp('email_verified_at')->nullable();
20
-            $table->string('password')->nullable(
21
-                FilamentCompanies::hasSocialiteFeatures()
22
-            );
19
+            $table->string('password')->nullable();
23
             $table->rememberToken();
20
             $table->rememberToken();
24
             $table->foreignId('current_company_id')->nullable();
21
             $table->foreignId('current_company_id')->nullable();
25
             $table->foreignId('current_connected_account_id')->nullable();
22
             $table->foreignId('current_connected_account_id')->nullable();

+ 0
- 43
database/migrations/2023_11_06_225016_create_account_histories_table.php 查看文件

1
-<?php
2
-
3
-use Illuminate\Database\Migrations\Migration;
4
-use Illuminate\Database\Schema\Blueprint;
5
-use Illuminate\Support\Facades\Schema;
6
-
7
-return new class extends Migration
8
-{
9
-    /**
10
-     * Run the migrations.
11
-     */
12
-    public function up(): void
13
-    {
14
-        Schema::create('account_histories', function (Blueprint $table) {
15
-            $table->id();
16
-            $table->unsignedBigInteger('company_id');
17
-            $table->unsignedBigInteger('account_id');
18
-            $table->string('type');
19
-            $table->string('name');
20
-            $table->string('number');
21
-            $table->string('currency_code');
22
-            $table->bigInteger('opening_balance');
23
-            $table->bigInteger('balance');
24
-            $table->bigInteger('exchange_rate');
25
-            $table->string('status');
26
-            $table->json('actions')->nullable();
27
-            $table->string('description')->nullable();
28
-            $table->boolean('enabled');
29
-            $table->unsignedBigInteger('changed_by')->nullable();
30
-            $table->timestamps();
31
-
32
-            $table->index(['company_id', 'account_id']);
33
-        });
34
-    }
35
-
36
-    /**
37
-     * Reverse the migrations.
38
-     */
39
-    public function down(): void
40
-    {
41
-        Schema::dropIfExists('account_histories');
42
-    }
43
-};

+ 86
- 86
package-lock.json 查看文件

507
             }
507
             }
508
         },
508
         },
509
         "node_modules/@rollup/rollup-android-arm-eabi": {
509
         "node_modules/@rollup/rollup-android-arm-eabi": {
510
-            "version": "4.17.0",
511
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.17.0.tgz",
512
-            "integrity": "sha512-nNvLvC2fjC+3+bHYN9uaGF3gcyy7RHGZhtl8TB/kINj9hiOQza8kWJGZh47GRPMrqeseO8U+Z8ElDMCZlWBdHA==",
510
+            "version": "4.17.2",
511
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.17.2.tgz",
512
+            "integrity": "sha512-NM0jFxY8bB8QLkoKxIQeObCaDlJKewVlIEkuyYKm5An1tdVZ966w2+MPQ2l8LBZLjR+SgyV+nRkTIunzOYBMLQ==",
513
             "cpu": [
513
             "cpu": [
514
                 "arm"
514
                 "arm"
515
             ],
515
             ],
520
             ]
520
             ]
521
         },
521
         },
522
         "node_modules/@rollup/rollup-android-arm64": {
522
         "node_modules/@rollup/rollup-android-arm64": {
523
-            "version": "4.17.0",
524
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.17.0.tgz",
525
-            "integrity": "sha512-+kjt6dvxnyTIAo7oHeYseYhDyZ7xRKTNl/FoQI96PHkJVxoChldJnne/LzYqpqidoK1/0kX0/q+5rrYqjpth6w==",
523
+            "version": "4.17.2",
524
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.17.2.tgz",
525
+            "integrity": "sha512-yeX/Usk7daNIVwkq2uGoq2BYJKZY1JfyLTaHO/jaiSwi/lsf8fTFoQW/n6IdAsx5tx+iotu2zCJwz8MxI6D/Bw==",
526
             "cpu": [
526
             "cpu": [
527
                 "arm64"
527
                 "arm64"
528
             ],
528
             ],
533
             ]
533
             ]
534
         },
534
         },
535
         "node_modules/@rollup/rollup-darwin-arm64": {
535
         "node_modules/@rollup/rollup-darwin-arm64": {
536
-            "version": "4.17.0",
537
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.17.0.tgz",
538
-            "integrity": "sha512-Oj6Tp0unMpGTBjvNwbSRv3DopMNLu+mjBzhKTt2zLbDJ/45fB1pltr/rqrO4bE95LzuYwhYn127pop+x/pzf5w==",
536
+            "version": "4.17.2",
537
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.17.2.tgz",
538
+            "integrity": "sha512-kcMLpE6uCwls023+kknm71ug7MZOrtXo+y5p/tsg6jltpDtgQY1Eq5sGfHcQfb+lfuKwhBmEURDga9N0ol4YPw==",
539
             "cpu": [
539
             "cpu": [
540
                 "arm64"
540
                 "arm64"
541
             ],
541
             ],
546
             ]
546
             ]
547
         },
547
         },
548
         "node_modules/@rollup/rollup-darwin-x64": {
548
         "node_modules/@rollup/rollup-darwin-x64": {
549
-            "version": "4.17.0",
550
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.17.0.tgz",
551
-            "integrity": "sha512-3nJx0T+yptxMd+v93rBRxSPTAVCv8szu/fGZDJiKX7kvRe9sENj2ggXjCH/KK1xZEmJOhaNo0c9sGMgGdfkvEw==",
549
+            "version": "4.17.2",
550
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.17.2.tgz",
551
+            "integrity": "sha512-AtKwD0VEx0zWkL0ZjixEkp5tbNLzX+FCqGG1SvOu993HnSz4qDI6S4kGzubrEJAljpVkhRSlg5bzpV//E6ysTQ==",
552
             "cpu": [
552
             "cpu": [
553
                 "x64"
553
                 "x64"
554
             ],
554
             ],
559
             ]
559
             ]
560
         },
560
         },
561
         "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
561
         "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
562
-            "version": "4.17.0",
563
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.17.0.tgz",
564
-            "integrity": "sha512-Vb2e8p9b2lxxgqyOlBHmp6hJMu/HSU6g//6Tbr7x5V1DlPCHWLOm37nSIVK314f+IHzORyAQSqL7+9tELxX3zQ==",
562
+            "version": "4.17.2",
563
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.17.2.tgz",
564
+            "integrity": "sha512-3reX2fUHqN7sffBNqmEyMQVj/CKhIHZd4y631duy0hZqI8Qoqf6lTtmAKvJFYa6bhU95B1D0WgzHkmTg33In0A==",
565
             "cpu": [
565
             "cpu": [
566
                 "arm"
566
                 "arm"
567
             ],
567
             ],
572
             ]
572
             ]
573
         },
573
         },
574
         "node_modules/@rollup/rollup-linux-arm-musleabihf": {
574
         "node_modules/@rollup/rollup-linux-arm-musleabihf": {
575
-            "version": "4.17.0",
576
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.17.0.tgz",
577
-            "integrity": "sha512-Md60KsmC5ZIaRq/bYYDloklgU+XLEZwS2EXXVcSpiUw+13/ZASvSWQ/P92rQ9YDCL6EIoXxuQ829JkReqdYbGg==",
575
+            "version": "4.17.2",
576
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.17.2.tgz",
577
+            "integrity": "sha512-uSqpsp91mheRgw96xtyAGP9FW5ChctTFEoXP0r5FAzj/3ZRv3Uxjtc7taRQSaQM/q85KEKjKsZuiZM3GyUivRg==",
578
             "cpu": [
578
             "cpu": [
579
                 "arm"
579
                 "arm"
580
             ],
580
             ],
585
             ]
585
             ]
586
         },
586
         },
587
         "node_modules/@rollup/rollup-linux-arm64-gnu": {
587
         "node_modules/@rollup/rollup-linux-arm64-gnu": {
588
-            "version": "4.17.0",
589
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.17.0.tgz",
590
-            "integrity": "sha512-zL5rBFtJ+2EGnMRm2TqKjdjgFqlotSU+ZJEN37nV+fiD3I6Gy0dUh3jBWN0wSlcXVDEJYW7YBe+/2j0N9unb2w==",
588
+            "version": "4.17.2",
589
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.17.2.tgz",
590
+            "integrity": "sha512-EMMPHkiCRtE8Wdk3Qhtciq6BndLtstqZIroHiiGzB3C5LDJmIZcSzVtLRbwuXuUft1Cnv+9fxuDtDxz3k3EW2A==",
591
             "cpu": [
591
             "cpu": [
592
                 "arm64"
592
                 "arm64"
593
             ],
593
             ],
598
             ]
598
             ]
599
         },
599
         },
600
         "node_modules/@rollup/rollup-linux-arm64-musl": {
600
         "node_modules/@rollup/rollup-linux-arm64-musl": {
601
-            "version": "4.17.0",
602
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.17.0.tgz",
603
-            "integrity": "sha512-s2xAyNkJqUdtRVgNK4NK4P9QttS538JuX/kfVQOdZDI5FIKVAUVdLW7qhGfmaySJ1EvN/Bnj9oPm5go9u8navg==",
601
+            "version": "4.17.2",
602
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.17.2.tgz",
603
+            "integrity": "sha512-NMPylUUZ1i0z/xJUIx6VUhISZDRT+uTWpBcjdv0/zkp7b/bQDF+NfnfdzuTiB1G6HTodgoFa93hp0O1xl+/UbA==",
604
             "cpu": [
604
             "cpu": [
605
                 "arm64"
605
                 "arm64"
606
             ],
606
             ],
611
             ]
611
             ]
612
         },
612
         },
613
         "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
613
         "node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
614
-            "version": "4.17.0",
615
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.17.0.tgz",
616
-            "integrity": "sha512-7F99yzVT67B7IUNMjLD9QCFDCyHkyCJMS1dywZrGgVFJao4VJ9szrIEgH67cR+bXQgEaY01ur/WSL6B0jtcLyA==",
614
+            "version": "4.17.2",
615
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.17.2.tgz",
616
+            "integrity": "sha512-T19My13y8uYXPw/L/k0JYaX1fJKFT/PWdXiHr8mTbXWxjVF1t+8Xl31DgBBvEKclw+1b00Chg0hxE2O7bTG7GQ==",
617
             "cpu": [
617
             "cpu": [
618
                 "ppc64"
618
                 "ppc64"
619
             ],
619
             ],
624
             ]
624
             ]
625
         },
625
         },
626
         "node_modules/@rollup/rollup-linux-riscv64-gnu": {
626
         "node_modules/@rollup/rollup-linux-riscv64-gnu": {
627
-            "version": "4.17.0",
628
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.17.0.tgz",
629
-            "integrity": "sha512-leFtyiXisfa3Sg9pgZJwRKITWnrQfhtqDjCamnZhkZuIsk1FXmYwKoTkp6lsCgimIcneFFkHKp/yGLxDesga4g==",
627
+            "version": "4.17.2",
628
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.17.2.tgz",
629
+            "integrity": "sha512-BOaNfthf3X3fOWAB+IJ9kxTgPmMqPPH5f5k2DcCsRrBIbWnaJCgX2ll77dV1TdSy9SaXTR5iDXRL8n7AnoP5cg==",
630
             "cpu": [
630
             "cpu": [
631
                 "riscv64"
631
                 "riscv64"
632
             ],
632
             ],
637
             ]
637
             ]
638
         },
638
         },
639
         "node_modules/@rollup/rollup-linux-s390x-gnu": {
639
         "node_modules/@rollup/rollup-linux-s390x-gnu": {
640
-            "version": "4.17.0",
641
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.17.0.tgz",
642
-            "integrity": "sha512-FtOgui6qMJ4jbSXTxElsy/60LEe/3U0rXkkz2G5CJ9rbHPAvjMvI+3qF0A0fwLQ5hW+/ZC6PbnS2KfRW9JkgDQ==",
640
+            "version": "4.17.2",
641
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.17.2.tgz",
642
+            "integrity": "sha512-W0UP/x7bnn3xN2eYMql2T/+wpASLE5SjObXILTMPUBDB/Fg/FxC+gX4nvCfPBCbNhz51C+HcqQp2qQ4u25ok6g==",
643
             "cpu": [
643
             "cpu": [
644
                 "s390x"
644
                 "s390x"
645
             ],
645
             ],
650
             ]
650
             ]
651
         },
651
         },
652
         "node_modules/@rollup/rollup-linux-x64-gnu": {
652
         "node_modules/@rollup/rollup-linux-x64-gnu": {
653
-            "version": "4.17.0",
654
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.0.tgz",
655
-            "integrity": "sha512-v6eiam/1w3HUfU/ZjzIDodencqgrSqzlNuNtiwH7PFJHYSo1ezL0/UIzmS2lpSJF1ORNaplXeKHYmmdt81vV2g==",
653
+            "version": "4.17.2",
654
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.2.tgz",
655
+            "integrity": "sha512-Hy7pLwByUOuyaFC6mAr7m+oMC+V7qyifzs/nW2OJfC8H4hbCzOX07Ov0VFk/zP3kBsELWNFi7rJtgbKYsav9QQ==",
656
             "cpu": [
656
             "cpu": [
657
                 "x64"
657
                 "x64"
658
             ],
658
             ],
663
             ]
663
             ]
664
         },
664
         },
665
         "node_modules/@rollup/rollup-linux-x64-musl": {
665
         "node_modules/@rollup/rollup-linux-x64-musl": {
666
-            "version": "4.17.0",
667
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.17.0.tgz",
668
-            "integrity": "sha512-OUhkSdpM5ofVlVU2k4CwVubYwiwu1a4jYWPpubzN7Vzao73GoPBowHcCfaRSFRz1SszJ3HIsk3dZYk4kzbqjgw==",
666
+            "version": "4.17.2",
667
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.17.2.tgz",
668
+            "integrity": "sha512-h1+yTWeYbRdAyJ/jMiVw0l6fOOm/0D1vNLui9iPuqgRGnXA0u21gAqOyB5iHjlM9MMfNOm9RHCQ7zLIzT0x11Q==",
669
             "cpu": [
669
             "cpu": [
670
                 "x64"
670
                 "x64"
671
             ],
671
             ],
676
             ]
676
             ]
677
         },
677
         },
678
         "node_modules/@rollup/rollup-win32-arm64-msvc": {
678
         "node_modules/@rollup/rollup-win32-arm64-msvc": {
679
-            "version": "4.17.0",
680
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.17.0.tgz",
681
-            "integrity": "sha512-uL7UYO/MNJPGL/yflybI+HI+n6+4vlfZmQZOCb4I+z/zy1wisHT3exh7oNQsnL6Eso0EUTEfgQ/PaGzzXf6XyQ==",
679
+            "version": "4.17.2",
680
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.17.2.tgz",
681
+            "integrity": "sha512-tmdtXMfKAjy5+IQsVtDiCfqbynAQE/TQRpWdVataHmhMb9DCoJxp9vLcCBjEQWMiUYxO1QprH/HbY9ragCEFLA==",
682
             "cpu": [
682
             "cpu": [
683
                 "arm64"
683
                 "arm64"
684
             ],
684
             ],
689
             ]
689
             ]
690
         },
690
         },
691
         "node_modules/@rollup/rollup-win32-ia32-msvc": {
691
         "node_modules/@rollup/rollup-win32-ia32-msvc": {
692
-            "version": "4.17.0",
693
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.17.0.tgz",
694
-            "integrity": "sha512-4WnSgaUiUmXILwFqREdOcqvSj6GD/7FrvSjhaDjmwakX9w4Z2F8JwiSP1AZZbuRkPqzi444UI5FPv33VKOWYFQ==",
692
+            "version": "4.17.2",
693
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.17.2.tgz",
694
+            "integrity": "sha512-7II/QCSTAHuE5vdZaQEwJq2ZACkBpQDOmQsE6D6XUbnBHW8IAhm4eTufL6msLJorzrHDFv3CF8oCA/hSIRuZeQ==",
695
             "cpu": [
695
             "cpu": [
696
                 "ia32"
696
                 "ia32"
697
             ],
697
             ],
702
             ]
702
             ]
703
         },
703
         },
704
         "node_modules/@rollup/rollup-win32-x64-msvc": {
704
         "node_modules/@rollup/rollup-win32-x64-msvc": {
705
-            "version": "4.17.0",
706
-            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.17.0.tgz",
707
-            "integrity": "sha512-ve+D8t1prRSRnF2S3pyDtTXDlvW1Pngbz76tjgYFQW1jxVSysmQCZfPoDAo4WP+Ano8zeYp85LsArZBI12HfwQ==",
705
+            "version": "4.17.2",
706
+            "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.17.2.tgz",
707
+            "integrity": "sha512-TGGO7v7qOq4CYmSBVEYpI1Y5xDuCEnbVC5Vth8mOsW0gDSzxNrVERPc790IGHsrT2dQSimgMr9Ub3Y1Jci5/8w==",
708
             "cpu": [
708
             "cpu": [
709
                 "x64"
709
                 "x64"
710
             ],
710
             ],
931
             }
931
             }
932
         },
932
         },
933
         "node_modules/caniuse-lite": {
933
         "node_modules/caniuse-lite": {
934
-            "version": "1.0.30001613",
935
-            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001613.tgz",
936
-            "integrity": "sha512-BNjJULJfOONQERivfxte7alLfeLW4QnwHvNW4wEcLEbXfV6VSCYvr+REbf2Sojv8tC1THpjPXBxWgDbq4NtLWg==",
934
+            "version": "1.0.30001616",
935
+            "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001616.tgz",
936
+            "integrity": "sha512-RHVYKov7IcdNjVHJFNY/78RdG4oGVjbayxv8u5IO74Wv7Hlq4PnJE6mo/OjFijjVFNy5ijnCt6H3IIo4t+wfEw==",
937
             "dev": true,
937
             "dev": true,
938
             "funding": [
938
             "funding": [
939
                 {
939
                 {
1079
             "dev": true
1079
             "dev": true
1080
         },
1080
         },
1081
         "node_modules/electron-to-chromium": {
1081
         "node_modules/electron-to-chromium": {
1082
-            "version": "1.4.750",
1083
-            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.750.tgz",
1084
-            "integrity": "sha512-9ItEpeu15hW5m8jKdriL+BQrgwDTXEL9pn4SkillWFu73ZNNNQ2BKKLS+ZHv2vC9UkNhosAeyfxOf/5OSeTCPA==",
1082
+            "version": "1.4.757",
1083
+            "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.757.tgz",
1084
+            "integrity": "sha512-jftDaCknYSSt/+KKeXzH3LX5E2CvRLm75P3Hj+J/dv3CL0qUYcOt13d5FN1NiL5IJbbhzHrb3BomeG2tkSlZmw==",
1085
             "dev": true
1085
             "dev": true
1086
         },
1086
         },
1087
         "node_modules/emoji-regex": {
1087
         "node_modules/emoji-regex": {
1467
             "dev": true
1467
             "dev": true
1468
         },
1468
         },
1469
         "node_modules/lru-cache": {
1469
         "node_modules/lru-cache": {
1470
-            "version": "10.2.1",
1471
-            "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.1.tgz",
1472
-            "integrity": "sha512-tS24spDe/zXhWbNPErCHs/AGOzbKGHT+ybSBqmdLm8WZ1xXLWvH8Qn71QPAlqVhd0qUTWjy+Kl9JmISgDdEjsA==",
1470
+            "version": "10.2.2",
1471
+            "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.2.tgz",
1472
+            "integrity": "sha512-9hp3Vp2/hFQUiIwKo8XCeFVnrg8Pk3TYNPIR7tJADKi5YfcF7vEaK7avFHTlSy3kOKYaJQaalfEo6YuXdceBOQ==",
1473
             "dev": true,
1473
             "dev": true,
1474
             "engines": {
1474
             "engines": {
1475
                 "node": "14 || >=16.14"
1475
                 "node": "14 || >=16.14"
1543
             }
1543
             }
1544
         },
1544
         },
1545
         "node_modules/minipass": {
1545
         "node_modules/minipass": {
1546
-            "version": "7.0.4",
1547
-            "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz",
1548
-            "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==",
1546
+            "version": "7.1.0",
1547
+            "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.0.tgz",
1548
+            "integrity": "sha512-oGZRv2OT1lO2UF1zUcwdTb3wqUwI0kBGTgt/T7OdSj6M6N5m3o5uPf0AIW6lVxGGoiWUR7e2AwTE+xiwK8WQig==",
1549
             "dev": true,
1549
             "dev": true,
1550
             "engines": {
1550
             "engines": {
1551
                 "node": ">=16 || 14 >=14.17"
1551
                 "node": ">=16 || 14 >=14.17"
2010
             }
2010
             }
2011
         },
2011
         },
2012
         "node_modules/rollup": {
2012
         "node_modules/rollup": {
2013
-            "version": "4.17.0",
2014
-            "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.17.0.tgz",
2015
-            "integrity": "sha512-wZJSn0WMtWrxhYKQRt5Z6GIXlziOoMDFmbHmRfL3v+sBTAshx2DBq1AfMArB7eIjF63r4ocn2ZTAyUptg/7kmQ==",
2013
+            "version": "4.17.2",
2014
+            "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.17.2.tgz",
2015
+            "integrity": "sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ==",
2016
             "dev": true,
2016
             "dev": true,
2017
             "dependencies": {
2017
             "dependencies": {
2018
                 "@types/estree": "1.0.5"
2018
                 "@types/estree": "1.0.5"
2025
                 "npm": ">=8.0.0"
2025
                 "npm": ">=8.0.0"
2026
             },
2026
             },
2027
             "optionalDependencies": {
2027
             "optionalDependencies": {
2028
-                "@rollup/rollup-android-arm-eabi": "4.17.0",
2029
-                "@rollup/rollup-android-arm64": "4.17.0",
2030
-                "@rollup/rollup-darwin-arm64": "4.17.0",
2031
-                "@rollup/rollup-darwin-x64": "4.17.0",
2032
-                "@rollup/rollup-linux-arm-gnueabihf": "4.17.0",
2033
-                "@rollup/rollup-linux-arm-musleabihf": "4.17.0",
2034
-                "@rollup/rollup-linux-arm64-gnu": "4.17.0",
2035
-                "@rollup/rollup-linux-arm64-musl": "4.17.0",
2036
-                "@rollup/rollup-linux-powerpc64le-gnu": "4.17.0",
2037
-                "@rollup/rollup-linux-riscv64-gnu": "4.17.0",
2038
-                "@rollup/rollup-linux-s390x-gnu": "4.17.0",
2039
-                "@rollup/rollup-linux-x64-gnu": "4.17.0",
2040
-                "@rollup/rollup-linux-x64-musl": "4.17.0",
2041
-                "@rollup/rollup-win32-arm64-msvc": "4.17.0",
2042
-                "@rollup/rollup-win32-ia32-msvc": "4.17.0",
2043
-                "@rollup/rollup-win32-x64-msvc": "4.17.0",
2028
+                "@rollup/rollup-android-arm-eabi": "4.17.2",
2029
+                "@rollup/rollup-android-arm64": "4.17.2",
2030
+                "@rollup/rollup-darwin-arm64": "4.17.2",
2031
+                "@rollup/rollup-darwin-x64": "4.17.2",
2032
+                "@rollup/rollup-linux-arm-gnueabihf": "4.17.2",
2033
+                "@rollup/rollup-linux-arm-musleabihf": "4.17.2",
2034
+                "@rollup/rollup-linux-arm64-gnu": "4.17.2",
2035
+                "@rollup/rollup-linux-arm64-musl": "4.17.2",
2036
+                "@rollup/rollup-linux-powerpc64le-gnu": "4.17.2",
2037
+                "@rollup/rollup-linux-riscv64-gnu": "4.17.2",
2038
+                "@rollup/rollup-linux-s390x-gnu": "4.17.2",
2039
+                "@rollup/rollup-linux-x64-gnu": "4.17.2",
2040
+                "@rollup/rollup-linux-x64-musl": "4.17.2",
2041
+                "@rollup/rollup-win32-arm64-msvc": "4.17.2",
2042
+                "@rollup/rollup-win32-ia32-msvc": "4.17.2",
2043
+                "@rollup/rollup-win32-x64-msvc": "4.17.2",
2044
                 "fsevents": "~2.3.2"
2044
                 "fsevents": "~2.3.2"
2045
             }
2045
             }
2046
         },
2046
         },
2329
             "dev": true
2329
             "dev": true
2330
         },
2330
         },
2331
         "node_modules/update-browserslist-db": {
2331
         "node_modules/update-browserslist-db": {
2332
-            "version": "1.0.13",
2333
-            "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz",
2334
-            "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==",
2332
+            "version": "1.0.15",
2333
+            "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.15.tgz",
2334
+            "integrity": "sha512-K9HWH62x3/EalU1U6sjSZiylm9C8tgq2mSvshZpqc7QE69RaA2qjhkW2HlNA0tFpEbtyFz7HTqbSdN4MSwUodA==",
2335
             "dev": true,
2335
             "dev": true,
2336
             "funding": [
2336
             "funding": [
2337
                 {
2337
                 {
2348
                 }
2348
                 }
2349
             ],
2349
             ],
2350
             "dependencies": {
2350
             "dependencies": {
2351
-                "escalade": "^3.1.1",
2351
+                "escalade": "^3.1.2",
2352
                 "picocolors": "^1.0.0"
2352
                 "picocolors": "^1.0.0"
2353
             },
2353
             },
2354
             "bin": {
2354
             "bin": {
2365
             "dev": true
2365
             "dev": true
2366
         },
2366
         },
2367
         "node_modules/vite": {
2367
         "node_modules/vite": {
2368
-            "version": "5.2.10",
2369
-            "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.10.tgz",
2370
-            "integrity": "sha512-PAzgUZbP7msvQvqdSD+ErD5qGnSFiGOoWmV5yAKUEI0kdhjbH6nMWVyZQC/hSc4aXwc0oJ9aEdIiF9Oje0JFCw==",
2368
+            "version": "5.2.11",
2369
+            "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz",
2370
+            "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==",
2371
             "dev": true,
2371
             "dev": true,
2372
             "dependencies": {
2372
             "dependencies": {
2373
                 "esbuild": "^0.20.1",
2373
                 "esbuild": "^0.20.1",

+ 1
- 1
resources/views/livewire/company/service/connected-account/list-institutions.blade.php 查看文件

56
 
56
 
57
                             @if($account?->ending_balance)
57
                             @if($account?->ending_balance)
58
                                 <div class="account-balance flex text-base leading-6 text-gray-700 dark:text-gray-200 space-x-1">
58
                                 <div class="account-balance flex text-base leading-6 text-gray-700 dark:text-gray-200 space-x-1">
59
-                                    <strong wire:poll.visible>{{ $account->ending_balance->formatted() }}</strong>
59
+                                    <strong wire:poll.visible>{{ $account->ending_balance->format() }}</strong>
60
                                     <p>{{ $account->currency_code }}</p>
60
                                     <p>{{ $account->currency_code }}</p>
61
                                 </div>
61
                                 </div>
62
                             @endif
62
                             @endif

Loading…
取消
儲存