Merge pull request #21419 from NextGestion/dolibarr_fixbugs

Add input "Search" to multiSelectArrayWithCheckbox() function
This commit is contained in:
Laurent Destailleur 2023-05-03 02:02:04 +02:00 committed by GitHub
commit 4fb57477a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -8760,9 +8760,10 @@ class Form
<input type="hidden" class="' . $htmlname . '" name="' . $htmlname . '" value="' . $listcheckedstring . '">
</dt>
<dd class="dropdowndd">
<div class="multiselectcheckbox' . $htmlname . '">
<ul class="' . $htmlname . ($pos == '1' ? 'left' : '') . '">
' . $listoffieldsforselection . '
<div class="multiselectcheckbox'.$htmlname.'">
<ul class="'.$htmlname.($pos == '1' ? 'left' : '').'">
<li><input class="inputsearch_dropdownselectedfields width90p minwidth200" style="width:90%;" type="text" placeholder="'.$langs->trans('Search').'"></li>
'.$listoffieldsforselection.'
</ul>
</div>
</dd>
@ -8785,6 +8786,12 @@ class Form
// Now, we submit page
//$(this).parents(\'form:first\').submit();
});
$("input.inputsearch_dropdownselectedfields").on("keyup", function() {
var value = $(this).val().toLowerCase();
$(\'.multiselectcheckbox'.$htmlname.' li > label\').filter(function() {
$(this).parent().toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});

View File

@ -153,6 +153,7 @@ if (!defined('JS_JQUERY_DISABLE_DROPDOWN')) {
// Click onto the link "link to" or "hamburger", toggle dropdown
$(document).on(\'click\', \'.dropdown dt a\', function () {
console.log("toggle dropdown dt a");
setTimeout(() => { $(\'.inputsearch_dropdownselectedfields\').focus(); }, 200);
//$(this).parent().parent().find(\'dd ul\').slideToggle(\'fast\');
$(".ulselectedfields").removeClass("open");

View File

@ -1814,7 +1814,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
print '<td class="nowraponall">';
$durationtouse = (GETPOST('timespent_duration') ? GETPOST('timespent_duration') : '');
if (GETPOSTISSET('timespent_durationhour') || GETPOSTISSET('timespent_durationmin')) {
$durationtouse = (GETPOST('timespent_durationhour') * 3600 + GETPOST('timespent_durationmin') * 60);
$durationtouse = ((int) GETPOST('timespent_durationhour') * 3600 + (int) GETPOST('timespent_durationmin') * 60);
}
print $form->select_duration('timespent_duration', $durationtouse, 0, 'text');
print '</td>';