Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ositoMalvado committed Jul 25, 2024
1 parent 87527df commit 5045afa
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 7 deletions.
7 changes: 4 additions & 3 deletions Tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ def __init__(self):
self.text = "Franquicias"
self.mi_data_table = ft.DataTable(
columns=[
ft.DataColumn(ft.Text("Tipo de Vehículo", weight=ft.FontWeight.BOLD), tooltip="Tipo de Vehículo"),
ft.DataColumn(ft.Text("% Suma Asegurada", weight=ft.FontWeight.BOLD), tooltip="% Suma Asegurada"),
ft.DataColumn(ft.Text("Monto mínimo de Franquicia", weight=ft.FontWeight.BOLD), tooltip="Monto mínimo de Franquicia"),
ft.DataColumn(ft.Text(expand=True,value="Tipo de Vehículo", weight=ft.FontWeight.BOLD), tooltip="Tipo de Vehículo"),
ft.DataColumn(ft.Text(expand=True,value="% Suma Asegurada", weight=ft.FontWeight.BOLD), tooltip="% Suma Asegurada"),
ft.DataColumn(ft.Text(expand=True,value="Monto mínimo de Franquicia", weight=ft.FontWeight.BOLD), tooltip="Monto mínimo de Franquicia"),
],
rows=[],
expand=True,
)

for i, franquicia in enumerate(self.franquicias):
Expand Down
18 changes: 16 additions & 2 deletions Widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class CalculadoraPremio(ft.Container):

def update_premio(self, e):
# Aplicar el descuento del 15%
self.sonido.play()
if self.text_field_premio.value == '':
self.valor_final.value = "0"
self.valor_final.update()
Expand All @@ -27,19 +28,27 @@ def slider_handle(self, e):
self.slider.label = "Descuento: " + str(int(self.slider.value)) + "%"
self.slider.update()
self.update_premio(e)
self.sonido.play()

def copy_premio(self, e):
self.copy_sound.play()
self.page.set_clipboard(self.valor_final.value)
self.sb_copiado.open = True
self.page.update()

def did_mount(self):
self.page.overlay.append(self.sb_copiado)
self.page.overlay.append(self.sonido)
self.page.overlay.append(self.copy_sound)
self.page.update()
return super().did_mount()

def __init__(self):
super().__init__()

self.sonido = ft.Audio(src="bamboo.mp3")
self.copy_sound = ft.Audio(src="copy.mp3")

self.sb_copiado = ft.SnackBar(
content=ft.Text("Copiado al portapapeles"),
bgcolor=ft.colors.GREEN
Expand All @@ -56,13 +65,18 @@ def __init__(self):
label="Descuento: 15%",
)

self.valor_final = ft.Text("0", size=30)
self.valor_final = ft.Text("0", size=40, expand=True, text_align=ft.TextAlign.CENTER)

self.text_field_premio = ft.TextField(
label="Premio",
prefix_icon=ft.icons.ATTACH_MONEY_ROUNDED,
hint_text="Ingresa el premio",
on_change=self.update_premio
on_change=self.update_premio,
input_filter=ft.InputFilter(
regex_string=r"[0-9]",
allow=True,
replacement_string="",
)
)
self.boton_copiar = ft.ElevatedButton(
content=ft.Row(
Expand Down
Binary file added assets/bamboo.mp3
Binary file not shown.
Binary file added assets/copy.mp3
Binary file not shown.
Binary file added assets/copy.wav
Binary file not shown.
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def change_color():

page.add(
ft.Tabs(
[
tabs=[
ft.Tab(
text="Federación Patronal",
content=ft.Tabs(
Expand Down Expand Up @@ -67,4 +67,4 @@ def change_color():



ft.app(main, assets_dir="assets", view=ft.AppView.WEB_BROWSER)
ft.app(main, assets_dir="assets")

0 comments on commit 5045afa

Please sign in to comment.