<!-- BEGIN {$smarty.template} -->
<script type="text/javascript" src="js/tasks.js"></script>

{include file="delete_operation.tpl.js"}

<div id="opdetails"> </div>
<div id="editopdetails">{include file="add_operation_div.tpl.html"}</div>

<form action="{$smarty.const.PHPAGA_SELF}" method="get">

<table class="stdtable" cellspacing="0">
  <tr>
    <td colspan="2" class="header nobb"> {t}Main{/t} </td>
  </tr>

  <!-- BEGIN subsection MANHOURS GRAPHS -->

  <tr>
    <td colspan="2" class="section"> {$MYMANHOURS} </td>
  </tr>

  <tr>
    <td colspan="2">
      <div class="imgcontainer">
        <div class="spacer">
          <div class="imgfloat"><img id="imgmhy" width="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_WIDTH}" height="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_HEIGHT}" alt="{t}Weekly manhours{/t}" src="manhours_graph.php?pe_id={$PE_ID}&amp;type={$smarty.const.PHPAGA_MANHOURS_DISPLAY_YEAR}&amp;size={$smarty.const.PHPAGA_MANHOURS_GRAPH_SMALL}" /></div>
          <div class="imgfloat"><img id="imgmhw" width="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_WIDTH}" height="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_HEIGHT}" alt="{t}Daily manhours{/t}" src="manhours_graph.php?pe_id={$PE_ID}&amp;type={$smarty.const.PHPAGA_MANHOURS_DISPLAY_MONTH}&amp;size={$smarty.const.PHPAGA_MANHOURS_GRAPH_SMALL}" /></div>
        </div>
      </div>
    </td>
  </tr>

  <!-- END subsection MANHOURS GRAPHS -->

  <!-- BEGIN subsection PROJECTS -->

    <tr>
      <td class="section">{t}My projects and projects I'm a member of{/t}</td>
      <td class="sectionaction">
        {t}Status{/t}:
        <select name="prj_status">
          {html_options options=$prjstat selected=$prjstat_sel}
        </select>
        <input type="submit" value="{t}Search{/t}" />
      </td>
    </tr>

    <tr>
      <td colspan="2" class="st">
        <table class="substdtable" cellspacing="0" width="100%">

       <tr>
          <th> <a href="{$location}{$psort.pr}"{if $porder == $smarty.const.ORDER_PRJ_PR_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_PR_DESC} class="sortdesc"{/if}>
              {t}Title{/t}</a>
          </th>

          <th> <a href="{$location}{$psort.prjstat}"{if $porder == $smarty.const.ORDER_PRJ_PRJSTATUS_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_PRJSTATUS_DESC} class="sortdesc"{/if}>
              {t}Status{/t}</a>
          </th>

          <th> <a href="{$location}{$psort.cpn}"{if $porder == $smarty.const.ORDER_PRJ_CUSTOMER_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_CUSTOMER_DESC} class="sortdesc"{/if}>
              {t}Customer{/t}</a>
          </th>

          <th class="number"> <a href="{$location}{$psort.prio}"{if $porder == $smarty.const.ORDER_PRJ_PRIORITY_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_PRIORITY_DESC} class="sortdesc"{/if}>
              {t}Prio.{/t}</a>
          </th>

          <th class="time"> <a href="{$location}{$psort.start}"{if $porder == $smarty.const.ORDER_PRJ_STARTDATE_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_STARTDATE_DESC} class="sortdesc"{/if}>
              {t}Start date{/t}</a>
          </th>

          <th class="time"> <a href="{$location}{$psort.deadline}"{if $porder == $smarty.const.ORDER_PRJ_PROJDEADLINE_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_PROJDEADLINE_DESC} class="sortdesc"{/if}>
              {t}Deadline{/t}</a>
          </th>

          <th> <a href="{$location}{$psort.prjcat}"{if $porder == $smarty.const.ORDER_PRJ_PRJCAT_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_PRJCAT_DESC} class="sortdesc"{/if}>
              {t}Category{/t}</a>
          </th>

          <th class="time"> <a href="{$location}{$psort.duration}"{if $porder == $smarty.const.ORDER_PRJ_DURATION_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_DURATION_DESC} class="sortdesc"{/if}>
              {t}Hours{/t}</a>
          </th>

          <th> {t}Actions{/t} </th>
        </tr>

          {if (count($projects) > 0)}

          {section name=pdetails loop=$projects}
          <tr class="{cycle values="odd,even"}">
            <td{if ((strlen($projects[pdetails].prj_title) > $smarty.const.PHPAGA_SHOWPRJTITLELENGHT))} onmouseover="return escape('{$projects[pdetails].prj_title|phpaga_popup_sanitizestr}')"{/if}>
              <a href="project.php?id={$projects[pdetails].prj_id}">{$projects[pdetails].prj_title|wash|truncate:$smarty.const.PHPAGA_SHOWPRJTITLELENGHT:"...":true}</a>
            </td>
            <td> {$projects[pdetails].prjstat_title|wash} </td>
            <td> <a href="company.php?id={$projects[pdetails].cpn_id}">{$projects[pdetails].cpn_name|wash}</a> </td>
            <td class="time"> {$projects[pdetails].prj_priority|wash|default:"&nbsp;"} </td>
            <td class="time"> {$projects[pdetails].prj_startdate|wash|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT} </td>
            <td{if $projects[pdetails].prj_overdue} class="overdue"{/if}> {if strlen($projects[pdetails].prj_deadline)}{$projects[pdetails].prj_deadline|wash|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT}{else}&nbsp;{/if} </td>
            <td> {$projects[pdetails].prjcat_title|wash} </td>
            <td class="time" id="dur{$projects[pdetails].prj_id}"> {if (strlen($projects[pdetails].prj_duration) && ($projects[pdetails].prj_duration > 0))}{$projects[pdetails].prj_duration|phpaga_minutes2duration}{else}&nbsp;{/if} </td>
            <td class="actions"> <a href="add_operation.php?prj_id={$projects[pdetails].prj_id}" class="ptr" onclick="addTask({$projects[pdetails].prj_id}, 'pimg'); return false;"><img id="pimg{$projects[pdetails].prj_id}" src="img/phpaga/task_add.png" height="16" width="16" border="0" alt="{t}Add task{/t}" title="{t}Add task{/t}"></a> </td>
          </tr>
          {/section}
          {else}
          <tr>
            <td colspan="9">
              {if strlen($prjstat_sel_name)}
              {t}You have not created any projects and you are not a member of any existing project with the selected status.{/t}
              {else}
              {t}You have not created any projects and you are not a member of any existing project.{/t}
              {/if}
            </td>
          </tr>
          {/if}

        </table>
      </td>
    </tr>

  <!-- END subsection PROJECTS -->

  <!-- BEGIN subsection MY LAST OPERATIONS -->
  <tr>
    <td class="section">{$LAST_OPERATIONS}</td>
    <td class="sectionaction">
      &nbsp;
    </td>
  </tr>
  <tr>
    <td colspan="2" class="st">

      {if count($operations) > 0}

      <table class="substdtable" id="lop" cellspacing="0" width="100%">

        <tr>
          <th> {t}Project{/t} </th>
          <th> {t}Task{/t} </th>
          <th class="time"> {t}Date{/t} </th>
          <th> {t}Category{/t} </th>
          <th class="time"> {t}Hours{/t} </th>
          <th> {t}Actions{/t} </th>
        </tr>

        {section name=details loop=$operations}
        <tr class="{cycle values="odd,even"}">
          <td{if ((strlen($operations[details].prj_title) > $smarty.const.PHPAGA_SHOWPRJTITLELENGHT))} onmouseover="return escape('{$operations[details].prj_title|phpaga_popup_sanitizestr}')"{/if}>
            <a href="project.php?id={$operations[details].prj_id}">{$operations[details].prj_title|wash|truncate:$smarty.const.PHPAGA_SHOWPRJTITLELENGHT:"...":true}</a>
          </td>
          <td{if ((strlen($operations[details].op_desc) > $smarty.const.PHPAGA_SHOWOPDESCLENGHT))} onmouseover="return escape('{$operations[details].op_desc|wash|phpaga_popup_sanitizestr}')"{/if}>
            {$operations[details].op_desc|wash|truncate:$smarty.const.PHPAGA_SHOWOPDESCLENGHT:"...":true}
          </td>
          <td class="time"> {$operations[details].op_startdate|wash|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT} </td>
          <td> {$operations[details].opcat_title|wash} </td>
          <td class="time"> {$operations[details].op_duration_hrs} </td>
          <td class="actions"> {strip}
            <a class="ptr" onclick="viewTaskDetails({$operations[details].op_id}, 'vimg')"><img id="vimg{$operations[details].op_id}" src="img/phpaga/view.png" height="16" width="16" border="0" alt="{t}View{/t}" title="{t}View{/t}"></a>
            {if ($operations[details].op_canedit)}
            <a href="operation.php?id={$operations[details].op_id}"><img src="img/phpaga/edit.png" height="16" width="16" border="0" alt="{t}Edit{/t}" title="{t}Edit{/t}"></a>
            <a class="ptr" onclick="confirm_delete_op({$operations[details].op_id}, '{$operations[details].op_startdate|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT}\n{t}Project{/t}: {$operations[details].prj_title}\n{t}Task{/t}: {$operations[details].op_desc|phpaga_jsmessage_sanitizestr}');"><img src="img/phpaga/delete.png" height="16" width="16" border="0" alt="{t}Delete{/t}" title="{t}Delete{/t}"></a>
            {elseif $perm_view_invoices}
            <a href="bill.php?id={$operations[details].bill_id}"><img src="img/phpaga/bill.png" height="16" width="16" border="0" alt="{t}View invoice{/t}" title="{t}View invoice{/t}"></a>
            {/if}
            {/strip}
          </td>

        </tr>
        {/section}

      </table>

      {else}
      <div class="msg">{t}You have not tracked any tasks yet.{/t}</div>
      {/if}

    </td>
  </tr>

  <!-- END subsection MY LAST OPERATIONS -->

</table>

</form>

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