Skip to content

Commit c50f95d

Browse files
committed
WIP: invoicing screen
1 parent a4fb69b commit c50f95d

File tree

3 files changed

+108
-106
lines changed

3 files changed

+108
-106
lines changed

.pre-commit-config.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ repos:
55
- id: check-yaml
66
- id: end-of-file-fixer
77
- id: trailing-whitespace
8-
- repo: https://github.com/timothycrosley/isort
9-
rev: 5.5.4
10-
hooks:
11-
- id: isort
8+
# - repo: https://github.com/timothycrosley/isort
9+
# rev: 5.5.4
10+
# hooks:
11+
# - id: isort
1212
- repo: https://github.com/psf/black
1313
rev: 22.6.0
1414
hooks:
1515
- id: black
1616

17+
1718
# - repo: https://github.com/pycqa/pydocstyle
1819
# rev: 4.0.0
1920
# hooks:

app/home/view.py

+76-98
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,86 @@
1-
from typing import Optional, Callable
1+
from typing import Callable, Optional
22

33
import webbrowser
4+
from dataclasses import dataclass
5+
46
from flet import (
5-
PopupMenuButton,
6-
PopupMenuItem,
77
Column,
88
Container,
9+
ElevatedButton,
10+
Icon,
911
IconButton,
1012
NavigationRail,
1113
NavigationRailDestination,
14+
PopupMenuButton,
15+
PopupMenuItem,
16+
ResponsiveRow,
1217
Row,
1318
Text,
1419
UserControl,
1520
alignment,
16-
icons,
17-
margin,
18-
padding,
19-
ResponsiveRow,
20-
Icon,
2121
border,
2222
icons,
23-
Container,
24-
Text,
23+
margin,
2524
padding,
26-
Row,
27-
icons,
28-
alignment,
29-
ElevatedButton,
3025
)
3126

32-
33-
from core.views import get_body_txt, get_headline_with_subtitle
27+
from clients.view import ClientsListView
28+
from contacts.view import ContactEditorPopUp, ContactsListView
29+
from contracts.view import ContractsListView
3430
from core.abstractions import DialogHandler, TuttleView, TuttleViewParams
3531
from core.utils import (
32+
ALWAYS_SCROLL,
33+
CENTER_ALIGNMENT,
3634
COMPACT_RAIL_WIDTH,
3735
SPACE_BETWEEN_ALIGNMENT,
3836
START_ALIGNMENT,
39-
TXT_ALIGN_START,
40-
ALWAYS_SCROLL,
4137
STRETCH_ALIGNMENT,
38+
TXT_ALIGN_START,
39+
)
40+
from core.views import (
41+
get_app_logo,
42+
get_body_txt,
43+
get_headline_with_subtitle,
44+
get_std_txt_field,
45+
)
46+
from invoicing.view import InvoicingView
47+
from projects.view import ProjectsListView
48+
from res.colors import (
49+
BLACK_COLOR,
50+
GRAY_COLOR,
51+
GRAY_DARK_COLOR,
52+
PRIMARY_COLOR,
53+
WHITE_COLOR,
4254
)
43-
from res.colors import GRAY_DARK_COLOR, GRAY_COLOR, BLACK_COLOR
4455
from res.dimens import (
45-
MIN_WINDOW_WIDTH,
56+
FOOTER_HEIGHT,
4657
MIN_WINDOW_HEIGHT,
58+
MIN_WINDOW_WIDTH,
59+
SPACE_LG,
4760
SPACE_MD,
4861
SPACE_SM,
4962
SPACE_STD,
5063
SPACE_XL,
5164
SPACE_XS,
52-
SPACE_LG,
53-
FOOTER_HEIGHT,
65+
TOOLBAR_HEIGHT,
5466
)
5567
from res.fonts import (
68+
BODY_2_SIZE,
5669
HEADLINE_4_SIZE,
5770
HEADLINE_FONT,
58-
BODY_2_SIZE,
59-
SUBTITLE_2_SIZE,
6071
SUBTITLE_1_SIZE,
72+
SUBTITLE_2_SIZE,
6173
)
62-
6374
from res.res_utils import (
6475
ADD_CLIENT_INTENT,
6576
ADD_CONTACT_INTENT,
77+
CONTRACT_CREATOR_SCREEN_ROUTE,
78+
NEW_TIME_TRACK_INTENT,
6679
PREFERENCES_SCREEN_ROUTE,
6780
PROFILE_SCREEN_ROUTE,
68-
)
69-
from contacts.view import ContactEditorPopUp
70-
71-
from flet import (
72-
Container,
73-
Text,
74-
padding,
75-
IconButton,
76-
Row,
77-
icons,
78-
alignment,
79-
ElevatedButton,
80-
)
81-
82-
from core.utils import SPACE_BETWEEN_ALIGNMENT, CENTER_ALIGNMENT
83-
from core.views import get_app_logo, get_std_txt_field
84-
from res.colors import BLACK_COLOR, WHITE_COLOR, PRIMARY_COLOR
85-
from res.dimens import SPACE_MD, TOOLBAR_HEIGHT
86-
87-
from res.fonts import HEADLINE_4_SIZE, HEADLINE_FONT
88-
from dataclasses import dataclass
89-
90-
91-
from res.res_utils import (
9281
PROJECT_CREATOR_SCREEN_ROUTE,
93-
ADD_CLIENT_INTENT,
94-
ADD_CONTACT_INTENT,
95-
CONTRACT_CREATOR_SCREEN_ROUTE,
96-
NEW_TIME_TRACK_INTENT,
9782
)
98-
from core.abstractions import TuttleView
99-
from typing import Optional
100-
from clients.view import ClientsListView
101-
from contacts.view import ContactsListView
102-
from contracts.view import ContractsListView
103-
from projects.view import ProjectsListView
10483
from timetracking.view import TimeTrackingView
105-
from invoicing.view import InvoicingView
10684

10785
MIN_SIDE_BAR_WIDTH = int(MIN_WINDOW_WIDTH * 0.3)
10886
MIN_FOOTER_WIDTH = int(MIN_WINDOW_WIDTH * 0.7)
@@ -251,46 +229,46 @@ def __init__(self, params: TuttleViewParams):
251229
self.contracts_view = ContractsListView(params)
252230
self.items = [
253231
MenuItem(
254-
0,
232+
index=0,
255233
label="Dashboard",
256234
icon=icons.SPEED,
257235
selected_icon=icons.SPEED_ROUNDED,
258236
destination=Container(),
259237
on_new_screen_route="/404",
260238
),
261239
MenuItem(
262-
1,
263-
"Projects",
264-
icons.WORK_OUTLINE,
265-
icons.WORK_ROUNDED,
266-
self.projects_view,
240+
index=1,
241+
label="Projects",
242+
icon=icons.WORK_OUTLINE,
243+
selected_icon=icons.WORK_ROUNDED,
244+
destination=self.projects_view,
267245
on_new_screen_route=PROJECT_CREATOR_SCREEN_ROUTE,
268246
on_new_intent=None,
269247
),
270248
MenuItem(
271-
2,
272-
"Contacts",
273-
icons.CONTACT_MAIL_OUTLINED,
274-
icons.CONTACT_MAIL_ROUNDED,
275-
self.contacts_view,
249+
index=2,
250+
label="Contacts",
251+
icon=icons.CONTACT_MAIL_OUTLINED,
252+
selected_icon=icons.CONTACT_MAIL_ROUNDED,
253+
destination=self.contacts_view,
276254
on_new_screen_route=None,
277255
on_new_intent=ADD_CONTACT_INTENT,
278256
),
279257
MenuItem(
280-
3,
281-
"Clients",
282-
icons.CONTACTS_OUTLINED,
283-
icons.CONTACTS_ROUNDED,
284-
self.clients_view,
258+
index=3,
259+
label="Clients",
260+
icon=icons.CONTACTS_OUTLINED,
261+
selected_icon=icons.CONTACTS_ROUNDED,
262+
destination=self.clients_view,
285263
on_new_screen_route=None,
286264
on_new_intent=ADD_CLIENT_INTENT,
287265
),
288266
MenuItem(
289-
4,
290-
"Contracts",
291-
icons.HANDSHAKE_OUTLINED,
292-
icons.HANDSHAKE_ROUNDED,
293-
self.contracts_view,
267+
index=4,
268+
label="Contracts",
269+
icon=icons.HANDSHAKE_OUTLINED,
270+
selected_icon=icons.HANDSHAKE_ROUNDED,
271+
destination=self.contracts_view,
294272
on_new_screen_route=CONTRACT_CREATOR_SCREEN_ROUTE,
295273
on_new_intent=None,
296274
),
@@ -309,29 +287,29 @@ def __init__(self, params: TuttleViewParams):
309287

310288
self.items = [
311289
MenuItem(
312-
0,
313-
"Time Tracking",
314-
icons.TIMER_OUTLINED,
315-
icons.TIMER_ROUNDED,
316-
self.timetrack_view,
290+
index=0,
291+
label="Time Tracking",
292+
icon=icons.TIMER_OUTLINED,
293+
selected_icon=icons.TIMER_ROUNDED,
294+
destination=self.timetrack_view,
317295
on_new_screen_route=None,
318296
on_new_intent=NEW_TIME_TRACK_INTENT,
319297
),
320298
MenuItem(
321-
0,
322-
"Invoicing",
323-
icons.ATTACH_MONEY_SHARP,
324-
icons.ATTACH_MONEY_ROUNDED,
325-
Container(),
326-
"/404",
299+
index=1,
300+
label="Invoicing",
301+
icon=icons.ATTACH_MONEY_SHARP,
302+
selected_icon=icons.ATTACH_MONEY_ROUNDED,
303+
destination=self.invoicing_view,
304+
on_new_screen_route="/404",
327305
),
328306
MenuItem(
329-
0,
330-
"Datatable",
331-
icons.TABLE_CHART,
332-
icons.TABLE_CHART_ROUNDED,
333-
Container(),
334-
"/404",
307+
index=2,
308+
label="Datatable",
309+
icon=icons.TABLE_CHART,
310+
selected_icon=icons.TABLE_CHART_ROUNDED,
311+
destination=Container(),
312+
on_new_screen_route="/404",
335313
),
336314
]
337315

app/invoicing/view.py

+27-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
from flet import (
2-
UserControl,
3-
)
1+
from flet import Column, Container, ResponsiveRow, UserControl
42

3+
from core import views
54
from core.abstractions import DialogHandler, TuttleView, TuttleViewParams
6-
from core.utils import AlertDialogControls
75
from core.models import IntentResult
6+
from core.utils import AlertDialogControls
7+
from res import colors, fonts
88

99
from .intent import InvoicingIntent
1010

@@ -16,3 +16,26 @@ def __init__(
1616
):
1717
super().__init__(params)
1818
self.intent_handler = InvoicingIntent()
19+
20+
self.title_control = ResponsiveRow(
21+
controls=[
22+
Column(
23+
col={"xs": 12},
24+
controls=[
25+
views.get_headline_txt(
26+
txt="Invoicing", size=fonts.HEADLINE_4_SIZE
27+
),
28+
],
29+
)
30+
]
31+
)
32+
33+
def build(self):
34+
35+
view = Column(
36+
controls=[
37+
self.title_control,
38+
views.mdSpace,
39+
]
40+
)
41+
return view

0 commit comments

Comments
 (0)