This repository was archived by the owner on Dec 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
118 lines (96 loc) · 4.58 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Decay Calculator</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> -->
<script src="https://momentjs.com/downloads/moment.js"></script>
</head>
<body>
<div id="app" class="container">
<h1 class="mt-5 mb-5">Gradido Vergänglichkeitsrechner</h1>
<label for="gdd-input">Betrag GDD</label>
<input type="text" id="input_amount" class="form-control"></input>
<div class="form-group">
<label >Von</label>
<input type="date" id="input_from" name="bday" class="form-control">
</div>
<div class="form-group">
<label >Bis</label>
<input type="date" id="input_to" name="bday" class="form-control" >
</div>
<div v-if="decays2 > 0">
<p id="date_from"></p>
<p id="date_to"></p>
<p id="date_days"></p>
<p id="date_seconds"></p>
<p>
<b id="date_decay" > </b>
</p>
<p id="percent_decay"></p>
<p id="percent_remain"></p>
<p>
<b id="summe"></b>
</p>
</div>
<div id="alert_box" class="alert alert-info" role="alert">
<span id="texttext"></span>
<span id="seconds"></span>
</div>
<div id="alert_box_text" class="alert alert-light" role="alert">
</div>
<div class="row text-center mt-5">
<div class="col"><button type="button" id="cancel" class="btn btn-primary btn-lg">Formular zurücksetzen</button></div>
</div>
</div>
</body>
<script>
$(document).ready(function() {
$('#alert_box').hide();
$('#input_to').change(function(){
var i_amount = $('#input_amount').val();
var i_from = $('#input_from').val();
var i_to = $('#input_to').val();
$('#date_from').text('Von: ' + moment(i_from).format('DD.MM.YYYY'));
$('#date_to').text('Bis: ' + moment(i_to).format('DD.MM.YYYY'));
var startfrom = moment(i_from);
var endto = moment(i_to);
var days = endto.diff(startfrom, 'days');
var seconds = endto.diff(startfrom, 'seconds');
$('#date_days').text('Tage: ' + days);
$('#date_seconds').text('Sekunden: ' + seconds);
var decay = i_amount - i_amount * Math.pow(0.99999997802044727, seconds)
$('#date_decay').text('Vergänglichkeit: ' + decay.toFixed(2) + ' GDD');
$('#alert_box').show();
$('#texttext').text(' '+ i_amount +' - '+ i_amount +' * 0.99999997802044727 ');
$('#seconds').html('<sup>' + seconds + '</sup>');
$('#percent_decay').text("Der vergangene Anteil: " + (decay/i_amount*100).toFixed(2) + " %");
$('#percent_remain').text("Der verbleibende Anteil: " + ((i_amount-decay)/i_amount*100).toFixed(2) + "%");
$('#summe').text("Summe: " + (i_amount - decay).toFixed(2) + 'GDD ');
var summeText = 'Bei einem Betrag von '+ i_amount +' GDD und einer Zeitspanne von ' + days + ' Tagen (' + seconds + ' Sekunden), hat man eine Vergänglichkeit von '+ decay.toFixed(2)+' GDD ('+decay+'). Es bleiben also von den '+ i_amount +' GDD '+((i_amount-decay)/i_amount*100).toFixed(2) + "%"+' übrig. <br> <b>Das sind in Summe ' +(i_amount - decay).toFixed(2)+' GDD</b>';
$('#alert_box_text').html(summeText);
});
$('#cancel').click(function(){
$('#input_amount').val('');
$('#input_from').val('');
$('#input_to').val('');
$('#date_from').text('');
$('#date_to').text('');
$('#date_days').text('');
$('#date_seconds').text('');
$('#date_decay').text('');
$('#alert_box').hide();
$('#percent_decay').text('');
$('#percent_remain').text('');
$('#summe').text('');
$('#alert_box_text').html('');
});
});
</script>
</html>