feat: import work hours from SaaS and exchange signed time sheet
This commit is contained in:
1 parent
7cf39850e6
commit
1a7c272414
73 files changed
+10488
-72
No files matched your search
@@ -25,6 +25,7 @@ class AppExtension extends AbstractExtension
|
||||
new TwigFilter('bpn_pickup_label', [AppRuntime::class, 'bpnPickupLabel']),
|
||||
new TwigFilter('upload_status_badge', [AppRuntime::class, 'renderUploadStatusBadge'], ['is_safe' => ['html']]),
|
||||
new TwigFilter('upload_filename_full', [AppRuntime::class, 'getFilenameWithFolder']),
|
||||
new TwigFilter('duration_hm', [AppRuntime::class, 'formatDurationHoursMinutes']),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,24 @@ class AppRuntime implements RuntimeExtensionInterface
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Minutes as hours and minutes, the way a timesheet reads them: 510 becomes "8:30".
|
||||
*
|
||||
* Hours are not padded and not capped at 24 - a month total is a perfectly ordinary
|
||||
* "195:45". Null is a day the SaaS never reported, which is not the same as zero.
|
||||
*/
|
||||
public function formatDurationHoursMinutes(?int $minutes, string $empty = '–'): string
|
||||
{
|
||||
if (null === $minutes) {
|
||||
return $empty;
|
||||
}
|
||||
|
||||
$sign = $minutes < 0 ? '-' : '';
|
||||
$minutes = abs($minutes);
|
||||
|
||||
return sprintf('%s%d:%02d', $sign, intdiv($minutes, 60), $minutes % 60);
|
||||
}
|
||||
|
||||
public function seasonAssignmentLabel(SeasonAssignment $seasonAssignment): string
|
||||
{
|
||||
return $this->seasonAssignmentLabeler->label($seasonAssignment);
|
||||
|
||||
Reference in new issue
Block a user