Andrew Wallo 8 月之前
父節點
當前提交
cbf49afa17

+ 1
- 5
app/Filament/Company/Resources/Sales/ClientResource.php 查看文件

317
                     ->searchable()
317
                     ->searchable()
318
                     ->sortable()
318
                     ->sortable()
319
                     ->description(fn (Client $client) => $client->primaryContact->full_name),
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
                 Tables\Columns\TextColumn::make('primaryContact.email')
320
                 Tables\Columns\TextColumn::make('primaryContact.email')
325
                     ->label('Email')
321
                     ->label('Email')
326
                     ->searchable()
322
                     ->searchable()
332
                 Tables\Columns\TextColumn::make('billingAddress.address_string')
328
                 Tables\Columns\TextColumn::make('billingAddress.address_string')
333
                     ->label('Billing Address')
329
                     ->label('Billing Address')
334
                     ->searchable()
330
                     ->searchable()
335
-                    ->toggleable()
331
+                    ->toggleable(isToggledHiddenByDefault: true)
336
                     ->listWithLineBreaks(),
332
                     ->listWithLineBreaks(),
337
                 Tables\Columns\TextColumn::make('balance')
333
                 Tables\Columns\TextColumn::make('balance')
338
                     ->label('Balance')
334
                     ->label('Balance')

+ 50
- 0
app/Filament/Company/Resources/Sales/ClientResource/Pages/EditClient.php 查看文件

4
 
4
 
5
 use App\Concerns\RedirectToListPage;
5
 use App\Concerns\RedirectToListPage;
6
 use App\Filament\Company\Resources\Sales\ClientResource;
6
 use App\Filament\Company\Resources\Sales\ClientResource;
7
+use App\Models\Common\Client;
7
 use Filament\Actions;
8
 use Filament\Actions;
8
 use Filament\Resources\Pages\EditRecord;
9
 use Filament\Resources\Pages\EditRecord;
9
 use Filament\Support\Enums\MaxWidth;
10
 use Filament\Support\Enums\MaxWidth;
11
+use Illuminate\Database\Eloquent\Model;
10
 
12
 
11
 class EditClient extends EditRecord
13
 class EditClient extends EditRecord
12
 {
14
 {
25
     {
27
     {
26
         return MaxWidth::FiveExtraLarge;
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
         },
497
         },
498
         {
498
         {
499
             "name": "aws/aws-sdk-php",
499
             "name": "aws/aws-sdk-php",
500
-            "version": "3.337.0",
500
+            "version": "3.337.2",
501
             "source": {
501
             "source": {
502
                 "type": "git",
502
                 "type": "git",
503
                 "url": "https://github.com/aws/aws-sdk-php.git",
503
                 "url": "https://github.com/aws/aws-sdk-php.git",
504
-                "reference": "7e40cecb3ce66749bbd5eaa9f370de48c16acd6c"
504
+                "reference": "f885dd803a257da9d54e72a4750bba73e1196aee"
505
             },
505
             },
506
             "dist": {
506
             "dist": {
507
                 "type": "zip",
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
                 "shasum": ""
510
                 "shasum": ""
511
             },
511
             },
512
             "require": {
512
             "require": {
589
             "support": {
589
             "support": {
590
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
590
                 "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
591
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
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
             "name": "aws/aws-sdk-php-laravel",
597
             "name": "aws/aws-sdk-php-laravel",
1282
         },
1282
         },
1283
         {
1283
         {
1284
             "name": "doctrine/dbal",
1284
             "name": "doctrine/dbal",
1285
-            "version": "4.2.1",
1285
+            "version": "4.2.2",
1286
             "source": {
1286
             "source": {
1287
                 "type": "git",
1287
                 "type": "git",
1288
                 "url": "https://github.com/doctrine/dbal.git",
1288
                 "url": "https://github.com/doctrine/dbal.git",
1289
-                "reference": "dadd35300837a3a2184bd47d403333b15d0a9bd0"
1289
+                "reference": "19a2b7deb5fe8c2df0ff817ecea305e50acb62ec"
1290
             },
1290
             },
1291
             "dist": {
1291
             "dist": {
1292
                 "type": "zip",
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
                 "shasum": ""
1295
                 "shasum": ""
1296
             },
1296
             },
1297
             "require": {
1297
             "require": {
1304
                 "doctrine/coding-standard": "12.0.0",
1304
                 "doctrine/coding-standard": "12.0.0",
1305
                 "fig/log-test": "^1",
1305
                 "fig/log-test": "^1",
1306
                 "jetbrains/phpstorm-stubs": "2023.2",
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
                 "slevomat/coding-standard": "8.13.1",
1311
                 "slevomat/coding-standard": "8.13.1",
1313
                 "squizlabs/php_codesniffer": "3.10.2",
1312
                 "squizlabs/php_codesniffer": "3.10.2",
1314
                 "symfony/cache": "^6.3.8|^7.0",
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
             "suggest": {
1316
             "suggest": {
1319
                 "symfony/console": "For helpful console commands such as SQL execution and import of files."
1317
                 "symfony/console": "For helpful console commands such as SQL execution and import of files."
1370
             ],
1368
             ],
1371
             "support": {
1369
             "support": {
1372
                 "issues": "https://github.com/doctrine/dbal/issues",
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
             "funding": [
1373
             "funding": [
1376
                 {
1374
                 {
1386
                     "type": "tidelift"
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
             "name": "doctrine/deprecations",
1390
             "name": "doctrine/deprecations",
4446
         },
4444
         },
4447
         {
4445
         {
4448
             "name": "matomo/device-detector",
4446
             "name": "matomo/device-detector",
4449
-            "version": "6.4.2",
4447
+            "version": "6.4.3",
4450
             "source": {
4448
             "source": {
4451
                 "type": "git",
4449
                 "type": "git",
4452
                 "url": "https://github.com/matomo-org/device-detector.git",
4450
                 "url": "https://github.com/matomo-org/device-detector.git",
4453
-                "reference": "806e52d214b05ddead1a1d4304c7592f61f95976"
4451
+                "reference": "aa4586d495a7f59029d46d976f160b13eb769bb0"
4454
             },
4452
             },
4455
             "dist": {
4453
             "dist": {
4456
                 "type": "zip",
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
                 "shasum": ""
4457
                 "shasum": ""
4460
             },
4458
             },
4461
             "require": {
4459
             "require": {
4511
                 "source": "https://github.com/matomo-org/matomo",
4509
                 "source": "https://github.com/matomo-org/matomo",
4512
                 "wiki": "https://dev.matomo.org/"
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
             "name": "monolog/monolog",
4515
             "name": "monolog/monolog",

Loading…
取消
儲存