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?

CommentFileSizeAuthor
#6 h3Action.png5.54 KBcoaston
Command icon 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

    coaston created an issue. See original summary.

    tiagoz’s picture

    Version: 1.0.0-alpha4 » 1.0.0-alpha5
    Status: Active » Needs review

    I´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.

    coaston’s picture

    Status: Needs review » Needs work

    Hello,
    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-log after 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!

    tiagoz’s picture

    Version: 1.0.0-alpha5 » 1.0.0-alpha6
    Status: Needs work » Needs review

    Forgot to push the last changes. It's now available in alpha6 version as well as the labels inside the block form.

    coaston’s picture

    Awesome! Much appreciated. It works as expected. The block is quite a big one because of time, but I can handle it with custom css.

    coaston’s picture

    StatusFileSize
    new5.54 KB

    just 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.

    #block-punchtime h3 {
      display: none;
    }

    big

    tiagoz’s picture

    Version: 1.0.0-alpha6 » 1.0.0-alpha7

    I 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.

    tiagoz’s picture

    Assigned: Unassigned » tiagoz
    Status: Needs review » Reviewed & tested by the community
    coaston’s picture

    Thank you, much appreciated.

    tiagoz’s picture

    Status: Reviewed & tested by the community » Closed (outdated)

    Now that this issue is closed, review the contribution record.

    As a contributor, attribute any organization that helped you, or if you volunteered your own time.

    Maintainers, credit people who helped resolve this issue.