<?php
session_start();
$pageSequence = $_SESSION['sequence'];
$toDiv = "contentZone" . $pageSequence;
$resultZoneDiv = "resultZone" . $pageSequence;
$tableZone = "#tableZone" . $pageSequence;
$tblName = "tblReport" . $pageSequence;
$btAdd = "btnAdd" . $pageSequence;
$btDel = "btnDel" . $pageSequence;
$btDelObj = "btnDelObj" . $pageSequence;
$dataSection = "dataSection" . $pageSequence;
$_SESSION['sequence']++;
//echo  dirname(__FILE__);  
//echo $_SERVER['DOCUMENT_ROOT'] . "   ".dirname(__FILE__)."  ".str_replace($_SERVER['DOCUMENT_ROOT'],"",dirname(__FILE__)) ;

$currentBaseDir = dirname($_SERVER['PHP_SELF']);
include($_SESSION['basedir'] . "veriflog.php");
include($_SESSION['basedir'] . "core.php");

//$res = $dba->getUserDetailByRight($_SESSION['right'], $_SESSION['ownerId'], false, 0, 0);
$res = $dba->getSCCCallReasonDetails(0);
?>


<!-- Content Header (Page header) -->
<section class="content-header">
    <div class="header-icon">
        <i class="fa fa-user-circle"></i>
    </div>
    <div class="header-title">
        <h1>Mes Mails</h1>
        <small>Gestion des mails</small>
    </div>
</section>
<!-- Main content -->
<div id="<?php echo $dataSection; ?>">
   <section class="content">
               <div class="row">
                  <div class="col-sm-12">
                     <div class="mailbox">
                        <div class="mailbox-header">
                           <div class="row">
                              <div class="col-xs-4">
                                 <div class="inbox-avatar">
                                    <i class="fa fa-user-circle fa-lg"></i>
                                    <div class="inbox-avatar-text hidden-xs hidden-sm">
                                       <div class="avatar-name">Alrazy</div>
                                       <div><small>Messages</small></div>
                                    </div>
                                 </div>
                              </div>
                              <div class="col-xs-8">
                                 <div class="inbox-toolbar btn-toolbar">
                                    <div class="btn-group">
                                       <a href="compose.html" class="btn btn-add"><span class="fa fa-pencil-square-o"></span></a>
                                    </div>
                                    <div class="btn-group">
                                       <a href="#" class="btn btn-default"><span class="fa fa-reply"></span></a>
                                       <a href="#" class="hidden-xs hidden-sm btn btn-default"><span class="fa fa-reply-all"></span></a>
                                       <a href="#" class="btn btn-default"><span class="fa fa-share"></span></a>
                                    </div>
                                    <div class="hidden-xs hidden-sm btn-group">
                                       <button type="button" class="text-center btn btn-danger"><span class="fa fa-exclamation"></span></button>
                                       <button type="button" class="btn btn-danger"><span class="fa fa-trash"></span></button>
                                    </div>
                                 </div>
                              </div>
                           </div>
                        </div>
                        <div class="mailbox-body">
                           <div class="row m-0">
                              <div class="col-sm-3 p-0 inbox-nav hidden-xs hidden-sm">
                                 <div class="mailbox-sideber">
                                    <div class="profile-usermenu">
                                       <h6>Messages box</h6>
                                       <ul class="nav">
                                          <li class="active"><a href="#"><i class="fa fa-inbox"></i>Inbox <small class="label pull-right bg-green">61</small></a></li>
                                          <li><a href="#"><i class="fa fa-envelope-o"></i>Send Mail</a></li>
                                          <li><a href="#"><i class="fa fa-star-o"></i>Starred</a></li>
                                          <li><a href="#"><i class="fa fa-trash-o"></i>Tresh </a></li>
                                          <li><a href="#"><i class="fa fa-paperclip"></i>Attachments</a></li>
                                       </ul>
                                       <hr>
                                    </div>
                                 </div>
                              </div>
                              <div class="col-xs-12 col-sm-12 col-md-9 p-0 inbox-mail">
                                 <div class="mailbox-content">
                                    <a href="mailDetails.html" class="inbox_item unread">
                                       <div class="inbox-avatar">
                                          <img src="assets/dist/img/avatar.png" class="border-green hidden-xs hidden-sm" alt="">
                                          <div class="inbox-avatar-text">
                                             <div class="avatar-name">Naeem Khan (3)</div>
                                             <div><small><span class="bg-green badge avatar-text">SOME LABEL</span><span><strong>Early access: </strong><span> Lorem Ipsum is simply dummy text of the printing and typesetting industry.</span></span></small></div>
                                          </div>
                                          <div class="inbox-date hidden-sm hidden-xs hidden-md">
                                             <div class="date">Jan 17th</div>
                                             <div><small>#1</small></div>
                                          </div>
                                       </div>
                                    </a>
                                    <a href="mailDetails.html" class="inbox_item">
                                       <div class="inbox-avatar">
                                          <img src="assets/dist/img/avatar2.png" class="border-red hidden-xs hidden-sm" alt="">
                                          <div class="inbox-avatar-text">
                                             <div class="avatar-name">Tuhin Sarker</div>
                                             <div><small><span class="bg-red badge avatar-text">SOME LABEL</span><span><strong>Early access: </strong><span>It is a long established fact that a reader will be distracted by the </span></span></small></div>
                                          </div>
                                          <div class="inbox-date hidden-sm hidden-xs hidden-md">
                                             <div class="date">Jan 17th</div>
                                             <div><small>#2</small></div>
                                          </div>
                                       </div>
                                    </a>
                                    <a href="mailDetails.html" class="inbox_item unread">
                                       <div class="inbox-avatar">
                                          <img src="assets/dist/img/avatar3.png" class="border-violet hidden-xs hidden-sm" alt="">
                                          <div class="inbox-avatar-text">
                                             <div class="avatar-name">Tanjil Ahmed (6)</div>
                                             <div><small><span class="bg-violet badge avatar-text">SOME LABEL</span><span><strong>Early access: </strong><span>Contrary to popular belief, Lorem Ipsum is not simply random text.</span></span></small></div>
                                          </div>
                                          <div class="inbox-date hidden-sm hidden-xs hidden-md">
                                             <div class="date">Jan 17th</div>
                                             <div><small>#3</small></div>
                                          </div>
                                       </div>
                                    </a>
                                    <a href="mailDetails.html" class="inbox_item unread">
                                       <div class="inbox-avatar">
                                          <img src="assets/dist/img/avatar4.png" class="border-gray hidden-xs hidden-sm" alt="">
                                          <div class="inbox-avatar-text">
                                             <div class="avatar-name">Jahangir Alam (2)</div>
                                             <div><small><span class="bg-gray badge avatar-text">SOME LABEL</span><span><strong>Early access: </strong><span>There are many variations of passages of Lorem Ipsum available, </span></span></small></div>
                                          </div>
                                          <div class="inbox-date hidden-sm hidden-xs hidden-md">
                                             <div class="date">Jan 17th</div>
                                             <div><small>#4</small></div>
                                          </div>
                                       </div>
                                    </a>
                                    <a href="mailDetails.html" class="inbox_item">
                                       <div class="inbox-avatar">
                                          <img src="assets/dist/img/avatar5.png" class="border-yellow hidden-xs hidden-sm" alt="">
                                          <div class="inbox-avatar-text">
                                             <div class="avatar-name">Mozammel Hoque</div>
                                             <div><small><span class="bg-yellow badge avatar-text">SOME LABEL</span><span><strong>Early access: </strong><span>Lorem Ipsum has been the industry's standard dummy text .</span></span></small></div>
                                          </div>
                                          <div class="inbox-date hidden-sm hidden-xs hidden-md">
                                             <div class="date">Jan 17th</div>
                                             <div><small>#5</small></div>
                                          </div>
                                       </div>
                                    </a>
                                    <a href="mailDetails.html" class="inbox_item">
                                       <div class="inbox-avatar">
                                          <img src="assets/dist/img/avatar.png" class="border-green hidden-xs hidden-sm" alt="">
                                          <div class="inbox-avatar-text">
                                             <div class="avatar-name">Slaah Uddin</div>
                                             <div><small><span class="bg-green badge avatar-text">SOME LABEL</span><span><strong>Early access: </strong><span>The point of using Lorem Ipsum is that it has ....</span></span></small></div>
                                          </div>
                                          <div class="inbox-date hidden-sm hidden-xs hidden-md">
                                             <div class="date">Jan 17th</div>
                                             <div><small>#6</small></div>
                                          </div>
                                       </div>
                                    </a>
                                    <a href="mailDetails.html" class="inbox_item">
                                       <div class="inbox-avatar">
                                          <img src="assets/dist/img/avatar2.png" class="border-red hidden-xs hidden-sm" alt="">
                                          <div class="inbox-avatar-text">
                                             <div class="avatar-name">Tahmina Akther</div>
                                             <div><small><span class="bg-red badge avatar-text">SOME LABEL</span><span><strong>Early access: </strong><span>Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia,</span></span></small></div>
                                          </div>
                                          <div class="inbox-date hidden-sm hidden-xs hidden-md">
                                             <div class="date">Jan 17th</div>
                                             <div><small>#7</small></div>
                                          </div>
                                       </div>
                                    </a>
                                    <a href="mailDetails.html" class="inbox_item">
                                       <div class="inbox-avatar">
                                          <img src="assets/dist/img/avatar3.png" class="border-violet hidden-xs hidden-sm" alt="">
                                          <div class="inbox-avatar-text">
                                             <div class="avatar-name">Jordyn Ouellet</div>
                                             <div><small><span class="bg-violet badge avatar-text">SOME LABEL</span><span><strong>Early access: </strong><span>Quam nulla porttitor massa id neque aliquam vestibulum morbi blandit.</span></span></small></div>
                                          </div>
                                          <div class="inbox-date hidden-sm hidden-xs hidden-md">
                                             <div class="date">Jan 17th</div>
                                             <div><small>#8</small></div>
                                          </div>
                                       </div>
                                    </a>
                                    <a href="mailDetails.html" class="inbox_item">
                                       <div class="inbox-avatar">
                                          <img src="assets/dist/img/avatar4.png" class="border-gray hidden-xs hidden-sm" alt="">
                                          <div class="inbox-avatar-text">
                                             <div class="avatar-name">Facebook</div>
                                             <div><small><span class="bg-gray badge avatar-text">SOME LABEL</span><span>Quam nulla porttitor massa id neque aliquam vestibulum morbi blandit.</span></small></div>
                                          </div>
                                          <div class="inbox-date hidden-sm hidden-xs hidden-md">
                                             <div class="date">Jan 17th</div>
                                             <div><small>#9</small></div>
                                          </div>
                                       </div>
                                    </a>
                                 </div>
                              </div>
                           </div>
                        </div>
                     </div>
                  </div>
               </div>
            </section>
</div>
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<script src="plugins/datatables/dataTables.buttons.min.js"></script>
<script src="plugins/datatables/buttons.html5.min.js"></script>
<script type="text/javascript" src="js/jquery.loading.min.js"></script>


<!-- /.content -->
<script type="text/javascript" >
                                        $(document).ready(function () {
                                            var table = $('#<?php echo $tblName; ?>').DataTable({
                                                "language": {
                                                    "search": "Filtrer:",
                                                    "emptyTable": "Table vide",
                                                    "zeroRecords": "Table vide",
                                                    "lengthMenu": "Nombre de lignes  _MENU_ ",

                                                    "info": "Affichage de  _START_ &aacute; _END_ sur  _TOTAL_ entr&eacute;es",
                                                    "paginate": {
                                                        "first": "D&eacute;but",
                                                        "last": "Fin",
                                                        "next": "Suivant",
                                                        "previous": "Pr&eacute;c&eacute;dent"
                                                    },
                                                    "infoEmpty": "Affichage de  0 &agrave; 0 sur  0 entr&eacute;es"
                                                }
                                            });


                                            $('#<?php echo $btDel; ?>').on("click", function (e) {

                                                e.preventDefault();
                                                $.confirm({
                                                    title: 'Attention!',
                                                    content: 'Voulez-vous supprimer les éléments selectionnés?',
                                                    buttons: {
                                                        confirm: {
                                                            text: 'Confirmer',
                                                            btnClass: 'btn-blue',
                                                            action: function () {

                                                                var ids = "";
                                                                table.$('input:checked').each(function ()
                                                                {


                                                                    ids = ids + $(this).val() + ",";
                                                                });
                                                                //  alert(ids);

                                                                $.ajax({
                                                                    url: $('#<?php echo $btDel; ?>').attr('data-href') + "?ids=" + ids,
                                                                    type: 'post',
                                                                    dataType: 'json',
                                                                    success: function (obj) {
                                                                        //alert(data);
                                                                        if (obj.errorCode == 0) {

                                                                            $('#loader').hide();
                                                                            $.confirm({

                                                                                icon: 'glyphicon glyphicon-ok',
                                                                                title: 'RESULTAT',
                                                                                content: obj.errorMessage,
                                                                                type: 'green',
                                                                                typeAnimated: true,
                                                                                buttons: {
                                                                                    confirm: {
                                                                                        text: 'OK',
                                                                                        btnClass: 'btn-blue',
                                                                                        action: function () {

                                                                                            $("#content-wrapper").load('<?php echo $_SERVER['PHP_SELF']; ?>');


                                                                                        }

                                                                                    }}
                                                                            });
                                                                            //  alert(data);


                                                                        } else {

                                                                            $.alert({
                                                                                icon: 'glyphicon glyphicon-warning-sign',
                                                                                title: 'RESULTAT',
                                                                                content: obj.errorMessage,
                                                                                type: 'red',
                                                                                typeAnimated: true
                                                                            });
                                                                        }
                                                                    }
                                                                });
                                                            }},
                                                        cancel: {
                                                            text: 'Annuler',
                                                            action: function () {


                                                            }
                                                        }
                                                    }
                                                });
                                                //$('#sbmt01').submit() ;

                                            });
                                        });
</script>


<script type="text/javascript">





    var checkBoxes = $('tbody .<?php echo $btDelObj; ?>');
    var counterChecked = 0;
    $('body').on('change', 'input[type="checkbox"]', function () {

        this.checked ? counterChecked++ : counterChecked--;
        counterChecked > 0 ? $('#<?php echo $btDel; ?>').prop("disabled", false) : $('#<?php echo $btDel; ?>').prop("disabled", true);
    });

</script>

<script type="text/javascript" src="js/jquery.loading.min.js"></script>
<link rel="stylesheet" href="css/jquery-confirm.min.css">
<script src="js/jquery-confirm.min.js"></script>

<?php   /* include 'call_event_listener.php'*/ ?> ;