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

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

{$STATUSMSG}

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

  <tr>
    <td class="header" colspan="4"> {$person.pe_person|wash} </td>
    <td class="headeraction" colspan="4">
      {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> ]
      {else}
      &nbsp;
      {/if}
    </td>
  </tr>

  <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>
  {if strlen($person.pe_fotoname)}
  <tr>
    <td class="last foto lr" colspan="8">
      <img src="image.php?image={$person.pe_fotoname|urlencode}" border="1" alt="{$person.pe_person|wash}" title="{$person.pe_person|wash}" />
    </td>
  </tr>
  {/if}

  {if $person.pe_duration > 0}
  <tr>
    <td class="section" colspan="4">{$MANHOURS_HEADER} {if strlen($mhr_year)}{$mhr_year}{/if}</td>
    <td class="sectionaction" colspan="4">[
      <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}
      ]
    </td>
  </tr>
  <tr>
    <td class="desc last" colspan="8">
      <img width="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_WIDTH}" height="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_HEIGHT}" src="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}" alt="{$MANHOURS_HEADER}" title="{$MANHOURS_HEADER}" />
    </td>
  </tr>
  {/if}

  {if $opcatresult}

  {if ($opcat_byproject == 0)}
  <tr>
    <td class="section" colspan="4"> {t}Task categories{/t} </td>
    <td class="sectionaction" colspan="4"> [ <a href="person.php?id={$person.pe_id}&amp;mhr_year={$mhr_year}&amp;detail={if $opcat_byproject == 0}{$smarty.const.PHPAGA_OPCGRP_PROJECT}{else}0{/if}">{if $opcat_byproject == 0}{t}Details{/t}{else}{t}Overall{/t}{/if}</a> ] </td>
  </tr>
  <tr>
    <td class="desc last" colspan="8">

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

        <tr>
          <td class="opcat">
            <table cellspacing="0">
              {section name=opcdet loop=$opcats}
              <tr>
                <td class="label op">{$opcats[opcdet].opcat_title|wash}:&nbsp;</td>
                <td class="numdesc">&nbsp;{$opcats[opcdet].opcat_duration|phpaga_minutes2duration}&nbsp;</td>
              </tr>
              {/section}
              <tr>
                <td class="op" colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td class="label op">{t}Total duration{/t}: </td>
                <td class="numdesc"> {$TOTAL_DURATION|phpaga_minutes2duration} </td>
              </tr>
            </table>
          </td>

          <td class="desc last"><img src="opcat_graph.php?pe_id={$person.pe_id}" alt="{t}Task categories{/t}" title="{t}Task categories{/t}" /></td>
        </tr>
      </table>

    </td>
  </tr>

  {else}

  <tr>
    <td class="section" colspan="4"> {t}Task categories{/t} </td>
    <td class="sectionaction" colspan="4"> [ <a href="person.php?id={$person.pe_id}&mhr_year={$mhr_year}&detail={if $opcat_byproject == 0}{$smarty.const.PHPAGA_OPCGRP_PROJECT}{else}0{/if}">{if $opcat_byproject == 0}{t}Details{/t}{else}{t}Overall{/t}{/if}</a> ] </td>
  </tr>
  <tr>
    <td class="desc last" colspan="8">

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

        <tr>
          <td class="fillerul">&nbsp;</td>
          {foreach item=prj from=$opcats.projects}
          <td class="projects"> <a href="project.php?id={$prj.prj_id}">{$prj.prj_title|wash}</a></td>
          {/foreach}
          <td class="fillerur">&nbsp;</td>
        </tr>
        {foreach key=opckey item=opc from=$opcats.opcats}
        <tr class="{cycle values="oodd,oeven"}">
          <td class="opcats"> {$opc.opcat_title|wash} </td>
          {foreach item=row from=$opcats.rows[$opckey]}
          <td> {if strlen($row.opcat_duration)}{$row.opcat_duration|phpaga_minutes2duration}{else}&nbsp;{/if} </td>
          {/foreach}
          <td class="opcatsduration"> {$opc.duration|phpaga_minutes2duration} </td>
        </tr>
        {/foreach}
        <tr>
          <td class="fillerll">&nbsp;</td>
          {foreach item=prj from=$opcats.projects}
          <td class="prjduration"> {$prj.duration|phpaga_minutes2duration}</td>
          {/foreach}
          <td class="totalduration"> {$TOTAL_DURATION|phpaga_minutes2duration} </td>
        </tr>
      </table>

    </td>
  </tr>

  {/if}

  {/if}
</table>

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

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