Support » Plugin: Dynamic Time » Disabling saturdays and sundays from filling

  • Resolved subhamkotnala

    (@subhamkotnala)


    Hi,
    I want to disable saturdays and sundays from the time report. The user should not be able to fill time report for saturdays and sundays. Also the user should not be allowed to fill on some specific days.
    Can I achieve this?
    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Rhett

    (@rermis)

    Hi Subhamkotnala,

    Sure, give this a try by pasting it into a custom html block on the same page as the shortcode. You may need to edit it for perfection:

    <script type="text/javascript">
    function block_wkd() {
      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].style.opacity='.5';
          dyt_days[i].style.pointerEvents='none';
      }}
    }
    window.onload=function(){setTimeout(function(){block_wkd()},1000);};
    </script>

    Great, It works. Thanks a lot 🙂

    Hi Rhett,
    A small correction. The saturdays and sundays are editable in next periods. The problem is we are calling the js function on windows.load . The next period and prev period are AJAX calls. So how can we fix it?

    Plugin Author Rhett

    (@rermis)

    Great catch, to resolve, change the last line to
    window.onload=function(){setInterval(function(){block_wkd()},3000);};

    Cool, works fine now. 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.