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

{if isset($STATUSMSG) && strlen($STATUSMSG)}
<div>
{$STATUSMSG}
</div>
{/if}

{if (!is_array($select_person)) || (count($select_person) == 0)}
<div class="msg">
{if $is_owner_or_manager}
{t}Tasks can only be tracked for members. This project does currently not have any members.{/t}
{else}
{t}You are not a member of this project.{/t}
{/if}
</div>
{else}

{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="{$FORM_ACTION}" method="post" name="faddop" autocomplete="off">
<input type="hidden" name="op_id" value="{$opInfo.op_id}">
<input type="hidden" name="prj_id" value="{$prjInfo.prj_id}">

<table class="stdtable" cellspacing="0">
  <caption><em>{$PRJ_OPERATION|wash}</em></caption>
  <tr>
    <th colspan="4"> {t}Project{/t} </th>
  </tr>

  <tr>
    <td class="label"> {t}Project{/t}: </td>
    <td class="data" colspan="3"> <a href="project.php?id={$prjInfo.prj_id}">{$prjInfo.prj_title|wash|default:"&nbsp;"}</a> </td>
  </tr>
  <tr>
    <td class="label"> {t}Customer{/t}: </td>
    <td class="data" colspan="3"> <a href="company.php?id={$prjInfo.cpn_id}">{$prjInfo.cpn_name|wash|default:"&nbsp;"}</a> </td>
  </tr>
  <tr>
    <td class="label"> {t}Start date{/t}: </td>
    <td class="data"> {$prjInfo.prj_startdate|wash|date_format:$smarty.const.PHPAGA_DATEFORMAT_LONG|default:"&nbsp;"} </td>
    <td class="label"> {t}Projected end{/t}: </td>
    <td class="data"> {$prjInfo.prj_estimatedend|wash|default:"&nbsp;"} </td>
  </tr>
  <tr>
    <td class="label"> {t}Category{/t}: </td>
    <td class="data"> {$prjInfo.prjcat_title|wash|default:"&nbsp;"} </td>
    <td class="label"> {t}Hours{/t}: </td>
    <td class="data"> {$HOURS_SO_FAR|default:"&nbsp;"} </td>
  </tr>

  <tr>
    <th colspan="4"> {t}Task{/t} </th>
  </tr>

  <tr>
    <td class="label">{t}Project member{/t}: </td>
    <td class="data" colspan="3">
      <select name="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 format-y-m-d divider-dash no-transparency" 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" 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 format-y-m-d divider-dash no-transparency" 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">
    </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">
        {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" name="op_duration" value="{$opInfo.op_duration|wash}" onfocus="calcTimeDiff();" size="6" maxlength="6"> <i>hh:mm</i></td>
  </tr>
  {if $prjInfo.prj_billabletype != 10}
  <tr>
    <td class="label">{t}Billable{/t}: </td>
    <td class="data" colspan="3">
      <input type="checkbox" class="cbox" 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" cols="50" rows="6" wrap="virtual">{$opInfo.op_desc|wash}</textarea>
    </td>
  </tr>
</table>

<div class="buttons">
  <input type="submit" name="submit" value="{t}Submit{/t}">
</div>

</form>

{literal}
<script type="text/javascript">
document.getElementById('op_startdate').focus();
</script>
{/literal}

{/if}

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