File size: 28,218 Bytes
53143bf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
<!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%;
    }
    /* Styling for the scrollable container */
    .scrollable-container {
      height: 500px; /* Set the desired height for the container */
      overflow: auto; /* Enable scrolling when content exceeds the container height */
      border: 1px solid rgb(199, 199, 199);
      border-radius: 3%;
      padding: 18px;
    }
  </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('regular_user') }}"
              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">Home</span>
              </li>
              <li class="sidebar-item">
                <a
                  class="sidebar-link"
                  href="{{ url_for('regular_user') }}"
                  aria-expanded="false"
                >
                  <span>
                    <i class="ti ti-layout-dashboard"></i>
                  </span>
                  <span class="hide-menu">Dashboard</span>
                </a>
              </li>
              <li class="nav-small-cap">
                <i class="ti ti-dots nav-small-cap-icon fs-4"></i>
                <span class="hide-menu">Quick Links</span>
              </li>
              <li class="sidebar-item">
                <a
                  class="sidebar-link"
                  href="{{ url_for('buyer') }}"
                  aria-expanded="false"
                >
                  <span>
                    <i class="ti ti-article"></i>
                  </span>
                  <span class="hide-menu">Buyer</span>
                </a>
              </li>
              <li class="sidebar-item">
                <a
                  class="sidebar-link"
                  href="{{ url_for('seller') }}"
                  aria-expanded="false"
                >
                  <span>
                    <i class="ti ti-alert-circle"></i>
                  </span>
                  <span class="hide-menu">Seller</span>
                </a>
              </li>
              <li class="sidebar-item">
                <a class="sidebar-link" href="#" aria-expanded="false">
                  <span>
                    <i class="ti ti-file-description"></i>
                  </span>
                  <span class="hide-menu">Exclusivity</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="{{ url_for('logout') }}"
                        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 id="earning"></div>
                </div>
              </div>
            </div>
          </div>
          <div class="row">
            <div class="col-lg-6 d-flex align-items-stretch">
              <div class="card w-100">
                <div class="card-body p-4">
                  <div class="mb-4">
                    <h5 class="card-title fw-semibold">Calender</h5>
                  </div>
                  <div id="calendar">
                    <div id="calendar_header">
                      <i class="icon-chevron-left"></i>
                      <h1></h1>
                      <i class="icon-chevron-right"></i>
                    </div>
                    <div id="calendar_weekdays"></div>
                    <div id="calendar_content"></div>
                  </div>
                </div>
              </div>
            </div>
            <div class="col-lg-6 d-flex align-items-stretch">
              <div class="card w-100">
                <div class="card-body p-4">
                  <h5 class="card-title fw-semibold mb-4">About ARAZIM</h5>
                  <div class="scrollable-container">
                    <h5>Introduction:</h5>
                    <p>
                      ARAZIM is a cutting-edge web application that
                      revolutionizes the real estate industry by seamlessly
                      connecting buyers and sellers, empowered by the latest
                      advancements in artificial intelligence. Whether you're
                      looking for your dream property or aiming to sell your
                      estate at the best price, ARAZIM is here to provide you
                      with an exceptional experience.
                    </p>
                    <h5>Key Features:</h5>
                    <p></p>
                    <h6>Smart Property Search:</h6>
                    <p>
                      ARAZIM harnesses the power of AI to deliver intelligent
                      property search results. Buyers can specify their
                      preferences, such as location, budget, property type,
                      amenities, and more. Our AI algorithms analyze this data
                      to present personalized and relevant listings, saving time
                      and effort in finding the perfect property.
                    </p>

                    <h6>Property Valuation:</h6>
                    <p>
                      For sellers, ARAZIM offers an AI-driven property valuation
                      tool. Our system leverages vast real estate data and
                      market trends to accurately assess the value of your
                      property. This ensures you get the best possible price
                      when selling your estate.
                    </p>

                    <h6>Virtual Tours:</h6>
                    <p>
                      Experience properties like never before with our virtual
                      tour feature. Buyers can explore properties from the
                      comfort of their homes, gaining a comprehensive
                      understanding of the layout and design before arranging a
                      physical visit.
                    </p>

                    <h6>Intelligent Matchmaking:</h6>
                    <p>
                      ARAZIM employs AI to match buyers with the most suitable
                      properties based on their preferences, lifestyle, and
                      previous interactions. This streamlined approach enhances
                      the chances of finding the right home for every buyer.
                    </p>

                    <h6>Real-Time Notifications:</h6>
                    <p>
                      Stay up-to-date with the latest listings and property
                      developments. ARAZIM sends real-time notifications to both
                      buyers and sellers, ensuring that no opportunity is
                      missed.
                    </p>

                    <h6>Secure Communication:</h6>

                    <p>
                      Our platform provides a secure messaging system, allowing
                      buyers and sellers to communicate efficiently and
                      privately. Share essential details, negotiate terms, and
                      finalize deals without any hassle.
                    </p>

                    <h6>Document Management:</h6>
                    <p>
                      ARAZIM simplifies the paperwork involved in real estate
                      transactions. Upload, store, and access documents
                      securely, ensuring a smooth and transparent process.
                    </p>

                    <h5>Benefits for Buyers:</h5>

                    <h6>Efficiency:</h6>
                    <p>
                      Save time and energy with personalized property
                      recommendations that match your preferences precisely.
                    </p>
                    <h6>Comprehensive Insights:</h6>
                    <p>
                      Access detailed property information, neighborhood
                      statistics, and historical pricing trends to make informed
                      decisions.
                    </p>
                    <h6>Convenience:</h6>
                    <p>
                      Explore properties virtually, reducing the need for
                      unnecessary physical visits.
                    </p>
                    <h6>Tailored Experience:</h6>
                    <p>
                      Our AI ensures that you are presented with relevant
                      options based on your unique requirements and lifestyle.
                    </p>

                    <h5>Benefits for Sellers:</h5>

                    <h6>Accurate Valuation:</h6>
                    <p>
                      Receive an AI-powered property valuation, helping you
                      determine the optimal listing price.
                    </p>
                    <h6>Wider Reach:</h6>
                    <p>
                      Showcase your property to a broad audience of potential
                      buyers, reaching beyond traditional marketing channels.
                    </p>
                    <h6>Time Savings:</h6>
                    <p>
                      Automate tasks and streamline the selling process, leaving
                      you with more time to focus on other priorities.
                    </p>
                    <h6>Competitive Edge:</h6>
                    <p>
                      Gain insights into the market to make strategic decisions
                      that position your property competitively.
                    </p>

                    <h5>Security and Privacy:</h5>

                    ARAZIM prioritizes the security and privacy of its users.
                    Your data is encrypted and stored securely, ensuring that
                    your personal information remains protected at all times.
                  </div>
                </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>
      // 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>