Problem/Motivation
First of all, I would like to thank you for such an amazing module. The Labor time tracker has been extremely helpful, and I really appreciate your work and contributions!
I have a feature suggestion that could significantly improve the usability of Labor time tracker.
Would it be possible to add a block that displays the current session timer (counting time since "Punch In"), with "Punch In" and "Punch Out" buttons?
The idea is that users could add this block to every page they visit, so they can always see how much time they've spent during the current session and easily remember to punch out when they're done.
This would help prevent situations where users forget to stop tracking, and would make it much more convenient to manage working hours.
Anyone can help please?
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | h3Action.png | 5.54 KB | coaston |
Issue fork labor_time_tracker-3574973
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
tiagozI´m really glad that you find my module usefull for your needs.
Adding a custom block is a great idea. I have added that in my new release. It needs more testing.
Comment #3
coaston commentedHello,
Thank you for quickly updating the module with the new release! However, after downloading and testing the latest version (uploaded yesterday), I’m unable to find the expected block. There is no block visible under the Drupal block layout, and when I check the module code, the folder
src/Plugin/Block(where the block class would typically be located) is missing.Could you please check if the correct version was uploaded?
It looks like an incorrect release might have been published by mistake.
Also, I have a small feature request:
Would it be possible to add a settings form (or configuration option) that allows site admins to change the wording for "Punch In" / "Punch Out"?
For example, in my case, I would like to use “🕒 Start Tracking” and “🛑 Time Recording” instead.
It would be great if this could be customized (possibly with emoji support).
Finally, would it also be possible to implement an option to redirect the user to a page
/labor-info/time-logafter clicking Punch out / Stop Recording?Something similar to:
$form_state->setRedirectUrl(\Drupal\Core\Url::fromUserInput('/labor-info/time-log'));after stop/clock-out.Thanks a lot for your time and for maintaining this module!
Comment #4
tiagozForgot to push the last changes. It's now available in alpha6 version as well as the labels inside the block form.
Comment #5
coaston commentedAwesome! Much appreciated. It works as expected. The block is quite a big one because of time, but I can handle it with custom css.
Comment #6
coaston commentedjust one additional input - would be possible to get rid of that "H3" element = which refers to "Action title" - this is the reason why that block is too big :D
So basically this part of code is not really necessary I guess:
'title' => ['#markup' => '<h3>' . $this->t('Action') . '</h3>'],but I can use custom css to hide, but it is up to you.
Comment #7
tiagozI remove the h3 and gave it a class so it can be styled.
Regarding the redirect option, it was not intended to do it. I suggest you to make a custom code for that behaviour.
Comment #8
tiagozComment #9
coaston commentedThank you, much appreciated.
Comment #10
tiagoz