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

{include file="delete_person.tpl.js"}
{include file="delete_file.js"}
{include file="upload.tpl.html"}

{$STATUSMSG}

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

  <caption>
    <em>{$person.pe_person|wash}</em>
    {if ($perm_persons) || ($person.pe_pe_id == $smarty.session.auth_user.pe_id)}
    [ <a class="ptr" onclick="confirm_delete_person({$person.pe_id}, '{$person.pe_person|phpaga_popup_sanitizestr}');">{t}Delete{/t}</a>
    | <a href="edit_person.php?id={$person.pe_id}">{t}Edit{/t}</a>
    | <a id="uplink" class="ptr" onclick="show_box('uplink', 'upload');">{t}Add files{/t}</a>]
    {/if}
  </caption>
  <tr>
    <td class="label">{t}Person{/t}: </td>
    <td class="data" colspan="3"> {$person.pe_person|wash} </td>
    <td class="label">{t}Category{/t}: </td>
    <td class="data" colspan="3"> {$person.pecat_title|wash|default:"&nbsp;"} </td>
  </tr>
  <tr>
    <td class="label">{t}Address{/t}: </td>
    <td class="data nrb" colspan="7"> {$person.pe_address|wash|default:"&nbsp;"} </td>
  </tr>
  <tr>
    <td class="label">{t}Address 2{/t}: </td>
    <td class="data nrb" colspan="7"> {$person.pe_address2|wash|default:"&nbsp;"} </td>
  </tr>
  <tr>
    <td class="label">{t}ZIP{/t}: </td>
    <td class="data"> {$person.pe_zip|wash|default:"&nbsp;"} </td>
    <td class="label">{t}City{/t}: </td>
    <td class="data"> {$person.pe_city|wash|default:"&nbsp;"} </td>
    <td class="label">{t}Work phone{/t}: </td>
    <td class="data" colspan="3"> {$person.pe_phonework|wash|default:"&nbsp;"} </td>
  </tr>
  <tr>
    <td class="label">{t}Region{/t}: </td>
    <td class="data" colspan="3"> {$person.pe_region|wash|default:"&nbsp;"} </td>
    <td class="label">{t}Mobile{/t}: </td>
    <td class="data" colspan="3"> {$person.pe_phonemobile|wash|default:"&nbsp;"} </td>
  </tr>
  <tr>
    <td class="label">{t}Country{/t}: </td>
    <td class="data" colspan="3"> <img src="img/flags/{$person.ctr_code|strtolower|wash}.png" alt="{$person.ctr_name|wash|default:"&nbsp;"}" title="{$person.ctr_name|wash|default:"&nbsp;"}" /> {$person.ctr_name|wash|default:"&nbsp;"} </td>
    <td class="label">{t}Home phone{/t}: </td>
    <td class="data" colspan="3"> {$person.pe_phonehome|wash|default:"&nbsp;"} </td>
  </tr>
  <tr>
    <td class="label">{t}Tax number{/t}: </td>
    <td class="data" colspan="3"> {$person.pe_taxnr|wash|default:"&nbsp;"} </td>
    <td class="label">{t}Fax{/t}: </td>
    <td class="data" colspan="3"> {$person.pe_fax|wash|default:"&nbsp;"} </td>
  </tr>

  <tr>
    <td class="label">{t}Url{/t}: </td>
    <td class="data" colspan="3"> {if strlen($person.pe_url)}{$person.pe_url|wash|phpaga_urlmodifier}{else}&nbsp;{/if} </td>
    <td class="label">{t}Company{/t}: </td>
    <td class="data" colspan="3"> <a href="company.php?id={$person.cpn_id}"> {$person.cpn_name|wash} </a> </td>
  </tr>
  <tr>
    <td class="label">{t}Email{/t}: </td>
    <td class="data" colspan="3">
      {if (isset($person.pe_email) && strlen($person.pe_email))}
      <a href="mailto:{$person.pe_email|wash}"> {$person.pe_email|wash} </a>
      {else}
      &nbsp;
      {/if}
    </td>
    <td class="label">{t}Job category{/t}: </td>
    <td class="data" colspan="3"> {$person.jcat_title|wash|default:"&nbsp;"} </td>
  </tr>
  <tr>
    <td class="label recinfo"> {t}Record owner{/t}:</td>
    <td class="data recinfo" colspan="3"> {$person.owner_pe_person|wash|default:"&nbsp;"} </td>
    <td class="label{if (!$perm_rate)} greyed{/if}"> {t}Default hourly rate{/t}: </td>
    <td class="data{if (!$perm_rate)} greyed{/if} last"> {if ($perm_rate)}{$person.pe_hourlyrate|wash|default:"&nbsp;"}{else}{t}hidden{/t}{/if} </td>
  </tr>
</table>

{assign var=files value=$person.files}

{if count($files) > 0}
{include file="listfiles.tpl.html"}
{/if}

{if $person.pe_duration > 0}
<div class="dcaption"><em>{$MANHOURS_HEADER} {if strlen($mhr_year)}{$mhr_year}{/if}</em>
  [<a href="person.php?id={$person.pe_id}&amp;detail={$opcat_byproject}&amp;mhr_year={math equation="y - 1" y = $mhr_year}">&lt; {math equation="y - 1" y = $mhr_year}</a>
  {if ($mhr_year < $curryear)} | <a href="person.php?id={$person.pe_id}&detail={$opcat_byproject}&mhr_year={math equation="x + 1" x = $mhr_year}">{math equation="x + 1" x = $mhr_year} &gt;</a>{/if}
  ]
  </div>

<object id="objmhp" type="image/svg+xml" data="manhours_graph.php?pe_id={$person.pe_id}&amp;type={$smarty.const.PHPAGA_MANHOURS_DISPLAY_YEAR}&amp;size={$smarty.const.PHPAGA_MANHOURS_GRAPH_SMALL}{if strlen($mhr_year)}&amp;date={$mhr_year}-01-01{/if}" height="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_HEIGHT}" width="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_WIDTH}">
  You need a browser capeable of SVG to display this image.
  You can find the Adobe SVG Viewer here:
  <a href="http://www.adobe.com/svg/viewer/install/main.html">http://www.adobe.com/svg/viewer/install/main.html</a>
</object>
{/if}

{if (isset($opcats) && (count($opcats) > 0))}
{if ($opcat_byproject == 0)}
<div class="dcaption"><em>{t}Task categories{/t}</em>
  [ <a href="person.php?id={$person.pe_id}&amp;mhr_year={$mhr_year}&amp;detail={$smarty.const.PHPAGA_OPCGRP_PROJECT}">{t}Details{/t}</a> ]
</div>

<div class="floatcontainer">
  <table class="stdtable w20 flleft" cellspacing="0">
    {section name=opcdet loop=$opcats}
    <tr>
      <td class="label">{$opcats[opcdet].opcat_title|wash}:</td>
      <td class="data number">{$opcats[opcdet].opcat_duration|phpaga_minutes2duration}</td>
    </tr>
    {/section}
    <tr class="summary">
      <td class="label">{t}Total duration{/t}:</td>
      <td class="data number">{$TOTAL_DURATION|phpaga_minutes2duration}</td>
    </tr>
  </table>

  <div class="flleft">
    <object type="image/svg+xml" data="opcat_graph.php?pe_id={$person.pe_id}" height="{$smarty.const.PHPAGA_GRAPH_HEIGHT}" width="{$smarty.const.PHPAGA_GRAPH_WIDTH}">
      You need a browser capeable of SVG to display this image.
      You can find the Adobe SVG Viewer here:
      <a href="http://www.adobe.com/svg/viewer/install/main.html">http://www.adobe.com/svg/viewer/install/main.html</a>
    </object>
  </div>
</div>
<div class="spacer"></div>
{else}

<table class="stdtable" cellspacing="0">
  <caption><em>{t}Task categories{/t}</em>
    [ <a href="person.php?id={$person.pe_id}&mhr_year={$mhr_year}&detail=0">{t}Overall{/t}</a> ]
  </caption>
  <tr class="r">
    <th>&nbsp;</th>
    {foreach item=prj from=$opcats.projects}
    <th><a href="project.php?id={$prj.prj_id}">{$prj.prj_title|wash}</a></th>
    {/foreach}
    <th>{t}Total{/t}</th>
  </tr>
  {foreach key=opckey item=opc from=$opcats.opcats}
  <tr class="{cycle values="odd,even"}">
    <td>{$opc.opcat_title|wash}</td>
    {foreach item=row from=$opcats.rows[$opckey]}
    <td class="time">{if strlen($row.opcat_duration)}{$row.opcat_duration|phpaga_minutes2duration}{else}&nbsp;{/if}</td>
    {/foreach}
    <td class="time">{$opc.duration|phpaga_minutes2duration}</td>
  </tr>
  {/foreach}
  <tr class="summary">
    <td>&nbsp;</td>
    {foreach item=prj from=$opcats.projects}
    <td class="time">{$prj.duration|phpaga_minutes2duration}</td>
    {/foreach}
    <td class="time">{$TOTAL_DURATION|phpaga_minutes2duration}</td>
  </tr>
</table>
{/if}
{/if}

{if (isset($person.projects) && (count($person.projects) > 0))}
<table class="stdtable" cellspacing="0">
  <caption><em>{t}Projects{/t}</em></caption>
  {foreach name=fpowns item=pown from=$person.projects}
  <tr class="{cycle values="odd,even"}">
    <td><a href="project.php?id={$pown.prj_id}">{$pown.prj_title|wash}</a></td>
    <td>{$pown.relation}</td>
  </tr>
  {/foreach}
</table>
{/if}

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