Skip to content

Commit

Permalink
#512 [TimeSpent] add: More sticky for header column
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Sep 1, 2023
1 parent 825666d commit 64ffc29
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/dolisirh_timespent.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,8 @@ function task_lines_within_range(int &$inc, int $timestampStart, int $timestampE
}

print '<tr class="oddeven trforbreak nobold">';
print '<td colspan="' . (2 + $addColSpan + $daysInRange) . '"' . ($project->status == $project::STATUS_CLOSED ? 'style="background-color: #CBCDCD!important;' : '') . '>';
print '<span style="position: sticky; left: 20px;">' . $project->getNomUrl(1, '', 0, '<strong>' . $langs->transnoentitiesnoconv('YourRole') . ' : </strong> ' . $projectsRole[$lines[$i]->fk_project]);
print '<td colspan="' . (2 + $addColSpan + $daysInRange) . '"' . ($project->status == $project::STATUS_CLOSED ? "style='background-color: #CBCDCD!important;'" : '') . '>';
print '<span style="position: sticky; left: 5px;">' . $project->getNomUrl(1, '', 0, '<strong>' . $langs->transnoentitiesnoconv('YourRole') . ' : </strong> ' . $projectsRole[$lines[$i]->fk_project]);
if ($thirdparty->id > 0) {
print ' - ' . $thirdparty->getNomUrl(1);
}
Expand All @@ -660,7 +660,7 @@ function task_lines_within_range(int &$inc, int $timestampStart, int $timestampE
print '<tr class="oddeven" data-task_id="' . $lines[$i]->id . '" >';

// Ref.
print '<td class="nowrap" style="position: sticky; left: 20px; background-color: #FFFFFF;">';
print '<td class="nowrap" style="position: sticky; left: 0; background-color: #FFFFFF;">';
print '<!-- Task id = ' . $lines[$i]->id . ' -->';
for ($k = 0; $k < $level; $k++) {
print '<div class="marginleftonly">';
Expand Down Expand Up @@ -756,7 +756,7 @@ function task_lines_within_range(int &$inc, int $timestampStart, int $timestampE

$tableCell .= '<div class="modal-open">';
$tableCell .= '<input hidden class="modal-options" data-modal-to-open="timespent" data-from-id="' . $lines[$i]->id . '" data-from-module="dolisirh">';
$tableCell .= '<input type="text" alt="' . ($disabledTaskDay ? '' : $altTitle) . '" title="' . ($disabledTaskDay ? '' : $altTitle) . '" ' . ($disabledTaskDay ? 'disabled' : '') . ' class="center smallpadd timespent" size="2" id="timeadded[' . $inc . '][' . $idw.']" name="task[' . $lines[$i]->id . '][' . $idw . ']" data-task-id=' . $lines[$i]->id . ' data-timestamp=' . $dayInLoop . ' data-date=' . dol_print_date($dayInLoop, 'day') . ' data-cell=' . $idw . ' value="" cols="2" maxlength="5">';
$tableCell .= '<input type="text" alt="' . ($disabledTaskDay ? '' : $altTitle) . '" title="' . ($disabledTaskDay ? '' : $altTitle) . '" ' . ($disabledTaskDay ? 'disabled' : '') . ' class="center smallpadd timespent" size="2" id="timeadded[' . $inc . '][' . $idw.']" name="task[' . $lines[$i]->id . '][' . $idw . ']" data-task-id=' . $lines[$i]->id . ' data-timestamp=' . $dayInLoop . ' data-date="' . dol_print_date($dayInLoop, '%a') . ' - ' . dol_print_date($dayInLoop, 'dayreduceformat') . '" data-cell=' . $idw . ' value="" cols="2" maxlength="5">';
$tableCell .= '</div></td>';
print $tableCell;
}
Expand Down
18 changes: 10 additions & 8 deletions view/timespent_range.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,10 @@

print '<div class="' . ($conf->browser->layout == 'phone' ? 'div-table-responsive' : '') . '">';
print '<table class="tagtable liste" id="tablelines3">';
print '<thead style="position: sticky; top: 20px; background-color: #FFFFFF; z-index: 1001;">';
print '<thead style="position: sticky; top: 0; background-color: var(--colorbacklineimpair2); z-index: 1040;">';

// If the user can view user other than himself.
$moreForFilter = '<tr class="liste_titre"><td class="liste_titre" colspan="' . (3 + $daysInRange) . '">';
$moreForFilter = '<tr class="liste_titre"><td class="liste_titre" style="position: sticky; left: 0; background-color: var(--colorbacktitle1); z-index: 1100;">';
$includeOnly = '';
if (empty($user->rights->user->user->lire)) {
$includeOnly = [$user->id];
Expand All @@ -503,20 +503,22 @@
$moreForFilter .= img_picto($langs->trans('Filter') . ' ' . $langs->trans('ThirdParty'), 'company', 'class="marginleftonly paddingright pictofixedwidth"') . '<input type="text" name="search_thirdparty" class="maxwidth100" value="' . dol_escape_htmltag($searchThirdparty) . '">';
}

$moreForFilter .= '</td>';

// Filter on categories.
if (isModEnabled('categorie') && $user->rights->categorie->lire) {
$moreForFilter .= '<span class="marginleftonly">' . $formCategory->getFilterBox(Categorie::TYPE_PROJECT, $searchCategoryArray) . '</span>';
$moreForFilter .= '<td class="liste_titre" colspan="6"><span>' . $formCategory->getFilterBox(Categorie::TYPE_PROJECT, $searchCategoryArray, 'minwidth300 widthcentpercentminusx timespent-list-z-index') . '</span></td>';
}

$moreForFilter .= '</td></tr>';
$moreForFilter .= '<td class="liste_titre" colspan="' . (2 + $daysInRange - 6) . '"></td></tr>';

print $moreForFilter;
$parameters = [];
$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $task may have been modified by hook.
print $hookmanager->resPrint;

print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"><input type="text" size="4" name="search_task_label" value="' . dol_escape_htmltag($searchTaskLabel) . '"></td>';
print '<td class="liste_titre" style="position: sticky; left: 0; background-color: var(--colorbacktitle1); z-index: 1040;"><input type="text" size="4" name="search_task_label" value="' . dol_escape_htmltag($searchTaskLabel) . '"></td>';
// TASK fields.
if (!empty($arrayFields['timeconsumed']['checked'])) {
print '<td class="liste_titre"></td>';
Expand All @@ -531,7 +533,7 @@
print '</tr>';

print '<tr class="liste_titre">';
print '<th>' . $form->textwithpicto($langs->trans('Task'), $tooltipTaskInfo);
print '<th style="position: sticky; left: 0; background-color: var(--colorbacktitle1); z-index: 1040;>' . $form->textwithpicto($langs->trans('Task'), $tooltipTaskInfo);
print ' <i class="fas fa-star"></i>';
print '<input type="checkbox" class="show-only-favorite-tasks"' . ($user->conf->DOLISIRH_SHOW_ONLY_FAVORITE_TASKS ? ' checked' : '') . '>';
print $form->textwithpicto('', $langs->trans('ShowOnlyFavoriteTasks'));
Expand Down Expand Up @@ -576,7 +578,7 @@
$plannedWorkingTime = load_planned_time_within_range($firstDayToShow, dol_time_plus_duree($lastDayOfRange, 1, 'd'), $workingHours, $isAvailable);

print '<tr class="liste_total">';
print '<td class="liste_total" colspan="' . $colspan . '">';
print '<td class="liste_total" style="position: sticky; left: 0; background-color: var(--colorbacklineimpair2); z-index: 1040; colspan="' . $colspan . '">';
print $langs->trans('Total');
print '<span class="opacitymediumbycolor"> - ';
if ($viewMode == 'month') {
Expand Down Expand Up @@ -624,7 +626,7 @@

<!-- TIMESPENT ADD MODAL -->
<div class="timespent-add-modal">
<div class="wpeo-modal modal-timespent" id="timespent">
<div class="wpeo-modal modal-timespent" id="timespent" style="z-index: 1200;">
<div class="modal-container wpeo-modal-event" style="max-width: 400px; max-height: 300px;">
<!-- Modal-Header -->
<div class="modal-header">
Expand Down

0 comments on commit 64ffc29

Please sign in to comment.