Browse Source

bug fix + esg history api

parent
commit
59d60863de

+ 3
- 1
app/Filament/Resources/ProjectResource.php View File

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

+ 1
- 1
app/Http/Controllers/Api/EsgController.php View File

@@ -29,7 +29,7 @@ class EsgController extends Controller
29 29
         $result["yearList"] = $yearList;
30 30
         foreach($data as $item){
31 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 33
                 "title" => $item->getTranslation("title", $locale),
34 34
                 "description" => $item->getTranslation("description", $locale)
35 35
             ];

+ 1
- 1
app/Http/Controllers/Api/HistoryController.php View File

@@ -29,7 +29,7 @@ class HistoryController extends Controller
29 29
         $result["yearList"] = $yearList;
30 30
         foreach($data as $item){
31 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 33
                 "title" => $item->getTranslation("title", $locale),
34 34
                 "imgUrl" => $item->img_url_link
35 35
             ];

+ 3
- 1
app/Http/Controllers/Api/ProjectController.php View File

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

+ 1
- 1
app/Models/Project.php View File

@@ -14,7 +14,7 @@ class Project extends Model
14 14
     protected $guarded = ['id'];
15 15
 
16 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 19
     protected $casts = ["img_url" => "array"];
20 20
 

+ 1
- 1
database/migrations/2025_09_18_093938_create_badgeables_table.php View File

@@ -16,7 +16,7 @@ return new class extends Migration
16 16
             $table->foreignId('badge_id')->constrained()->cascadeOnDelete();
17 17
             $table->morphs('badgeable');
18 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 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 View File

@@ -0,0 +1,32 @@
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
+};