task #0000832: Filtrage simple de table

Ajout pour les utilisateurs, dossier, modèles, balances (PRINTBAL),
rapprochements bancaires(FREC)
This commit is contained in:
Dany De Bontridder 2013-05-06 23:35:00 +00:00
parent 524bbfb161
commit 647822c9ee
11 changed files with 92 additions and 26 deletions

View file

@ -49,6 +49,11 @@ content[18]="Donnez une partie du nom, prénom, de la description, du poste comp
content[19]="Donnez une partie du nom, de la description, du n° de TVA ou quick code";
content[20]="Les menus ne peuvent dépendre que dans d'un menu principal ou d'un menu, si cette liste est vide, ajouter des modules ou menu principal sans donner de dépendance";
content[21]="Donnez un nombre entre 0 & 100";
content[22]="Donnez une partie du nom du dossier,du nom, du prénom ou du login pour filtrer";
content[23]="Donnez une partie du nom du dossier ou de la description pour filtrer";
content[24]="Donnez une partie du poste comptable ou du libellé pour filtrer";
content[25]="Donnez une partie du libellé, la date, le montant ou le numéro d'opération pour filtrer, cela n'efface pas ce qui a déjà été sélectionné";
function showBulle(p_ctl)
{
d=document.getElementById('bulle');

View file

@ -1712,4 +1712,45 @@ function view_action(ag_id,dossier,modify)
}
}
);
}
/**
* @brief filter quickly a table
* @param phrase : phrase to seach
* @param _id : id of the table
* @param colnr : string containing the column number where you're searching separated by a comma
* @param start_row : first row (1 if you have table header)
* @returns nothing
* @see HtmlInput::filter_table
*/
function filter_table(phrase, _id, colnr,start_row) {
var words = phrase.value.toLowerCase();
var table = document.getElementById(_id);
// if colnr contains a comma then check several columns
var aCol = new Array();
if (colnr.indexOf(',') >= 0) {
aCol = colnr.split(',');
} else {
aCol[0] = colnr;
}
var ele;
for (var r = start_row; r < table.rows.length; r++) {
var found=0;
for (var col =0;col < aCol.length;col++)
{
var idx=aCol[col];
console.log(r);
if (table.rows[r].cells[idx])
{
ele = table.rows[r].cells[idx].innerHTML.replace(/<[^>]+>/g, "");
//var displayStyle = 'none';
if (ele.toLowerCase().indexOf(words) >= 0){ found=1; }
}
}
if (found == 1 ){
table.rows[r].style.display = '';
} else {
table.rows[r].style.display = 'none';
}
}
}

View file

@ -25,6 +25,7 @@
include_once ("ac_common.php");
require_once('class_database.php');
require_once('class_itext.php');
require_once 'function_javascript.php';
@html_page_start($_SESSION['g_theme']);
$rep=new Database();
include_once ("class_user.php");
@ -93,6 +94,7 @@ if ( $User->Admin() == 1)
include_once("user_menu.php");
$priv=($User->admin==1)?"Administrateur":"Utilisateur";
load_all_script();
echo '<div class="welcome"> ';
/**
*
@ -140,29 +142,18 @@ echo '</div>';
?>
<div class="foldercontent">
<?php echo '<h2 >'._('Choississez votre dossier').'</h2>';?>
<form method="get" action="?">
<input type="submit" class="button" value="<?php echo _('Rechercher');?>">
<?php
$w=new IText();
$p_nom=isset($_GET ['p_nom'])?$_GET['p_nom']:"";
echo $w->input('p_nom',$p_nom);
<span style="display:block">
<?php
echo _('Filtre').HtmlInput::infobulle(23);
?>
<span class="notice">
<?php
echo _('Donnez une partie du nom du dossier ou de la description à rechercher');
<?php
echo HtmlInput::filter_table("folder", '1,2',0);
?>
</span>
</form>
<?php
$filtre="";
if ( isset ($_GET ['p_nom']))
{
$filtre=$_GET['p_nom'];
}
// If admin show everything otherwise only the available dossier
$res=$User->show_dossier($filtre);
$res=$User->show_dossier("");
echo $res;
?>
<P>

View file

@ -172,6 +172,7 @@ if ( isset ($_GET['view'] ) )
$hid=new IHidden();
echo "<table>";
echo '<TR>';
echo '<TD><form method="GET" ACTION="export.php">'.
@ -255,8 +256,11 @@ if ( isset($_GET['view'] ) )
$a=$periode->get_date_limit($_GET['from_periode']);
$b=$periode->get_date_limit($_GET['to_periode']);
echo "<h2 class=\"info\"> période du ".$a['p_start']." au ".$b['p_end']."</h2>";
echo '<table width="100%">';
echo '<span style="display:block">';
echo _('Filtre').HtmlInput::infobulle(24);
echo HtmlInput::filter_table("t_balance", "0,1","1");
echo '</span>';
echo '<table id="t_balance" width="100%">';
echo '<th>Poste Comptable</th>';
echo '<th>Libell&eacute;</th>';
echo '<th>D&eacute;bit</th>';

View file

@ -713,4 +713,13 @@ class HtmlInput
return $sel;
}
}
static function filter_table($p_table_id,$p_col,$start_row)
{
$r= "
<form style=\"display:inline\">
<input class=\"input_text\" name=\"filter\" onkeyup=\"filter_table(this, '$p_table_id','$p_col',$start_row )\" type=\"text\">
</form>
";
return $r;
}
}

View file

@ -935,7 +935,7 @@ class User
if ($p_array == 0)
return $result . " * Aucun dossier *";
$result.="<TABLE style=\"width:auto;border-width:0px;border-collapse:collapse;\">";
$result.="<TABLE id=\"folder\" style=\"width:auto;border-width:0px;border-collapse:collapse;\">";
for ($i = 0; $i < sizeof($p_array); $i++)
{

View file

@ -122,7 +122,11 @@ echo 'solde Fin' . $nend_extrait->input();
echo IButton::tooggle_checkbox('rec1');
echo '</p>';
echo HtmlInput::submit('save', 'Mettre à jour le n° de relevé bancaire');
echo '<table class="sortable" style="width:80%;margin-left:10%">';
echo '<span style="display:block">';
echo _('Filtre').HtmlInput::infobulle(25);
echo HtmlInput::filter_table("t_rec_bk", "0,1,2,3","1");
echo '</span>';
echo '<table id="t_rec_bk" class="sortable" style="width:80%;margin-left:10%">';
$r ='<th class=" sorttable_sorted_reverse">'.'Date '.HtmlInput::infobulle(17).'<span id="sorttable_sortrevind">&nbsp;&blacktriangle;</span>'.'</th>';
$r.=th('Libellé');
$r.=th('N° interne');

View file

@ -35,8 +35,9 @@ $g_failed="<span style=\"font-size:18px;color:red\">&#x2716;</span>";
$g_succeed="<span style=\"font-size:18px;color:green\">&#x2713;</span>";
/*set to none for production */
/* uncomment for production */
define ('SVNINFO',5666);
$version_phpcompta=SVNINFO;
define ("DEBUG",false);
define ("DEBUG",true);
/* define ('SVNINFO',5015);
* $version_phpcompta=SVNINFO;
* define ("DEBUG",true);

View file

@ -172,7 +172,11 @@ if ( $sa == 'list' )
$compteur=1;
$template="";
echo '<div class="content">';
echo '<TABLE class="table_large" >';
echo '<span style="display:block">';
echo _('Filtre').HtmlInput::infobulle(23);
echo HtmlInput::filter_table("t_dossier", "0,1,2","1");
echo '</span>';
echo '<TABLE id="t_dossier" class="table_large" >';
$r="";
$r.='<th>'.$header->get_header(0).'</td>';
$r.='<th>'.$header->get_header(1).'</td>';

View file

@ -232,8 +232,11 @@ if ($sa == 'list')
echo HtmlInput::button_anchor('Rafra&icirc;chir', 'admin_repo.php?action=modele_mgt');
echo HtmlInput::button_anchor('Ajouter', 'admin_repo.php?action=modele_mgt&sa=add');
echo '<table class="result" style="border-spacing:10;border-collapse:separate" >';
echo '<span style="display:block;margin-top:10">';
echo _('Filtre').HtmlInput::infobulle(23);
echo HtmlInput::filter_table("t_modele", "0,1,2","1");
echo '</span>';
echo '<table id="t_modele" class="table_large" style="border-spacing:10;border-collapse:separate" >';
echo "<TR>".
"<TH>".$header->get_header(0)."</TH>" .
"<TH>".$header->get_header(1)."</TH>" .

View file

@ -112,7 +112,11 @@ $a_user=$repo->get_user_folder($sql);
if ( !empty ($a_user) )
{
echo '<table class="result">';
echo '<span style="display:block">';
echo _('Filtre').HtmlInput::infobulle(22);
echo HtmlInput::filter_table("user", "0,1,2,5","1");
echo '</span>';
echo '<table id="user" class="result">';
echo '<tr>';
echo '<th>'.$header->get_header(0).'</th>';
echo '<th>'.$header->get_header(1).'</th>';