66use Filament \Forms \Components \TextInput ;
77use Filament \Forms \Components \Select ;
88use Filament \Forms \Components \DateTimePicker ;
9+ use Filament \Forms \Components \Section ;
10+ use Filament \Forms \Components \Grid ;
911use Filament \Tables \Columns \TextColumn ;
1012use Filament \Actions \EditAction ;
1113use Filament \Actions \BulkActionGroup ;
@@ -46,36 +48,65 @@ public static function form(Schema $schema): Schema
4648 {
4749 return $ schema
4850 ->components ([
49- TextInput::make ('givn ' )->label ('First Name ' ),
50- TextInput::make ('surn ' )->label ('Last Name ' ),
51- Select::make ('sex ' )
52- ->options ([
53- 'M ' => 'Male ' ,
54- 'F ' => 'Female ' ,
55- ])
56- ->label ('Sex ' ),
57- TextInput::make ('child_in_family_id ' )->label ('Child In Family ID ' ),
58- TextInput::make ('description ' )->label ('Description ' ),
59- TextInput::make ('titl ' )->label ('Title ' ),
60- TextInput::make ('name ' )->label ('Name ' ),
61- TextInput::make ('appellative ' )->label ('Appellative ' ),
62- TextInput::make ('email ' )->label ('Email ' ),
63- TextInput::make ('phone ' )->label ('Phone ' ),
64- DateTimePicker::make ('birthday ' )->label ('Birthday ' ),
65- DateTimePicker::make ('deathday ' )->label ('Deathday ' ),
66- FileUpload::make ('photo_url ' )
67- ->image ()
68- ->label ('Profile Photo ' )
69- ->directory ('people ' )
70- ->disk ('public ' ),
71- DateTimePicker::make ('burial_day ' )->label ('Burial Day ' ),
72- TextInput::make ('bank ' )->label ('Bank ' ),
73- TextInput::make ('bank_account ' )->label ('Bank Account ' ),
74- TextInput::make ('chan ' )->label ('Chan ' ),
75- TextInput::make ('rin ' )->label ('Rin ' ),
76- TextInput::make ('resn ' )->label ('Resn ' ),
77- TextInput::make ('rfn ' )->label ('Rfn ' ),
78- TextInput::make ('afn ' )->label ('Afn ' ),
51+ Section::make ('Basic Information ' )
52+ ->description ('Core identity and personal details ' )
53+ ->icon ('heroicon-o-user ' )
54+ ->columns (2 )
55+ ->schema ([
56+ FileUpload::make ('photo_url ' )
57+ ->image ()
58+ ->label ('Profile Photo ' )
59+ ->directory ('persons ' )
60+ ->disk ('public ' )
61+ ->columnSpanFull (),
62+ TextInput::make ('givn ' )->label ('First Name ' ),
63+ TextInput::make ('surn ' )->label ('Last Name ' ),
64+ TextInput::make ('titl ' )->label ('Title ' ),
65+ TextInput::make ('appellative ' )->label ('Appellative ' ),
66+ TextInput::make ('name ' )->label ('Full Name ' ),
67+ Select::make ('sex ' )
68+ ->options ([
69+ 'M ' => 'Male ' ,
70+ 'F ' => 'Female ' ,
71+ ])
72+ ->label ('Sex ' ),
73+ TextInput::make ('description ' )->label ('Description ' )->columnSpanFull (),
74+ ]),
75+
76+ Section::make ('Vital Records ' )
77+ ->description ('Birth, death, and burial information ' )
78+ ->icon ('heroicon-o-calendar ' )
79+ ->columns (2 )
80+ ->schema ([
81+ DateTimePicker::make ('birthday ' )->label ('Date of Birth ' ),
82+ DateTimePicker::make ('deathday ' )->label ('Date of Death ' ),
83+ DateTimePicker::make ('burial_day ' )->label ('Burial Date ' ),
84+ TextInput::make ('child_in_family_id ' )->label ('Child in Family ID ' ),
85+ ]),
86+
87+ Section::make ('Contact Information ' )
88+ ->description ('Email and phone details ' )
89+ ->icon ('heroicon-o-envelope ' )
90+ ->columns (2 )
91+ ->schema ([
92+ TextInput::make ('email ' )->label ('Email ' )->email (),
93+ TextInput::make ('phone ' )->label ('Phone ' ),
94+ ]),
95+
96+ Section::make ('Record References ' )
97+ ->description ('Genealogy record identifiers and metadata ' )
98+ ->icon ('heroicon-o-document-text ' )
99+ ->columns (3 )
100+ ->collapsed ()
101+ ->schema ([
102+ TextInput::make ('rin ' )->label ('RIN ' ),
103+ TextInput::make ('rfn ' )->label ('RFN ' ),
104+ TextInput::make ('afn ' )->label ('AFN ' ),
105+ TextInput::make ('resn ' )->label ('Restriction ' ),
106+ TextInput::make ('chan ' )->label ('Change Date ' ),
107+ TextInput::make ('bank ' )->label ('Bank ' ),
108+ TextInput::make ('bank_account ' )->label ('Bank Account ' ),
109+ ]),
79110 ]);
80111 }
81112
@@ -84,33 +115,27 @@ public static function table(Table $table): Table
84115 {
85116 return $ table
86117 ->columns ([
87- TextColumn::make ('givn ' )->label ('First Name ' ),
88- TextColumn::make ('surn ' )->label ('Last Name ' ),
89- TextColumn::make ('sex ' )->label ('Sex ' ),
90- TextColumn::make ('child_in_family_id ' )->label ('Child In Family ID ' ),
91- TextColumn::make ('description ' )->label ('Description ' ),
92- TextColumn::make ('titl ' )->label ('Title ' ),
93- TextColumn::make ('name ' )->label ('Name ' ),
94- TextColumn::make ('appellative ' )->label ('Appellative ' ),
95- TextColumn::make ('email ' )->label ('Email ' ),
96- TextColumn::make ('phone ' )->label ('Phone ' ),
97- TextColumn::make ('birthday ' )->label ('Birthday ' ),
98- TextColumn::make ('deathday ' )->label ('Deathday ' ),
99- ImageColumn::make ('photo_url ' )->label ('Photo ' )->disk ('public ' )->height (40 )->width (40 ),
100- TextColumn::make ('burial_day ' )->label ('Burial Day ' ),
101- TextColumn::make ('bank ' )->label ('Bank ' ),
102- TextColumn::make ('bank_account ' )->label ('Bank Account ' ),
103- TextColumn::make ('chan ' )->label ('Chan ' ),
104- TextColumn::make ('rin ' )->label ('Rin ' ),
105- TextColumn::make ('resn ' )->label ('Resn ' ),
106- TextColumn::make ('rfn ' )->label ('Rfn ' ),
107- TextColumn::make ('afn ' )->label ('Afn ' ),
108- TextColumn::make ('created_at ' )->label ('Created At ' )->sortable (),
109- TextColumn::make ('updated_at ' )->label ('Updated At ' )->sortable (),
110-
118+ ImageColumn::make ('photo_url ' )->label ('Photo ' )->disk ('public ' )->height (40 )->width (40 )->circular (),
119+ TextColumn::make ('givn ' )->label ('First Name ' )->searchable ()->sortable (),
120+ TextColumn::make ('surn ' )->label ('Last Name ' )->searchable ()->sortable (),
121+ TextColumn::make ('sex ' )->label ('Sex ' )->badge ()
122+ ->color (fn (string $ state ): string => match ($ state ) {
123+ 'M ' => 'info ' ,
124+ 'F ' => 'danger ' ,
125+ default => 'gray ' ,
126+ }),
127+ TextColumn::make ('birthday ' )->label ('Born ' )->date ('Y ' )->sortable (),
128+ TextColumn::make ('deathday ' )->label ('Died ' )->date ('Y ' )->sortable (),
129+ TextColumn::make ('email ' )->label ('Email ' )->toggleable (isToggledHiddenByDefault: true ),
130+ TextColumn::make ('phone ' )->label ('Phone ' )->toggleable (isToggledHiddenByDefault: true ),
131+ TextColumn::make ('created_at ' )->label ('Added ' )->since ()->sortable ()->toggleable (isToggledHiddenByDefault: true ),
111132 ])
112133 ->filters ([
113- //
134+ Tables \Filters \SelectFilter::make ('sex ' )
135+ ->options ([
136+ 'M ' => 'Male ' ,
137+ 'F ' => 'Female ' ,
138+ ]),
114139 ])
115140 ->recordActions ([
116141 EditAction::make (),
0 commit comments