114 lines
4.8 KiB
PHP
114 lines
4.8 KiB
PHP
<?php
|
|
|
|
|
|
require_once 'MonitoringVMHeader.php';
|
|
require_once 'MonitoringDBRequest.php';
|
|
|
|
$userId = $current_user->get('id');
|
|
|
|
$result1 = getResultatVMComptes($userId,$roleid);
|
|
$result2 = getResultatVM2Comptes();
|
|
$result3 = getResultatVM3Comptes();
|
|
|
|
|
|
|
|
|
|
|
|
function arraySearch($var, $array){
|
|
|
|
|
|
for($i=0;$i <= sizeof($array)-1;$i++){
|
|
|
|
|
|
if($var==$array[$i][0]){
|
|
|
|
|
|
return $array[$i][1];
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
$temp=array();
|
|
|
|
$result=array();
|
|
|
|
for($i=0;$i <= sizeof($result1)-1;$i++){
|
|
|
|
|
|
$temp[0]=$result1[$i][0];//userid
|
|
|
|
$temp['fullname']=$result1[$i][1];//fullname
|
|
|
|
$temp['NbrComptesLocaliser']=arraySearch($temp[0],$result3); //nbr total des comptes localiser
|
|
|
|
$temp['TotalCompte']=arraySearch($temp[0],$result2); //nbr total des comptes
|
|
|
|
$temp['NbrComptesNonLocaliser']=$temp['TotalCompte']-$temp['NbrComptesLocaliser']; //nbr total des comptes non localiser
|
|
|
|
|
|
//post
|
|
if(isDR($result1[$i][2]))
|
|
|
|
$temp[5]="DIRECTEUR REGIONAL";
|
|
|
|
|
|
if(isSuperviseur($result1[$i][2]))
|
|
|
|
$temp[5]="SUPERVISEUR";
|
|
|
|
|
|
if(isDM($result1[$i][2]))
|
|
|
|
$temp[5]="DELEGUE MEDICAL";
|
|
|
|
|
|
if($result1[$i][2]=="DIRECTEUR DE LA PROMOTION MEDICALE"){
|
|
|
|
|
|
$temp[5]="DIRECTEUR DE LA PROMOTION MEDICALE";
|
|
|
|
$temp[6]="OUEST";
|
|
|
|
}
|
|
|
|
|
|
//région
|
|
|
|
if(isOuestVMText($result1[$i][2]))
|
|
|
|
$temp[6]="OUEST";
|
|
|
|
|
|
if(isCentreVMText($result1[$i][2]))
|
|
|
|
$temp[6]="CENTRE";
|
|
|
|
|
|
if(isEstVMText($result1[$i][2]))
|
|
|
|
$temp[6]="EST";
|
|
|
|
|
|
|
|
$result[$i]=$temp;
|
|
|
|
}
|
|
|
|
echo getMonitoringMainBar(3,$roleid).
|
|
'<div class="main-container main-container-Accounts">
|
|
<div id="scrollbar" style="margin:15px 15px 15px 15px; border:1px solid #ecf0f1; overflow-y: scroll; overflow-x: scroll; height:462.709px ;border:1px solid #bdc3c7;">
|
|
<div style=" text-align: center"><h3>Nombre des comptes localisé/Non localisé</h3></div>
|
|
<hr>
|
|
<div class="form-row">
|
|
<div class="form-group col-md-4">
|
|
<label for="inputCity">Nom & Prénom</label>
|
|
<input class="form-control mb-4 w-20" type="text" name="nomprenom" placeholder="Rechercher" onKeyUp="fullNameChange(this)">
|
|
</div>'.getRegionSelectSubmit($roleid,false).getRolesSelect().'
|
|
</div>';
|
|
|
|
echo '<table id="tabcenter" class="table" >
|
|
|
|
<tr class="center borderline">
|
|
|
|
<th id="role" >Poste</th>
|
|
|
|
<th id="region" >Région</th>
|
|
|
|
<th id="fullname" > Nom & Prénom</th>
|
|
|
|
<th>Compte localisé</th>
|
|
|
|
<th>Compte non localisé</th>
|
|
|
|
<th style="text-align: center;"> total</th>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
</div></div>';
|
|
|
|
|
|
$viewer->view('CustomDashboardFooter.tpl');
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
function loadTable(data){
|
|
|
|
|
|
$('#tabcenter tr').slice(1).remove();
|
|
if(data.length > 0) {
|
|
|
|
for(var i = 0; i < data.length; i++) {
|
|
|
|
|
|
var row = data[i];
|
|
|
|
var click = "";
|
|
|
|
|
|
$('#tabcenter').append(
|
|
|
|
|
|
"<tr class='center borderline'"+click+">"
|
|
|
|
+"<td>"+row[5]+"</td>"
|
|
|
|
+"<td>"+row[6]+"</td>"
|
|
|
|
+"<td >"+row['fullname'].trim()+"</td>"
|
|
|
|
+"<td>"+row['NbrComptesLocaliser']+"</td>"
|
|
|
|
+"<td><span class='fieldValue'><span class='value'><a href='?module=Accounts&view=List&app=INVENTORY&parent=user;"+row['fullname']+"'>"+row['NbrComptesNonLocaliser']+"</a></span></span></td>"
|
|
|
|
+"<td style=' background:#7f8fa6; color: #ffffff;text-align: center;'>"+row['TotalCompte']+"</td>"
|
|
|
|
+"</tr>"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var result = <?php echo json_encode($result); ?>;
|
|
|
|
function loadByFullName() {
|
|
|
|
|
|
var fullnames = Array.prototype.slice.call(result).sort(function(a, b){
|
|
|
|
|
|
if(a.fullname < b.fullname) { return -1; }
|
|
|
|
if(a.fullname > b.fullname) { return 1; }
|
|
|
|
return 0;
|
|
|
|
});
|
|
|
|
loadTable(fullnames);
|
|
|
|
}
|
|
|
|
|
|
roleChange("DELEGUE MEDICAL");
|
|
|
|
|
|
|
|
|
|
|
|
//filtre nom/prenom
|
|
|
|
function fullNameChange(e) {
|
|
|
|
|
|
document.getElementById("role").value = "All";
|
|
|
|
document.getElementById("region").value = "All";
|
|
|
|
var res = result.filter(a => a.fullname.toUpperCase().includes(e.value.toUpperCase()) );
|
|
|
|
loadTable(res);
|
|
|
|
}
|
|
|
|
|
|
//filtre region
|
|
|
|
function regionChange(e) {
|
|
|
|
document.getElementById("role").value = "All";
|
|
|
|
|
|
var arrayFiltre=result;
|
|
|
|
var filteredValue = arrayFiltre.filter(function (item) {
|
|
|
|
return item[6] === e ;
|
|
|
|
});
|
|
|
|
|
|
if(e== "All"){filteredValue=arrayFiltre;}
|
|
|
|
|
|
loadTable(filteredValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//filtre Role
|
|
|
|
function roleChange(e) {
|
|
|
|
|
|
if(document.getElementById("region").options.length > 1)
|
|
|
|
document.getElementById("region").value = "All";
|
|
|
|
|
|
var arrayFiltre=result;
|
|
|
|
var filteredValue = arrayFiltre.filter(function (item) {
|
|
|
|
return item[5] === e ;
|
|
|
|
});
|
|
|
|
|
|
if(e== "All"){filteredValue=arrayFiltre;}
|
|
|
|
|
|
loadTable(filteredValue);
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
</html>
|