diff --git a/html/ajax_card.php b/html/ajax_card.php index 00a21f041..3906c6e9c 100644 --- a/html/ajax_card.php +++ b/html/ajax_card.php @@ -222,7 +222,7 @@ case 'bc': /* Before inserting a new card, the type must be selected */ /* ------------------------------------------------------------ */ case 'st': - $sql="select fd_id,fd_label from fiche_def"; + $sql="select fd_id,fd_label,fd_description from fiche_def"; /* if we filter thanks the ledger*/ if ( $ledger != -1 ) { @@ -275,7 +275,7 @@ case 'st': } $sql.=" ".$where." order by fd_label"; - $array=$cn->make_array($sql); + $array=$cn->get_array($sql); $html=HtmlInput::title_box(_("Choix de la catégorie"), $ctl); if ( empty($array)) @@ -287,22 +287,40 @@ case 'st': else { $r=''; - $r.='

'; + $r.='

'; $r.=_("Choississez la catégorie de fiche à laquelle vous aimeriez ajouter une fiche").'

'; - $isel=new ISelect('fd_id'); - $isel->value=$array; + $r.='
'; - $r.='
'; + + $msg=_('Choisissez une catégorie svp'); + $r.='" ; + $r.=''; $r.=dossier::hidden(); $r.=(isset($ref))?HtmlInput::hidden('ref',1):''; - - $r.=$isel->input(); + $r.=_('Filtrer').' '.HtmlInput::filter_table("cat_card_table", '0,1', 0); + $r.=''; + for ($i=0;$i'; + $r.=''; + $r.=''; + + $r.=""; + } + $r.='
'; + $r.=''.h($array[$i]['fd_label']).''; + $r.=''; + $r.=''.h($array[$i]['fd_description']).''; + $r.='
'; + $r.=HtmlInput::hidden('fd_id',0); $r.='

'; $r.=HtmlInput::submit('st','choix'); $r.=HtmlInput::button('Annuler',_('Annuler')," onclick=\"removeDiv('$ctl')\" "); $r.='

'; $r.='
'; - $r.='
'; + $r.=''; $html.=$r; } diff --git a/html/js/scripts.js b/html/js/scripts.js index e8cd6905e..5d555549f 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -1891,7 +1891,8 @@ function filter_table(phrase, _id, colnr, start_row) { aCol[0] = colnr; } var ele; - + var tot_found=0; + for (var r = start_row; r < table.rows.length; r++) { var found = 0; for (var col = 0; col < aCol.length; col++) @@ -1908,6 +1909,7 @@ function filter_table(phrase, _id, colnr, start_row) { } if (found === 1) { + tot_found++; table.rows[r].style.display = ''; } else { table.rows[r].style.display = 'none'; @@ -1915,6 +1917,15 @@ function filter_table(phrase, _id, colnr, start_row) { $('info_div').style.display = "none"; $('info_div').innerHTML = ""; } + if (tot_found == 0) { + if ($('info_'+_id)) { + $('info_'+_id).innerHTML=" Aucun résultat "; + } + } else { + if ($('info_'+_id)) { + $('info_'+_id).innerHTML=" "; + } + } } /** * @brief @@ -2539,4 +2550,23 @@ function show_description(p_id) $('print_desc'+p_id).hide(); $('input_desc'+p_id).show(); +} +/** + * Hightlight the row we select and restore previous one + * @param {type} x + * @returns {undefined} + */ +var old_class = null; +var old_select = null; + +function select_cat(x) +{ + if (old_select != null) + { + $(old_select).className = old_class; + } + old_select = $('select_cat_row_' + x); + old_class = old_select.className; + $(old_select).className = "highlight"; + $('fd_id').value = x; } \ No newline at end of file diff --git a/include/class_html_input.php b/include/class_html_input.php index 3f8ea98f2..8ca0c4cd6 100755 --- a/include/class_html_input.php +++ b/include/class_html_input.php @@ -779,6 +779,7 @@ class HtmlInput "; + $r.=' '; return $r; } diff --git a/include/class_iradio.php b/include/class_iradio.php index 0112ba8d9..bf2175269 100644 --- a/include/class_iradio.php +++ b/include/class_iradio.php @@ -39,6 +39,7 @@ class IRadio extends HtmlInput $check = ( $this->selected == true || $this->selected == 't' ) ? "checked" : "unchecked"; $r = 'value\""; + $r.=' class="css-checkbox" '; $r.=($this->javascript != '') ? 'onclick="' . $this->javascript . '"' : ''; $r.=" $check > "; return $r;