File tree Expand file tree Collapse file tree 2 files changed +57
-1
lines changed Expand file tree Collapse file tree 2 files changed +57
-1
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,29 @@ def update_content(self):
151
151
self .update ()
152
152
153
153
154
+ class ClientsPage (AppPage ):
155
+ def __init__ (
156
+ self ,
157
+ app : App ,
158
+ ):
159
+ super ().__init__ (app )
160
+
161
+ def update (self ):
162
+ super ().update ()
163
+
164
+ def update_content (self ):
165
+ super ().update_content ()
166
+ self .main_column .controls .clear ()
167
+
168
+ clients = self .app .con .query (Client )
169
+
170
+ for client in clients :
171
+ self .main_column .controls .append (
172
+ views .make_client_view (client ),
173
+ )
174
+ self .update ()
175
+
176
+
154
177
class ProjectsPage (AppPage ):
155
178
def __init__ (
156
179
self ,
@@ -381,7 +404,7 @@ def main(page: Page):
381
404
icon = icons .HANDSHAKE ,
382
405
label = "Clients" ,
383
406
),
384
- AppPage (app ),
407
+ ClientsPage (app ),
385
408
),
386
409
(
387
410
NavigationRailDestination (
Original file line number Diff line number Diff line change 18
18
19
19
from tuttle .model import (
20
20
Contact ,
21
+ Client ,
21
22
Contract ,
22
23
Project ,
23
24
)
@@ -284,6 +285,38 @@ def make_project_view(project: Project):
284
285
)
285
286
286
287
288
+ def make_client_view (client : Client ):
289
+ return Card (
290
+ content = Container (
291
+ content = Column (
292
+ [
293
+ ListTile (
294
+ leading = Icon (icons .HANDSHAKE ),
295
+ title = Text (client .name ),
296
+ # subtitle=Text(client.company),
297
+ trailing = PopupMenuButton (
298
+ icon = icons .MORE_VERT ,
299
+ items = [
300
+ PopupMenuItem (
301
+ icon = icons .EDIT ,
302
+ text = "Edit" ,
303
+ ),
304
+ PopupMenuItem (
305
+ icon = icons .DELETE ,
306
+ text = "Delete" ,
307
+ ),
308
+ ],
309
+ ),
310
+ ),
311
+ Column ([]),
312
+ ]
313
+ ),
314
+ # width=400,
315
+ padding = 10 ,
316
+ )
317
+ )
318
+
319
+
287
320
def make_card (content ):
288
321
"""Make a card with the given content."""
289
322
return Card (
You can’t perform that action at this time.
0 commit comments