-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.php
286 lines (282 loc) · 10 KB
/
popup.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
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
<?php
if (empty(session_id()) && !headers_sent()) {
session_start();
}
if (isset($_GET['status'])) {
// Get the status
$status = $_GET['status'];
// Popup variables
$popupText = '';
$popupColour = '';
// Customer not found
switch ($status) {
case '1':
$popupText = "Customer could not be found. Please try again!";
$popupColour = "danger";
break;
case '2':
// Get the field name
if (isset($_GET['status_details'])) {
$fieldTooLongName = $_GET['status_details'];
$popupText = "$fieldTooLongName field is too long (max 255 characters). Please try again!";
} else {
$popupText = "An unexpected error occured and one of your fields were too long. Please try again!";
}
$popupColour = "danger";
break;
case '3':
$popupText = "Invalid Email for customer. Please try again!";
$popupColour = "danger";
break;
case '4':
$popupText = "Frequency cannot be higher than 4. Please try again!";
$popupColour = "danger";
break;
case '5':
$popupText = "Monthly fee cannot be zero or less. Please try again!";
$popupColour = "danger";
break;
case '6':
$popupText = "There was an error while updating the customer's details. Please try again! (6)";
$popupColour = "danger";
break;
case '7':
$popupText = "Successfully updated customer details!";
$popupColour = "success";
break;
case '8':
$popupText = "There was an error while updating the customer's details. Please try again! (8)";
$popupColour = "danger";
break;
case '9':
$popupText = "There was an error while updating the customer's sanitizing details. Please try again! (9)";
$popupColour = "danger";
break;
case '10':
$popupText = "Successfully updated customer sanitizing details!";
$popupColour = "success";
break;
case '11':
$popupText = "There was an error while updating the customer's sanitizing details. Please try again! (11)";
$popupColour = "danger";
break;
case '12':
$popupText = "There was an error while adding the customer's contact. Please try again! (12)";
$popupColour = "danger";
break;
case '13':
$popupText = "Successfully added customer contact!";
$popupColour = "success";
break;
case '14':
$popupText = "There was an error while updating the customer's contact. Please try again! (14)";
$popupColour = "danger";
break;
case '15':
$popupText = "Successfully updated customer contact!";
$popupColour = "success";
break;
case '16':
$popupText = "An unexpected error occured while adding/updating the customer's contact. Please try again! (16)";
$popupColour = "danger";
break;
case '17':
$popupText = "There was an error while adding the customer's comment. Please try again! (17)";
$popupColour = "danger";
break;
case '18':
$popupText = "Successfully added customer comment!";
$popupColour = "success";
break;
case '19':
$popupText = "There was an error while updating the customer's comment. Please try again! (19)";
$popupColour = "danger";
break;
case '20':
$popupText = "Successfully updated customer comment!";
$popupColour = "success";
break;
case '21':
$popupText = "An unexpected error occured while adding/updating the customer's comment. Please try again! (21)";
$popupColour = "danger";
break;
case '22':
$popupText = "There was an error while adding the customer's dustbin. Please try again! (22)";
$popupColour = "danger";
break;
case '23':
$popupText = "Successfully added customer dustbin!";
$popupColour = "success";
break;
case '24':
$popupText = "There was an error while updating the customer's bin. Please try again! (24)";
$popupColour = "danger";
break;
case '25':
$popupText = "Successfully updated customer bin!";
$popupColour = "success";
break;
case '26':
$popupText = "An unexpected error occured while adding/updating the customer's bin. Please try again! (26)";
$popupColour = "danger";
break;
case '27':
$popupText = "An unexpected error occured while removing the customer's contact. Please try again! (27)";
$popupColour = "danger";
break;
case '28':
$popupText = "Successfully removed customer contact!";
$popupColour = "success";
break;
case '29':
$popupText = "There was an error while removing the customer's contact. Please try again! (29)";
$popupColour = "danger";
break;
case '30':
$popupText = "An unexpected error occured while removing the customer's comment. Please try again! (30)";
$popupColour = "danger";
break;
case '31':
$popupText = "Successfully removed customer comment!";
$popupColour = "success";
break;
case '32':
$popupText = "There was an error while removing the customer's comment. Please try again! (32)";
$popupColour = "danger";
break;
case '33':
$popupText = "An unexpected error occured while removing the customer's bin. Please try again! (33)";
$popupColour = "danger";
break;
case '34':
$popupText = "Successfully removed customer bin!";
$popupColour = "success";
break;
case '35':
$popupText = "There was an error while removing the customer's bin. Please try again! (35)";
$popupColour = "danger";
break;
case '36':
$popupText = "Something went wrong while adding the customer. Please try again! (36)";
$popupColour = "danger";
break;
case '37':
$popupText = "Successfully added customer!";
$popupColour = "success";
break;
case '38':
$popupText = "There was an error while adding the customer. Please try again! (38)";
$popupColour = "danger";
break;
case '39':
$popupText = "Something went wrong while deactivating the customer. Please try again! (39)";
$popupColour = "danger";
break;
case '40':
$popupText = "Customer has been successfully deactivated!";
$popupColour = "success";
break;
case '41':
$popupText = "There was an error while deactivating the customer. Please try again! (41)";
$popupColour = "danger";
break;
case '42':
$popupText = "Something went wrong while reactivating the customer. Please try again! (42)";
$popupColour = "danger";
break;
case '43':
$popupText = "Customer has been successfully reactivated!";
$popupColour = "success";
break;
case '44':
$popupText = "There was an error while reactivating the customer. Please try again! (44)";
$popupColour = "danger";
break;
case '45':
$popupText = "Customer's prefered banking details have been successfully updated!";
$popupColour = "success";
break;
case '46':
$popupText = "There was an error while updating the customer's preferred banking details. Please try again (46)";
$popupColour = "danger";
break;
case '47':
$popupText = "An unexpected error occured while updating the customer's preffered banking details. Please try again! (47)";
$popupColour = "danger";
break;
case '48':
$popupText = "Successfully Added Payment!";
$popupColour = "success";
break;
case '49':
$popupText = "There was an error while updating the customer's balance. The payment has been rolled back. (49)";
$popupColour = "danger";
break;
case '50':
$popupText = "There was an error while adding the customer's payment. The payment has been rolled back. (50)";
$popupColour = "danger";
break;
case '51':
$popupText = "Please provide a payment amount";
$popupColour = "danger";
break;
case '52':
$popupText = "Successfully reversed the customer's payment!";
$popupColour = "success";
break;
case '53':
$popupText = "There was an error while trying to reverse the customer's payment. Please try again! (53)";
$popupColour = "danger";
break;
case '54':
$popupText = "There was an error while trying to reverse the customer's payment. Please try again! (54)";
$popupColour = "danger";
break;
case '55':
$popupText = "There was a error while valdating the reCAPTCHA. Please try again!";
$popupColour = "danger";
break;
case '56':
$popupText = "Token is invalid. Please try again!";
$popupColour = "danger";
break;
case '57':
$popupText = "reCaptcha is invalid. Please try again!";
$popupColour = "danger";
break;
case '58':
$popupText = "Successfully updated bank account!";
$popupColour = "success";
break;
case '59':
$popupText = "Successfully created bank account!";
$popupColour = "success";
break;
case '60':
$popupText = "Successfully deleted bank account!";
$popupColour = "success";
break;
}
?>
<div class="d-flex justify-content-center" style="z-index: 999;">
<div class="toast align-items-center bg-white" role="alert" aria-live="assertive" aria-atomic="true" id="status-toast"
style="position: fixed; top: 1rem; left: 50%; transform: translateX(-50%);">
<div class="d-flex">
<div class="toast-body d-flex align-items-center text-<?php echo $popupColour; ?>" style="gap: 0.7rem">
<i class="bi bi-info-circle-fill fs-5"></i>
<?php echo $popupText ?>
</div>
<button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
// Get the toast element by ID
const toastElement = document.getElementById("status-toast");
// Show the toast using Bootstrap's toast() method
const toast = new bootstrap.Toast(toastElement);
toast.show();
});
</script>
<?php } ?>