-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete.py
128 lines (111 loc) · 5.73 KB
/
delete.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import pandas as pd
import streamlit as st
from database import view_only_booked_bid
from database import view_only_customer_cid
from database import view_only_feedback_id
from database import view_only_places_pid
from database import view_only_information_pid
from database import view_only_travel_agent_aid
from database import view_all_data_booking
from database import view_all_data_customer
from database import view_all_data_feedback
from database import view_all_data_places
from database import view_all_data_information
from database import view_all_data_travel_agent
from database import delete_data_booking
from database import delete_data_customer
from database import delete_data_feedback
from database import delete_data_places
from database import delete_data_information
from database import delete_data_travel_agent
def delete(table):
if table=='booking':
result = view_all_data_booking()
df = pd.DataFrame(result, columns=['bid', 'aid', 'fname', 'lname', 'email','city','fphone','fdesti','cost','reward'])
with st.expander("Current data"):
st.dataframe(df)
list_of_dealers = [i[0] for i in view_only_booked_bid()]
selected_dealer = st.selectbox("Task to Delete", list_of_dealers)
st.warning("Do you want to delete ::{}".format(selected_dealer))
if st.button("Delete user"):
delete_data_booking(selected_dealer)
st.success("user has been deleted successfully")
new_result = view_all_data_booking()
df2 = pd.DataFrame(new_result, columns=['bid', 'aid', 'fname', 'lname', 'email','city','fphone','fdesti','cost','reward'])
with st.expander("Updated data"):
st.dataframe(df2)
elif table=='customer':
result = view_all_data_customer()
df = pd.DataFrame(result, columns=['cid','fname', 'lname', 'email','city','phone'])
with st.expander("Current data"):
st.dataframe(df)
list_of_dealers = [i[0] for i in view_only_customer_cid()]
selected_dealer = st.selectbox("Task to Delete", list_of_dealers)
st.warning("Do you want to delete ::{}".format(selected_dealer))
if st.button("Delete user"):
delete_data_customer(selected_dealer)
st.success("user has been deleted successfully")
new_result = view_all_data_customer()
df2 = pd.DataFrame(new_result, columns=['cid','fname', 'lname', 'email','city','phone'])
with st.expander("Updated data"):
st.dataframe(df2)
elif table=='feedback':
result = view_all_data_feedback()
df = pd.DataFrame(result, columns=['id', 'name', 'email','feedbk'])
with st.expander("Current data"):
st.dataframe(df)
list_of_dealers = [i[0] for i in view_only_feedback_id()]
selected_dealer = st.selectbox("Task to Delete", list_of_dealers)
st.warning("Do you want to delete ::{}".format(selected_dealer))
if st.button("Delete user"):
delete_data_feedback(selected_dealer)
st.success("user has been deleted successfully")
new_result = view_all_data_feedback()
df2 = pd.DataFrame(new_result, columns=['id', 'name', 'email','feedbk'])
with st.expander("Updated data"):
st.dataframe(df2)
elif table=='places':
result = view_all_data_places()
df = pd.DataFrame(result, columns=['pid', 'pname', 'pcity'])
with st.expander("Current data"):
st.dataframe(df)
list_of_dealers = [i[0] for i in view_only_places_pid()]
selected_dealer = st.selectbox("Task to Delete", list_of_dealers)
st.warning("Do you want to delete ::{}".format(selected_dealer))
if st.button("Delete user"):
delete_data_places(selected_dealer)
st.success("user has been deleted successfully")
new_result = view_all_data_places()
df2 = pd.DataFrame(new_result, columns=['pid', 'pname', 'pcity'])
with st.expander("Updated data"):
st.dataframe(df2)
elif table=='information':
result = view_all_data_information()
df = pd.DataFrame(result, columns=['pname', 'pid', 'cost', 'pdescription'])
with st.expander("Current data"):
st.dataframe(df)
list_of_dealers = [i[0] for i in view_only_information_pid()]
selected_dealer = st.selectbox("Task to Delete", list_of_dealers)
st.warning("Do you want to delete ::{}".format(selected_dealer))
if st.button("Delete user"):
delete_data_information(selected_dealer)
st.success("user has been deleted successfully")
new_result = view_all_data_information()
df2 = pd.DataFrame(new_result, columns=['pname', 'pid', 'cost', 'pdescription'])
with st.expander("Updated data"):
st.dataframe(df2)
elif table=='travel_agent':
result = view_all_data_travel_agent()
df = pd.DataFrame(result, columns=['aid', 'afname', 'alname', 'aemail', 'acity', 'aphone'])
with st.expander("Current data"):
st.dataframe(df)
list_of_dealers = [i[0] for i in view_only_travel_agent_aid()]
selected_dealer = st.selectbox("Task to Delete", list_of_dealers)
st.warning("Do you want to delete ::{}".format(selected_dealer))
if st.button("Delete user"):
delete_data_travel_agent(selected_dealer)
st.success("user has been deleted successfully")
new_result = view_all_data_travel_agent()
df2 = pd.DataFrame(new_result, columns=['aid', 'afname', 'alname', 'aemail', 'acity', 'aphone'])
with st.expander("Updated data"):
st.dataframe(df2)