From 7b9f45027ff7518825eaa3e0738bb069d1f3bfa1 Mon Sep 17 00:00:00 2001
From: Alex Orluc <alex.orluc@maarch.org>
Date: Fri, 17 Feb 2017 15:36:03 +0100
Subject: [PATCH] add status (parameter) in difflists + modif css

---
 apps/maarch_entreprise/js/functions.js                 |  9 ++++-----
 .../template/documents_list_with_attachments.html      |  6 ++----
 modules/entities/difflist_display.php                  | 10 ++++++++++
 modules/entities/loadDiffList.php                      |  6 ++++++
 modules/entities/xml/IVS/validation_rules.xml          |  1 +
 5 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/apps/maarch_entreprise/js/functions.js b/apps/maarch_entreprise/js/functions.js
index d17ccc7f6c1..a2c78e1c00e 100755
--- a/apps/maarch_entreprise/js/functions.js
+++ b/apps/maarch_entreprise/js/functions.js
@@ -3041,21 +3041,20 @@ function loadDiffList(id)
         parameters: { res_id : id },
         onSuccess: function(answer){
             eval("response = "+answer.responseText);
-            $('divDiffList_'+id).innerHTML = response.toShow;
+            $('divDiffList_'+id).innerHTML = '<fieldset style="border: 1px dashed rgb(0, 157, 197);width:100%;"><legend>Liste de diffusion:</legend>'+response.toShow+'</fieldset>';
         }
     });
     var path_manage_script = 'index.php?module=entities&page=loadDiffList&display=true';
     new Ajax.Request(path_manage_script,
     {
         method:'post',
-        parameters: { res_id : id,typeList : 'VISA_CIRCUIT' },
+        parameters: { res_id : id,typeList : 'VISA_CIRCUIT',showStatus : true },
         onSuccess: function(answer){
             eval("response = "+answer.responseText);
-            console.log(response.toShow);
             if(!response.toShow.match(/<div style="font-style:italic;text-align:center;color:#ea0000;margin:10px;">/)){
-                $('divDiffList_'+id).innerHTML += response.toShow;
+                $('divDiffList_'+id).innerHTML += '<fieldset style="border: 1px dashed rgb(0, 157, 197);width:100%;"><legend>Circuit de visa:</legend>'+response.toShow+'</fieldset>';
                  $j('#divDiffList_'+id).css({"width":"97%","display":"table"});
-                $j('#divDiffList_'+id).children().css({"width":"50%","display":"table-cell","vertical-align":"top","padding":"5px"});
+                $j('#divDiffList_'+id).children().css({"width":"48%","display":"table-cell","vertical-align":"top","padding":"5px","margin":"5px"});
             }
             
             
diff --git a/apps/maarch_entreprise/template/documents_list_with_attachments.html b/apps/maarch_entreprise/template/documents_list_with_attachments.html
index 63ab4c349c9..db0ac81a931 100644
--- a/apps/maarch_entreprise/template/documents_list_with_attachments.html
+++ b/apps/maarch_entreprise/template/documents_list_with_attachments.html
@@ -164,8 +164,7 @@ Mods
                 </tr>
 			   <tr id="noteList_##loadValue|res_id##" name="noteList_##loadValue|res_id##" style="display: none; border-bottom: solid 1px black; background-color: white;" width="100%">
 					<td colspan="6" style="background-color: #f2f2f2;">
-						<div id="divNoteList_##loadValue|res_id##" align="center" style="color: grey;margin:10px;padding:10px;
-  border: 1px dashed #009DC5;">
+						<div id="divNoteList_##loadValue|res_id##" align="center" style="color: grey;margin:10px;padding:10px;border: 1px dashed #009DC5;">
 							<i class="fa fa-spinner fa-2x"></i><br />
 							##define_lang|_LOADING_INFORMATIONS##
 						</div>
@@ -190,8 +189,7 @@ Mods
                 </tr>
                 <tr id="diffList_##loadValue|res_id##" name="diffList_##loadValue|res_id##" style="display: none; border-bottom: solid 1px black;" width="100%">
                     <td colspan="2" style="background-color: #f2f2f2;">
-                        <div id="divDiffList_##loadValue|res_id##" align="center" style="color: grey;margin:10px;padding:10px;
-  border: 1px dashed #009DC5;">
+                        <div id="divDiffList_##loadValue|res_id##" align="center" style="color: grey;margin:10px;padding:10px;">
                             <i class="fa fa-spinner fa-2x"></i><br />
                             ##defineLang|_LOADING_INFORMATIONS##
                         </div>
diff --git a/modules/entities/difflist_display.php b/modules/entities/difflist_display.php
index 15339dc93de..fb5d048f0d2 100644
--- a/modules/entities/difflist_display.php
+++ b/modules/entities/difflist_display.php
@@ -51,6 +51,16 @@
                     </td>
                     <td style="width:37%;"><?php functions::xecho($user['lastname'] . " " . $user['firstname']);?></td>
                     <td style="width:38%;"><?php functions::xecho($user['entity_label']);?></td>
+                    <?php
+                    if($showStatus == true){
+                        if(!empty($difflist[$role_id]['users'][$i]['process_date'])){
+                            echo '<td style="width:5%;"><i class="fa fa-check" aria-hidden="true" style="color:green;"></i></td>';
+                        }else{
+                            echo '<td style="width:5%;"><i class="fa fa-hourglass" aria-hidden="true"></i></td>';
+                        }
+                    }
+                    
+                    ?>
                 </tr><?php
             } ?>
             </table><?php
diff --git a/modules/entities/loadDiffList.php b/modules/entities/loadDiffList.php
index 2c59c2223b6..5adb6069738 100644
--- a/modules/entities/loadDiffList.php
+++ b/modules/entities/loadDiffList.php
@@ -11,6 +11,12 @@ if(isset($_REQUEST['typeList'])){
 }else{
     $typeList = 'entity_id';
 }
+
+if(isset($_REQUEST['showStatus'])){
+    $showStatus = true;
+}else{
+    $showStatus = false;
+}
 require_once('modules/entities/class/class_manage_listdiff.php');
 $diffListObj = new diffusion_list();
 $difflist = $diffListObj->get_listinstance($_REQUEST['res_id'], false, $_SESSION['collection_id_choice'],$typeList);
diff --git a/modules/entities/xml/IVS/validation_rules.xml b/modules/entities/xml/IVS/validation_rules.xml
index 703fe4b9d9f..a9208ffd958 100755
--- a/modules/entities/xml/IVS/validation_rules.xml
+++ b/modules/entities/xml/IVS/validation_rules.xml
@@ -213,6 +213,7 @@
 		<parameter name="module" type="identifier" />
 		<parameter name="res_id" type="integer" />
                 <parameter name="typeList" type="string" />
+                <parameter name="showStatus" type="boolean" />
     </validationRule>
 
     <validationRule name="loadDiffListHistory" extends="standardForm" mode="error">
-- 
GitLab