-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
108 lines (102 loc) · 3.96 KB
/
index.html
File metadata and controls
108 lines (102 loc) · 3.96 KB
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
<html>
<head>
<title>Договор</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<base href="https://sbca68.github.io/test/index.html">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;700&display=block" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="styles.css?v=3">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://sbca68.github.io/test/lanta.js"></script>
<script>
showBonusesPage = function(item) {
document.body.innerHTML = `
<div class="container">
<div class="title">Бонусы</div>
<div class="item main_container">
<div class="main_row_1">
<span class="level_part1 header1">Уровень:</span>
<span class="level_part2">` + (item.bonusLevel < 10 ? item.bonusLevel : 10) + `/10</span>
</div>
<div class="main_row_2">
<div class="header1">Ваш бонусный баланс</div>
<div class="row_2_content">
<span class="row_2_content_amount">` + item.bonus + `</span>
<span class="row_2_content_units">баллов</span>
</div>
</div>
<div class="main_row_3">
<div class="row_3_text">Обменяйте рубли на бонусы</div>
<img class="row_3_image" src="src/exchange_bonuses.png">
</div>
<a class="main_row_4" href="exchange_dialog.html" target="_blank">Обменять</a>
</div>
<a class="item item_container" href="bonus_table.html" target="_blank">
<span class="item_text">Таблица зависимости процентов от уровней</span>
<img src="src/right_arrow.png" class="arrow">
</a>
<a class="item item_container" href="bonus_agreement.html" target="_blank">
<span class="item_text">Условия бонусной программы</span>
<img src="src/right_arrow.png" class="arrow">
</a>
</div>
`
}
showSelectContractPage = function(items) {
document.body.innerHTML = `<div class="container"><div class="title">Выберите договор</div>` +
items.map( (item) => `<a class="item item_container" href="?client_id=` + item.clientId + `">
<span class="item_text">` + item.contractName + `<br>` + item.address + `</span>
<img src="src/right_arrow.png" class="arrow">
</a>`).join('\n') +
`</div>`;
}
window.onerror = function(error) {
alert(error); // Fire when errors occur. Just a test, not always do this.
};
window.onload = function() {
postLoadingStarted()
$.ajax({
url: 'https://dm.lanta.me/api/user/getPaymentsList',
headers: {
'Authorization':'Bearer ' + bearerToken(),
'Content-Type':'application/json'
},
method: 'POST',
dataType: 'json',
data: '',
success: function(data){
const response = data.data.flatMap(
function(item) {
return item.accounts.map(
function(account) {
let newitem = account;
newitem.address = item.address;
newitem.flatId = item.flatId;
newitem.houseId = item.houseId;
return newitem;
}
);
}
);
let url = new URL(document.location.href);
let clientId = url.searchParams.get('client_id');
if (clientId) {
showBonusesPage(response.find( item => item.clientId == clientId));
return;
}
if (response.length == 1) {
let item = response[0];
showBonusesPage(item);
} else {
showSelectContractPage(response);
}
postloadingFinished()
}
});
}
</script>
</head>
<body>
</body>
</html>