<?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']);
include($_SESSION['basedir'] . "core.php");
$res = $dba->getUserDetailByRight($_SESSION['right'], $_SESSION['ownerId'], false, 0, 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>Liste des utilsateurs</h1>
        <small>Utilisateurs </small>
    </div>
</section>
<!-- Main content -->

<section class="content">
    <div class="row">
        <div class="col-sm-12">
            <div class="panel panel-bd lobidrag">
                <div class="panel-heading">
                    <div class="btn-group" id="buttonexport">
                        <a href="#">
                            <h4>Invoices</h4>
                        </a>
                    </div>
                </div>
                <div class="panel-body">
                    <!-- Plugin content:powerpoint,txt,pdf,png,word,xl -->
                    <div class="btn-group">
                        <button class="btn btn-exp btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bars"></i> Export Table Data</button>
                        <ul class="dropdown-menu exp-drop" role="menu">
                            <li>
                                <a href="#" onclick="$('#tbluserProd').tableExport({type: 'json', escape: 'false'});"> 
                                    <img src="assets/dist/img/json.png" width="24" alt="logo"> JSON</a>
                            </li>
                            <li>
                                <a href="#" onclick="$('#tbluserProd').tableExport({type: 'json', escape: 'false', ignoreColumn: '[2,3]'});">
                                    <img src="assets/dist/img/json.png" width="24" alt="logo"> JSON (ignoreColumn)</a>
                            </li>
                            <li><a href="#" onclick="$('#tbluserProd').tableExport({type: 'json', escape: 'true'});">
                                    <img src="assets/dist/img/json.png" width="24" alt="logo"> JSON (with Escape)</a>
                            </li>
                            <li class="divider"></li>
                            <li><a href="#" onclick="$('#tbluserProd').tableExport({type: 'xml', escape: 'false'});">
                                    <img src="assets/dist/img/xml.png" width="24" alt="logo"> XML</a>
                            </li>
                            <li><a href="#" onclick="$('#tbluserProd').tableExport({type: 'sql'});"> 
                                    <img src="assets/dist/img/sql.png" width="24" alt="logo"> SQL</a>
                            </li>
                            <li class="divider"></li>
                            <li>
                                <a href="#" onclick="$('#tbluserProd').tableExport({type: 'csv', escape: 'false'});"> 
                                    <img src="assets/dist/img/csv.png" width="24" alt="logo"> CSV</a>
                            </li>
                            <li>
                                <a href="#" onclick="$('#tbluserProd').tableExport({type: 'txt', escape: 'false'});"> 
                                    <img src="assets/dist/img/txt.png" width="24" alt="logo"> TXT</a>
                            </li>
                            <li class="divider"></li>
                            <li>
                                <a href="#" onclick="$('#tbluserProd').tableExport({type: 'excel', escape: 'false'});"> 
                                    <img src="assets/dist/img/xls.png" width="24" alt="logo"> XLS</a>
                            </li>
                            <li>
                                <a href="#" onclick="$('#tbluserProd').tableExport({type: 'doc', escape: 'false'});">
                                    <img src="assets/dist/img/word.png" width="24" alt="logo"> Word</a>
                            </li>
                            <li>
                                <a href="#" onclick="$('#tbluserProd').tableExport({type: 'powerpoint', escape: 'false'});"> 
                                    <img src="assets/dist/img/ppt.png" width="24" alt="logo"> PowerPoint</a>
                            </li>
                            <li class="divider"></li>
                            <li>
                                <a href="#" onclick="$('#tbluserProd').tableExport({type: 'png', escape: 'false'});"> 
                                    <img src="assets/dist/img/png.png" width="24" alt="logo"> PNG</a>
                            </li>
                            <li>
                                <a href="#" onclick="$('#tbluserProd').tableExport({type: 'pdf', pdfFontSize: '7', escape: 'false'});"> 
                                    <img src="assets/dist/img/pdf.png" width="24" alt="logo"> PDF</a>
                            </li>
                        </ul>
                    </div>
                    <!-- ./Plugin content:powerpoint,txt,pdf,png,word,xl -->
                    <div class="table-responsive">
                        <table id="tbluserProd" class="table table-striped table-bordered" width="100%" cellspacing="0">
                            <thead>
                                <tr>
                                    <th width="7%">#Id</th>
                                    <th width="14%">Date de cr&eacute;ation</th>
                                    <th width="8%">Login</th>
                                    <th width="23%">Nom &amp; Prénoms</th>
                                    <th width="11%">Numéro</th>
                                    <th width="11%">Type</th>
                                    <th width="9%">Action</th>
                                </tr>
                            </thead>
                            <tbody>

                                <?php
                                $cmpt = 1;

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




                                    <tr>
                                        <td><?php echo $i + 1; ?></td>
                                        <td><?php echo $res[$i]['creation_date_d']; ?></td>
                                        <td><?php echo $res[$i]['user_name_v']; ?></td>
                                        <td><?php echo $res[$i]['last_name_v'] . " " . $res[$i]['first_name_v']; ?></td>
                                        <td><?php echo $res[$i]['mobile_phone_v']; ?></td>
                                        <td><?php echo $res[$i]['profile_name_v']; ?></td>
                                        <td></td>
                                    </tr>

<?php } ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- customer Modal1 -->
    <div class="modal fade" id="customer1" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header modal-header-primary">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3><i class="fa fa-user m-r-5"></i> Update Invoices</h3>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-12">
                            <form class="form-horizontal">
                                <fieldset>
                                    <!-- Text input-->
                                    <div class="col-md-4 form-group">
                                        <label class="control-label">Account:</label>
                                        <input type="text" placeholder="Accounts" class="form-control">
                                    </div>
                                    <!-- Text input-->
                                    <div class="col-md-4 form-group">
                                        <label class="control-label">Amount</label>
                                        <input type="text" placeholder="Amount" class="form-control">
                                    </div>
                                    <!-- Text input-->
                                    <div class="col-md-4 form-group">
                                        <label class="control-label">Invoice Date</label>
                                        <input type="number" placeholder="Invoice Date" class="form-control">
                                    </div>
                                    <div class="col-md-6 form-group">
                                        <label class="control-label">Due Date</label>
                                        <input type="number" placeholder="Due Date" class="form-control">
                                    </div>
                                    <div class="col-md-6 form-group">
                                        <label class="control-label">type</label>
                                        <input type="text" placeholder="type" class="form-control">
                                    </div>
                                    <div class="col-md-12 form-group user-form-group">
                                        <div class="pull-right">
                                            <button type="button" class="btn btn-danger btn-sm">Cancel</button>
                                            <button type="submit" class="btn btn-add btn-sm">Save</button>
                                        </div>
                                    </div>
                                </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-danger pull-left" data-dismiss="modal">Close</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->
    <!-- Modal -->   
    <!-- Customer Modal2 -->
    <div class="modal fade" id="customer2" tabindex="-1" role="dialog" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header modal-header-primary">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3><i class="fa fa-user m-r-5"></i> Delete Invoices</h3>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-12">
                            <form class="form-horizontal">
                                <fieldset>
                                    <div class="col-md-12 form-group user-form-group">
                                        <label class="control-label">Delete Invoices</label>
                                        <div class="pull-right">
                                            <button type="button" class="btn btn-danger btn-sm">NO</button>
                                            <button type="submit" class="btn btn-add btn-sm">YES</button>
                                        </div>
                                    </div>
                                </fieldset>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-danger pull-left" data-dismiss="modal">Close</button>
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
    <!-- /.modal -->
</section>

<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" >   
    
$('#tbluserProd').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"
  }
});
</script>

