• Resolved headhunterz

    (@headhunterz)


    Hey Rhett,
    I have been using this plugin recently and it works great πŸ™‚ KUDOS
    I was just working out on something that would make the users feel easy to fill their time report.
    How can I have a button somewhere in the page (may be below the dyt_days) that could fill all the days(except saturdays and sundays) with 8hrs and with REG type?
    Can you please help me with this.
    May be I can have a js function on the page that would set the value to 8hrs with REG type to all the days except saturdays and sundays.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author RLDD

    (@rermis)

    Hi there,

    This is a start, but you may need to adjust it for perfection. This will work if the timecard is set up for “Simple” entry type (the first option under settings) on the admin page.

    <script type="text/javascript">
    function preset_wkd() {
      if(parseInt(document.getElementById('TOTamt').value.replace('$',''))>0) return false;
      var dyt_days=document.getElementsByClassName('dyt_day');
      for(var i = 0; i < dyt_days.length; i++) {
        if(!dyt_days[i].innerHTML.includes('Sat')>0 && !dyt_days[i].innerHTML.includes('Sun')>0) {
          dyt_days[i].lastElementChild.firstElementChild.nextElementSibling.value=8;
      }}
      sumrows();
    }
    window.onload=function(){setInterval(function(){preset_wkd()},3000);};
    </script>

    This can be pasted on the same page as the shortcode. It will not affect the admin view (if accessed on the WP admin dashboard side). Let me know if you have any issues!

    Thread Starter headhunterz

    (@headhunterz)

    Thanks a lot, with a little tweak it worked like a magic πŸ™‚

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Button to fill time report automatically’ is closed to new replies.