<?php session_start();
$pageSequence = $_SESSION['sequence'];
$toDiv = "contentZone" . $pageSequence;
$resultZoneDiv = "resultZone" . $pageSequence;
$tableZone ="#tableZone".$pageSequence;
$_SESSION['sequence']++;
//echo  dirname(__FILE__);  
//echo $_SERVER['DOCUMENT_ROOT'] . "   ".dirname(__FILE__)."  ".str_replace($_SERVER['DOCUMENT_ROOT'],"",dirname(__FILE__)) ;

$currentBaseDir = dirname($_SERVER['PHP_SELF']);
//echo $currentBaseDir ;
include($_SESSION['basedir']."core.php");
$res = $dba->getSCCTicketDetails(-1, $_SESSION['ownerId'],$_SESSION['right'], 3, NULL, NULL);


?>

 <style>
        body {
            font-size: 140%;
        }

        table.dataTable th,
        table.dataTable td {
            white-space: nowrap;
        }
    </style>

<div id="<?php echo $toDiv; ?>" class="tab-content"  >
<div  class="container-fluid" style="background-color:#F3F3F3; overflow:auto"  >

    <table width="100%" border="0" >

        <tr>

            <td> 



                <div id="<?php echo $resultZoneDiv; ?>">  </div></td>

        </tr>



    </table>



    <table width="100%"  >



        <td align="center">

          

                <table width="94%" border="0" cellspacing="1" cellpadding="1">



              <tr>

                        <td align="center" valign="top" ></td>







                    <tr>

                        <td colspan="2" align="center" valign="top"><b style="color:red">

                            </b></td>

                    </tr>

                    <tr height="40">

                        <td height="19" colspan="2" class="connection" valign="top" align="left">

       

                                <div id="routeType1" >

                                    <fieldset >

                                      <legend><em>Liste des tickets clos</em></legend>



                                        <table width="100%" border="0">

                            <!--                    <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal" tabindex="10">
    Launch demo modal
</button>   -->

                                            <tr>

                                                <td align="left"><table width="100%" border="0">
                                                <tr>
                                                  <td align="center"> 
                                                  <div class="containerIcons"> 
                                                  <div>
                                                  
                                                   <button id="refreshPage" class="btn" onclick="getPage('<?php echo $_SERVER['PHP_SELF']; ?>','<?php echo $toDiv; ?>')"   title="Rafraichir"><i class="cus-page-refresh"></i>Rafraichir</button>

	</div> </div></td>
                                                </tr>
                                              </table></td>
                                            </tr>
                                            <tr>
                                              <td align="left">
                                              
                                              <table id="tblClosedTicket" class="table table-striped table-bordered" width="100%" cellspacing="0">
        <thead>
            <tr>
                <th align="left" width="1%">&nbsp;</th>
                <th align="left" width="1%">&nbsp;</th>
                <th align="left" width="1%">&nbsp;</th>
                <th width="18" align="left">Date</th>
                <th width="15" align="left">N°Appelant</th>
                <th width="25" align="left">Agent</th>
                <th width="25" align="left">Identifiant client</th>
                <th width="7" align="left">N°Ticket</th>
                <th width="30" align="left">Motif d'appel</th>
                <th width="18" align="left">Date Acquittement</th>
                <th width="18" align="left">Date de clôture</th>
                <th width="18" align="left">Type</th>
                <th width="5" align="left">Statut</th>
             </tr>
        </thead>
        <tbody>
          <?php

            $cmpt = 1;

            for ($i = 0; $i < count($res); $i++) {

        ?>




            <tr>
              <!--  <td align="left"><input type="checkbox" name="ticketFullId" value="<?php echo $res[$i]['item_id_n']; ?>" /></td> -->
                <td align="left"><?php if($res[$i]['status_n']!='Clos') { ?><a href="#" data-href="<?php echo $currentBaseDir; ?>/edit_incoming_ticket.php?item=<?php echo $res[$i]['item_id_n']; ?>&toDiv=<?php echo $toDiv; ?>&rpage=<?php echo $_SERVER['PHP_SELF']; ?>"  title="Modifier" class="cus-application-form-edit" ></a><?php } ?></td>
                <td align="left"><a href="#" data-href="<?php echo $currentBaseDir; ?>/show_comments_list.php?item=<?php echo $res[$i]['ticket_number_v']; ?>&toDiv=<?php echo $toDiv; ?>&rpage=<?php echo $_SERVER['PHP_SELF']; ?>"  title="Voir les commentaires" class="cus-comment" ></a></td>
                <td align="left"><a href="#" data-href="<?php echo $currentBaseDir; ?>/view_incoming_ticket.php?item=<?php echo $res[$i]['item_id_n']; ?>&toDiv=<?php echo $toDiv; ?>&rpage=<?php echo $_SERVER['PHP_SELF']; ?>"  title="Ouvrir le ticket" class="cus-application-view-list" ></a></td>
                <td align="left"><?php echo $res[$i]['event_datetime_d']; ?></td>
                <td align="left"><?php echo $res[$i]['mobile1_phone_v']; ?></td>
                <td align="left"><?php echo $res[$i]['user_name_v']; ?></td>
                <td align="left"><?php echo $res[$i]['first_name_v']. " ".$res[$i]['last_name_v']; ?></td>
                <td align="left"><?php echo $res[$i]['ticket_number_v']; ?></td>
                <td align="left"><?php echo $res[$i]['motif_name_v']; ?></td>
                 <td align="left"><?php echo $res[$i]['aknowledge_date_d']; ?></td>
                  <td align="left"><?php echo $res[$i]['closure_date_d']; ?></td>
                  <td align="left"><?php echo $res[$i]['char_field_5']; ?></td>
                <td align="left"><?php echo $res[$i]['status_n']; ?></td>
                </tr>
            
         <?php }   ?>
     
        </tbody>
    </table></td>
                                            </tr>
                                        </table>









                                  </fieldset>

                                </div> 

                         









                        </td>

                    </tr>



                </table>


        </td>

        </tr>





    </table>

</div>

</div>
<div id="loader" ></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>

  <script type="text/javascript" >   
    
$('#tblClosedTicket').DataTable( {
    dom: 'Bfrtip',
								buttons: [
							            {
										extend: 'csv',
										title: "export<?php echo date('YmdHis'); ?>" 
									   }
								],
  "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"
  }
});
</script>


 



<script>
$('#addbtn2345').on('click',function(){
	 var dataURL = $(this).attr('data-href');
	 var modalTitle = $(this).attr('title'); 
	 $('.modal-title').html(modalTitle) ;
    $('.modal-body').load(dataURL ,function(){
        $('#myModalDesc').modal({
		 backdrop:'static',
		 keyboard: false
		});
    });
});
</script>


<script id="ajax" type="text/javascript">

var $modal = $('#myModal');

$('#addBtnCallReason').on('click', function(){
  // create the backdrop and wait for next modal to be triggered
 // $('body').modalmanager('loading');
   $('#loader').loading({
		  message : "Chargement...",
		  theme : 'dark'
		  
		});
    var dataURL = $(this).attr('data-href');
	 var modalTitle = $(this).attr('title'); 
	 $('.modal-title').html(modalTitle) ;
	  $('#loader').loading('stop'); 
	 $('.modal-body').load(dataURL ,function(){
        $modal.modal({
		 backdrop:'static',
		 keyboard: false
		});
    }); 

 
});




$("#tblClosedTicket").on('click','.cus-application-view-list', function(){
  // create the backdrop and wait for next modal to be triggered
 // $('body').modalmanager('loading');
   $('#loader').loading({
		  message : "Chargement...",
		  theme : 'dark'
		  
		});
    var dataURL = $(this).attr('data-href');
	 var modalTitle = $(this).attr('title'); 
	 $('.modal-title').html(modalTitle) ;
	  $('#loader').loading('stop'); 
	 $('.modal-body').load(dataURL ,function(){
        $modal.modal({
		 backdrop:'static',
		 keyboard: false
		});
    }); 

 
});

$("#tblClosedTicket").on('click','.cus-application-form-edit', function(){
  // create the backdrop and wait for next modal to be triggered
 // $('body').modalmanager('loading');
   $('#loader').loading({
		  message : "Chargement...",
		  theme : 'dark'
		  
		});
    var dataURL = $(this).attr('data-href');
	 var modalTitle = $(this).attr('title'); 
	 $('.modal-title').html(modalTitle) ;
	  $('#loader').loading('stop'); 
	 $('.modal-body').load(dataURL ,function(){
        $modal.modal({
		 backdrop:'static',
		 keyboard: false
		});
    }); 

 
});

$("#tblClosedTicket").on('click', '.cus-comment', function(){
  // create the backdrop and wait for next modal to be triggered
 // $('body').modalmanager('loading');
   $('#loader').loading({
		  message : "Chargement...",
		  theme : 'dark'
		  
		});
    var dataURL = $(this).attr('data-href');
	 var modalTitle = $(this).attr('title'); 
	 $('.modal-title').html(modalTitle) ;
	  $('#loader').loading('stop'); 
	 $('.modal-body').load(dataURL ,function(){
        $myLargeModal.modal({
		 backdrop:'static',
		 keyboard: false
		});
    }); 

 
});
</script> 
<script type="text/javascript" src="js/jquery.loading.min.js"></script>