Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 31 additions & 27 deletions timesheetweek_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1569,22 +1569,26 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
// Inputs zone/panier bloqués si statut != brouillon
$disabledAttr = ($object->status != tw_status('draft')) ? ' disabled' : '';

echo '<div class="div-table-responsive">';
// EN: Scope the vertical and horizontal centering helper to the specific cells that need alignment (days/zones/baskets/hours/totals).
// FR: Limite l'aide de centrage vertical et horizontal aux cellules spécifiques nécessitant l'alignement (jours/zones/paniers/heures/totaux).
echo '<style>';
echo '.grille-saisie-temps .cellule-jour,';
echo '.grille-saisie-temps .cellule-zone-panier,';
echo '.grille-saisie-temps .cellule-temps,';
echo '.grille-saisie-temps .cellule-total { vertical-align: middle; text-align: center; }';
echo '</style>';
echo '<table class="noborder centpercent grille-saisie-temps">';
echo '<div class="div-table-responsive">';
// EN: Scope the vertical and horizontal centering helper to the specific cells that need alignment (days/zones/baskets/hours/totals).
// FR: Limite l'aide de centrage vertical et horizontal aux cellules spécifiques nécessitant l'alignement (jours/zones/paniers/heures/totaux).
echo '<style>';
echo '.grille-saisie-temps .cellule-jour,';
echo '.grille-saisie-temps .cellule-zone-panier,';
echo '.grille-saisie-temps .cellule-temps,';
echo '.grille-saisie-temps .cellule-total { vertical-align: middle; text-align: center; }';
echo '.grille-saisie-temps .col-project-task { position: sticky; left: 0; background: #fff; z-index: 2; }';
echo '.grille-saisie-temps .liste_titre .col-project-task { z-index: 3; }';
echo '.grille-saisie-temps .col-total { position: sticky; right: 0; background: #fff; z-index: 2; }';
echo '.grille-saisie-temps .liste_titre .col-total { z-index: 3; }';
echo '</style>';
echo '<table class="noborder centpercent grille-saisie-temps">';

// EN: Apply the vertical-centering helper on each day header to keep labels visually aligned.
// FR: Applique l'aide de centrage vertical sur chaque en-tête de jour pour conserver des libellés alignés visuellement.
// Header jours
echo '<tr class="liste_titre">';
echo '<th>'.$langs->trans("ProjectTaskColumn").'</th>';
echo '<tr class="liste_titre">';
echo '<th class="col-project-task">'.$langs->trans("ProjectTaskColumn").'</th>';
foreach ($days as $d) {
// EN: Render day headers safely even if week dates are undefined.
// FR: Affiche les en-têtes de jours en sécurité même sans dates de semaine définies.
Expand All @@ -1605,15 +1609,15 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
}
echo '</th>';
}
echo '<th class="center cellule-total">'.$langs->trans("Total").'</th>';
echo '</tr>';
echo '<th class="center cellule-total">'.$langs->trans("Total").'</th>';
echo '</tr>';

// EN: Add the vertical-centering helper on zone and meal cells so both controls stay centered whatever their height.
// FR: Ajoute l'aide de centrage vertical sur les cellules zone et repas afin que les deux contrôles restent centrés quelle que soit leur hauteur.
// Ligne zone + panier (préfills depuis lignes)
if (!$isDailyRateEmployee) {
echo '<tr class="liste_titre">';
echo '<td></td>';
echo '<td class="col-project-task"></td>';
foreach ($days as $d) {
// EN: Attach the vertical-centering helper to keep both zone selector and meal checkbox aligned.
// FR: Attache l'aide de centrage vertical pour garder alignés le sélecteur de zone et la case repas.
Expand All @@ -1635,7 +1639,7 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
echo '<label><input type="checkbox" name="meal_'.$d.'" value="1" class="mealbox"'.$checked.$disabledAttr.'> '.$langs->trans("Meal").'</label>';
echo '</td>';
}
echo '<td></td>';
echo '<td class=""></td>';
echo '</tr>';
}

Expand Down Expand Up @@ -1682,11 +1686,11 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
}
foreach ($byproject as $pid => $pdata) {
// Ligne projet
echo '<tr class="oddeven trforbreak nobold">';
$colspan = 1 + count($days) + 1;
echo '<td colspan="'.$colspan.'">';
$proj = new Project($db);
$proj->fetch($pid);
echo '<tr class="oddeven trforbreak nobold">';
$colspan = 1 + count($days) + 1;
echo '<td colspan="'.$colspan.'" class="col-project-task">';
$proj = new Project($db);
$proj->fetch($pid);
if (empty($proj->ref)) { $proj->ref = $pdata['ref']; $proj->title = $pdata['title']; }
echo tw_get_project_nomurl($proj, 1);
echo '</td>';
Expand All @@ -1695,7 +1699,7 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
// Tâches
foreach ($pdata['tasks'] as $task) {
echo '<tr>';
echo '<td class="paddingleft">';
echo '<td class="paddingleft col-project-task">';
$tsk = new Task($db);
$tsk->fetch((int)$task['task_id']);
if (empty($tsk->label)) { $tsk->id = (int)$task['task_id']; $tsk->ref = $task['task_ref'] ?? ''; $tsk->label = $task['task_label']; }
Expand Down Expand Up @@ -1738,7 +1742,7 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
// FR: Centre les totaux de tâche pour les garder alignés avec les autres valeurs centrées.
if ($isDailyRateEmployee) {
echo '<td class="center task-total cellule-total">'.tw_format_days(($rowTotal > 0 ? ($rowTotal / 8.0) : 0.0), $langs).'</td>';
} else {
} else {
echo '<td class="center task-total cellule-total">'.formatHours($rowTotal).'</td>';
}
echo '</tr>';
Expand All @@ -1758,11 +1762,11 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
}
echo '<td class="center grand-total cellule-total">'.tw_format_days($grandDays, $langs).'</td>';
echo '</tr>';
} else {
} else {
echo '<tr class="liste_total row-total-hours">';
// EN: Center overall totals and daily sums for consistent middle alignment.
// FR: Centre les totaux généraux et journaliers pour un alignement médian homogène.
echo '<td class="left">'.$langs->trans("Total").'</td>';
echo '<td class="left col-total">'.$langs->trans("Total").'</td>';
foreach ($days as $d) {
echo '<td class="center day-total cellule-total">00:00</td>';
}
Expand All @@ -1772,7 +1776,7 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
echo '<tr class="liste_total">';
// EN: Center meal counters to match the rest of the grid alignment.
// FR: Centre les compteurs de repas pour correspondre au reste de l'alignement de la grille.
echo '<td class="left">'.$langs->trans("Meals").'</td>';
echo '<td class="left col-total">'.$langs->trans("Meals").'</td>';
$initMeals = array_sum($dayMeal);
echo '<td colspan="'.count($days).'" class="cellule-total"></td>';
echo '<td class="left meal-total cellule-total">'.$initMeals.'</td>';
Expand All @@ -1781,7 +1785,7 @@ function updateWeekRange(){var v=$('#weekyear').val();var p=parseYearWeek(v);if(
echo '<tr class="liste_total">';
// EN: Center overtime summary cells so every footer row follows the same alignment pattern.
// FR: Centre les cellules du récapitulatif des heures supplémentaires pour harmoniser l'alignement de chaque ligne de pied.
echo '<td class="left">'.$langs->trans("Overtime").' ('.formatHours($contractedHours).')</td>';
echo '<td class="left col-total">'.$langs->trans("Overtime").' ('.formatHours($contractedHours).')</td>';
$ot = ($object->overtime_hours > 0 ? (float) $object->overtime_hours : max(0.0, $grand - $contractedHours));
echo '<td colspan="'.count($days).'"class="cellule-total"></td>';
echo '<td class="center overtime-total cellule-total">'.formatHours($ot).'</td>';
Expand Down