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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
import streamlit as st
|
3 |
+
import yfinance as yf
|
4 |
+
import streamlit.components.v1 as components
|
5 |
+
from requests_html import HTMLSession
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
st.set_page_config('Home',":shark:","wide",menu_items={'About': "This is an *extremely* cool app!"})
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
menu=['Registeration form by streamlit','Online register step by step','Registeration form by component,Html']
|
15 |
+
ch=st.sidebar.selectbox('Menu',menu)
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
if ch == 'Registeration form by streamlit':
|
28 |
+
st.title('Registration form')
|
29 |
+
|
30 |
+
|
31 |
+
st.subheader('Customer information')
|
32 |
+
ct = ['Private','Business']
|
33 |
+
ctype = st.selectbox('Customer type', ct)
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
if ctype == 'Private' :
|
38 |
+
|
39 |
+
cemail = st.text_input('Email')
|
40 |
+
|
41 |
+
rcemail = st.text_input('Repeat Email')
|
42 |
+
if cemail != rcemail :
|
43 |
+
st.warning('Email does not match')
|
44 |
+
else:
|
45 |
+
st.success('Please note that it is very important that your email is correct, as all communication and invoices will be sent by email.')
|
46 |
+
|
47 |
+
cname = st.text_input('Name and family name')
|
48 |
+
|
49 |
+
caddress = st.text_input('Address')
|
50 |
+
|
51 |
+
|
52 |
+
cpcode = st.text_input('Postal code')
|
53 |
+
|
54 |
+
|
55 |
+
ccity = st.text_input('City')
|
56 |
+
|
57 |
+
|
58 |
+
cphone = st.text_input('Phone')
|
59 |
+
|
60 |
+
|
61 |
+
else:
|
62 |
+
|
63 |
+
cemail = st.text_input('Email')
|
64 |
+
|
65 |
+
rcemail = st.text_input('Repeat Email')
|
66 |
+
if cemail != rcemail :
|
67 |
+
st.warning('Email does not match')
|
68 |
+
else:
|
69 |
+
st.success('Please note that it is very important that your email is correct, as all communication and invoices will be sent by email.')
|
70 |
+
|
71 |
+
ccvr = st.text_input('CVR number')
|
72 |
+
|
73 |
+
|
74 |
+
company = st.text_input('Company name')
|
75 |
+
|
76 |
+
|
77 |
+
caddress = st.text_input('Address')
|
78 |
+
|
79 |
+
|
80 |
+
cpcode = st.text_input('Postal code')
|
81 |
+
|
82 |
+
|
83 |
+
ccity = st.text_input('City')
|
84 |
+
|
85 |
+
|
86 |
+
cphone = st.text_input('Phone')
|
87 |
+
|
88 |
+
|
89 |
+
st.subheader('Subscription')
|
90 |
+
pack=st.radio('package', ['Gold','silver','bronz'],horizontal=True)
|
91 |
+
if 'Gold' in pack:
|
92 |
+
st.success('Kr. 1185.00 årligt inkl. moms')
|
93 |
+
if 'silver' in pack:
|
94 |
+
st.success('885.00 årligt inkl. moms')
|
95 |
+
if 'bronz' in pack:
|
96 |
+
st.success('585.00 årligt inkl. moms')
|
97 |
+
|
98 |
+
goog=st.radio('include google map', ['Yes','No'],horizontal=True)
|
99 |
+
if 'Yes' in goog:
|
100 |
+
st.success('Kr. 75.00 årligt inkl. moms')
|
101 |
+
|
102 |
+
alarm=st.radio('include alarmcentral', ['Yes','No'],horizontal=True)
|
103 |
+
if 'Yes' in alarm:
|
104 |
+
st.success('Tilvælg alarmcentral + 400.00 årligt inkl. moms')
|
105 |
+
ins=['Topdanmark Forsikring A/S','Tryg Forsikring A/S','ALG Europe','Alka Forsikring','Alm. Brand Forsikring A/S','Andet']
|
106 |
+
ins2=st.selectbox('Insurance company',ins)
|
107 |
+
|
108 |
+
|
109 |
+
st.subheader('Vehicle')
|
110 |
+
|
111 |
+
plate = st.text_input('Registration Plate')
|
112 |
+
|
113 |
+
brand = st.text_input('Brand')
|
114 |
+
|
115 |
+
model = st.text_input('Model')
|
116 |
+
|
117 |
+
year = st.text_input('Year')
|
118 |
+
|
119 |
+
|
120 |
+
submitted = st.button("Submit")
|
121 |
+
|
122 |
+
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
|
127 |
+
|
128 |
+
|
129 |
+
|
130 |
+
|
131 |
+
|
132 |
+
|
133 |
+
if ch == 'Online register step by step':
|
134 |
+
st.title('Online Bestil forsikringstracker')
|
135 |
+
|
136 |
+
st.subheader('Customer information')
|
137 |
+
|
138 |
+
ct = ['--Select--','Private','Business']
|
139 |
+
ctype = st.selectbox('Customer type', ct)
|
140 |
+
if '--Select--' in ctype:
|
141 |
+
st.stop()
|
142 |
+
|
143 |
+
cemail = st.text_input('Email')
|
144 |
+
if not cemail:
|
145 |
+
st.stop()
|
146 |
+
|
147 |
+
rcemail = st.text_input('Repeat Email')
|
148 |
+
if not rcemail:
|
149 |
+
st.stop()
|
150 |
+
|
151 |
+
if cemail != rcemail :
|
152 |
+
st.warning('Email does not match')
|
153 |
+
st.stop()
|
154 |
+
else:
|
155 |
+
st.success('We will send login infomation to this email.')
|
156 |
+
|
157 |
+
|
158 |
+
|
159 |
+
if ctype == 'Private' :
|
160 |
+
|
161 |
+
cname = st.text_input('Name and family name')
|
162 |
+
if not cname:
|
163 |
+
st.stop()
|
164 |
+
|
165 |
+
caddress = st.text_input('Address')
|
166 |
+
if not caddress:
|
167 |
+
st.stop()
|
168 |
+
|
169 |
+
cpcode = st.text_input('Postal code')
|
170 |
+
if not cpcode:
|
171 |
+
st.stop()
|
172 |
+
|
173 |
+
ccity = st.text_input('City')
|
174 |
+
if not ccity:
|
175 |
+
st.stop()
|
176 |
+
|
177 |
+
cphone = st.text_input('Phone')
|
178 |
+
if not cphone:
|
179 |
+
st.stop()
|
180 |
+
|
181 |
+
else:
|
182 |
+
ccvr = st.text_input('CVR number')
|
183 |
+
if not ccvr:
|
184 |
+
st.stop()
|
185 |
+
|
186 |
+
company = st.text_input('Company name')
|
187 |
+
if not company:
|
188 |
+
st.stop()
|
189 |
+
|
190 |
+
caddress = st.text_input('Address')
|
191 |
+
if not company:
|
192 |
+
st.stop()
|
193 |
+
|
194 |
+
cpcode = st.text_input('Postal code')
|
195 |
+
if not cpcode:
|
196 |
+
st.stop()
|
197 |
+
|
198 |
+
ccity = st.text_input('City')
|
199 |
+
if not ccity:
|
200 |
+
st.stop()
|
201 |
+
|
202 |
+
cphone = st.text_input('Phone')
|
203 |
+
if not cphone:
|
204 |
+
st.stop()
|
205 |
+
|
206 |
+
|
207 |
+
st.subheader('Subscription')
|
208 |
+
pack=st.radio('package', ['Gold','silver','bronz','<--- choose'],horizontal=True,index=3)
|
209 |
+
if '<--- choose' in pack:
|
210 |
+
st.stop()
|
211 |
+
if 'Gold' in pack:
|
212 |
+
st.success('Kr. 1185.00 årligt inkl. moms')
|
213 |
+
if 'silver' in pack:
|
214 |
+
st.success('885.00 årligt inkl. moms')
|
215 |
+
if 'bronz' in pack:
|
216 |
+
st.success('585.00 årligt inkl. moms')
|
217 |
+
|
218 |
+
goog=st.radio('include google map', ['Yes','No','<--- choose'],horizontal=True,index=2)
|
219 |
+
if '<--- choose' in goog:
|
220 |
+
st.stop()
|
221 |
+
if 'Yes' in goog:
|
222 |
+
st.success('Kr. 75.00 årligt inkl. moms')
|
223 |
+
|
224 |
+
alarm=st.radio('Include alarmcentral', ['Yes','No','<--- choose'],horizontal=True,index=2)
|
225 |
+
if '<--- choose' in alarm:
|
226 |
+
st.stop()
|
227 |
+
if 'Yes' in alarm:
|
228 |
+
st.success('Tilvælg alarmcentral + 400.00 årligt inkl. moms')
|
229 |
+
ins=['--Select--','Topdanmark Forsikring A/S','Tryg Forsikring A/S','ALG Europe','Alka Forsikring','Alm. Brand Forsikring A/S','Andet']
|
230 |
+
|
231 |
+
ins2=st.selectbox('Your car insurance company',ins)
|
232 |
+
if ins2 == '--Select--':
|
233 |
+
st.stop()
|
234 |
+
|
235 |
+
st.subheader('Vehicle')
|
236 |
+
|
237 |
+
plate = st.text_input('Registration Plate')
|
238 |
+
if not plate:
|
239 |
+
st.stop()
|
240 |
+
|
241 |
+
brand = st.text_input('Brand')
|
242 |
+
if not brand:
|
243 |
+
st.stop()
|
244 |
+
|
245 |
+
model = st.text_input('Model')
|
246 |
+
if not model:
|
247 |
+
st.stop()
|
248 |
+
|
249 |
+
|
250 |
+
year = st.text_input('Year')
|
251 |
+
if not year:
|
252 |
+
st.stop()
|
253 |
+
|
254 |
+
|
255 |
+
subm=st.button('Send')
|
256 |
+
if subm:
|
257 |
+
st.write('Check your email to continue')
|
258 |
+
|
259 |
+
|
260 |
+
|
261 |
+
|
262 |
+
|
263 |
+
|
264 |
+
|
265 |
+
|
266 |
+
|
267 |
+
|
268 |
+
if ch == 'Registeration form by component,Html':
|
269 |
+
|
270 |
+
#define css
|
271 |
+
|
272 |
+
|
273 |
+
|
274 |
+
|
275 |
+
#define html
|
276 |
+
components.html("""
|
277 |
+
<!doctype html>
|
278 |
+
|
279 |
+
<html>
|
280 |
+
<head>
|
281 |
+
|
282 |
+
</head>
|
283 |
+
<script language="Javascript">
|
284 |
+
function hideA(x) {
|
285 |
+
if (x.checked) {
|
286 |
+
document.getElementById("A").style.display = "none";
|
287 |
+
document.getElementById("B").style.display = "initial";
|
288 |
+
document.getElementById('option1').checked = true;
|
289 |
+
}
|
290 |
+
}
|
291 |
+
|
292 |
+
function hideB(x) {
|
293 |
+
if (x.checked) {
|
294 |
+
document.getElementById("B").style.display = "none";
|
295 |
+
document.getElementById("A").style.display = "initial";
|
296 |
+
document.getElementById('option4').checked = true;
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
+
</script>
|
301 |
+
|
302 |
+
<body>
|
303 |
+
<h1>Tilmeldingsformular</h1>
|
304 |
+
|
305 |
+
|
306 |
+
|
307 |
+
|
308 |
+
<div id="A">
|
309 |
+
|
310 |
+
<form method="post" >
|
311 |
+
Status:
|
312 |
+
<input type="radio" name="c" id='option1' onchange="hideB(this)" value="1" checked="checked" >Ny kunde
|
313 |
+
<input type="radio" name="c" id='option2' onchange="hideA(this)" value="2"> Eksisterende kunde
|
314 |
+
<br><br>
|
315 |
+
<input type="text" placeholder="Fornavn og Efternavn*" name="name" required minlength="4"/>
|
316 |
+
<br><br>
|
317 |
+
<input type="text" placeholder="Firmanavn" name="firma" />
|
318 |
+
<br><br>
|
319 |
+
<input type="email" placeholder="E-mail*" name="email" required/>
|
320 |
+
<br><br>
|
321 |
+
<input type="text" placeholder="Telefonnummer" name="tlf" />
|
322 |
+
<br><br>
|
323 |
+
<input type="text" placeholder="Post nr" name="post" />
|
324 |
+
<br><br>
|
325 |
+
<input type="text" placeholder="By" name="city" />
|
326 |
+
<br><br>
|
327 |
+
<input type="text" placeholder="Adresse" name="address" />
|
328 |
+
<br><br>
|
329 |
+
<input type="text" placeholder="Nummerplade*" name="plate" required minlength="4"/>
|
330 |
+
<br><br>
|
331 |
+
<input type="text" placeholder="Mærke" name="mark" />
|
332 |
+
<br><br>
|
333 |
+
<input type="text" placeholder="Model" name="model" />
|
334 |
+
<br><br>
|
335 |
+
<input type="text" placeholder="Årgang" name="year" />
|
336 |
+
<br><br>
|
337 |
+
|
338 |
+
Abonnement: <input type="radio" name="s" id="f" value="1" checked="checked"> ULTIMATE
|
339 |
+
<input type="radio" name="s" id="k" value="2"> PREMIUM
|
340 |
+
<input type="radio" name="s" id="p" value="3" > BASIC
|
341 |
+
<br><br>
|
342 |
+
|
343 |
+
<input type="text" placeholder="IMEI nr.*" name="imei" required/>
|
344 |
+
<br><br>
|
345 |
+
|
346 |
+
Enhed model: <input type="radio" name="m" value="1" checked="checked"> GT06E
|
347 |
+
<!-- <input type="radio" name="m" value="2"> GV20
|
348 |
+
<input type="radio" name="m" value="3" > ET25
|
349 |
+
<input type="radio" name="m" value="9" checked="checked" > Unknown-->
|
350 |
+
<br><br>
|
351 |
+
|
352 |
+
|
353 |
+
|
354 |
+
<input type=submit value=Opret>
|
355 |
+
</form>
|
356 |
+
</div>
|
357 |
+
|
358 |
+
|
359 |
+
|
360 |
+
<div id="B" style="display:none">
|
361 |
+
<form method="post">
|
362 |
+
Status:
|
363 |
+
<input type="radio" name="c" id='option3' onchange="hideB(this)" value="1" >Ny kunde
|
364 |
+
<input type="radio" name="c" id='option4' onchange="hideA(this)" value="2" checked="checked" > Eksisterende kunde
|
365 |
+
<br><br>
|
366 |
+
<input type="email" placeholder="E-mail*" name="email" required/>
|
367 |
+
<br><br>
|
368 |
+
<input type="text" placeholder="Nummerplade*" name="plate" required minlength="4"/>
|
369 |
+
<br><br>
|
370 |
+
<input type="text" placeholder="Mærke" name="mark" />
|
371 |
+
<br><br>
|
372 |
+
<input type="text" placeholder="Model" name="model" />
|
373 |
+
<br><br>
|
374 |
+
<input type="text" placeholder="Årgang" name="year" />
|
375 |
+
<br><br>
|
376 |
+
<input type="text" placeholder="IMEI nr.*" name="imei" required/>
|
377 |
+
<br><br>
|
378 |
+
|
379 |
+
Enhed model: <input type="radio" name="m" value="1" checked="checked"> GT06E
|
380 |
+
<!--<input type="radio" name="m" value="2"> GV20
|
381 |
+
<input type="radio" name="m" value="3" > ET25
|
382 |
+
<input type="radio" name="m" value="9" > Unknown-->
|
383 |
+
<br><br>
|
384 |
+
<input type=submit value=Opret>
|
385 |
+
</form>
|
386 |
+
</div>
|
387 |
+
|
388 |
+
|
389 |
+
</body>
|
390 |
+
</html>
|
391 |
+
""", height=1000)
|