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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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
import requests
import streamlit as st
import yfinance as yf
import streamlit.components.v1 as components
from requests_html import HTMLSession



menu=['Home','Sport news','Crypto','Sales','Registeration form by streamlit','Online register step by step','Registeration form by component,Html']
ch=st.sidebar.selectbox('Menu',menu)





if ch=='Home':
    st.title('Test python projects')
    st.write('This is a homepage to run and test different python scripts!')
if ch== 'Sport news':
    st.title('Sport news')
    ti=st.text_input('Text input')
    if len(ti)>0:
        r=requests.get('https://search-api.varzesh3.com/v1.0/query?q='+ti)
        x=r.json()
        for i in x['news']:
            st.subheader(i['title'])
            st.success(i['publishedOn'])
            st.write(i['shortDescription'])
            st.image(i['picture'])
            st.write('--------------------------------------------')







if ch== 'Crypto':
    list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD']
    ms = st.multiselect('choose asset', list_asset)
    dates1 = st.date_input('from')
    dates2 = st.date_input('to')

    if len(ms) > 0:
        df = yf.download(ms, dates1, dates2)
        st.write(df)
        df2 = yf.download(ms, dates1, dates2)['Close']
        st.line_chart(df2)










if ch == 'Sales':
    st.title('Good deals from stores below:')
    url = requests.get('https://www.cheapshark.com/api/1.0/stores')
    x = url.json()

    for i in x:
        st.write(i['storeName'] )

    url2 = requests.get('https://www.cheapshark.com/api/1.0/deals?storeID=1&upperPrice=15')
    y = url2.json()

    for j in y:
        st.write('------------------------------------------')
        st.write('Game name:   '+j['title'])
        st.write('ID:  '+j['gameID'])
        st.write('New price:  '+j['salePrice'])
        st.write('Old price:  '+j['normalPrice'])
        st.write(j['thumb'])
        st.write('------------------------------------------')










if ch == 'Registeration form by streamlit':
    st.title('Registration form')


    st.subheader('Customer information')
    ct = ['Private','Business']
    ctype = st.selectbox('Customer type', ct)



    if ctype == 'Private' :

        cemail = st.text_input('Email')

        rcemail = st.text_input('Repeat Email')
        if cemail != rcemail :
            st.warning('Email does not match')
        else:
            st.success('Please note that it is very important that your email is correct, as all communication and invoices will be sent by email.')

        cname = st.text_input('Name and family name')

        caddress = st.text_input('Address')


        cpcode = st.text_input('Postal code')


        ccity = st.text_input('City')


        cphone = st.text_input('Phone')


    else:

        cemail = st.text_input('Email')

        rcemail = st.text_input('Repeat Email')
        if cemail != rcemail :
            st.warning('Email does not match')
        else:
            st.success('Please note that it is very important that your email is correct, as all communication and invoices will be sent by email.')

        ccvr = st.text_input('CVR number')


        company = st.text_input('Company name')


        caddress = st.text_input('Address')


        cpcode = st.text_input('Postal code')


        ccity = st.text_input('City')


        cphone = st.text_input('Phone')


    st.subheader('Subscription')
    pack=st.radio('package', ['Gold','silver','bronz'],horizontal=True)
    if 'Gold' in pack:
        st.success('Kr. 1185.00 årligt inkl. moms')
    if 'silver' in pack:
        st.success('885.00 årligt inkl. moms')
    if 'bronz' in pack:
        st.success('585.00 årligt inkl. moms')

    goog=st.radio('include google map', ['Yes','No'],horizontal=True)
    if 'Yes' in goog:
        st.success('Kr. 75.00 årligt inkl. moms')

    alarm=st.radio('include alarmcentral', ['Yes','No'],horizontal=True)
    if 'Yes' in alarm:
        st.success('Tilvælg alarmcentral + 400.00 årligt inkl. moms')
        ins=['Topdanmark Forsikring A/S','Tryg Forsikring A/S','ALG Europe','Alka Forsikring','Alm. Brand Forsikring A/S','Andet']    
        ins2=st.selectbox('Insurance company',ins)


    st.subheader('Vehicle')

    plate = st.text_input('Registration Plate')

    brand = st.text_input('Brand')

    model = st.text_input('Model')

    year = st.text_input('Year')


    submitted = st.button("Submit")












if ch == 'Online register step by step':
    st.title('Online Bestil forsikringstracker')

    st.subheader('Customer information')

    ct = ['--Select--','Private','Business']
    ctype = st.selectbox('Customer type', ct)
    if '--Select--' in ctype:
        st.stop()

    cemail = st.text_input('Email')
    if not cemail:
        st.stop()

    rcemail = st.text_input('Repeat Email')
    if not rcemail:
        st.stop()

    if cemail != rcemail :
        st.warning('Email does not match')
        st.stop()
    else:
        st.success('We will send login infomation to this email.')



    if ctype == 'Private' :

        cname = st.text_input('Name and family name')
        if not cname:
            st.stop()

        caddress = st.text_input('Address')
        if not caddress:
            st.stop()

        cpcode = st.text_input('Postal code')
        if not cpcode:
            st.stop()

        ccity = st.text_input('City')
        if not ccity:
            st.stop()

        cphone = st.text_input('Phone')
        if not cphone:
            st.stop()

    else:
        ccvr = st.text_input('CVR number')
        if not ccvr:
            st.stop()

        company = st.text_input('Company name')
        if not company:
            st.stop()

        caddress = st.text_input('Address')
        if not company:
            st.stop()

        cpcode = st.text_input('Postal code')
        if not cpcode:
            st.stop()

        ccity = st.text_input('City')
        if not ccity:
            st.stop()

        cphone = st.text_input('Phone')
        if not cphone:
            st.stop()


    st.subheader('Subscription')
    pack=st.radio('package', ['Gold','silver','bronz','<--- choose'],horizontal=True,index=3)
    if '<--- choose' in pack:
        st.stop()
    if 'Gold' in pack:
        st.success('Kr. 1185.00 årligt inkl. moms')
    if 'silver' in pack:
        st.success('885.00 årligt inkl. moms')
    if 'bronz' in pack:
        st.success('585.00 årligt inkl. moms')

    goog=st.radio('include google map', ['Yes','No','<--- choose'],horizontal=True,index=2)
    if '<--- choose' in goog:
        st.stop()
    if 'Yes' in goog:
        st.success('Kr. 75.00 årligt inkl. moms')

    alarm=st.radio('Include alarmcentral', ['Yes','No','<--- choose'],horizontal=True,index=2)
    if '<--- choose' in alarm:
        st.stop()
    if 'Yes' in alarm:
        st.success('Tilvælg alarmcentral + 400.00 årligt inkl. moms')
        ins=['--Select--','Topdanmark Forsikring A/S','Tryg Forsikring A/S','ALG Europe','Alka Forsikring','Alm. Brand Forsikring A/S','Andet']    

        ins2=st.selectbox('Your car insurance company',ins)
        if ins2 == '--Select--':
            st.stop()

    st.subheader('Vehicle')

    plate = st.text_input('Registration Plate')
    if not plate:
        st.stop()

    brand = st.text_input('Brand')
    if not brand:
        st.stop()

    model = st.text_input('Model')
    if not model:
        st.stop()


    year = st.text_input('Year')
    if not year:
        st.stop()


    subm=st.button('Send')
    if subm:
        st.write('Check your email to continue')










if ch == 'Registeration form by component,Html':

    #define css




    #define html
    components.html("""
    <!doctype html>

    <html>
    <head>

    </head>
    <script language="Javascript">
    function hideA(x) {
        if (x.checked) {
        document.getElementById("A").style.display = "none";
        document.getElementById("B").style.display = "initial";
        document.getElementById('option1').checked = true;
        }
    }

    function hideB(x) {
        if (x.checked) {
        document.getElementById("B").style.display = "none";
        document.getElementById("A").style.display = "initial";
        document.getElementById('option4').checked = true;
        }
    }

    </script>

    <body>
    <h1>Tilmeldingsformular</h1>




    <div id="A">

    <form method="post" >
    Status:
    <input type="radio" name="c"  id='option1' onchange="hideB(this)"  value="1"  checked="checked" >Ny kunde
    <input type="radio" name="c"  id='option2' onchange="hideA(this)" value="2"> Eksisterende kunde
    <br><br>
    <input type="text" placeholder="Fornavn og Efternavn*" name="name" required  minlength="4"/>
    <br><br>
    <input type="text" placeholder="Firmanavn" name="firma" />
    <br><br>
    <input type="email" placeholder="E-mail*" name="email" required/>
    <br><br>
    <input type="text" placeholder="Telefonnummer" name="tlf" />
    <br><br>
    <input type="text" placeholder="Post nr" name="post" />
    <br><br>
    <input type="text" placeholder="By" name="city" />
    <br><br>
    <input type="text" placeholder="Adresse" name="address" />
    <br><br>
    <input type="text" placeholder="Nummerplade*" name="plate" required  minlength="4"/>
    <br><br>
    <input type="text" placeholder="Mærke" name="mark" />
    <br><br>
    <input type="text" placeholder="Model" name="model" />
    <br><br>
    <input type="text" placeholder="Årgang" name="year" />
    <br><br>

    Abonnement:      <input type="radio" name="s" id="f"  value="1" checked="checked"> ULTIMATE
    <input type="radio" name="s" id="k"  value="2"> PREMIUM
    <input type="radio" name="s" id="p"  value="3"   > BASIC
    <br><br>

    <input type="text" placeholder="IMEI nr.*" name="imei" required/>
    <br><br>

    Enhed model:      <input type="radio" name="m"   value="1" checked="checked"> GT06E
    <!-- <input type="radio" name="m"   value="2"> GV20
    <input type="radio" name="m"   value="3"   > ET25
    <input type="radio" name="m"   value="9"  checked="checked" > Unknown-->
    <br><br>



    <input type=submit value=Opret>
    </form>
    </div>



    <div id="B" style="display:none">
    <form method="post">
    Status:
    <input type="radio" name="c"  id='option3' onchange="hideB(this)"  value="1"   >Ny kunde
    <input type="radio" name="c"  id='option4' onchange="hideA(this)" value="2" checked="checked" > Eksisterende kunde
    <br><br>
    <input type="email" placeholder="E-mail*" name="email" required/>
    <br><br>
    <input type="text" placeholder="Nummerplade*" name="plate" required  minlength="4"/>
    <br><br>
    <input type="text" placeholder="Mærke" name="mark" />
    <br><br>
    <input type="text" placeholder="Model" name="model" />
    <br><br>
    <input type="text" placeholder="Årgang" name="year" />
    <br><br>
    <input type="text" placeholder="IMEI nr.*" name="imei" required/>
    <br><br>

    Enhed model:      <input type="radio" name="m"   value="1" checked="checked"> GT06E
    <!--<input type="radio" name="m"   value="2"> GV20
    <input type="radio" name="m"   value="3"   > ET25
    <input type="radio" name="m"   value="9"   > Unknown-->
        <br><br>
    <input type=submit value=Opret>
    </form>
    </div>


    </body>
    </html>
    """, height=1000)