-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.html
456 lines (419 loc) · 23.2 KB
/
settings.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
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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/png" href="/favico.png" />
<title>Home | Dashboard</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="//cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous" />
<!-- <link href="//cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.rtl.min.css" rel="stylesheet" integrity="sha384-nU14brUcp6StFntEOOEBvcJm4huWjB0OcIeQ3fltAfSmuZFrkAif0T+UtNGlKKQv" crossorigin="anonymous"> -->
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css" />
<link rel="stylesheet" href="/assets/css/style.css?v=1.0.0">
<!-- <link rel="stylesheet" href="/assets/css/rtl_style.css?v=1.0.0"> -->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.8.2/angular-sanitize.js"></script>
<style>
.list-group {
height: 240px;
overflow-y: auto;
}
#wrapper .list-group-item.active {
background-color: #f2f2f2;
color: #000;
font-weight: bold;
border-color: #ccc;
}
</style>
</head>
<body id="page-top">
<nav class="navbar navbar-expand-md navbar-dark bg-dark px-2 fixed-top">
<div class="d-flex w-100 align-items-center">
<div class="me-auto">
<a class="h5 bi bi-list link-light p-2 m-0 me-3" role="button" data-bs-toggle="offcanvas"
data-bs-target="#navOffcanvas" aria-controls="navOffcanvas"></a>
<a class="navbar-brand fw-bold" href="/">Dashboard</a>
</div>
<form action="" method="get" role="search">
<input type="search" name="q" class="form-control my-3 my-md-0 rounded-pill" placeholder="Search..."
value="">
</form>
</div>
</nav>
<div class="offcanvas offcanvas-start" tabindex="-1" id="navOffcanvas">
<script>
const navTarget = 'target';
$(function () {
$(`.nav-${navTarget} b`).addClass('text-danger');
});
</script>
<div class="offcanvas-body">
<ul class="list-group list-group-flush">
<li class="list-group-item nav-dashboard">
<a class="link-dark d-block" href="#">
<i class="bi bi-speedometer text-secondary me-2"></i><b>Dashboard</b>
</a>
</li>
<li class="list-group-item nav-customers">
<a class="link-dark d-block" href="#">
<i class="bi bi-people text-secondary me-2"></i><b>Customers</b>
</a>
</li>
<li class="list-group-item nav-articles">
<a class="link-dark d-block" href="">
<i class="bi bi-file-earmark-richtext text-secondary me-2"></i><b>Articles</b>
</a>
</li>
<li class="list-group-item nav-news">
<a class="link-dark d-block" href="">
<i class="bi bi-newspaper text-secondary me-2"></i><b>News</b>
</a>
</li>
<li class="list-group-item nav-pages">
<a class="link-dark d-block" href="">
<i class="bi bi-file-earmark text-secondary me-2"></i><b>Web Pages</b>
</a>
</li>
<li class="list-group-item">
<a class="link-dark d-block" data-bs-toggle="collapse" href="#paymentsCollapse" role="button"
aria-expanded="false" aria-controls="paymentsCollapse">
<i class="bi bi-wallet2 text-secondary me-2"></i><b>Finance</b>
</a>
<div class="collapse" id="paymentsCollapse">
<ul class="list-group list-group-flush">
<li class="list-group-item nav-subsc">
<a class="link-dark d-block" href="#">
<i class="bi bi-cart-check text-secondary me-2"></i><b>Subscriptions</b>
</a>
</li>
<li class="list-group-item nav-trans">
<a class="link-dark d-block" href="#">
<i class="bi bi-credit-card text-secondary me-2"></i><b>Transactions</b>
</a>
</li>
<li class="list-group-item nav-refunds">
<a class="link-dark d-block" href="">
<i class="bi bi-arrow-left-right text-secondary me-2"></i><b>Refund Requests</b>
</a>
</li>
<li class="list-group-item nav-promos">
<a class="link-dark d-block" href="#">
<i class="bi bi-ticket-perforated text-secondary me-2"></i><b>Promocodes</b>
</a>
</li>
</ul>
</div>
<script>
const paymentsCollapse = new bootstrap.Collapse('#paymentsCollapse', {
toggle: false
});
if (['subsc', 'trans', 'refunds', 'promos'].includes(navTarget))
paymentsCollapse.show();
</script>
</li>
<li class="list-group-item nav-users">
<a class="link-dark d-block" href="#">
<i class="bi bi-fingerprint text-secondary me-2"></i><b>Users</b>
</a>
</li>
<li class="list-group-item nav-support">
<a class="link-dark d-block" href="">
<i class="bi bi-question-circle text-secondary me-2"></i><b>Help Disk</b>
</a>
</li>
<li class="list-group-item">
<a class="link-dark d-block" data-bs-toggle="collapse" href="#reportsCollapse" role="button"
aria-expanded="false" aria-controls="reportsCollapse">
<i class="bi bi-receipt-cutoff text-secondary me-2"></i><b>Reports</b>
</a>
<div class="collapse" id="reportsCollapse">
<ul class="list-group list-group-flush">
<li class="list-group-item nav-rep-students">
<a class="link-dark d-block" href="#">
<i class="bi bi-people text-secondary me-2"></i><b>Customers</b>
</a>
</li>
<li class="list-group-item nav-rep-subsc">
<a class="link-dark d-block" href="#">
<i class="bi bi-cart-check text-secondary me-2"></i><b>Subscriptions</b>
</a>
</li>
<li class="list-group-item nav-rep-trans">
<a class="link-dark d-block" href="#">
<i class="bi bi-credit-card text-secondary me-2"></i><b>Transactions</b>
</a>
</li>
</ul>
</div>
<script>
const reportsCollapse = new bootstrap.Collapse('#reportsCollapse', {
toggle: false
});
if (['rep-customers', 'rep-trans', 'rep-subsc'].includes(navTarget))
reportsCollapse.show();
</script>
</li>
<li class="list-group-item nav-settings">
<a class="link-dark d-block" href="#">
<i class="bi bi-gear text-secondary me-2"></i><b>Settings</b>
</a>
</li>
<li class="list-group-item nav-help">
<a class="link-dark d-block" href="#">
<i class="bi bi-info-lg text-secondary me-2"></i><b>Help</b>
</a>
</li>
</ul>
</div>
<div class="d-flex">
<a href="#" class="d-block p-3 flex-grow-1 border-top rounded-0 link-dark">
<i class="bi bi-person-circle text-warning me-2"></i>
<b>User name</b>
</a>
<a href="#" class="d-block p-3 border-top border-start rounded-0">
<i class="bi bi-power text-danger"></i>
</a>
</div>
</div>
<div id="wrapper" data-ng-app="ngApp" data-ng-controller="ngCtrl">
<div class="container-fluid">
<div class="card card-box">
<div class="card-body">
<h5 class="card-title fw-bold text-uppercase">Locations</h5>
<div class="row">
<div id="countriesBox" class="col-12 col-sm-6 col-lg-3">
<div class="list-box border p-3">
<div class="d-flex">
<h6 class="fw-bold me-auto">
<small class="loading-spinner spinner-border spinner-border-sm text-warning"
role="status"></small>
<span>Countries</span>
</h6>
<a href="" class="link-primary bi bi-plus-circle"
data-ng-click="locationModal(1, 0)"></a>
</div>
<ul data-ng-if="countries.length" class="list-group list-group-flush">
<li data-ng-repeat="c in countries"
class="list-group-item list-group-item-action d-flex"
data-ng-class="activeCountry == $index ? 'active' : ''">
<span data-ng-bind="jsonParse(c.location_name).en" class="me-auto"></span>
<a href="" class="link-primary bi bi-eye me-2"
data-ng-click="toggleVisibility($index)"></a>
<a href="" class="link-primary bi bi-chevron-right"
data-ng-click="setActive('activeCountry', $index, 'states', 'countries')"></a>
</li>
</ul>
<div data-ng-if="!countries.length" class="py-5 text-center">
<h1 style="font-size: 90px"><i class="bi bi-info-circle text-secondary"></i></h1>
<h6 class="text-secondary">No records</h6>
</div>
</div>
</div>
<div id="statesBox" class="col-12 col-sm-6 col-lg-3">
<div class="list-box border p-3">
<div class="d-flex">
<h6 class="fw-bold me-auto">
<small class="loading-spinner spinner-border spinner-border-sm text-warning"
role="status"></small>
<span>States</span>
</h6>
<a data-ng-if="activeCountry != undefined" href=""
class="link-primary bi bi-plus-circle"
data-ng-click="locationModal(2, countries[activeCountry].location_id)"></a>
</div>
<ul data-ng-if="states.length" class="list-group list-group-flush">
<li data-ng-repeat="c in states"
class="list-group-item list-group-item-action d-flex"
data-ng-class="activeState == $index ? 'active' : ''">
<span data-ng-bind="jsonParse(c.location_name).en" class="me-auto"></span>
<a href="" class="link-primary bi bi-eye me-2"
data-ng-click="toggleVisibility($index)"></a>
<a href="" class="link-primary bi bi-chevron-right"
data-ng-click="setActive('activeState', $index, 'cities', 'states')"></a>
</li>
</ul>
<div data-ng-if="!states.length" class="py-5 text-center">
<h1 style="font-size: 90px"><i class="bi bi-info-circle text-secondary"></i></h1>
<h6 class="text-secondary">No records</h6>
</div>
</div>
</div>
<div id="citiesBox" class="col-12 col-sm-6 col-lg-3">
<div class="list-box border p-3">
<div class="d-flex">
<h6 class="fw-bold me-auto">
<small class="loading-spinner spinner-border spinner-border-sm text-warning"
role="status"></small>
<span>Cities</span>
</h6>
<a data-ng-if="activeState != undefined" href=""
class="link-primary bi bi-plus-circle"
data-ng-click="locationModal(3, states[activeState].location_id)"></a>
</div>
<ul data-ng-if="cities.length" class="list-group list-group-flush">
<li data-ng-repeat="c in cities"
class="list-group-item list-group-item-action d-flex"
data-ng-class="activeCity == $index ? 'active' : ''">
<span data-ng-bind="jsonParse(c.location_name).en" class="me-auto"></span>
<a href="" class="link-primary bi bi-eye me-2"
data-ng-click="toggleVisibility($index)"></a>
<a href="" class="link-primary bi bi-chevron-right"
data-ng-click="setActive('activeCity', $index, 'areas', 'cities')"></a>
</li>
</ul>
<div data-ng-if="!cities.length" class="py-5 text-center">
<h1 style="font-size: 90px"><i class="bi bi-info-circle text-secondary"></i></h1>
<h6 class="text-secondary">No records</h6>
</div>
</div>
</div>
<div id="areasBox" class="col-12 col-sm-6 col-lg-3">
<div class="list-box border p-3">
<div class="d-flex">
<h6 class="fw-bold me-auto">
<small class="loading-spinner spinner-border spinner-border-sm text-warning"
role="status"></small>
<span>Area</span>
</h6>
<a data-ng-if="activeCity != undefined" href=""
class="link-primary bi bi-plus-circle"
data-ng-click="locationModal(4, cities[activeCity].location_id)"></a>
</div>
<ul data-ng-if="areas.length" class="list-group list-group-flush">
<li data-ng-repeat="c in areas"
class="list-group-item list-group-item-action d-flex">
<span data-ng-bind="jsonParse(c.location_name).en" class="me-auto"></span>
<a href="" class="link-primary bi bi-eye me-2"
data-ng-click="toggleVisibility($index)"></a>
</li>
</ul>
<div data-ng-if="!areas.length" class="py-5 text-center">
<h1 style="font-size: 90px"><i class="bi bi-info-circle text-secondary"></i></h1>
<h6 class="text-secondary">No records</h6>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="locationModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-body">
<form action="https://sallahnow.yottaline.com/api/settings/locations_submit" method="post">
<input type="hidden" name="location_type" data-ng-value="modalObject.type">
<input type="hidden" name="location_parent" data-ng-value="modalObject.parent">
<div class="mb-3">
<label for="locationNameEn">Name EN<b class="text-danger">*</b></label>
<input type="text" name="location_name_en" id="locationNameEn" class="form-control"
required>
</div>
<div class="mb-3">
<label for="locationNameAr">Name AR<b class="text-danger">*</b></label>
<input type="text" name="location_name_ar" id="locationNameAr" class="form-control"
required>
</div>
<div class="d-flex">
<button type="button" class="btn btn-outline-secondary btn-sm me-auto"
data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-outline-primary btn-sm">Submit</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<footer class="py-2 bg-dark text-center text-secondary fixed-bottom dir-ltr small font-monospace">
<small>ver 1.4.61 by
<a href="http://yottaline.com" class="link-secondary">yottaline</a></small>
<a href="#page-top" class="link-light bg-dark border-0"><i class="bi bi-arrow-up-short"></i></a>
</footer>
<script>
var scope, ngApp = angular.module("ngApp", ['ngSanitize']);
ngApp.controller("ngCtrl", function ($scope) {
$scope.countries = [];
$scope.states = [];
$scope.cities = [];
$scope.areas = [];
$scope.activeCountry;
$scope.activeState;
$scope.activeCity;
$scope.modalObject = {
type: 0,
parent: 0,
};
$scope.jsonParse = str => JSON.parse(str);
$scope.locationModal = function (type, parent) {
$scope.modalObject = {
type: +type,
parent: +parent,
};
$('#locationModal').modal('show');
};
$scope.setActive = function (obj, indx, target, list) {
$scope[obj] = indx;
switch (obj) {
case 'activeCountry':
$scope.states = [];
$scope.activeState = undefined;
case 'activeState':
$scope.cities = [];
$scope.activeCity = undefined;
case 'activeCity':
$scope.areas = [];
}
$scope.loadData($scope[list][indx], target);
};
$scope.loadData = function (parent, target) {
$(`#${target}Box .loading-spinner`).show();
$.post('https://sallahnow.yottaline.com/api/settings/locations_load', {
type: parent ? (+parent.location_type + 1) : 1,
parent: parent ? parent.location_id : 0,
}, function (data) {
$(`#${target}Box .loading-spinner`).hide();
$scope.$apply(() => $scope[target] = data)
}, 'json');
};
$scope.loadData(0, 'countries');
scope = $scope;
});
$(function () {
$('.loading-spinner').hide();
$('#locationModal form').on('submit', function (e) {
e.preventDefault();
var form = $(this),
formData = new FormData(this),
action = form.attr('action'),
method = form.attr('method'),
controls = form.find('button, input'),
spinner = $('#locationModal .loading-spinner');
spinner.show();
controls.prop('disabled', true);
$.ajax({
url: action,
type: method,
data: formData,
processData: false,
contentType: false,
}).done(function (data, textStatus, jqXHR) {
// add to list
}).fail(function (jqXHR, textStatus, errorThrown) {
// error msg
}).always(function () {
spinner.hide();
controls.prop('disabled', false);
});
})
{
}
});
</script>
</body>
</html>