@@ -278,6 +278,21 @@ public static function infolist(Schema $schema): Schema
278278 ->label (__ ('HTML Content ' ))
279279 ->columnSpanFull (),
280280 ]),
281+ Tab::make ('HTML (Formatted) ' )
282+ ->schema ([
283+ TextEntry::make ('html ' )
284+ ->hiddenLabel ()
285+ ->extraAttributes (['class ' => 'overflow-x-auto ' ])
286+ ->formatStateUsing (fn (string $ state , Mail $ record ): View => view (
287+ 'mails::mails.html-formatted ' ,
288+ ['html ' => $ state , 'mail ' => $ record ],
289+ ))
290+ ->copyable ()
291+ ->copyMessage ('Copied! ' )
292+ ->copyMessageDuration (1500 )
293+ ->label (__ ('HTML Content (Formatted) ' ))
294+ ->columnSpanFull (),
295+ ]),
281296 Tab::make ('Text ' )
282297 ->schema ([
283298 TextEntry::make ('text ' )
@@ -286,7 +301,7 @@ public static function infolist(Schema $schema): Schema
286301 ->copyMessage ('Copied! ' )
287302 ->copyMessageDuration (1500 )
288303 ->label (__ ('Text Content ' ))
289- ->formatStateUsing (fn (string $ state ): HtmlString => new HtmlString (nl2br (e ($ state ))))
304+ ->formatStateUsing (fn (string $ state ): HtmlString => new HtmlString (' <code> ' . nl2br (e ($ state )) . ' </code> ' ))
290305 ->columnSpanFull (),
291306 ]),
292307 ])->columnSpanFull (),
@@ -308,17 +323,22 @@ public static function infolist(Schema $schema): Schema
308323 ->label (__ ('Attachments ' ))
309324 ->visible (fn (Mail $ record ) => $ record ->attachments ->count () > 0 )
310325 ->schema ([
311- Grid::make (3 )
326+ Grid::make (4 )
312327 ->schema ([
313328 TextEntry::make ('filename ' )
314329 ->label (__ ('Name ' )),
315330 TextEntry::make ('size ' )
316- ->label (__ ('Size ' )),
331+ ->label (__ ('Size ' ))
332+ ->formatStateUsing (fn (int $ state ): string => match (true ) {
333+ $ state >= 1073741824 => number_format ($ state / 1073741824 , 2 ) . ' GB ' ,
334+ $ state >= 1048576 => number_format ($ state / 1048576 , 2 ) . ' MB ' ,
335+ $ state >= 1024 => number_format ($ state / 1024 , 2 ) . ' KB ' ,
336+ default => $ state . ' bytes ' ,
337+ }),
317338 TextEntry::make ('mime ' )
318339 ->label (__ ('Mime Type ' )),
319340 ViewEntry::make ('uuid ' )
320341 ->label (__ ('Download ' ))
321- ->formatStateUsing (fn ($ record ) => $ record )
322342 ->view ('mails::mails.download ' ),
323343 ]),
324344 ]),
@@ -392,7 +412,6 @@ public static function table(Table $table): Table
392412 ])
393413 ->recordActions ([
394414 ViewAction::make ()
395- // ->url(null)
396415 ->modal ()
397416 ->slideOver ()
398417 ->label (__ ('View ' ))
0 commit comments