-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpy.php
236 lines (204 loc) · 9.31 KB
/
py.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
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
<?php $get_std = false;
include("./includes/nav.php");
include("./db.con.php"); ?>
<?php
if (!isset($_SESSION['username'])) {
$_SESSION['msg'] = "You must log in first to view this page";
header('location: login.php');
}
?>
<div class="side-bar ui bg-dark white">
<?php include("./includes/sideBar.php"); ?>
<?php include("./header.php"); ?>
</div>
<div class="ui main">
<div class="container-fluid">
<div class="ui row">
<div class="col-md-3">
<div class="card card-body">
<form action="" autocomplete="off" method="post">
<input type="search" name="search" id="searchText" placeholder="Recherche..."
class="form-control">
</form>
</div>
<div id="results" class="card mt-2 card-body">
<p>Chargment... <img src="./images/loader.gif" width="32px" height="32px" alt="loading..."></p>
</div>
</div>
<div class="col-md-9">
<?php if(isset($_GET['get'])):?>
<input type="hidden" id="id" name="id_student" value="<?= $_GET['get']?>" class="form-control">
<div class="row">
<div class="col-md-4">
<div class="card">
<div class="card-header p-2">
<h4>Ajouter payement</h4>
</div>
<div class="card-body">
<div id="error"></div>
<div id="editPy">
<form action="" id="FormData" method="post">
<div class="form-group">
<input type="hidden" name="unique_id" id="unique_id"
value="<?= $_GET['get'];?>" class="form-control">
<label for="mount">Montant</label>
<input type="number" name="mount" id="mount" placeholder="Montant"
class="form-control">
</div>
<div class="form-group">
<label for="bank">Banque</label>
<select name="bank" id="bank" class="form-control">
<option value="">-- seectionner --</option>
<option value="Bank of Kigali">Bank of Kigali</option>
<option value="Unguka Bank">Unguka Bank</option>
<option value="Irembo">Irembos</option>
</select>
</div>
<div class="form-group">
<button type="button" id="pyBtn" class="btn btn-sm btn-success"></button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="col-md-8">
<div id="dataStudent">
<p>Chargement...</p>
</div>
</div>
</div>
<?php else:?>
<div class="card card-body">
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Saepe nobis et harum. Voluptatem non
accusamus libero quos voluptas est dolorem nam, officia veritatis rem esse dolore explicabo
voluptatum debitis corrupti vitae ex animi amet, aliquid itaque commodi obcaecati sed temporibus
reiciendis? Eligendi dolores officiis repellat, veritatis veniam corrupti ullam, officia
praesentium ratione et aliquid sit nobis accusamus atque velit adipisci magni est, architecto
vitae. Repudiandae, nostrum id tempore a repellat, eligendi dolorum, odio eveniet voluptatibus
aperiam fuga totam explicabo labore nemo quibusdam mollitia commodi. Assumenda eius, sunt ut
atque, enim a fugit cum itaque aliquam eos delectus dignissimos facilis laborum laboriosam unde,
aliquid dolore hic. Doloremque ea a quae vel quasi illum iure minima repellat unde harum nam
quas, labore voluptate? Aut a repellendus aliquid maiores atque aspernatur alias autem maxime
magni earum officiis corrupti repudiandae vitae consequuntur error praesentium amet numquam,
neque voluptatum odio cupiditate! Provident dolore, porro ipsum quas aliquid quam necessitatibus
id, atque perferendis obcaecati officiis repellendus hic. Sunt, provident voluptates sed vel
distinctio nostrum possimus consequatur nam commodi tempora minus. Asperiores accusamus quam
necessitatibus explicabo, soluta quibusdam at quod nulla aperiam reprehenderit, molestias
tempora quos beatae voluptate velit architecto, atque maiores est facilis accusantium. Ducimus,
numquam?
</p>
</div>
<?php endif;?>
</div>
</div>
</div>
</div>
</div>
<script>
const results = document.getElementById('results')
window.onload = () => {
FetchAll()
Datastudent()
const pyBtn = document.getElementById('pyBtn'),
form = document.getElementById('FormData'),
error = document.getElementById('error')
pyBtn.textContent = 'Enregistre'
pyBtn.onclick = () => {
const mount = document.getElementById('mount').value
const id = document.getElementById('unique_id').value
let bank = document.getElementById('bank').value
let mountTrim = mount.trim()
if (!mountTrim || !id || !bank) {
console.log('Remplissez tout champs svp :) &&&&&&&&&&&&&&&&&&&')
error.innerHTML = '<p class="alert alert-danger">Remplissez tout champs svp :)</p>'
} else {
error.innerHTML = '<p>Chargement...</p>'
let xhr = new XMLHttpRequest()
xhr.onload = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
let data = xhr.response
console.log(data)
if (data !== 'error') {
location.href = `py.php?get=${id}`
} else {
error.innerHTML = '<p class="Verifier si tout vos donnees* sont la*"></p>'
}
}
}
}
xhr.open("POST", "./configuration/enregistrement.php", true)
// xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
let formData = new FormData(form)
xhr.send(formData)
}
}
}
const dataStudent = document.getElementById('dataStudent')
function Datastudent() {
let id = document.getElementById('id'),
Id = id.value
let xhr = new XMLHttpRequest()
xhr.onload = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
let data = xhr.response
dataStudent.innerHTML = data
}
}
}
xhr.open("POST", "./configuration/action3.php", true)
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
xhr.send("Action=dataStudent&Id=" + Id)
}
const search = document.querySelector('#searchText')
search.onkeyup = () => {
let txt = search.value,
text = txt.trim()
if (text != '') {
results.innerHTML = ''
// console.log('Ed ' + text)
let xhr = new XMLHttpRequest()
xhr.onload = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
let data = xhr.response
results.innerHTML = data
}
}
}
xhr.open("POST", "./configuration/action3.php", true)
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
xhr.send(`searchpy=${text}`)
} else {
FetchAll()
}
}
function FetchAll() {
let xhr = new XMLHttpRequest()
xhr.onload = () => {
if (xhr.readyState === XMLHttpRequest.DONE) {
if (xhr.status === 200) {
let data = xhr.response
results.innerHTML = data
}
}
}
xhr.open("POST", "./configuration/payement.php", true)
xhr.send()
}
</script>
<?php include('./footer.php'); ?>
<script>
$(document).ready(function() {
$(document).on("click", ".reduire", function() {
$('#studentCard').hide(500)
})
$('document').on("click", ".edit", function() {
let id = $(".edit").attr('id')
alert(id)
})
})
</script>