CodeCommitAccess+1-at-632418466995 3 месяцев назад
Родитель
Сommit
59d60863de

+ 3
- 1
app/Filament/Resources/ProjectResource.php Просмотреть файл

73
                         }),
73
                         }),
74
                         Translate::make()->schema(fn (string $locale) => [
74
                         Translate::make()->schema(fn (string $locale) => [
75
                             Textarea::make("summaries")->label("簡述"),
75
                             Textarea::make("summaries")->label("簡述"),
76
+                            TextInput::make("district")->label("區域"),
76
                             TextInput::make("address")->label("地址"),
77
                             TextInput::make("address")->label("地址"),
77
                             Textarea::make("floor_plan")->label("樓層規劃"),
78
                             Textarea::make("floor_plan")->label("樓層規劃"),
78
                             Textarea::make("building_structure")->label("建築結構"),
79
                             Textarea::make("building_structure")->label("建築結構"),
79
-                            Textarea::make("design_unit")->label("設計團隊")
80
+                            Textarea::make("design_unit")->label("設計單位")
80
                         ])
81
                         ])
81
                         ->locales(["zh_TW", "en"])
82
                         ->locales(["zh_TW", "en"])
82
                         ->actions([
83
                         ->actions([
167
                                 app(DeepLService::class)->createTranslationAction("contact", ["contact_unit", "contact_phone", "inversment_phone"])
168
                                 app(DeepLService::class)->createTranslationAction("contact", ["contact_unit", "contact_phone", "inversment_phone"])
168
                             ])->columnSpanFull()->columns(3)
169
                             ])->columnSpanFull()->columns(3)
169
                             ->id("contact"),
170
                             ->id("contact"),
171
+                            TextInput::make("offical_link")->label("官網連結"),
170
                         ])->columnSpanFull(),
172
                         ])->columnSpanFull(),
171
                         Repeater::make("spaceInfos")->label("")->schema([
173
                         Repeater::make("spaceInfos")->label("")->schema([
172
                             Translate::make()->schema(fn (string $locale) => [
174
                             Translate::make()->schema(fn (string $locale) => [

+ 1
- 1
app/Http/Controllers/Api/EsgController.php Просмотреть файл

29
         $result["yearList"] = $yearList;
29
         $result["yearList"] = $yearList;
30
         foreach($data as $item){
30
         foreach($data as $item){
31
             $result["list"][$item->selected_year][] = [
31
             $result["list"][$item->selected_year][] = [
32
-                "operateMonth " => $item->selected_year . "." . $item->selected_month,
32
+                "operateMonth " => $item->selected_year . "." . str_pad($item->selected_month, 2, "0", STR_PAD_LEFT),
33
                 "title" => $item->getTranslation("title", $locale),
33
                 "title" => $item->getTranslation("title", $locale),
34
                 "description" => $item->getTranslation("description", $locale)
34
                 "description" => $item->getTranslation("description", $locale)
35
             ];
35
             ];

+ 1
- 1
app/Http/Controllers/Api/HistoryController.php Просмотреть файл

29
         $result["yearList"] = $yearList;
29
         $result["yearList"] = $yearList;
30
         foreach($data as $item){
30
         foreach($data as $item){
31
             $result["list"][$item->selected_year][] = [
31
             $result["list"][$item->selected_year][] = [
32
-                "operateMonth " => $item->selected_year . "." . $item->selected_month,
32
+                "operateMonth " => $item->selected_year . "." . str_pad($item->selected_month, 2, "0", STR_PAD_LEFT),
33
                 "title" => $item->getTranslation("title", $locale),
33
                 "title" => $item->getTranslation("title", $locale),
34
                 "imgUrl" => $item->img_url_link
34
                 "imgUrl" => $item->img_url_link
35
             ];
35
             ];

+ 3
- 1
app/Http/Controllers/Api/ProjectController.php Просмотреть файл

27
 
27
 
28
     public function list(Request $request, $locale = 'tw')
28
     public function list(Request $request, $locale = 'tw')
29
     {
29
     {
30
-        $categoryId = $request->input("categoryId") ?? "";
31
         $locale = $locale == "tw" ? "zh_TW" : $locale;
30
         $locale = $locale == "tw" ? "zh_TW" : $locale;
32
         $result = [];
31
         $result = [];
33
 
32
 
66
                 "id" => $project->id,
65
                 "id" => $project->id,
67
                 "region_id" => $project->region_id,
66
                 "region_id" => $project->region_id,
68
                 "region" => $project->region->getTranslation("name", $locale),
67
                 "region" => $project->region->getTranslation("name", $locale),
68
+                "district" => $project->getTranslation("district", $locale),
69
                 "address" => $project->getTranslation("address", $locale),
69
                 "address" => $project->getTranslation("address", $locale),
70
                 "tags" => $project->tags->map(function ($record) use ($locale){
70
                 "tags" => $project->tags->map(function ($record) use ($locale){
71
                     return [
71
                     return [
109
             "region_id" => $project->region_id,
109
             "region_id" => $project->region_id,
110
             "region" => $project->region->getTranslation("name", $locale),
110
             "region" => $project->region->getTranslation("name", $locale),
111
             "address" => $project->getTranslation("address", $locale),
111
             "address" => $project->getTranslation("address", $locale),
112
+            "district" => $project->getTranslation("district", $locale),
112
             "tags" => $project->tags->map(function ($record) use ($locale){
113
             "tags" => $project->tags->map(function ($record) use ($locale){
113
                 return [
114
                 return [
114
                     "id" => $record->id,
115
                     "id" => $record->id,
124
                 "unitName" => $project->getTranslation("contact_unit", $locale),
125
                 "unitName" => $project->getTranslation("contact_unit", $locale),
125
                 "unitPhone" => $project->getTranslation("contact_phone", $locale),
126
                 "unitPhone" => $project->getTranslation("contact_phone", $locale),
126
                 "inversmentPhone" => $project->getTranslation("inversment_phone", $locale),
127
                 "inversmentPhone" => $project->getTranslation("inversment_phone", $locale),
128
+                "officalLink" => $project->offical_link,
127
             ],
129
             ],
128
             "spaceInfo" => $projectSpaceInfo,
130
             "spaceInfo" => $projectSpaceInfo,
129
             "historyList" => $projectHistories
131
             "historyList" => $projectHistories

+ 1
- 1
app/Models/Project.php Просмотреть файл

14
     protected $guarded = ['id'];
14
     protected $guarded = ['id'];
15
 
15
 
16
     protected $translatable = ["name", "sub_name", "summaries", "img_alt", "address", "floor_plan",
16
     protected $translatable = ["name", "sub_name", "summaries", "img_alt", "address", "floor_plan",
17
-        "building_structure", "design_unit", "contact_unit", "contact_phone", "inversment_phone"
17
+        "building_structure", "design_unit", "contact_unit", "contact_phone", "inversment_phone", "district"
18
     ];
18
     ];
19
     protected $casts = ["img_url" => "array"];
19
     protected $casts = ["img_url" => "array"];
20
 
20
 

+ 1
- 1
database/migrations/2025_09_18_093938_create_badgeables_table.php Просмотреть файл

16
             $table->foreignId('badge_id')->constrained()->cascadeOnDelete();
16
             $table->foreignId('badge_id')->constrained()->cascadeOnDelete();
17
             $table->morphs('badgeable');
17
             $table->morphs('badgeable');
18
             $table->date("award_date")->nullable()->comment("取得標章時刻");
18
             $table->date("award_date")->nullable()->comment("取得標章時刻");
19
-            $table->tinyInteger("award_type")->comment("1. 永續目標 2.取得標章");
19
+            $table->tinyInteger("award_type")->nullable()->comment("1. 永續目標 2.取得標章");
20
             $table->timestamps();
20
             $table->timestamps();
21
         });
21
         });
22
     }
22
     }

+ 32
- 0
database/migrations/2025_11_04_063554_alter_table_projects_add_column_district_and_offical_link.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
+        //
15
+        Schema::table("projects", function (Blueprint $table) {
16
+            $table->json("district")->nullable()->comment("專案項目地區");
17
+            $table->string("offical_link")->nullable()->comment("專案項目聯絡官網");
18
+        });
19
+    }
20
+
21
+    /**
22
+     * Reverse the migrations.
23
+     */
24
+    public function down(): void
25
+    {
26
+        //
27
+        Schema::table("projects", function (Blueprint $table) {
28
+            $table->dropColumn("district");
29
+            $table->dropColumn("offical_link");
30
+        });
31
+    }
32
+};