Browse Source

update: dependencies and account

3.x
wallo 2 years ago
parent
commit
d7569c7365

+ 11
- 0
app/Filament/Company/Resources/Banking/AccountResource.php View File

256
                             $cachedExchangeRate = $currencyService->getCachedExchangeRate($defaultCurrency, $record->currency_code);
256
                             $cachedExchangeRate = $currencyService->getCachedExchangeRate($defaultCurrency, $record->currency_code);
257
                             $oldExchangeRate = $record->currency->rate;
257
                             $oldExchangeRate = $record->currency->rate;
258
 
258
 
259
+                            if ($cachedExchangeRate === null) {
260
+                                Notification::make()
261
+                                    ->warning()
262
+                                    ->title('Exchange Rate Unavailable')
263
+                                    ->body(__('The exchange rate for this account is currently unavailable. Please try again later.'))
264
+                                    ->persistent()
265
+                                    ->send();
266
+
267
+                                $action->cancel();
268
+                            }
269
+
259
                             if ($cachedExchangeRate === $oldExchangeRate) {
270
                             if ($cachedExchangeRate === $oldExchangeRate) {
260
                                 Notification::make()
271
                                 Notification::make()
261
                                     ->warning()
272
                                     ->warning()

+ 3
- 3
app/Listeners/SyncAssociatedModels.php View File

57
         }
57
         }
58
     }
58
     }
59
 
59
 
60
-    private function updateEnabledStatus(BelongsTo $relation, $newId): void
60
+    private function updateEnabledStatus(BelongsTo $relation, $newValue): void
61
     {
61
     {
62
         if ($relation->exists()) {
62
         if ($relation->exists()) {
63
             $previousDefault = $relation->getResults();
63
             $previousDefault = $relation->getResults();
64
             $previousDefault->update(['enabled' => false]);
64
             $previousDefault->update(['enabled' => false]);
65
         }
65
         }
66
 
66
 
67
-        if ($newId !== null) {
68
-            $newDefault = $relation->getRelated()->newQuery()->find($newId);
67
+        if ($newValue !== null) {
68
+            $newDefault = $relation->getRelated()->newQuery()->where($relation->getOwnerKeyName(), $newValue)->first();
69
             $newDefault?->update(['enabled' => true]);
69
             $newDefault?->update(['enabled' => true]);
70
         }
70
         }
71
     }
71
     }

+ 2
- 1
app/Models/Banking/Account.php View File

4
 
4
 
5
 use App\Casts\MoneyCast;
5
 use App\Casts\MoneyCast;
6
 use App\Models\Setting\Currency;
6
 use App\Models\Setting\Currency;
7
-use App\Traits\{Blamable, CompanyOwned};
7
+use App\Traits\{Blamable, CompanyOwned, SyncsWithCompanyDefaults};
8
 use Database\Factories\Banking\AccountFactory;
8
 use Database\Factories\Banking\AccountFactory;
9
 use Illuminate\Database\Eloquent\Factories\{Factory, HasFactory};
9
 use Illuminate\Database\Eloquent\Factories\{Factory, HasFactory};
10
 use Illuminate\Database\Eloquent\Model;
10
 use Illuminate\Database\Eloquent\Model;
18
     use CompanyOwned;
18
     use CompanyOwned;
19
     use HasFactory;
19
     use HasFactory;
20
     use HasTags;
20
     use HasTags;
21
+    use SyncsWithCompanyDefaults;
21
 
22
 
22
     protected $table = 'accounts';
23
     protected $table = 'accounts';
23
 
24
 

+ 37
- 37
composer.lock View File

1234
         },
1234
         },
1235
         {
1235
         {
1236
             "name": "filament/actions",
1236
             "name": "filament/actions",
1237
-            "version": "v3.0.62",
1237
+            "version": "v3.0.63",
1238
             "source": {
1238
             "source": {
1239
                 "type": "git",
1239
                 "type": "git",
1240
                 "url": "https://github.com/filamentphp/actions.git",
1240
                 "url": "https://github.com/filamentphp/actions.git",
1241
-                "reference": "bdb469056fe3b8265ce5b7c7f115338783cedb5c"
1241
+                "reference": "7533ade9edf0ca07d9fccc3c49f41318c8aadb1c"
1242
             },
1242
             },
1243
             "dist": {
1243
             "dist": {
1244
                 "type": "zip",
1244
                 "type": "zip",
1245
-                "url": "https://api.github.com/repos/filamentphp/actions/zipball/bdb469056fe3b8265ce5b7c7f115338783cedb5c",
1246
-                "reference": "bdb469056fe3b8265ce5b7c7f115338783cedb5c",
1245
+                "url": "https://api.github.com/repos/filamentphp/actions/zipball/7533ade9edf0ca07d9fccc3c49f41318c8aadb1c",
1246
+                "reference": "7533ade9edf0ca07d9fccc3c49f41318c8aadb1c",
1247
                 "shasum": ""
1247
                 "shasum": ""
1248
             },
1248
             },
1249
             "require": {
1249
             "require": {
1280
                 "issues": "https://github.com/filamentphp/filament/issues",
1280
                 "issues": "https://github.com/filamentphp/filament/issues",
1281
                 "source": "https://github.com/filamentphp/filament"
1281
                 "source": "https://github.com/filamentphp/filament"
1282
             },
1282
             },
1283
-            "time": "2023-09-25T19:23:47+00:00"
1283
+            "time": "2023-09-30T14:07:50+00:00"
1284
         },
1284
         },
1285
         {
1285
         {
1286
             "name": "filament/filament",
1286
             "name": "filament/filament",
1287
-            "version": "v3.0.62",
1287
+            "version": "v3.0.63",
1288
             "source": {
1288
             "source": {
1289
                 "type": "git",
1289
                 "type": "git",
1290
                 "url": "https://github.com/filamentphp/panels.git",
1290
                 "url": "https://github.com/filamentphp/panels.git",
1291
-                "reference": "d70fc7bf035ec5162c07bd2c71b367d78d86ba5a"
1291
+                "reference": "0d8f301ffcccfa9b6a7f9f1049b7ce80a278b01e"
1292
             },
1292
             },
1293
             "dist": {
1293
             "dist": {
1294
                 "type": "zip",
1294
                 "type": "zip",
1295
-                "url": "https://api.github.com/repos/filamentphp/panels/zipball/d70fc7bf035ec5162c07bd2c71b367d78d86ba5a",
1296
-                "reference": "d70fc7bf035ec5162c07bd2c71b367d78d86ba5a",
1295
+                "url": "https://api.github.com/repos/filamentphp/panels/zipball/0d8f301ffcccfa9b6a7f9f1049b7ce80a278b01e",
1296
+                "reference": "0d8f301ffcccfa9b6a7f9f1049b7ce80a278b01e",
1297
                 "shasum": ""
1297
                 "shasum": ""
1298
             },
1298
             },
1299
             "require": {
1299
             "require": {
1345
                 "issues": "https://github.com/filamentphp/filament/issues",
1345
                 "issues": "https://github.com/filamentphp/filament/issues",
1346
                 "source": "https://github.com/filamentphp/filament"
1346
                 "source": "https://github.com/filamentphp/filament"
1347
             },
1347
             },
1348
-            "time": "2023-09-25T19:23:50+00:00"
1348
+            "time": "2023-09-30T14:07:59+00:00"
1349
         },
1349
         },
1350
         {
1350
         {
1351
             "name": "filament/forms",
1351
             "name": "filament/forms",
1352
-            "version": "v3.0.62",
1352
+            "version": "v3.0.63",
1353
             "source": {
1353
             "source": {
1354
                 "type": "git",
1354
                 "type": "git",
1355
                 "url": "https://github.com/filamentphp/forms.git",
1355
                 "url": "https://github.com/filamentphp/forms.git",
1356
-                "reference": "78bec0ef90965d0da8c61a18b2ca2065aca7070c"
1356
+                "reference": "65166c53015f0bee0abac491aaed2311ca4d083a"
1357
             },
1357
             },
1358
             "dist": {
1358
             "dist": {
1359
                 "type": "zip",
1359
                 "type": "zip",
1360
-                "url": "https://api.github.com/repos/filamentphp/forms/zipball/78bec0ef90965d0da8c61a18b2ca2065aca7070c",
1361
-                "reference": "78bec0ef90965d0da8c61a18b2ca2065aca7070c",
1360
+                "url": "https://api.github.com/repos/filamentphp/forms/zipball/65166c53015f0bee0abac491aaed2311ca4d083a",
1361
+                "reference": "65166c53015f0bee0abac491aaed2311ca4d083a",
1362
                 "shasum": ""
1362
                 "shasum": ""
1363
             },
1363
             },
1364
             "require": {
1364
             "require": {
1401
                 "issues": "https://github.com/filamentphp/filament/issues",
1401
                 "issues": "https://github.com/filamentphp/filament/issues",
1402
                 "source": "https://github.com/filamentphp/filament"
1402
                 "source": "https://github.com/filamentphp/filament"
1403
             },
1403
             },
1404
-            "time": "2023-09-25T19:23:44+00:00"
1404
+            "time": "2023-09-30T14:07:48+00:00"
1405
         },
1405
         },
1406
         {
1406
         {
1407
             "name": "filament/infolists",
1407
             "name": "filament/infolists",
1408
-            "version": "v3.0.62",
1408
+            "version": "v3.0.63",
1409
             "source": {
1409
             "source": {
1410
                 "type": "git",
1410
                 "type": "git",
1411
                 "url": "https://github.com/filamentphp/infolists.git",
1411
                 "url": "https://github.com/filamentphp/infolists.git",
1456
         },
1456
         },
1457
         {
1457
         {
1458
             "name": "filament/notifications",
1458
             "name": "filament/notifications",
1459
-            "version": "v3.0.62",
1459
+            "version": "v3.0.63",
1460
             "source": {
1460
             "source": {
1461
                 "type": "git",
1461
                 "type": "git",
1462
                 "url": "https://github.com/filamentphp/notifications.git",
1462
                 "url": "https://github.com/filamentphp/notifications.git",
1463
-                "reference": "f9eb47d71e53f3f31af995ce09facb895fe605d4"
1463
+                "reference": "bcca58686b750084d9052bfc71b56ff2d0defa6f"
1464
             },
1464
             },
1465
             "dist": {
1465
             "dist": {
1466
                 "type": "zip",
1466
                 "type": "zip",
1467
-                "url": "https://api.github.com/repos/filamentphp/notifications/zipball/f9eb47d71e53f3f31af995ce09facb895fe605d4",
1468
-                "reference": "f9eb47d71e53f3f31af995ce09facb895fe605d4",
1467
+                "url": "https://api.github.com/repos/filamentphp/notifications/zipball/bcca58686b750084d9052bfc71b56ff2d0defa6f",
1468
+                "reference": "bcca58686b750084d9052bfc71b56ff2d0defa6f",
1469
                 "shasum": ""
1469
                 "shasum": ""
1470
             },
1470
             },
1471
             "require": {
1471
             "require": {
1504
                 "issues": "https://github.com/filamentphp/filament/issues",
1504
                 "issues": "https://github.com/filamentphp/filament/issues",
1505
                 "source": "https://github.com/filamentphp/filament"
1505
                 "source": "https://github.com/filamentphp/filament"
1506
             },
1506
             },
1507
-            "time": "2023-09-25T19:23:46+00:00"
1507
+            "time": "2023-09-30T14:07:48+00:00"
1508
         },
1508
         },
1509
         {
1509
         {
1510
             "name": "filament/spatie-laravel-tags-plugin",
1510
             "name": "filament/spatie-laravel-tags-plugin",
1511
-            "version": "v3.0.62",
1511
+            "version": "v3.0.63",
1512
             "source": {
1512
             "source": {
1513
                 "type": "git",
1513
                 "type": "git",
1514
                 "url": "https://github.com/filamentphp/spatie-laravel-tags-plugin.git",
1514
                 "url": "https://github.com/filamentphp/spatie-laravel-tags-plugin.git",
1545
         },
1545
         },
1546
         {
1546
         {
1547
             "name": "filament/support",
1547
             "name": "filament/support",
1548
-            "version": "v3.0.62",
1548
+            "version": "v3.0.63",
1549
             "source": {
1549
             "source": {
1550
                 "type": "git",
1550
                 "type": "git",
1551
                 "url": "https://github.com/filamentphp/support.git",
1551
                 "url": "https://github.com/filamentphp/support.git",
1552
-                "reference": "48f4aa87829678bfe50a6e18a81a6428b47b5948"
1552
+                "reference": "d4f1fd574969a628c691c1603115769f438f4618"
1553
             },
1553
             },
1554
             "dist": {
1554
             "dist": {
1555
                 "type": "zip",
1555
                 "type": "zip",
1556
-                "url": "https://api.github.com/repos/filamentphp/support/zipball/48f4aa87829678bfe50a6e18a81a6428b47b5948",
1557
-                "reference": "48f4aa87829678bfe50a6e18a81a6428b47b5948",
1556
+                "url": "https://api.github.com/repos/filamentphp/support/zipball/d4f1fd574969a628c691c1603115769f438f4618",
1557
+                "reference": "d4f1fd574969a628c691c1603115769f438f4618",
1558
                 "shasum": ""
1558
                 "shasum": ""
1559
             },
1559
             },
1560
             "require": {
1560
             "require": {
1598
                 "issues": "https://github.com/filamentphp/filament/issues",
1598
                 "issues": "https://github.com/filamentphp/filament/issues",
1599
                 "source": "https://github.com/filamentphp/filament"
1599
                 "source": "https://github.com/filamentphp/filament"
1600
             },
1600
             },
1601
-            "time": "2023-09-25T19:24:07+00:00"
1601
+            "time": "2023-09-30T14:08:13+00:00"
1602
         },
1602
         },
1603
         {
1603
         {
1604
             "name": "filament/tables",
1604
             "name": "filament/tables",
1605
-            "version": "v3.0.62",
1605
+            "version": "v3.0.63",
1606
             "source": {
1606
             "source": {
1607
                 "type": "git",
1607
                 "type": "git",
1608
                 "url": "https://github.com/filamentphp/tables.git",
1608
                 "url": "https://github.com/filamentphp/tables.git",
1609
-                "reference": "4fd382c363d3b24a9ca3238a83f4bd5ecfdcb475"
1609
+                "reference": "b2cb8a6c8a0f86b72343bba965e4c18710ae0828"
1610
             },
1610
             },
1611
             "dist": {
1611
             "dist": {
1612
                 "type": "zip",
1612
                 "type": "zip",
1613
-                "url": "https://api.github.com/repos/filamentphp/tables/zipball/4fd382c363d3b24a9ca3238a83f4bd5ecfdcb475",
1614
-                "reference": "4fd382c363d3b24a9ca3238a83f4bd5ecfdcb475",
1613
+                "url": "https://api.github.com/repos/filamentphp/tables/zipball/b2cb8a6c8a0f86b72343bba965e4c18710ae0828",
1614
+                "reference": "b2cb8a6c8a0f86b72343bba965e4c18710ae0828",
1615
                 "shasum": ""
1615
                 "shasum": ""
1616
             },
1616
             },
1617
             "require": {
1617
             "require": {
1651
                 "issues": "https://github.com/filamentphp/filament/issues",
1651
                 "issues": "https://github.com/filamentphp/filament/issues",
1652
                 "source": "https://github.com/filamentphp/filament"
1652
                 "source": "https://github.com/filamentphp/filament"
1653
             },
1653
             },
1654
-            "time": "2023-09-25T12:42:22+00:00"
1654
+            "time": "2023-09-30T14:08:15+00:00"
1655
         },
1655
         },
1656
         {
1656
         {
1657
             "name": "filament/widgets",
1657
             "name": "filament/widgets",
1658
-            "version": "v3.0.62",
1658
+            "version": "v3.0.63",
1659
             "source": {
1659
             "source": {
1660
                 "type": "git",
1660
                 "type": "git",
1661
                 "url": "https://github.com/filamentphp/widgets.git",
1661
                 "url": "https://github.com/filamentphp/widgets.git",
1662
-                "reference": "d28b6e814412c6927218e9b53264769fa3a7fe91"
1662
+                "reference": "0201110d2dec8a14044bbbff5d1de1659d8dd6ec"
1663
             },
1663
             },
1664
             "dist": {
1664
             "dist": {
1665
                 "type": "zip",
1665
                 "type": "zip",
1666
-                "url": "https://api.github.com/repos/filamentphp/widgets/zipball/d28b6e814412c6927218e9b53264769fa3a7fe91",
1667
-                "reference": "d28b6e814412c6927218e9b53264769fa3a7fe91",
1666
+                "url": "https://api.github.com/repos/filamentphp/widgets/zipball/0201110d2dec8a14044bbbff5d1de1659d8dd6ec",
1667
+                "reference": "0201110d2dec8a14044bbbff5d1de1659d8dd6ec",
1668
                 "shasum": ""
1668
                 "shasum": ""
1669
             },
1669
             },
1670
             "require": {
1670
             "require": {
1695
                 "issues": "https://github.com/filamentphp/filament/issues",
1695
                 "issues": "https://github.com/filamentphp/filament/issues",
1696
                 "source": "https://github.com/filamentphp/filament"
1696
                 "source": "https://github.com/filamentphp/filament"
1697
             },
1697
             },
1698
-            "time": "2023-09-25T12:42:21+00:00"
1698
+            "time": "2023-09-30T14:08:22+00:00"
1699
         },
1699
         },
1700
         {
1700
         {
1701
             "name": "fruitcake/php-cors",
1701
             "name": "fruitcake/php-cors",

Loading…
Cancel
Save