<?php
$tt_page_info = array(
  'Page_Info' =>   array(
    'Title' => 'অ্যাকাউন্ট',
    'Description' => '',
    'Keyword' => '',
  ),
  'Social_og' => array(
    'Image' => '',
    'Type' => 'website',
    'URL' => 'account/',
  ),
);

require_once('./header.php'); // Include Footer
?>
<section id="account_mahamudfutureit" class="sectionbg pt-4 pb-5">
      <div class="container">
          <div class="row mt-4 justify-content-center">
              <!-- Side Bar -->
              <div class="col-lg-4">
                <div id="accountSidebar" class="side-bar mb-4">
                    <div class="round-15 p-4 mahamudfutureit-shadow border-0 card attraiit-profile">
                      <div class="dokan_ab_avater mb-2 border border-primary">
                          <img id="avatar" src="<?php echo userAvater($the_writer_id) ?>" alt="<?php echo htmlentities($the_writer['UserName'], ENT_QUOTES, 'utf-8'); ?>">
                          <?php
                          if ($the_writer['UpdateProfile'] == 'active') {
                            ?>
                            <div class="dokan_ab_avater_update text-center">
                              <label class="d-block label">
                                <i class="bi bi-camera"></i>
                                <input type="file" class=" d-none sr-only" id="input" name="image" accept="image/*">
                              </label>
                            </div>
                            <?php
                          }
                          ?>
                        </div>
                        <div class="modal fade" id="modal" tabindex="-1" aria-labelledby="modalLabel" aria-hidden="true">
                          <div class="modal-dialog" role="document">
                            <div class="modal-content rounded-0 dokan_avater_box">
                              <div class="modal-header">
                                <h5 class="modal-title primary-text" id="modalLabel">Crop the image</h5>
                                <button type="button" class="btn-close primary-text" data-bs-dismiss="modal" aria-label="Close"> </button>
                              </div>
                              <div class="modal-body">
                                <div class="img-container">
                                  <img style="width:100% ; height:auto" id="image" src="<?php echo userAvater($the_writer_id) ?>">
                                </div>
                              </div>
                              <div class="modal-footer">
                                <button type="button" class="btn btn-secondary  rounded-pill px-3" data-bs-dismiss="modal">Cancle</button>
                                <button type="button" class="btn btn-primary rounded-pill px-3" id="crop">Crop Update</button>
                              </div>
                            </div>
                          </div>
                        </div>
                        <div class="profile-main text-center">
                            <h4 class="text-center mt-2"> <?php echo htmlentities($the_writer['UserName'], ENT_QUOTES, 'utf-8'); ?> </h4>
                            <?php
                            if ($the_writer['UserDesignation'] !='') {
                              ?>
                              <h5> <?php echo $the_writer['UserDesignation'] ?></h5>
                              <?php
                            }
                            ?>

                            <div class="count-ac">
                              <ul class="p-0">
                                  <li>
                                    <span>
                                       <?php echo bnNumber(count(showAllttdata("mahamudfutureit_article", "WHERE PostAuthor = '$post_author_id'   ORDER BY  PostDate  DESC "))) ?>
                                    </span>
                                    <p>লিখেছেন </p>
                                  </li>
                                  <li>
                                    <i class="bi bi-dash-lg"></i>
                                  </li>
                                  <li>
                                    <span>
                                      <?php echo bnNumber(count(showAllttdata("mahamudfutureit_article", "WHERE PostAuthor = '$post_author_id' AND PostStatus = 'published' ORDER BY  PostDate  DESC "))) ?>
                                    </span>
                                    <p>প্রকাশিত</p>
                                  </li>
                                  <li>
                                    <i class="bi bi-dash-lg"></i>
                                  </li>
                                  <li>
                                    <span>
                                      <?php echo bnNumber(count(showAllttdata("mahamudfutureit_article", "WHERE PostAuthor = '$post_author_id' AND PostStatus = 'pending' ORDER BY  PostDate  DESC "))) ?>
                                    </span>
                                    <p>অপেক্ষামান</p>
                                  </li>
                              </ul>
                            </div>
                        </div>
                    </div>
                    <?php
                    if ($advancenews['AccountDashboardBanner']!='') {
                      ?>
                      <div class="col-lg-12 mb-2 d-block d-md-none mt-3">
                        <img src="<?php echo $advancenews['AccountDashboardBanner'] ?>" class="w-100 rounded-3" alt="">
                      </div>
                      <?php
                    }

                    if ($the_writer['UserPwdTemp'] == 'yes') {
                      ?>
                      <div class="col-12 mt-4 d-block d-md-none">
                        <div class="border-0 rounded-4 alert alert-warning alert-dismissible fade show" role="alert">
                           <strong>নিরাপত্তা সতর্কতা :</strong>  আপনার অ্যাকাউন্ট পাসওয়ার্ড পরিবর্তন করুন !
                          <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                        </div>
                      </div>
                      <?php
                    }


                    if ($the_writer['PostAbility'] == 'yes') {
                      ?>
                      <div class="round-15 mahamudfutureit-opts mahamudfutureit-shadow border-0 card mt-4 p-1">
                          <ul class="p-0 mb-1">
                                <li>
                                    <a href="<?php echo $site_domain;?>account/article/new/">
                                        <img src="<?php echo $site_domain;?>assets/image/icons/hand-with-pen.png" /> আর্টিকেল লিখুন
                                    </a>
                                </li>
                                <li>
                                    <a href="<?php echo $site_domain;?>account/article/published/">
                                        <img src="<?php echo $site_domain;?>assets/image/icons/published-news.png" /> প্রকাশিত আর্টিকেল
                                    </a>
                                </li>
                                <li>
                                    <a href="<?php echo $site_domain;?>account/article/pending/">
                                        <img src="<?php echo $site_domain;?>assets/image/icons/newspaper.png" />  অপেক্ষামান লেখা
                                    </a>
                                </li>
                                <li>
                                    <a href="<?php echo $site_domain;?>account/article/rejected/">
                                        <img src="<?php echo $site_domain;?>assets/image/icons/trash.png" /> বাতিল লেখা
                                    </a>
                                </li>
                          </ul>
                      </div>
                      <?php
                    }
                     ?>

                    <div class="round-15 mahamudfutureit-opts mahamudfutureit-shadow border-0 card mt-4 p-1">
                        <ul class="p-0 mb-1">
                              <li>
                                  <a href="<?php echo $site_domain;?>account/personal-info/">
                                      <img src="<?php echo $site_domain;?>assets/image/icons/admin-settings-male.png" /> ব্যাক্তিগত তথ্য
                                  </a>
                              </li>
                              <li>
                                  <a href="<?php echo $site_domain;?>account/address/">
                                      <img src="<?php echo $site_domain;?>assets/image/icons/shop-location.png" /> আমার ঠিকানা
                                  </a>
                              </li>
                              <li>
                                  <a href="<?php echo $site_domain;?>account/security/">
                                      <img src="<?php echo $site_domain;?>assets/image/icons/lock.png" /> একাউন্ট সিকিউরিটি
                                  </a>
                              </li>
                            <li>
                                <a href="<?php echo $site_domain;?>account/logout/">
                                    <img src="<?php echo $site_domain;?>assets/image/icons/log-out.png" /> লগ আউট
                                </a>
                            </li>
                        </ul>
                    </div>
                </div>
              </div>
              <!-- Main Section  -->
              <div class="col-lg-8">
                <!-- Featured Wedget -->
                <div class="row">

                  <?php
                  if ($advancenews['AccountDashboardBanner']!='') {
                    ?>
                    <div class="col-lg-12 mb-2 d-none d-md-block">
                      <img src="<?php echo $advancenews['AccountDashboardBanner'] ?>" class="w-100 rounded-3" alt="">
                    </div>
                    <?php
                  }

                  if ($the_writer['UserPwdTemp'] == 'yes') {
                    ?>
                    <div class="col-12 mt-4 d-none d-md-block">
                      <div class="border-0 rounded-4 alert alert-warning alert-dismissible fade show" role="alert">
                         <strong>নিরাপত্তা সতর্কতা :</strong>  আপনার অ্যাকাউন্ট পাসওয়ার্ড পরিবর্তন করুন !
                        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                      </div>
                    </div>
                    <?php
                  }
                  if ($the_writer['PostAbility'] == 'yes') {
                    ?>

                    <div class="col-lg-4 col-6 mb-3">
                      <a class="otp-wd yeallow" href="<?php echo $site_domain;?>account/article/published/">
                        <img class="img-fluid" src="<?php echo $site_domain;?>assets/image/icons/newspaper.png">
                        <div class="count-info">
                          <p class="count"> <?php echo bnNumber(count(showAllttdata("mahamudfutureit_article", "WHERE PostAuthor = '$post_author_id'   ORDER BY  PostDate  DESC "))) ?> </p>
                          <p>লিখেছেন</p>
                        </div>
                      </a>
                    </div>
                    <div class="col-lg-4 col-6 mb-3">
                      <a class="otp-wd blue" href="<?php echo $site_domain;?>account/article/published/">
                        <img class="img-fluid" src="<?php echo $site_domain;?>assets/image/icons/news-blue.png">
                        <div class="count-info">
                          <p class="count"><?php echo bnNumber(count(showAllttdata("mahamudfutureit_article", "WHERE PostAuthor = '$post_author_id' AND PostStatus = 'published' ORDER BY  PostDate  DESC "))) ?></p>
                          <p>প্রকাশিত</p>
                        </div>
                      </a>
                    </div>
                    <div class="col-lg-4 col-12 mb-3">
                      <a class="otp-wd deeptomato" href="<?php echo $site_domain;?>account/article/pending/">
                        <img class="img-fluid" src="<?php echo $site_domain;?>assets/image/icons/review-post.png">
                        <div class="count-info">
                          <p class="count"> <?php echo bnNumber(count(showAllttdata("mahamudfutureit_article", "WHERE PostAuthor = '$post_author_id' AND PostStatus = 'pending' ORDER BY  PostDate  DESC "))) ?> </p>
                          <p> অপেক্ষামান</p>
                        </div>
                      </a>
                    </div>
                    <?php
                  }
                  ?>
                 </div>
                <!-- Options -->
                <div class="col-lg-12">
                  <div class="card-ab dashboard">
                    <div class="card-body">
                      <h5 class="card-title">আপনার একাউন্ট <span> | আকাউন্ট নিয়ন্ত্রণ করুণ</span></h5>
                      <div class="row">
                        <div class="col-lg-3 col-6 mb-3">
                          <a class="mahamudfutureit-acc-optns blue p-3" href="<?php echo $site_domain;?>account/personal-info/">
                              <img class="img-fluid" src="<?php echo $site_domain;?>assets/image/icons/admin-settings-male.png">
                              <h4 class="pt-2 pb-1 m-0">ব্যাক্তিগত তথ্য</h4>
                           </a>
                        </div>
                        <div class="col-lg-3 col-6 mb-3">
                          <a class="mahamudfutureit-acc-optns p-3 red2" href="<?php echo $site_domain;?>account/address/">
                              <img class="img-fluid" src="<?php echo $site_domain;?>assets/image/icons/shop-location.png">
                              <h4 class="pt-2 pb-1 m-0">আমার ঠিকানা</h4>
                           </a>
                        </div>
                        <div class="col-lg-3 col-6 mb-3">
                          <a class="mahamudfutureit-acc-optns p-3 gray" href="<?php echo $site_domain;?>account/security/">
                              <img class="img-fluid" src="<?php echo $site_domain;?>assets/image/icons/lock.png">
                              <h4 class="pt-2 pb-1 m-0">সিকিউরিটি</h4>
                           </a>
                        </div>
                        <div class="col-lg-3 col-6 mb-3">
                          <a class="mahamudfutureit-acc-optns p-3 logout" href="<?php echo $site_domain;?>account/logout/">
                              <img class="img-fluid" src="<?php echo $site_domain;?>assets/image/icons/log-out.png">
                              <h4 class="pt-2 pb-1 m-0">লগ আউট</h4>
                           </a>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
          </div>
      </div>
  </section>
  <script>
    window.addEventListener("DOMContentLoaded",function(){var e,t=document.getElementById("avatar"),n=document.getElementById("image"),a=document.getElementById("input"),o=new bootstrap.Modal(document.getElementById("modal"));[].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')).map(function(e){return new bootstrap.Tooltip(e)}),a.addEventListener("change",function(e){var t,r,d=e.target.files,s=function(e){a.value="",n.src=e,o.show()};d&&d.length>0&&(r=d[0],URL?s(URL.createObjectURL(r)):FileReader&&((t=new FileReader).onload=function(e){s(t.result)},t.readAsDataURL(r)))}),document.getElementById("modal").addEventListener("shown.bs.modal",function(){e=new Cropper(n,{aspectRatio:1,viewMode:3})}),document.getElementById("modal").addEventListener("hidden.bs.modal",function(){e&&(e.destroy(),e=null,console.log("Cropper destroyed."))}),document.getElementById("crop").addEventListener("click",function(){var n,a;o.hide(),e&&(a=e.getCroppedCanvas({width:300,height:300}),n=t.src,t.src=a.toDataURL(),a.toBlob(function(e){var a=new FormData;a.append("avatar",e,"avatar.jpg"),$.ajax("<?php echo $site_domain ?>ajax_master/avater/",{method:"POST",data:a,processData:!1,contentType:!1,xhr:function(){return new XMLHttpRequest},success:function(e){console.log("Server Response:",e)},error:function(e,a,o){t.src=n,console.error("AJAX error. Status:",a,"Error:",o,"Response Text:",e.responseText)}})}))})});
  </script>
<?php
require_once('./footer.php'); // Include Footer
?>
