<!-- BEGIN {$smarty.template} -->

{literal}
<script type="text/javascript">
$(document).ready(function() { 

        var dates = $('#op_startdate, #op_enddate').datepicker({
            changeMonth: true,
            changeYear: true,
            numberOfMonths: 1,
            dateFormat: 'yy-mm-dd',
            showOn: 'both',
            buttonImage: '../img/phpaga/cal.png',
            buttonImageOnly: true,
            onSelect: function(selectedDate) {
                var option = this.id == "op_startdate" ? "minDate" : "maxDate";
                var instance = $(this).data("datepicker");
                var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
                dates.not(this).datepicker("option", option, date);
            }

        });

        $('#btn_sdate').click(function() { setCurrentDateTime('op_startdate', 'op_starthours'); $('#op_starthours').focus(); });
        $('#btn_edate').click(function() { setCurrentDateTime('op_enddate', 'op_endhours'); $('#op_endhours').focus(); });

        $('#op_enddate').focus(function() {
            if (!$('#op_enddate').val()) 
                $('#op_enddate').val($('#op_startdate').val());
        });

        $('#op_duration').focus(function() {
            if (!$(this).val()) {
                dtdiff = getDateTimeDiff($("#op_startdate").val()+' '+$("#op_starthours").val(),
                    $("#op_enddate").val()+' '+$("#op_endhours").val());
                $(this).val(dtdiff);
            }
        });
        $('#op_starthours').focus(); 
});
</script>
{/literal}

<form action="service.php" method="post" name="faddop" id="faddop" autocomplete="off">
<input type="hidden" name="saction" id="saction" value="{$smarty.const.ACTION_SERVICE_ADDTASK}">
<input type="hidden" name="prj_id" id="prj_id" value="{$editprjInfo.prj_id}">

<div class="divbgwrapper">

<table id="addtasktab" cellspacing="0">

  <caption><em>{t}Project{/t}: <span id="frmprjtitle" class="frmheadinfo">{$editprjInfo.prj_title|wash}</span></em></caption>

  <tr>
    <td class="label">{t}Project member{/t}: </td>
    <td class="data" colspan="3">
      <select name="pe_id" id="pe_id">
        {html_options options=$select_person selected=$opInfo.pe_id}
      </select>
    </td>
  </tr>

  <tr>
    <td class="label">{t}Start date{/t}: </td>
    <td class="data">
      <input type="text" class="tinput" id="op_startdate" name="op_startdate" value="{$opInfo.op_startdate|wash}" size="10" maxlength="10">
    </td>
    <td class="label">{t}time{/t}: </td>
    <td class="data"><input type="text" class="tinput" id="op_starthours" name="op_starthours" value="{$opInfo.op_starthours|wash}" size="5" maxlength="5"> <i>hh:mm</i><input type="button" id="btn_sdate" value="{t}Now{/t}"></td>
  </tr>

  <tr>
    <td class="label">{t}End date{/t}: </td>
    <td class="data">
      <input type="text" class="tinput" id="op_enddate" name="op_enddate" value="{$opInfo.op_enddate|wash}" size="10" maxlength="10">
    </td>
    <td class="label">{t}time{/t}: </td>
    <td class="data"><input type="text" class="tinput" id="op_endhours" name="op_endhours" value="{$opInfo.op_endhours|wash}" size="5" maxlength="5"> <i>hh:mm</i><input type="button" id="btn_edate" value="{t}Now{/t}"></td>
  </tr>

  <tr>
    <td class="label">{t}Category{/t}: </td>
    <td class="data">
      <select name="opcat_id" id="opcat_id">
        {html_options options=$select_opcat selected=$opInfo.opcat_id}
      </select>
    </td>
    <td class="label">{t}Duration{/t}: </td>
    <td class="data"><input type="text" class="tinput" id="op_duration" name="op_duration" value="{$opInfo.op_duration|wash}" size="6" maxlength="6"> <i>hh:mm</i></td>
  </tr>
  {if $editprjInfo.prj_billabletype != 10}
  <tr>
    <td class="label">{t}Billable{/t}: </td>
    <td class="data" colspan="3">
      <input type="checkbox" class="cbox" id="op_billabletype" name="op_billabletype" value="0" {if $opInfo.billable_checked}checked{/if}>
    </td>
  </tr>
  {/if}
  <tr>
    <td class="label"> {t}Description{/t}: </td>
    <td class="data" colspan="3">
      <textarea name="op_desc" id="op_desc" cols="50" rows="6" wrap="virtual">{$opInfo.op_desc|wash}</textarea>
    </td>
  </tr>
</table>

</div>

</form>

<!-- END {$smarty.template} -->
