Commit 05f399c5 authored by Tibor Katelbach's avatar Tibor Katelbach
Browse files

DEAL tweaks observatory global

parent 1faa9a13
......@@ -9,7 +9,7 @@ class DashboardAction extends CAction
$tpl = "costum.views.custom.process.dashboard";
$answers = PHDB::find( Form::ANSWER_COLLECTION,[ //"formId" => $params["formId"],
"parentSlug" => $controller->costum["contextSlug"] ] );
"parentSlug" => Yii::app()->session['costum']["contextSlug"] ] );
$blocks = [];
$title = "Observatoire <br/>de l'amélioration de l'habitat Réunion";
......@@ -115,6 +115,52 @@ class DashboardAction extends CAction
echo "<br/>---- xxx Tasks";*/
//count
$countAnswersWithOperators = 0;
$countAnswersWithOperatorsUnset = 0;
$countAnswersFinanced = 0;
$countAnswersFinished = 0;
$countAnswersRefused = 0;
$totalASked = 0;
$totalFinanced = 0;
$pieBudgetPerOperatorLbl = [];
$pieBudgetPerOperatorData = [];
$pieBudgetPerFinancerLbl = [];
$pieBudgetPerFinancerData = [];
foreach ($answers as $key => $ans) {
if( isset($ans["step"]) && $ans["step"] == "deal5" )
$countAnswersFinanced++;
if( isset($ans["links.operators"]) ){
$hasOperator = false;
foreach ( $ans["links.operators"] as $oid => $op) {
if($op != "0")
$hasOperator = true;
}
if($hasOperator)
$countAnswersWithOperators++;
else
$countAnswersWithOperatorsUnset++;
}
if( isset($ans["validation"]) ){
$refused = false;
foreach ( $ans["validation"] as $step => $v) {
if($v["valid"] == "notValid")
$refused = true;
}
if( isset($ans["validation"]['deal5']["finsished"]) && $ans["validation"]['deal5']["finsished"] == true )
$countAnswersFinished++;
if($refused)
$countAnswersRefused++;
}
if( isset($ans["deal3"]["budget"]) ){
foreach ($ans["deal3"]["budget"] as $bix => $bud) {
}
}
}
$lists = [
"chiffresDoss" =>[
......@@ -124,12 +170,13 @@ class DashboardAction extends CAction
"color" => "#fff",
"data" => [
["data"=>count($answers),"name"=>"Dossier déposés","icon"=>"folder-open","type"=>"default"],
["data"=>24,"name"=>"Dossier instruit","icon"=>"gavel","type"=>"success"],
["data"=>24,"name"=>"Dossier financé","icon"=>"money","type"=>"success"],
["data"=>24,"name"=>"Dossier refusé","icon"=>"thumbs-down","type"=>"success"],
["data"=>45,"name"=>"Dossier en attente de decision","type"=>"danger","icon"=>"hourglass-half"],
["data"=>60,"name"=>"Dossier en attente de decision","type"=>"danger","icon"=>"money"],
["data"=>45,"name"=>"Dossier abandonné","icon"=>"ban"],
["data"=>$countAnswersWithOperators,"name"=>"Dossier géré avec opérateur","icon"=>"handshake-o"],
["data"=>$countAnswersWithOperatorsUnset,"name"=>"Dossier sans opérateur","icon"=>"gavel","type"=>"danger"],
["data"=>$countAnswersFinanced,"name"=>"Dossier financé","icon"=>"money","type"=>"success"],
["data"=>$countAnswersFinished,"name"=>"Dossier clôturé","icon"=>"handshake-o","type"=>"success"],
["data"=>$countAnswersRefused,"name"=>"Dossier refusé","icon"=>"thumbs-down","type"=>"danger"],
["data"=>"??","name"=>"Dossier en attente de decision","type"=>"danger","icon"=>"hourglass-half"],
["data"=>"??","name"=>"Dossier abandonné","icon"=>"ban","type"=>"danger"],
],
"tpl" => "costum.views.tpls.list"
],
......@@ -152,7 +199,10 @@ class DashboardAction extends CAction
"bgColor" => Ctenat::$COLORS[0],
"color" => "#fff",
"data" => [
["data"=>24,"name"=>"for open projects Finance distribution per presta/ commons","icon"=>"thumbs-up","type"=>"success"],
["data"=>24,"name"=>"Budget des projets en cours","icon"=>"thumbs-up","type"=>"success"],
["data"=>45,"name"=>"Budget en cours de validation","type"=>"danger","icon"=>"map-marker"],
["data"=>60,"name"=>"","type"=>"danger","icon"=>"money"]
["data"=>24,"name"=>"Open projects Finance distribution","icon"=>"thumbs-up","type"=>"success"],
["data"=>45,"name"=>"for open projects Finance distribution per task types","type"=>"danger","icon"=>"map-marker"],
["data"=>60,"name"=>"for each worker Finances distribution per project","type"=>"danger","icon"=>"money"]
],
......@@ -165,7 +215,7 @@ class DashboardAction extends CAction
"url" => "/graph/co/dash/g/graph.views.co.line"
],
"decision" =>[
"title"=>"Décision",
"title"=>"Finaance",
"data" => [32,344,36,21,10],
"lbls" => ["Décision 0","Décision 1","Décision 2","Décision 3","Décision 4"],
"url"=>"/graph/co/dash/g/costum.views.custom.ctenat.graph.pieMany"
......
<style type="text/css">
#allAnswersList{ list-style: none }
#allAnswersList li{ padding:5px; border-bottom: 1px solid #ccc; display: block; }
</style>
<div class="col-xs-12 text-center">
<a href="javascript:;" class='btn btn-xs btn-default' id="showAnswerBtn"><i class="fa fa-bars"></i> Les <?php echo $what ?></a>
<a href="#dashboard" class='lbh btn btn-xs btn-default'><i class="fa fa-area-chart"></i> Observatoire Global</a>
<a href="/costum/co/index/slug/<?php echo $el["slug"] ?>/answer/new" class='btn btn-xs btn-primary' id="showAnswerBtn"><i class="fa fa-plus"></i> Ajouter <?php echo $what ?></a>
</div>
<div id="allAnswersContainer" class="hide col-xs-12 col-lg-offset-3 col-lg-6 margin-top-20">
<ul id="allAnswersList">
<?php
$ct = 0;
if(!empty($allAnswers)){
foreach ($allAnswers as $k => $ans) {
$ct++;
$lbl = $what." ".$ct;
if(isset(Yii::app()->session["costum"]["form"]["title"]))
{
$titlePath = explode( ".", Yii::app()->session["costum"]["form"]["title"] );
if(isset($ans["answers"][$titlePath[0]][$titlePath[1]]))
$lbl = $ans["answers"][$titlePath[0]][$titlePath[1]];
}
?>
<<<<<<< Updated upstream:views/tpls/forms/cplx/answers.php
<li class="answerLi">
<a class="col-xs-3" href="/costum/co/index/slug/<?php echo $el["slug"] ?>/answer/<?php echo $ans["_id"] ?>"> <?php echo $lbl." ".$ct ?></a>
=======
<li class="answerLi col-xs-12" >
<div class="col-xs-3 text-center">
<a href="/costum/co/index/slug/<?php echo $el["slug"] ?>/answer/<?php echo $ans["_id"] ?>"> <?php echo $lbl ?></a>
</div>
>>>>>>> Stashed changes:views/custom/sommom/answers.php
<?php
$lblp = "";
$percol = "danger";
if(!isset($ans["answers"])) {
$lblp = "no answers" ;
$percent = 0;
} else {
$totalInputs = 0;
$answeredInputs = 0;
foreach (Yii::app()->session["forms"] as $ix => $f) {
$totalInputs += count($f["inputs"]);
//echo "|".$f['id']."-fi=".count($f["inputs"]);
if( isset( $ans["answers"][$f['id']] ) ){
$answeredInputs += count( $ans["answers"][$f['id']] );
//echo "|".$f['id']."-ai=".count( $ans["answers"][$f['id']] )."<br/>";
}
}
//echo "tot".$totalInputs."-ans".$answeredInputs;
$percent = floor($answeredInputs*100/$totalInputs);
$lblp = $percent."%";
}
if( $percent > 50 )
$percol = "warning";
if( $percent > 75 )
$percol = "success";
?>
<span class="label label-<?php echo $percol ?>"> <i class="fa fa-pencil-square-o"></i> <?php echo $lblp ?> </span>
<span class="margin-left-5 label label-primary"> <i class="fa fa-group"></i> 3 Participants</span>
<span class="margin-left-5 label label-default"> <i class="fa fa-calendar"></i> <?php echo date("d/m/y H:i",$ans["created"]); ?></span>
<a href="#dashboard.answer.<?php echo $ans["_id"] ?>" class='lbh btn btn-xs btn-default margin-left-5'> <i class="fa fa-pie-chart "></i> Observatoire Local</a>
<a class='text-red pull-right' href=""> <i class="fa fa-trash"></i> </a>
</li>
<?php }?>
<li class="text-center"><a href="/costum/co/index/slug/<?php echo $el["slug"] ?>/answer/new" class="btn btn-xs btn-primary"><i class="fa fa-plus"></i> Ajouter</a></li>
</ul>
</div>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment