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

{literal}
<script type="text/javascript">

function calcTimeDiff() {

    if (!document.forms["faddop"].elements["op_duration"].value)
        document.forms["faddop"].elements["op_duration"].value = getDateTimeDiff(document.forms["faddop"].elements["op_startdate"].value + ' ' + document.forms["faddop"].elements["op_starthours"].value,
                                                                                 document.forms["faddop"].elements["op_enddate"].value + ' ' + document.forms["faddop"].elements["op_endhours"].value);
}

</script>
{/literal}

<form action="service.php" method="post" name="faddop" id="faddop" onsubmit="submitTaskForm(this);return false;">
<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}">

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

  <tr>
    <td class="header nobb" colspan="3"> {t}Project{/t}: <span id="frmprjtitle"></span> </td>
    <td class="headeraction nobb"> [ <a class="ptr" onclick="hideElement('editopdetails');">X</a> ] </td>
  </tr>

  <tr>
    <td class="section" colspan="4"> {t}Task{/t} </td>
  </tr>

  <tr>
    <td class="label">{t}Project member{/t}: </td>
    <td class="data" colspan="3">
      <select name="pe_id" id="sel_prjmembers">
        {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">
      <input type="image" src="img/phpaga/cal.png" id="btn_sdate">
    </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" value="{t}Now{/t}" onclick="setCurrentDateTime('op_startdate', 'op_starthours');"></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}" onfocus="if (!document.getElementById('op_enddate').value) document.getElementById('op_enddate').value = document.getElementById('op_startdate').value;" size="10" maxlength="10">
      <input type="image" src="img/phpaga/cal.png" id="btn_edate">
    </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" value="{t}Now{/t}" onclick="setCurrentDateTime('op_enddate', 'op_endhours');"></td>
  </tr>

  <tr>
    <td class="label">{t}Category{/t}: </td>
    <td class="data">
      <select name="opcat_id" id="sel_opcat">
        {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}" onfocus="calcTimeDiff();" 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>

  <tr>
    <td class="buttonrow" colspan="4"><input type="submit" name="submit" value="{t}Submit{/t}"></td>
  </tr>
</table>

</form>

{literal}
<script type="text/javascript">
Calendar.setup({
inputField     :    "op_startdate",
ifFormat       :    "%Y-%m-%d",
showsTime      :    false,
button         :    "btn_sdate",
singleClick    :    true,
showOthers     :    true
});

Calendar.setup({
inputField     :    "op_enddate",
ifFormat       :    "%Y-%m-%d",
showsTime      :    false,
button         :    "btn_edate",
singleClick    :    true,
showOthers     :    true
});
</script>

{/literal}

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