Andrew Wallo 8ヶ月前
コミット
cbf49afa17

+ 1
- 5
app/Filament/Company/Resources/Sales/ClientResource.php ファイルの表示

@@ -317,10 +317,6 @@ class ClientResource extends Resource
317 317
                     ->searchable()
318 318
                     ->sortable()
319 319
                     ->description(fn (Client $client) => $client->primaryContact->full_name),
320
-                Tables\Columns\TextColumn::make('account_number')
321
-                    ->label('Account Number')
322
-                    ->searchable()
323
-                    ->sortable(),
324 320
                 Tables\Columns\TextColumn::make('primaryContact.email')
325 321
                     ->label('Email')
326 322
                     ->searchable()
@@ -332,7 +328,7 @@ class ClientResource extends Resource
332 328
                 Tables\Columns\TextColumn::make('billingAddress.address_string')
333 329
                     ->label('Billing Address')
334 330
                     ->searchable()
335
-                    ->toggleable()
331
+                    ->toggleable(isToggledHiddenByDefault: true)
336 332
                     ->listWithLineBreaks(),
337 333
                 Tables\Columns\TextColumn::make('balance')
338 334
                     ->label('Balance')

+ 50
- 0
app/Filament/Company/Resources/Sales/ClientResource/Pages/EditClient.php ファイルの表示

@@ -4,9 +4,11 @@ namespace App\Filament\Company\Resources\Sales\ClientResource\Pages;
4 4
 
5 5
 use App\Concerns\RedirectToListPage;
6 6
 use App\Filament\Company\Resources\Sales\ClientResource;
7
+use App\Models\Common\Client;
7 8
 use Filament\Actions;
8 9
 use Filament\Resources\Pages\EditRecord;
9 10
 use Filament\Support\Enums\MaxWidth;
11
+use Illuminate\Database\Eloquent\Model;
10 12
 
11 13
 class EditClient extends EditRecord
12 14
 {
@@ -25,4 +27,52 @@ class EditClient extends EditRecord
25 27
     {
26 28
         return MaxWidth::FiveExtraLarge;
27 29
     }
30
+
31
+    protected function handleRecordUpdate(Model $record, array $data): Model
32
+    {
33
+        /** @var Client $record */
34
+        $record = parent::handleRecordUpdate($record, $data);
35
+
36
+        // Update billing address
37
+        $billingAddress = $record->billingAddress;
38
+        $billingAddress->update($data['billingAddress']);
39
+
40
+        // Update shipping address
41
+        $shippingAddress = $record->shippingAddress;
42
+        $shippingData = $data['shippingAddress'];
43
+
44
+        $shippingUpdateData = [
45
+            'recipient' => $shippingData['recipient'],
46
+            'phone' => $shippingData['phone'],
47
+            'notes' => $shippingData['notes'],
48
+        ];
49
+
50
+        if ($shippingData['same_as_billing']) {
51
+            $shippingUpdateData = [
52
+                ...$shippingUpdateData,
53
+                'parent_address_id' => $billingAddress->id,
54
+                'address_line_1' => $billingAddress->address_line_1,
55
+                'address_line_2' => $billingAddress->address_line_2,
56
+                'country' => $billingAddress->country,
57
+                'state_id' => $billingAddress->state_id,
58
+                'city' => $billingAddress->city,
59
+                'postal_code' => $billingAddress->postal_code,
60
+            ];
61
+        } else {
62
+            $shippingUpdateData = [
63
+                ...$shippingUpdateData,
64
+                'parent_address_id' => null,
65
+                'address_line_1' => $shippingData['address_line_1'],
66
+                'address_line_2' => $shippingData['address_line_2'],
67
+                'country' => $shippingData['country'],
68
+                'state_id' => $shippingData['state_id'],
69
+                'city' => $shippingData['city'],
70
+                'postal_code' => $shippingData['postal_code'],
71
+            ];
72
+        }
73
+
74
+        $shippingAddress->update($shippingUpdateData);
75
+
76
+        return $record;
77
+    }
28 78
 }

+ 22
- 24
composer.lock ファイルの表示

@@ -497,16 +497,16 @@
497 497
         },
498 498
         {
499 499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.337.0",
500
+            "version": "3.337.2",
501 501
             "source": {
502 502
                 "type": "git",
503 503
                 "url": "https://github.com/aws/aws-sdk-php.git",
504
-                "reference": "7e40cecb3ce66749bbd5eaa9f370de48c16acd6c"
504
+                "reference": "f885dd803a257da9d54e72a4750bba73e1196aee"
505 505
             },
506 506
             "dist": {
507 507
                 "type": "zip",
508
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/7e40cecb3ce66749bbd5eaa9f370de48c16acd6c",
509
-                "reference": "7e40cecb3ce66749bbd5eaa9f370de48c16acd6c",
508
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f885dd803a257da9d54e72a4750bba73e1196aee",
509
+                "reference": "f885dd803a257da9d54e72a4750bba73e1196aee",
510 510
                 "shasum": ""
511 511
             },
512 512
             "require": {
@@ -589,9 +589,9 @@
589 589
             "support": {
590 590
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
591 591
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
592
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.337.0"
592
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.337.2"
593 593
             },
594
-            "time": "2025-01-15T19:58:52+00:00"
594
+            "time": "2025-01-17T19:10:04+00:00"
595 595
         },
596 596
         {
597 597
             "name": "aws/aws-sdk-php-laravel",
@@ -1282,16 +1282,16 @@
1282 1282
         },
1283 1283
         {
1284 1284
             "name": "doctrine/dbal",
1285
-            "version": "4.2.1",
1285
+            "version": "4.2.2",
1286 1286
             "source": {
1287 1287
                 "type": "git",
1288 1288
                 "url": "https://github.com/doctrine/dbal.git",
1289
-                "reference": "dadd35300837a3a2184bd47d403333b15d0a9bd0"
1289
+                "reference": "19a2b7deb5fe8c2df0ff817ecea305e50acb62ec"
1290 1290
             },
1291 1291
             "dist": {
1292 1292
                 "type": "zip",
1293
-                "url": "https://api.github.com/repos/doctrine/dbal/zipball/dadd35300837a3a2184bd47d403333b15d0a9bd0",
1294
-                "reference": "dadd35300837a3a2184bd47d403333b15d0a9bd0",
1293
+                "url": "https://api.github.com/repos/doctrine/dbal/zipball/19a2b7deb5fe8c2df0ff817ecea305e50acb62ec",
1294
+                "reference": "19a2b7deb5fe8c2df0ff817ecea305e50acb62ec",
1295 1295
                 "shasum": ""
1296 1296
             },
1297 1297
             "require": {
@@ -1304,16 +1304,14 @@
1304 1304
                 "doctrine/coding-standard": "12.0.0",
1305 1305
                 "fig/log-test": "^1",
1306 1306
                 "jetbrains/phpstorm-stubs": "2023.2",
1307
-                "phpstan/phpstan": "1.12.6",
1308
-                "phpstan/phpstan-phpunit": "1.4.0",
1309
-                "phpstan/phpstan-strict-rules": "^1.6",
1310
-                "phpunit/phpunit": "10.5.30",
1311
-                "psalm/plugin-phpunit": "0.19.0",
1307
+                "phpstan/phpstan": "2.1.1",
1308
+                "phpstan/phpstan-phpunit": "2.0.3",
1309
+                "phpstan/phpstan-strict-rules": "^2",
1310
+                "phpunit/phpunit": "10.5.39",
1312 1311
                 "slevomat/coding-standard": "8.13.1",
1313 1312
                 "squizlabs/php_codesniffer": "3.10.2",
1314 1313
                 "symfony/cache": "^6.3.8|^7.0",
1315
-                "symfony/console": "^5.4|^6.3|^7.0",
1316
-                "vimeo/psalm": "5.25.0"
1314
+                "symfony/console": "^5.4|^6.3|^7.0"
1317 1315
             },
1318 1316
             "suggest": {
1319 1317
                 "symfony/console": "For helpful console commands such as SQL execution and import of files."
@@ -1370,7 +1368,7 @@
1370 1368
             ],
1371 1369
             "support": {
1372 1370
                 "issues": "https://github.com/doctrine/dbal/issues",
1373
-                "source": "https://github.com/doctrine/dbal/tree/4.2.1"
1371
+                "source": "https://github.com/doctrine/dbal/tree/4.2.2"
1374 1372
             },
1375 1373
             "funding": [
1376 1374
                 {
@@ -1386,7 +1384,7 @@
1386 1384
                     "type": "tidelift"
1387 1385
                 }
1388 1386
             ],
1389
-            "time": "2024-10-10T18:01:27+00:00"
1387
+            "time": "2025-01-16T08:40:56+00:00"
1390 1388
         },
1391 1389
         {
1392 1390
             "name": "doctrine/deprecations",
@@ -4446,16 +4444,16 @@
4446 4444
         },
4447 4445
         {
4448 4446
             "name": "matomo/device-detector",
4449
-            "version": "6.4.2",
4447
+            "version": "6.4.3",
4450 4448
             "source": {
4451 4449
                 "type": "git",
4452 4450
                 "url": "https://github.com/matomo-org/device-detector.git",
4453
-                "reference": "806e52d214b05ddead1a1d4304c7592f61f95976"
4451
+                "reference": "aa4586d495a7f59029d46d976f160b13eb769bb0"
4454 4452
             },
4455 4453
             "dist": {
4456 4454
                 "type": "zip",
4457
-                "url": "https://api.github.com/repos/matomo-org/device-detector/zipball/806e52d214b05ddead1a1d4304c7592f61f95976",
4458
-                "reference": "806e52d214b05ddead1a1d4304c7592f61f95976",
4455
+                "url": "https://api.github.com/repos/matomo-org/device-detector/zipball/aa4586d495a7f59029d46d976f160b13eb769bb0",
4456
+                "reference": "aa4586d495a7f59029d46d976f160b13eb769bb0",
4459 4457
                 "shasum": ""
4460 4458
             },
4461 4459
             "require": {
@@ -4511,7 +4509,7 @@
4511 4509
                 "source": "https://github.com/matomo-org/matomo",
4512 4510
                 "wiki": "https://dev.matomo.org/"
4513 4511
             },
4514
-            "time": "2024-12-16T16:38:01+00:00"
4512
+            "time": "2025-01-17T09:59:39+00:00"
4515 4513
         },
4516 4514
         {
4517 4515
             "name": "monolog/monolog",

読み込み中…
キャンセル
保存