<tr id="send_pane_[% nr %]"[% IF nr == 0 %] style="display:none"[% END %]>
  <td>
    <select name="send_type_[% nr %]" id="send_type_[% nr %]" class="w-full" onchange="cron_change_date(this.id)"[% IF !can_edit %] disabled[% END %]>
      <option value="month"[% IF cr.type == 'month' %] selected[% END %]>monthly</option>
      <option value="monthday"[% IF cr.type == 'monthday' %] selected[% END %]>monthly by day</option>
      <option value="week"[% IF cr.type == 'week' %] selected[% END %]>weekly</option>
      <option value="day"[% IF cr.type == 'day' %] selected[% END %]>daily</option>
      <option value="cust"[% IF cr.type == 'cust' %] selected[% END %]>custom</option>
    </select>
  </td>
  <td>
    <div id="div_send_month_[% nr %]">
      on day
      <select name="send_day_[% nr %]"[% IF !can_edit %] disabled[% END %]>
          [% day = 1 %]
          [% WHILE day <= 31 %]
          <option value="[% day %]"[% IF cr.day == day %] selected[% END %]>[% sprintf("%02s", day) %]</option>
          [% day = day + 1 %]
          [% END %]
      </select>
    </div>
    <div id="div_send_monthday_[% nr %]" style="display: none">
      on the
      <select name="send_monthday_[% nr %]"[% IF !can_edit %] disabled[% END %]>
        [% FOREACH rep = [ "1st", "2nd", "3rd", "4th", "Last" ]  %]
          [% FOREACH day = [ "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ]  %]
            [% monthday = rep _ '_' _ day  %]
            <option value="[% monthday %]"[% IF cr.exists('month_day') && cr.month_day == monthday %] selected[% END %]>[% rep +%] [%+ day %]</option>
          [% END %]
        [% END %]
      </select>
    </div>
    <div id="div_send_week_[% nr %]" style="display: none">
      [% lookup = {} %]
      [% FOREACH w = cr.week_day.split(',') %][% lookup.$w = 1 %][% END %]
      <input type="hidden" name="week_day_[% nr %]" value="">
      <table class="cellspacing-none">
      <tr>
        <td rowspan=2 valign="middle">on</td>
        [% IF first_day_of_week == 0 %]
        <td class="px-0.5 text-center">Sun</td>
        [% END %]
        <td class="px-0.5 text-center">Mon</td>
        <td class="px-0.5 text-center">Tue</td>
        <td class="px-0.5 text-center">Wed</td>
        <td class="px-0.5 text-center">Thu</td>
        <td class="px-0.5 text-center">Fri</td>
        <td class="px-0.5 text-center">Sat</td>
        [% IF first_day_of_week != 0 %]
        <td class="px-0.5 text-center">Sun</td>
        [% END %]
      </tr><tr>
        [% IF first_day_of_week == 0 %]
        <td class="px-0.5 text-center"><input type="checkbox" name="week_day_[% nr %]" value="0"[% IF lookup.exists('0') %] checked[% END %][% IF !can_edit %] disabled[% END %]></td>
        [% END %]
        <td class="px-0.5 text-center"><input type="checkbox" name="week_day_[% nr %]" value="1"[% IF lookup.exists('1') %] checked[% END %][% IF !can_edit %] disabled[% END %]></td>
        <td class="px-0.5 text-center"><input type="checkbox" name="week_day_[% nr %]" value="2"[% IF lookup.exists('2') %] checked[% END %][% IF !can_edit %] disabled[% END %]></td>
        <td class="px-0.5 text-center"><input type="checkbox" name="week_day_[% nr %]" value="3"[% IF lookup.exists('3') %] checked[% END %][% IF !can_edit %] disabled[% END %]></td>
        <td class="px-0.5 text-center"><input type="checkbox" name="week_day_[% nr %]" value="4"[% IF lookup.exists('4') %] checked[% END %][% IF !can_edit %] disabled[% END %]></td>
        <td class="px-0.5 text-center"><input type="checkbox" name="week_day_[% nr %]" value="5"[% IF lookup.exists('5') %] checked[% END %][% IF !can_edit %] disabled[% END %]></td>
        <td class="px-0.5 text-center"><input type="checkbox" name="week_day_[% nr %]" value="6"[% IF lookup.exists('6') %] checked[% END %][% IF !can_edit %] disabled[% END %]></td>
        [% IF first_day_of_week != 0 %]
        <td class="px-0.5 text-center"><input type="checkbox" name="week_day_[% nr %]" value="0"[% IF lookup.exists('0') %] checked[% END %][% IF !can_edit %] disabled[% END %]></td>
        [% END %]
      </tr>
      </table>
    </div>
    <div id="div_send_day_[% nr %]" style="display: none"></div>
    <div id="div_send_cust_[% nr %]" style="display: none">
      <input type="text" name="send_cust_[% nr %]" value="[% IF cr.exists('cust'); escape_html(cr.cust); END %]" class="w-full" placeholder="minute hour dom month dow   (cron syntax)"[% IF !can_edit %] disabled[% END %]>
    </div>
  </td>
  <td id="hour_select_[% nr %]">
    at
    <select name="send_hour_[% nr %]"[% IF !can_edit %] disabled[% END %]>
      [% hour = 0 %]
      [% WHILE hour < 24 %]
      <option value="[% hour %]"[% IF cr.hour == hour %] selected[% END %]>[% sprintf("%02s", hour) %]</option>
      [% hour = hour + 1 %]
      [% END %]
    </select>:<select name="send_minute_[% nr %]"[% IF !can_edit %] disabled[% END %]>
      [% min = 0 %]
      [% WHILE min < 60 %]
      <option value="[% min %]"[% IF cr.minute == min %] selected[% END %]>[% sprintf("%02s", min) %]</option>
      [% min = min + 1 %]
      [% END %]
    </select>
  </td>
  <td [% IF can_edit %]class='hoverable clickable w-5 px-1 rounded' onclick="delete_cron_row(this); return false;"[% END %]>
    [% IF can_edit %]<i class="uil uil-times"></i>[% END %]
    <script>
    <!--
    cron_change_date("send_type_[% nr %]");
    -->
    </script>
  </td>
</tr>
