{if isset($project)}
<table style="margin-bottom: 70px;" class="col2btn">
    {if isset($add2inforightbtns) && $add2inforightbtns === 'info_right_offers_management_button'}
        {include file='Projectadmin/_info_right_offers_management_table.tpl'}
        <tr>
            <td colspan="2" style="word-wrap: break-word;">&nbsp;</td>
        </tr>   
    {/if}
    <tr>
        <td>{$i.projectadmin_project}</td>
        <td>{$project->project}</td>
    </tr>
    {if !empty($project->start_date) && !$project->start_date->is_null()}
        <tr>
            <td>{$i.projectadmin_start_date}</td>
            <td>{$project->start_date->us_date()}</td>
        </tr>
    {/if}
    {if !empty($project->end_date) && !$project->end_date->is_null()}
        <tr>
            <td>{$i.projectadmin_end_date}</td>
            <td>{$project->end_date->us_date()}</td>
        </tr>
    {/if}
    {if $project->purpose neq ''}
        <tr>
            <td>{$i.projectadmin_purpose}</td>
            <td>{$project->purpose|truncate:120:"..."}</td>
        </tr>
    {/if}
    {if $project->photo_file_uri neq '' && $project->photo_file|strpos:"default_image_" !== 0}
        <tr>
            <td>{$i.projectadmin_photo_file}</td>
            <td>
                <span class="preview">
                    {if $project->photo_file}
                        {img_html uri=$project->photo_file_uri class='photo ui-corner-all'}
                    {else}
                        &nbsp;
                    {/if}
                </span>
            </td>
        </tr>
    {/if}
    {if $project->location neq ''}
        <tr>
            <td>{$i.projectadmin_location}</td>
            <td>{$project->location}</td>
        </tr>
    {/if}
    <tr>
        <td>{$i.projectadmin_is_add_to_indirect_costs}</td>
        <td>{is_add2indirect_costs value=$project->is_add_to_indirect_costs}</td>
    </tr>
    <tr>
        <td>{$i.projectadmin_is_private_project}</td>
        <td>{isprivate value=$project->is_private_project}</td>
    </tr>
    <tr>
        <td>{$i.projectadmin_is_calc_from_expenses}</td>
        <td>
            {is_calc_from_expenses value=$project->is_calc_from_expenses}
            {if $project->is_calc_from_expenses}
                {if isset($project_category_rates->times_name)}
                    <br />
                    <output type="number" title="{$i.projectadmin_times_rate}">{$project_category_rates->times_name}</output>
                {/if}
                {if isset($project_category_rates->area_name)}
                    <br />
                    <output type="number" title="{$i.projectadmin_areas_rate}">{$project_category_rates->area_name}</output>
                {/if}
                {if isset($project_category_rates->travel_name)}
                    <br />
                    <output type="number" title="{$i.projectadmin_travels_rate}">{$project_category_rates->travel_name}</output>
                {/if}
                {if isset($project_category_rates->extra_name)}
                    <br />
                    <output type="number" title="{$i.projectadmin_extras_rate}">{$project_category_rates->extra_name}</output>
                {/if}
            {/if}
        </td>
    </tr>
    <tr>
        <td>{$i.projectadmin_is_included_in_time_sheet}</td>
        <td>{is_included_in_time_sheet value=$project->is_included_in_time_sheet}</td>
    </tr>
    <tr>
        <td>{$i.projectadmin_ignore_required_purpose}</td>
        <td>{boolview value=$project->ignore_required_purpose}</td>
    </tr>
    <tr>
        <td>
            {$i.projectadmin_cost_centres}
        </td>
        <td>
            {if $has_mgmt_right}
                <span class="dialog_make_btn16 work_area_overview_edit smallbtns ui-corner-all frstbtn frstbtnflt"
                    onclick="fullPopup.view('work_packages', 'index', {$project->id})"
                    title="{$i.projectadmin_work_package_record} - {$i.projectadmin_cost_centre_new_info|forcsv}"></span>
            {/if}
            <div class="many" id="inforight_projectadmin_measurement">
                {foreach from=$project_cost_centres item=cost_centre}
                    <p class="measurement portlettooltip smallbtns" title="[{$cost_centre->cost_centre_id}]">
                        {$cost_centre->cost_centre_name|truncate:80:"..."}
                    </p>
                {foreachelse}
                    <span class="warningsmall warningsmaller ui-corner-all">{$i.projectadmin_cost_centre_new_info}</span>
                {/foreach}
            </div>
        </td>
    </tr>
    {if $project->project_phase_name neq ''}
        <tr>
            <td>{$i.projectadmin_project_phase}</td>
            <td>{$project->project_phase_name}</td>
        </tr>
    {/if}
    {if $project->project_category_name neq ''}
        <tr>
            <td>{$i.projectadmin_project_category}</td>
            <td>{$project->project_category_name}</td>
        </tr>
    {/if}
    <tr>
        <td>
            {$i.projectadmin_project_groups2}
        </td>
        <td>
            {if $has_admin_medium_right && !$filter_project_manager && !$filter_division_manager}
                <span class="dialog_make_btn16 edit smallbtns ui-corner-all frstbtn"
                    onclick="project_group_dialogs.view_add_proj_to_grp({$project->id})"
                    title="{$i.basic_edit}"></span>
            {/if}
            {$project->group_names}
        </td>
    </tr>
    {if $project->project_manager_name neq ''}
        <tr>
            <td>{$i.projectadmin_project_manager}</td>
            <td>{$project->project_manager_name}</td>
        </tr>
    {/if}
    {if $project->division_manager_name neq ''}
        <tr>
            <td>{$trans_division_manager}</td>
            <td>{$project->division_manager_name}</td>
        </tr>
    {/if}
    {if $project->client_name neq ''}
        <tr>
            <td>{$i.projectadmin_client}</td>
            <td>
                <a href="{site_url url="start/open/addressesandcontacts/index/$xjxcookie/view/{$project->client_id}/"}"
                    onclick="window.open(this.href); return false;"
                    class="dialog_make_btn16 addresses smallbtns ui-corner-all frstbtn" title="{$i.basic_addressesandcontacts}"></a>
                
                {$project->client_name} 
            </td>
        </tr>
    {/if}
    {if $project->office_in_charge_name neq ''}
        <tr>
            <td>{$i.projectadmin_office_in_charge}</td>
            <td>
                <a href="{site_url url="start/open/addressesandcontacts/index/$xjxcookie/view/{$project->office_in_charge_id}/"}"
                    onclick="window.open(this.href); return false;"
                    class="dialog_make_btn16 addresses smallbtns ui-corner-all frstbtn" title="{$i.basic_addressesandcontacts}"></a>
                
                {$project->office_in_charge_name}
            </td>
        </tr>
    {/if}
    <tr>
        <td>
            {$i.projectadmin_measurements}
        </td>
        <td>
            {if $has_admin_medium_right}
                <span class="dialog_make_btn16 edit smallbtns ui-corner-all frstbtn frstbtnflt"
                    onclick="projectadmin_measurements.open({$project->id})"
                    title="{$i.basic_edit} - {$i.projectadmin_measurements_new_info|forcsv}"></span>
            {/if}
            <div class="many" id="inforight_projectadmin_measurement">
                {foreach from=$project->measurements item=measurement}
                    <p class="measurement portlettooltip smallbtns" id="inforight_projectadmin_measurement_{$measurement->id}">
                        {float_to_usnumber($measurement->value)} {$measurement->measurement_name|truncate:80:"..."}
                    </p>
                {foreachelse}
                    &nbsp;
                {/foreach}
            </div>
        </td>
    </tr>
    {if $has_mgmt_right}
        <tr>
            <th colspan="2">{$i.projectadmin_work_packages}</th>
        </tr>
        <tr>
            <td>{$i.projectadmin_hours}</td>
            <td>{float_to_usnumber($project->sum_hours)}</td>
        </tr>
        <tr>
            <td>
                {$i.projectadmin_fee}
            </td>
            <td>
                {if $has_admin_medium_right}
                    <span class="dialog_make_btn16 work_area_overview_edit smallbtns ui-corner-all frstbtn"
                        onclick="fullPopup.view('work_packages', 'index', {$project->id})"
                        title="{$i.basic_edit}"></span>
                {/if}
                {float_to_usnumber($project->sum_costs)}
            </td>
        </tr>
        <tr>
            <th colspan="2">{$i.projectadmin_calcexp_level_of_completion}</th>
        </tr>
        <tr>
            <td>{$i.projectadmin_default_extras}</td>
            <td>{float_to_usnumber($project->default_extras)}</td>
        </tr>
        <tr>
            <td>{$i.projectadmin_default_discount}</td>
            <td>{float_to_usnumber($project->default_discount)}</td>
        </tr>
        <tr>
            <td>{$i.projectadmin_default_discount_days}</td>
            <td>{$project->default_discount_days}</td>
        </tr>
    {/if}
    {if is_array($dokspace_project_urls) && count($dokspace_project_urls)>=1}
        <tr>
            <td>dokspace</td>
            <td>
                <ul>
                {foreach from=$dokspace_project_urls item=dokspace_url}
                    <li>{$dokspace_url->url->url}</li>
                {/foreach}
                </ul>
            </td>
        </tr>
    {/if}
    {$view1 = true}{$view2 = true}
    {if $project->orig_translated_structure_tree_root_node_path neq '' || $project->path_correspondence_path eq ''}
        <tr>
            <td>
                {$i.projectadmin_path_main} 
                <span class="dialog_make_text_btn ui-corner-all" style="display: inline-block;" onclick="$('.correspondence_paths').show(); $(this).hide();">{$i.basic_view_more}</span>
            </td>
            <td>
                {filelink type="simplefolderfrstbtn" value=$project->orig_translated_structure_tree_root_node_path}
                {$project->orig_translated_structure_tree_root_node}
            </td>
        </tr>
        <tr style="display: none;" class="correspondence_paths">
            <td>{$i.projectadmin_path_correspondence}</td>
            <td>
                {filelink type="simplefolderfrstbtn" value=$project->path_correspondence_path}
                {$project->path_correspondence}
            </td>
        </tr>
    {else}
        <tr style="display: none;" class="correspondence_paths">
            <td>{$i.projectadmin_path_main}</td>
            <td>
                {filelink type="simplefolderfrstbtn" value=$project->orig_translated_structure_tree_root_node_path}
                {$project->orig_translated_structure_tree_root_node}
            </td>
        </tr>
        <tr>
            <td>
                {$i.projectadmin_path_correspondence} 
                <span class="dialog_make_text_btn ui-corner-all" style="display: inline-block;" onclick="$('.correspondence_paths').show(); $(this).hide();">{$i.basic_view_more}</span>
            </td>
            <td>
                {filelink type="simplefolderfrstbtn" value=$project->path_correspondence_path}
                {$project->path_correspondence}
            </td>
        </tr>
    {/if}
    <tr style="display: none;" class="correspondence_paths">
        <td>{$i.projectadmin_path_inbox}</td>
        <td>
            {filelink type="simplefolderfrstbtn" value=$project->path_inbox_path}
            {$project->path_inbox}
        </td>
    </tr>
    <tr style="display: none;" class="correspondence_paths">
        <td>{$i.projectadmin_path_outbox}</td>
        <td>
            {filelink type="simplefolderfrstbtn" value=$project->path_outbox_path}
            {$project->path_outbox}
        </td>
    </tr>
    <tr style="display: none;" class="correspondence_paths">
        <td>{$i.projectadmin_path_drawings}</td>
        <td>
            {filelink type="simplefolderfrstbtn" value=$project->path_drawings_path}
            {$project->path_drawings}
        </td>
    </tr>    
    {if $is_multitenancy}
        <tr>
            <td>{$i.projectadmin_project_allocation}</td>
            <td>
                <div class="many" id="inforight_projectadmin_measurement">
                    {foreach from=$all_companies item=company}
                        {if in_array($company->id, $active_companies_list)}
                            <p class="portlettooltip smallbtns" id="inforight_projectadmin_company_{$company->id}">
                                {$company->name}
                            </p>
                        {/if}
                    {/foreach}
                </div>
            </td>
        </tr>
    {/if}
    <tr>
        <td>{$i.projectadmin_created_date}</td>
        <td>{$project->created_date->us_date()}</td>
    </tr>
    <tr>
        <td>{$i.projectadmin_created_by}</td>
        <td>{$project->created_by_name}</td>
    </tr>
    <tr>
        <td>{$i.projectadmin_change_date}</td>
        <td>{$project->change_date->us_date()}</td>
    </tr>
    </tr>
        <tr>
        <td>{$i.projectadmin_changed_by}</td>
        <td>{$project->changed_by_name}</td>
    </tr>
    {if $project->project_archive_name neq ''}
        </tr>
            <tr>
            <td>{$i.projectadmin_project_archive}</td>
            <td>{$project->project_archive_name}</td>
        </tr>
    {/if}
    {if !empty($project->safekeeping_period) && !$project->safekeeping_period->is_null()}
        </tr>
            <tr>
            <td>{$i.projectadmin_safekeeping_period}</td>
            <td>{$project->safekeeping_period->us_date()}</td>
        </tr>
    {/if}
    {if isset($flink2go_project_url)}
        <tr>
            <td title="uStrich2Go">Doku Baustelle</td>
            <td>
                {link_if_url val=$flink2go_project_url}
            </td>
        </tr>
    {/if}
    {foreach from=$project->addi_fields item=field}
        <tr>
            {if $field->type eq US_exmodel::T_BLOCK}
                <th colspan="2" style="text-align:center; {if isset($field->color)}background:{$field->color}{/if}">{$field->name}</th>
            {else}
                <td style="{if isset($field->color)}background:{$field->color}{/if}">{$field->name}</td>
                <td>
                    {assign var='field_id' value=$field->field}
                    {addiview field=$field value=$project->$field_id item=$project}
                </td>
            {/if}
        </tr>
    {/foreach}
</table>
{/if}
