activity-timeline

On this page

Configuration

Behind the scenes, the plugin utilizes the previously mentioned infolists entry. We only modify the properties/data, but the logic remains unchanged.

1use App\Filament\Resources\OrderResource;
2use LaraZeus\ActivityTimeline\Pages\ActivityTimelinePage;
3 
4class ViewOrderActivities extends ActivityTimelinePage
5{
6 protected static string $resource = OrderResource::class;
7 
8 protected function configuration(): array
9 {
10 return [
11 'activity_section' => [
12 'label' => 'Activities', // label for the section
13 'description' => 'These are the activities that have been recorded.', // description for the section
14 'show_items_count' => 0, // show the number of items to be shown
15 'show_items_label' => 'Show more', // show button label
16 'show_items_icon' => 'heroicon-o-chevron-down', // show button icon,
17 'show_items_color' => 'gray', // show button color,
18 'aside' => true, // show the section in the aside
19 'empty_state_heading' => 'No activities yet', // heading for the empty state
20 'empty_state_description' => 'Check back later for activities that have been recorded.', // description for the empty state
21 'empty_state_icon' => 'heroicon-o-bolt-slash', // icon for the empty state
22 'heading_visible' => true, // show the heading
23 'extra_attributes' => [], // extra attributes
24 ],
25 'activity_title' => [
26 'placeholder' => 'No title is set', // this will show when there is no title
27 'allow_html' => true, // set true to allow html in the title
28 
29 /**
30 * You are free to adjust the state before displaying it on your page.
31 * Take note that the state returns these data below:
32 * [
33 * 'log_name' => $activity->log_name,
34 * 'description' => $activity->description,
35 * 'subject' => $activity->subject,
36 * 'event' => $activity->event,
37 * 'causer' => $activity->causer,
38 * 'properties' => json_decode($activity->properties, true),
39 * 'batch_uuid' => $activity->batch_uuid,
40 * ]
41 
42 * If you wish to make modifications, please refer to the default code in the HasSetting trait.
43 */
44 
45 // 'modify_state' => function (array $state) {
46 //
47 // }
48 
49 ],
50 'activity_description' => [
51 'placeholder' => 'No description is set', // this will show when there is no description
52 'allow_html' => true, // set true to allow html in the description
53 
54 /**
55 * You are free to adjust the state before displaying it on your page.
56 * Take note that the state returns these data below:
57 * [
58 * 'log_name' => $activity->log_name,
59 * 'description' => $activity->description,
60 * 'subject' => $activity->subject,
61 * 'event' => $activity->event,
62 * 'causer' => $activity->causer,
63 * 'properties' => json_decode($activity->properties, true),
64 * 'batch_uuid' => $activity->batch_uuid,
65 * ]
66 
67 * If you wish to make modifications, please refer to the default code in the HasSetting trait.
68 */
69 
70 // 'modify_state' => function (array $state) {
71 //
72 // }
73 
74 ],
75 'activity_date' => [
76 'name' => 'created_at', // or updated_at
77 'date' => 'F j, Y g:i A', // date format
78 'placeholder' => 'No date is set', // this will show when there is no date
79 ],
80 'activity_icon' => [
81 'icon' => fn (string | null $state): string | null => match ($state) {
82 /**
83 * 'event_name' => 'heroicon-o-calendar',
84 * ... and more
85 */
86 default => null
87 },
88 'color' => fn (string | null $state): string | null => match ($state) {
89 /**
90 * 'event_name' => 'primary',
91 * ... and more
92 */
93 default => null
94 },
95 ]
96 ];
97 }
98}

Our Sponsors

Zeus is an open-source project. Thanks to our sponsors for helping maintain these packages.