-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.php
205 lines (180 loc) · 7.9 KB
/
profile.php
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
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
<?php
require_once ('classes/autoload.php');
use classes\myWallet;
use classes\users;
use classes\categories;
session_start();
$users = new users();
$wallet = new myWallet();
$userData = $users->find($_SESSION);
$userConf = $users->loadConfiguration($_SESSION);
?>
<html>
<head>
<?php include ('includes/meta_head.php'); ?>
</head>
<body>
<header class="p-3 mb-3 border-bottom border-custom bg-custom-menu shadow-sm">
<div class="container">
<?php include ('includes/main_menu.php'); ?>
</div>
</header>
<div class="container">
<div class="row mb-4">
<div class="col">
<div class="card rounded border border-custom shadow-sm mb-3">
<div class="card-header">
<h6 class="card-header-title">Perfil</h6>
<svg class="card-header-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-bag"><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path><line x1="3" y1="6" x2="21" y2="6"></line><path d="M16 10a4 4 0 0 1-8 0"></path></svg>
</div>
<div class="p-4">
<form action="" method="post" name="profile">
<div class="mb-3">
<label for="name" class="form-label">Full name</label>
<input type="text" name="name" id="name" class="form-control" value="<?=$userData->name;?>">
</div>
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" name="username" id="username" class="form-control" value="<?=$userData->username;?>">
</div>
<div class="mb-3">
<label for="email" class="form-label">Email</label>
<input type="text" name="email" id="email" class="form-control" value="<?=$userData->email;?>">
</div>
<div class="mb-3">
<label for="password" class="form-label">New password</label>
<input type="text" name="password" id="password" class="form-control">
</div>
<div class="mb-3">
<input type="button" value="Save" class="btn btn-primary" >
</div>
</form>
</div>
</div>
<div class="card rounded border border-custom shadow-sm">
<div class="card-header">
<h6 class="card-header-title">Extrapolación</h6>
<svg class="card-header-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-bag"><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path><line x1="3" y1="6" x2="21" y2="6"></line><path d="M16 10a4 4 0 0 1-8 0"></path></svg>
</div>
<div class="p-4">
<form>
<p>Extrapolación de rendimientos en base a interes compuesto</p>
<div class="mb-3">
<label for="months" class="form-label"><?=$userConf[0]->description; ?></label>
<input type="text" id="months" class="form-control" value="<?=$userConf[0]->value; ?>">
</div>
<div class="mb-3">
<input type="button" id="confirm" value="Save" class="btn btn-primary">
</div>
</form>
</div>
</div>
</div> <!-- Col -->
<div class="col">
<div class="card rounded border border-custom shadow-sm mb-3">
<div class="card-header">
<h6 class="card-header-title">Alertas</h6>
<svg class="card-header-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-bag"><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path><line x1="3" y1="6" x2="21" y2="6"></line><path d="M16 10a4 4 0 0 1-8 0"></path></svg>
</div>
<div class="p-4">
<form action="" method="post" name="configuration">
<div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="sendnotify1">
<label class="form-check-label" for="sendnotify">Notify when balance goes down 3% in last hour</label>
</div>
<div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="sendnotify2" checked="true">
<label class="form-check-label" for="sendnotify">Notify when balance goes up 3% in last hour</label>
</div>
<div class="mb-3">
<input type="button" value="Save" class="btn btn-primary" >
</div>
</form>
</div>
</div>
<div class="card rounded border border-custom shadow-sm">
<div class="card-header">
<h6 class="card-header-title">Instrumentos de inversion</h6>
<svg class="card-header-icon" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-shopping-bag"><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"></path><line x1="3" y1="6" x2="21" y2="6"></line><path d="M16 10a4 4 0 0 1-8 0"></path></svg>
</div>
<div class="p-4">
<form action="" method="post" name="configuration">
<?php
$categories = new categories();
$instruments = $categories->load('Inversion');
foreach ($instruments as $instrument){
echo '<div class="mb-3 form-check">';
if ($instrument->visible == true){
echo ' <input type="checkbox" id='.$instrument->id.' class="form-check-input checkbox" checked>';
} else {
echo ' <input type="checkbox" id='.$instrument->id.' class="form-check-input checkbox">';
}
echo ' <label class="form-check-label" for="sendnotify">'.$instrument->category.'</label>';
echo '</div>';
}
?>
</form>
</div>
</div>
</div> <!-- Col -->
</div> <!-- row -->
</div> <!-- Container -->
<div class="toast-container position-fixed bottom-0 end-0 p-3">
<div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-delay="2000" data-bs-animation="true">
<div class="toast-header">
<img src="images/celular.png" class="rounded me-2" width="20">
<strong class="me-auto">Notificación</strong>
<small class="text-body-secondary">Ahora mismo</small>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body">
<span id="message"></span>
</div>
</div>
</div>
</body>
</html>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ"
crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
$(".checkbox").on('click', function(){
var object = $(this).attr("id");
var status = $(this).prop("checked");
$.ajax({
url: '/background/ajax_endpoint.php',
method: 'post',
data: {
action:'updateCheckboxStatus',
object:object,
status:status
},
success: function(response){
const json = JSON.parse(response);
const notify = document.getElementById('liveToast');
$("#message").text(json.message);
bootstrap.Toast.getOrCreateInstance(notify).show();
}
})
});
$("#confirm").on('click', function(){
const object = 1;
const months = $("#months").val();
$.ajax({
url: '/background/ajax_endpoint.php',
method: 'post',
data: {
action: 'updateConfiguration',
object: object,
status: months
},
success: function(response){
const json = JSON.parse(response)
const notify = document.getElementById('liveToast');
$("#message").text(json.message);
bootstrap.Toast.getOrCreateInstance(notify).show();
}
})
});
</script>