Skip to content
Snippets Groups Projects
Commit 807e5ce8 authored by Bouchaira Neirouz's avatar Bouchaira Neirouz
Browse files

shiny

parent e5749dac
No related branches found
No related tags found
No related merge requests found
File added
plotly
shiny
shinywidgets
sqlite3
pandas
datetime
\ No newline at end of file
import plotly.express as px
from shiny.express import input, render, ui
from shinywidgets import render_widget
import sqlite3
import pandas as pd
from datetime import datetime
# Connect to the database
conn = sqlite3.connect('C:/Users/neiro/Documents/GitHub/sgbd-usine/donnees/company.db')
ui.page_opts(title="Bienvenue à la page RH", fillable=True)
with ui.sidebar():
ui.input_action_button("new_employee", "Nouveau employé")
ui.input_action_button("employee_tracking", "Suivis employés")
@render.ui
def nouveau():
if input.new_employee:
ui.h2("Création de compte employé")
with ui.card():
"Veuillez remplir les informations suivantes pour créer un compte employé"
# Connect to the database
conn = sqlite3.connect('C:/Users/neiro/Documents/GitHub/sgbd-usine/donnees/company.db')
cursor = conn.cursor()
# Get the maximum employee number from the database
cursor.execute("SELECT MAX(NUMERO_EMPLOYE) FROM EMPLOYE")
max_numero_employe = cursor.fetchone()[0]
# Set the employee number to the next available number
if max_numero_employe is not None:
NUMERO_EMPLOYE = max_numero_employe + 1
else:
NUMERO_EMPLOYE= 1
# Employee name
return ui.input_text(
"Nom",
"NOM",
value='',
width=None,
placeholder=None,
autocomplete='off',
spellcheck=None,
)
...@@ -23,7 +23,7 @@ if page == "suivi_employes": ...@@ -23,7 +23,7 @@ if page == "suivi_employes":
# Add code for "Suivi Employés" page here # Add code for "Suivi Employés" page here
st.write("Page de suivi des employés") st.write("Page de suivi des employés")
# Connect to the database # Connect to the database
conn = sqlite3.connect('C:\Users\neiro\Documents\GitHub\sgbd-usine\donnes\company.db') conn = sqlite3.connect('donnees\company.db')
cursor = conn.cursor() cursor = conn.cursor()
# Fetch all employee records # Fetch all employee records
...@@ -46,7 +46,7 @@ if page == "creation_compte_employe": ...@@ -46,7 +46,7 @@ if page == "creation_compte_employe":
st.title("Création de compte employé") st.title("Création de compte employé")
# Connect to the database # Connect to the database
conn = sqlite3.connect('C:\Users\neiro\Documents\GitHub\sgbd-usine\donnes\company.db') conn = sqlite3.connect('donnees\company.db')
cursor = conn.cursor() cursor = conn.cursor()
# Get the maximum employee number from the database # Get the maximum employee number from the database
...@@ -82,7 +82,7 @@ if page == "creation_compte_employe": ...@@ -82,7 +82,7 @@ if page == "creation_compte_employe":
# Submit button # Submit button
if st.button("Create Account"): if st.button("Create Account"):
# Connect to the database # Connect to the database
conn = sqlite3.connect('C:\Users\neiro\Documents\GitHub\sgbd-usine\donnes\company.db') conn = sqlite3.connect('donnees\company.db')
cursor = conn.cursor() cursor = conn.cursor()
# Insert the new employee record # Insert the new employee record
......
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment