|
|
@@ -45,11 +45,12 @@ class EsgResource extends Resource
|
|
45
|
45
|
//
|
|
46
|
46
|
Tabs::make("")->tabs([
|
|
47
|
47
|
Tab::make('基本資訊')->schema([
|
|
48
|
|
- TextInput::make('keyword')->label("關聯字詞"),
|
|
|
48
|
+ TextInput::make('keyword')->label("關聯字詞")->required(),
|
|
49
|
49
|
Translate::make()->schema(fn (string $locale) => [
|
|
50
|
50
|
TextInput::make('title')
|
|
51
|
51
|
->label("標題")
|
|
52
|
|
- ->columnSpan(1),
|
|
|
52
|
+ ->columnSpan(1)
|
|
|
53
|
+ ->required($locale == "zh_TW"),
|
|
53
|
54
|
])->locales(["zh_TW", "en"])
|
|
54
|
55
|
->columnSpanFull()->columns(3),
|
|
55
|
56
|
]),
|
|
|
@@ -57,14 +58,15 @@ class EsgResource extends Resource
|
|
57
|
58
|
FileUpload::make('banner_pc')->label("Banner (PC)")
|
|
58
|
59
|
->disk("public")
|
|
59
|
60
|
// ->helperText('建議寬高限制為:1280*720px,檔案大小限制為1M以下')->maxSize('1024')
|
|
60
|
|
- ->directory("esg"),
|
|
|
61
|
+ ->directory("esg")->required(),
|
|
61
|
62
|
FileUpload::make('banner_mobile')->label("Banner (Mobile)")
|
|
62
|
63
|
->disk("public")
|
|
63
|
64
|
// ->helperText('建議寬高限制為:600*896px,檔案大小限制為1M以下')->maxSize('1024')
|
|
64
|
|
- ->directory("esg"),
|
|
|
65
|
+ ->directory("esg")->required(),
|
|
65
|
66
|
Translate::make()->schema(fn (string $locale) => [
|
|
66
|
67
|
TextInput::make('banner_alt')
|
|
67
|
|
- ->label("Banner 圖片註釋"),
|
|
|
68
|
+ ->label("Banner 圖片註釋")
|
|
|
69
|
+ ->required($locale == "zh_TW"),
|
|
68
|
70
|
Textarea::make("description")->rows(5)->columnSpanFull()->label("短文"),
|
|
69
|
71
|
])->locales(["zh_TW", "en"])
|
|
70
|
72
|
->columnSpanFull(),
|
|
|
@@ -92,7 +94,8 @@ class EsgResource extends Resource
|
|
92
|
94
|
RichEditor::make('content.text_content')
|
|
93
|
95
|
->fileAttachmentsDirectory('attachments')
|
|
94
|
96
|
->fileAttachmentsVisibility('private')
|
|
95
|
|
- ->disableToolbarButtons(['attachFiles']),
|
|
|
97
|
+ ->disableToolbarButtons(['attachFiles'])
|
|
|
98
|
+ ->required($locale == "zh_TW"),
|
|
96
|
99
|
])
|
|
97
|
100
|
->locales(["zh_TW", "en"])
|
|
98
|
101
|
->id(fn ($get) => "para_text_" . $get('item_key')),
|
|
|
@@ -123,7 +126,7 @@ class EsgResource extends Resource
|
|
123
|
126
|
// ->visible(fn (Get $get) => in_array($get('block_type'), ['title', 'subtitle', 'highlight'])),
|
|
124
|
127
|
RichEditor::make('block_content')
|
|
125
|
128
|
->disableToolbarButtons(['attachFiles'])
|
|
126
|
|
- ->required(),
|
|
|
129
|
+ ->required($locale == "zh_TW"),
|
|
127
|
130
|
])
|
|
128
|
131
|
->locales(["zh_TW", "en"])
|
|
129
|
132
|
->id(fn ($get) => "text_block_" . $get('block_item_key')),
|
|
|
@@ -256,7 +259,8 @@ class EsgResource extends Resource
|
|
256
|
259
|
->default(1),
|
|
257
|
260
|
RichEditor::make('col1')
|
|
258
|
261
|
->label('第1欄')
|
|
259
|
|
- ->disableToolbarButtons(['attachFiles']),
|
|
|
262
|
+ ->disableToolbarButtons(['attachFiles'])
|
|
|
263
|
+ ->required($locale == "zh_TW"),
|
|
260
|
264
|
// TextInput::make('col2')->label('第2欄')->required(),
|
|
261
|
265
|
Radio::make('align2')
|
|
262
|
266
|
->label('對齊')
|
|
|
@@ -268,7 +272,8 @@ class EsgResource extends Resource
|
|
268
|
272
|
->default(1),
|
|
269
|
273
|
RichEditor::make('col2')
|
|
270
|
274
|
->label('第2欄')
|
|
271
|
|
- ->disableToolbarButtons(['attachFiles']),
|
|
|
275
|
+ ->disableToolbarButtons(['attachFiles'])
|
|
|
276
|
+ ->required($locale == "zh_TW"),
|
|
272
|
277
|
Radio::make('align3')
|
|
273
|
278
|
->label('對齊')
|
|
274
|
279
|
->options([
|
|
|
@@ -281,7 +286,8 @@ class EsgResource extends Resource
|
|
281
|
286
|
RichEditor::make('col3')
|
|
282
|
287
|
->label('第3欄')
|
|
283
|
288
|
->disableToolbarButtons(['attachFiles'])
|
|
284
|
|
- ->visible(fn (Get $get) => intval($get('../../../content.column_count')) >= 3),
|
|
|
289
|
+ ->visible(fn (Get $get) => intval($get('../../../content.column_count')) >= 3)
|
|
|
290
|
+ ->required($locale == "zh_TW" && fn (Get $get)=> intval($get("../../../content.column_count")) >= 3),
|
|
285
|
291
|
Radio::make('align4')
|
|
286
|
292
|
->label('對齊')
|
|
287
|
293
|
->options([
|
|
|
@@ -294,7 +300,8 @@ class EsgResource extends Resource
|
|
294
|
300
|
RichEditor::make('col4')
|
|
295
|
301
|
->label('第4欄')
|
|
296
|
302
|
->disableToolbarButtons(['attachFiles'])
|
|
297
|
|
- ->visible(fn (Get $get) => intval($get('../../../content.column_count')) >= 4),
|
|
|
303
|
+ ->visible(fn (Get $get) => intval($get('../../../content.column_count')) >= 4)
|
|
|
304
|
+ ->required($locale == "zh_TW" && fn (Get $get)=> intval($get("../../../content.column_count")) >= 4),
|
|
298
|
305
|
])
|
|
299
|
306
|
->reactive() // 加入響應式
|
|
300
|
307
|
])->locales(["zh_TW", "en"]),
|
|
|
@@ -317,7 +324,8 @@ class EsgResource extends Resource
|
|
317
|
324
|
}
|
|
318
|
325
|
}),
|
|
319
|
326
|
Translate::make()->schema(fn (string $locale) => [
|
|
320
|
|
- TextInput::make('image_alt')->label("圖片註文"),
|
|
|
327
|
+ TextInput::make('image_alt')->label("圖片註文")
|
|
|
328
|
+ ->required($locale == "zh_TW"),
|
|
321
|
329
|
])->locales(["zh_TW", "en"])
|
|
322
|
330
|
->id(fn ($get) => "para_img_mul_" . $get('para_img_item_key')),
|
|
323
|
331
|
FileUpload::make('image_url')->label("")->disk("public")
|
|
|
@@ -336,7 +344,7 @@ class EsgResource extends Resource
|
|
336
|
344
|
->disk("public")
|
|
337
|
345
|
->directory("esg/paragraphVideo")
|
|
338
|
346
|
->helperText('建議寬高限制為:2000*720px,出血寬度720px,主要圖像範圍為:1280*720px,檔案大小限制為1M以下')->maxSize('1024'),
|
|
339
|
|
- TextInput::make('content.link')->label("網址")->nullable(),
|
|
|
347
|
+ TextInput::make('content.link')->label("網址")->required(),
|
|
340
|
348
|
Translate::make()->schema(fn (string $locale) => [
|
|
341
|
349
|
TextInput::make('content.video_alt')->label("影片註文"),
|
|
342
|
350
|
])->locales(["zh_TW", "en"])
|