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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>ARAZIM</title>
  <link rel="shortcut icon" type="image/png" href="../static/images/logos/Logo.png" />
  <link rel="stylesheet" href="../static/styles/styles.min.css" />
  <link rel="stylesheet" href="../static/styles/icons/tabler-icons/tabler-icons.css"/>
  <link
      rel="stylesheet"
      href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css"
    />
</head>
<style>
   #calendar {
      width: 300px;
    }
    #calendar_weekdays div {
      display: inline-block;
      vertical-align: top;
    }
    #calendar_content,
    #calendar_weekdays,
    #calendar_header {
      position: relative;
      width: 300px;
      overflow: hidden;
      float: left;
      z-index: 10;
    }
    #calendar_weekdays div,
    #calendar_content div {
      width: 40px;
      height: 40px;
      overflow: hidden;
      text-align: center;
      background-color: #ffffff;
      color: #545454;
      font-weight: 700;
    }
    #calendar_content {
      -webkit-border-radius: 0px 0px 12px 12px;
      -moz-border-radius: 0px 0px 12px 12px;
      border-radius: 0px 0px 12px 12px;
    }
    #calendar_content div {
      float: left;
    }
    #calendar_content div:hover {
      background-color: #f8f8f8;
    }
    #calendar_content div.blank {
      background-color: #e8e8e8;
    }
    #calendar_header,
    #calendar_content div.today {
      zoom: 1;
      filter: alpha(opacity=70);
      opacity: 0.7;
    }
    #calendar_content div.today {
      color: #ffffff;
    }
    #calendar_header {
      width: 100%;
      height: 37px;
      text-align: center;
      background-color: #7bcfff;
      padding: 18px 0;
      -webkit-border-radius: 12px 12px 0px 0px;
      -moz-border-radius: 12px 12px 0px 0px;
      border-radius: 12px 12px 0px 0px;
    }
    #calendar_header h1 {
      font-size: 1.5em;
      color: #ffffff;
      float: left;
      width: 70%;
    }
    i[class^="icon-chevron"] {
      color: #ffffff;
      float: left;
      width: 15%;
      margin-top: -20px;
      border-radius: 50%;
    }
</style>
<body>
  <!--  Body Wrapper -->
  <div class="page-wrapper" id="main-wrapper" data-layout="vertical" data-navbarbg="skin6" data-sidebartype="full"
    data-sidebar-position="fixed" data-header-position="fixed">
    <!-- Sidebar Start -->
    <aside class="left-sidebar" style="border-right: 1px solid rgb(199, 199, 199)">
      <!-- Sidebar scroll-->
      <div>
        <div class="brand-logo d-flex align-items-center justify-content-between">
          <a href="{{ url_for('admin') }}" class="text-nowrap logo-img">
            <img src="../static/images/logos/Logo.png" width="180" alt="" />
          </a>
          <div class="close-btn d-xl-none d-block sidebartoggler cursor-pointer" id="sidebarCollapse">
            <i class="ti ti-x fs-8"></i>
          </div>
        </div>
        <!-- Sidebar navigation-->
        <nav class="sidebar-nav scroll-sidebar" data-simplebar="">
          <ul id="sidebarnav">
            <li class="nav-small-cap">
              <i class="ti ti-dots nav-small-cap-icon fs-4"></i>
              <span class="hide-menu">Useful Links</span>
            </li>
            <li class="sidebar-item">
              <a class="sidebar-link" href="{{ url_for('admin') }}" aria-expanded="false">
                <span>
                  <i class="ti ti-layout-dashboard"></i>
                </span>
                <span class="hide-menu">Dashboard</span>
              </a>
            </li>

            <li class="sidebar-item">
              <a class="sidebar-link" href="#" aria-expanded="false">
                <span>
                  <i class="ti ti-article"></i>
                </span>
                <span class="hide-menu">User Searching</span>
              </a>
            </li>

          </ul>
        </nav>
        <!-- End Sidebar navigation -->
      </div>
      <!-- End Sidebar scroll-->
    </aside>
    <!--  Sidebar End -->
    <!--  Main wrapper -->
    <div class="body-wrapper">
      <!--  Header Start -->
      <header class="app-header" style="border-bottom: 1px solid rgb(199, 199, 199); z-index: 999">
        <nav class="navbar navbar-expand-lg navbar-light">
          <ul class="navbar-nav">
            <li class="nav-item d-block d-xl-none">
              <a class="nav-link sidebartoggler nav-icon-hover" id="headerCollapse" href="javascript:void(0)">
                <i class="ti ti-menu-2"></i>
              </a>
            </li>
            <li class="nav-item">
              <a class="nav-link nav-icon-hover" href="javascript:void(0)">
                <i class="ti ti-bell-ringing"></i>
                <div class="notification bg-primary rounded-circle"></div>
              </a>
            </li>
          </ul>
          <div class="navbar-collapse justify-content-end px-0" id="navbarNav">
            <ul class="navbar-nav flex-row ms-auto align-items-center justify-content-end">
              <a href="#" target="_blank" class="btn btn-primary">Welcome, {{ user_name }}!</a>
              <li class="nav-item dropdown">
                <a class="nav-link nav-icon-hover" href="javascript:void(0)" id="drop2" data-bs-toggle="dropdown"
                  aria-expanded="false">
                  <img src="../static/images/profile/user-1.jpg" alt="" width="35" height="35" class="rounded-circle">
                </a>
                <div class="dropdown-menu dropdown-menu-end dropdown-menu-animate-up" aria-labelledby="drop2">
                  <div class="message-body">
                    <a href="javascript:void(0)" class="d-flex align-items-center gap-2 dropdown-item">
                      <i class="ti ti-user fs-6"></i>
                      <p class="mb-0 fs-3">My Profile</p>
                    </a>
                    <a href="javascript:void(0)" class="d-flex align-items-center gap-2 dropdown-item">
                      <i class="ti ti-mail fs-6"></i>
                      <p class="mb-0 fs-3">My Account</p>
                    </a>
                    <a href="javascript:void(0)" class="d-flex align-items-center gap-2 dropdown-item">
                      <i class="ti ti-list-check fs-6"></i>
                      <p class="mb-0 fs-3">My Task</p>
                    </a>
                    <!-- <a href="../templates/authentication-login.html" class="btn btn-outline-primary mx-3 mt-2 d-block">Logout</a> -->
                    <a href="{{ url_for('logout') }}" id="logout-btn" class="btn btn-outline-primary mx-3 mt-2 d-block">Logout</a>
                  </div>
                </div>
              </li>
            </ul>
          </div>
        </nav>
      </header>
      <!--  Header End -->
      <div class="container-fluid">
        <!--  Row 1 -->
        <div class="row">
          <div class="col-lg-8 d-flex align-items-strech">
            <div class="card w-100">
              <div class="card-body">
                <div
                  class="d-sm-flex d-block align-items-center justify-content-between mb-9"
                >
                  <div class="mb-3 mb-sm-0">
                    <h5 class="card-title fw-semibold">Posts Overview</h5>
                  </div>
                </div>
                <div id="chart1"></div>
              </div>
            </div>
          </div>
          <div class="col-lg-4">
            <div class="row">
              <div class="col-lg-12">
                <!-- Yearly Breakup -->
                <div class="card overflow-hidden">
                  <div class="card-body p-4">
                    <h5 class="card-title mb-9 fw-semibold">
                      Post Information
                    </h5>
                    <div class="row align-items-center">
                      <div class="col-8">
                        <h4 class="fw-semibold mb-3">Donut Graph</h4>
                        <div class="d-flex align-items-center mb-3">
                          <!-- <p class="text-dark me-1 fs-3 mb-0">+9%</p> -->
                          <p class="fs-3 mb-0">
                            Overall seller and buyer posts distribution in
                            donut graph
                          </p>
                        </div>
                        <div class="d-flex align-items-center">
                          <div class="me-4">
                            <span
                              class="round-8 bg-primary rounded-circle me-2 d-inline-block"
                            ></span>
                            <span class="fs-2">Seller</span>
                          </div>
                          <div>
                            <span
                              class="round-8 bg-secondary rounded-circle me-2 d-inline-block"
                            ></span>
                            <span class="fs-2">Buyer</span>
                          </div>
                        </div>
                      </div>
                      <div class="col-4">
                        <div class="d-flex justify-content-center">
                          <div id="breakup1"></div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-lg-12">
                <!-- Monthly Earnings -->
                <div class="card">
                  <div class="card-body">
                    <div class="row alig n-items-start">
                      <div class="col-8">
                        <h5 class="card-title mb-9 fw-semibold">Line Graph Overview</h5>
                      </div>
                    </div>
                  </div>
                  <div id="earning"></div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col-lg-12 d-flex align-items-stretch">
            <div class="card w-100">
              <div class="card-body p-4">
                <h1><b>Admin Panel</b></h1>
                <br><br>
                <a href="{{ url_for('AdminResults') }}" target="_blank" class="btn btn-primary">Results</a>
                <br><br>
                <form action="{{ url_for('AdminResults') }}" method="POST">
                  <div class="table-responsive">
                    <table class="table mb-0 align-middle">
                      <thead class="text-dark fs-4">
                        <tr>
                          <th class="border-bottom-0">
                            <h5 class="fw-semibold mb-0">Post</h4>
                          </th>
                          <th class="border-bottom-0">
                            <h5 class="fw-semibold mb-0">Label</h4>
                          </th>
                          <th class="border-bottom-0">
                            <h5 class="fw-semibold mb-0">
                              <label>
                                Select All&nbsp&nbsp
                                <input type="checkbox" class="select-all-checkbox">
                              </label>
                            </h4>
                          </th>
                        </tr>
                      </thead>
                      <tbody>
                        {% for post, label in results %}
                        <tr>
                          <td class="border-bottom-0" style="width: 900px">
                            <p class="mb-0 fw-normal">{{ post }}</p>                      
                          </td>
                          <td class="border-bottom-0" style="width: 100px">
                            <p class="mb-0 fw-normal">{{ label }}</p>                      
                          </td>
                          <td class="border-bottom-0">
                            <input type="checkbox" class="select-checkbox" name="selected-rows" value="{{ loop.index }}">
                          </td>
                        </tr> 
                        {% endfor %}
                      </tbody>
                    </table>
                    <br>
                    <br>
                    <button type="submit" class="btn btn-success">Save</button>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <script src="{{url_for('static', filename='jquery.min.js')}}"></script>
  <script src="{{url_for('static', filename='bootstrap.bundle.min.js')}}"></script>
  <script src="{{url_for('static', filename='sidebarmenu.js')}}"></script>
  <script src="{{url_for('static', filename='app.min.js')}}"></script>
  <script src="{{url_for('static', filename='simplebar.js')}}"></script>
  <script src="{{url_for('static', filename='sidebarmenu.js')}}"></script>
  <script src="{{url_for('static', filename='apexcharts.min.js')}}"></script>
  <script src="{{url_for('static', filename='dashboard.js')}}"></script>

    <!-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> -->
    <script>
      $(document).ready(function() {
        $('.select-all-checkbox').change(function() {
          $('.select-checkbox').prop('checked', $(this).prop('checked'));
        });
      });
    </script>
        <script>
          // Function to fetch post counts from the back-end
          async function getPostCounts() {
            const response = await fetch("/post_counts");
            const data = await response.json();
            return data;
          }
    
          // Function to create the bar graph using ApexCharts.js
          async function createBarGraph() {
            const data = await getPostCounts();
    
            // Configuration options for the bar graph
            const options = {
              chart: {
                type: "bar",
                toolbar: {
                  show: true, // Set to true to show the toolbar
                },
                downloadMenu: {
                  // Options for the download menu
                  csv: false, // Set to true to enable CSV download
                  excel: false, // Set to true to enable Excel download
                  svg: true, // Set to true to enable SVG download
                  png: true, // Set to true to enable PNG download
                  jpeg: true, // Set to true to enable JPEG download
                  pdf: true, // Set to true to enable PDF download
                },
              },
              colors: ["#5d87ff", "#64c7ff"], // Custom colors for Seller and Buyer bars
              series: [
                {
                  name: "Number of Posts",
                  data: [data.seller_posts, data.buyer_posts],
                },
              ],
              xaxis: {
                categories: ["Seller", "Buyer"],
              },
              plotOptions: {
                bar: {
                  distributed: true, // Display bars with equal spacing across the chart
                },
              },
            };
    
            // Get the chart container element
            const chartContainer = document.getElementById("chart1");
    
            // Check if there's an existing chart and destroy it before creating the new one
            if (chartContainer._chart) {
              chartContainer._chart.destroy();
            }
    
            // Create the bar graph using ApexCharts
            const chart = new ApexCharts(chartContainer, options);
            chart.render();
          }
    
          // Call the function to create the bar graph
          createBarGraph();
        </script>
        <script>
          // Function to fetch post counts from the back-end
          async function getPostCounts() {
            const response = await fetch("/post_counts");
            const data = await response.json();
            return data;
          }
    
          // Function to create the donut chart using ApexCharts.js
          async function createDonutChart() {
            const data = await getPostCounts();
    
            // Configuration options for the donut chart
            const options = {
              chart: {
                type: "donut",
                width: "150", // Set the width of the chart (in pixels)
                height: "150", // Set the height of the chart (in pixels)
              },
              series: [data.buyer_posts, data.seller_posts],
              labels: ["Buyer", "Seller"],
              colors: ["#5d87ff", "#64c7ff"], // Custom colors for Buyer and Seller sections
              dataLabels: {
                enabled: false,
                formatter: function (val, opts) {
                  return opts.w.config.series[opts.seriesIndex] + " posts"; // Display the post count as a data label
                },
              },
              legend: {
                show: false, // Set to false to hide the legends
              },
            };
    
            // Get the chart container element
            const chartContainer = document.getElementById("breakup1");
    
            // Check if there's an existing chart and destroy it before creating the new one
            if (chartContainer._chart) {
              chartContainer._chart.destroy();
            }
    
            // Create the donut chart using ApexCharts
            const chart = new ApexCharts(chartContainer, options);
            chart.render();
          }
    
          // Call the function to create the donut chart
          createDonutChart();
        </script>
        <script>
          $(function () {
            function c() {
              p();
              var e = h();
              var r = 0;
              var u = false;
              l.empty();
              while (!u) {
                if (s[r] == e[0].weekday) {
                  u = true;
                } else {
                  l.append('<div class="blank"></div>');
                  r++;
                }
              }
              for (var c = 0; c < 42 - r; c++) {
                if (c >= e.length) {
                  l.append('<div class="blank"></div>');
                } else {
                  var v = e[c].day;
                  var m = g(new Date(t, n - 1, v))
                    ? '<div class="today">'
                    : "<div>";
                  l.append(m + "" + v + "</div>");
                }
              }
              var y = o[n - 1];
              a.css("background-color", y)
                .find("h1")
                .text(i[n - 1] + " " + t);
              f.find("div").css("color", y);
              l.find(".today").css("background-color", y);
              d();
            }
            function h() {
              var e = [];
              for (var r = 1; r < v(t, n) + 1; r++) {
                e.push({ day: r, weekday: s[m(t, n, r)] });
              }
              return e;
            }
            function p() {
              f.empty();
              for (var e = 0; e < 7; e++) {
                f.append("<div>" + s[e].substring(0, 3) + "</div>");
              }
            }
            function d() {
              var t;
              var n = $("#calendar").css("width", e + "px");
              n.find((t = "#calendar_weekdays, #calendar_content"))
                .css("width", e + "px")
                .find("div")
                .css({
                  width: e / 7 + "px",
                  height: e / 7 + "px",
                  "line-height": e / 7 + "px",
                });
              n.find("#calendar_header")
                .css({ height: e * (1 / 7) + "px" })
                .find('i[class^="icon-chevron"]')
                .css("line-height", e * (1 / 7) + "px");
            }
            function v(e, t) {
              return new Date(e, t, 0).getDate();
            }
            function m(e, t, n) {
              return new Date(e, t - 1, n).getDay();
            }
            function g(e) {
              return y(new Date()) == y(e);
            }
            function y(e) {
              return e.getFullYear() + "/" + (e.getMonth() + 1) + "/" + e.getDate();
            }
            function b() {
              var e = new Date();
              t = e.getFullYear();
              n = e.getMonth() + 1;
            }
            var e = 480;
            var t = 2013;
            var n = 9;
            var r = [];
            var i = [
              "JANUARY",
              "FEBRUARY",
              "MARCH",
              "APRIL",
              "MAY",
              "JUNE",
              "JULY",
              "AUGUST",
              "SEPTEMBER",
              "OCTOBER",
              "NOVEMBER",
              "DECEMBER",
            ];
            var s = [
              "Sunday",
              "Monday",
              "Tuesday",
              "Wednesday",
              "Thursday",
              "Friday",
              "Saturday",
            ];
            var o = [
              "#5d87ff",
              "#5d87ff",
              "#5d87ff",
              "#5d87ff",
              "#5d87ff",
              "#5d87ff",
              "#5d87ff",
              "#5d87ff",
              "#5d87ff",
              "#5d87ff",
              "#5d87ff",
              "#5d87ff",
            ];
            var u = $("#calendar");
            var a = u.find("#calendar_header");
            var f = u.find("#calendar_weekdays");
            var l = u.find("#calendar_content");
            b();
            c();
            a.find('i[class^="icon-chevron"]').on("click", function () {
              var e = $(this);
              var r = function (e) {
                n = e == "next" ? n + 1 : n - 1;
                if (n < 1) {
                  n = 12;
                  t--;
                } else if (n > 12) {
                  n = 1;
                  t++;
                }
                c();
              };
              if (e.attr("class").indexOf("left") != -1) {
                r("previous");
              } else {
                r("next");
              }
            });
          });
        </script>
</body>

</html>