<form id="projectadmin_participants_form" style="" class=""
    action=""  method="POST" enctype="multipart/form-data"
    onsubmit="projectadmin_participants.save(); return false;">
    <input type="submit" style="display:none;visibility:hidden;" />

    <fieldset class="noborder">
         {include file='r/hidden.tpl' name="projectadmin_participants_project_id" default=$project_id}{* The project we edit the participants from*}
        
        <p class="formstyle formcoll">
            <a href="javascript:projectadmin.open_participants_print({$project_id})"
               class="dialog_make_text_btn ui-corner-all">{$i.basic_print_portlet}</a>
        </p>
        
        <table style="width:100%; margin:0px" class="editablepop">
            <thead>
                <tr>
                    <th class="edtbledtv-btn noprint" style>
                    {if $user_can_edit}    
                    <span onclick="projectadmin_participants.add();" class="dialog_make_btn16 add mobile_big smallbtns ui-corner-all" title="{$i.basic_add}"></span>
                    {/if}
                    </th>
                    <th>{$i.projectadmin_address_name}</th>
                    <th>{$i.projectadmin_category_craft}</th>
                    <th style="width:16px; max-width:16px;"><span title="{$i.projectadmin_auto_plan_approv_manager}" class="dialog_make_btn14 info smallbtns ui-corner-all"></span></th>
                    <th>{$i.projectadmin_remark}</th>
                    {if $flink2go_installed}
                    {/if}
                    {*}Add the addi th{*}
                    {$last_block_header=false}
                    {if isset($participants_list.0)}
                        {foreach item="item" from=$participants_list.0->addi_fields}
                            {if ($item->type==US_exmodel::T_BLOCK)}
                                {$last_block_header=$item->name}
                            {else}
                                <th>{if $last_block_header}{$last_block_header}:{$last_block_header=false}<br />{/if}{$item->name}</th>
                            {/if}
                        {/foreach}
                    {/if}
                </tr>
            </thead>
            <tbody {if $user_can_edit}class="sortable"{/if}>
            {foreach item="item" from=$participants_list}
            <tr id="projectadmin_participant_{$item->id}" class="{if isset($item->rowinfo)}{$item->rowinfo->class} {/if}">
                <td>
                    {if $user_can_edit}
                    <span onclick="projectadmin_participants.edit({$item->id});" class="dialog_make_btn16 edit smallbtns ui-corner-all" title="{$i.basic_edit}"></span>
                    <span onclick="projectadmin_participants.delete_entry({$item->id});" class="dialog_make_btn16 delete smallbtns ui-corner-all" title="{$i.basic_delete}"></span>
                    <span onclick="projectadmin_participants.move_down(this);" class="dialog_make_btn16 move_down smallbtns ui-corner-all" title=""></span>
                    <span onclick="projectadmin_participants.move_up(this);" class="dialog_make_btn16 move_up smallbtns ui-corner-all" title=""></span>
                    {/if}
                    <a class="dialog_make_btn16 show_only smallbtns ui-corner-all" title="{$i.basic_addressesandcontacts}"
                       onclick="window.open(this.href); return false;"
                       href="{site_url url="start/open/addressesandcontacts/index/`$xjxcookie`/view/{$item->address_id}"}"></a  >
                </td>
                <td id="participant_name_{$item->id}">{$item->address_name}</td>
                <td>{$item->address_category_name}</td>
                <td>{boolview value=$item->auto_plan_approv}</td>
                <td>{$item->purpose}</td>
                {if $flink2go_installed}
                {/if}
                {*}Add the addi td{*}
                {foreach item="addi_item" from=$item->addi_fields}
                    {if ($addi_item->type==US_exmodel::T_BLOCK)}
                    {else}
                        <td>{addiview field=$addi_item value=$item->{$addi_item->field} item=$item}</td>
                    {/if}
                {/foreach}
            </tr>
            {/foreach}
            </tbody>
        </table>
    </fieldset>
</form>


<form id="projectadmin_participants_participant_form" style="display:none; margin-left:22px; padding-top:5px"
    action=""  method="POST" enctype="multipart/form-data">
<fieldset class="noborder">
    {* Will be set on clicking one of the addresses*}
    {include file='r/hidden.tpl' name="projectadmin_participants_edit" default="add"}
    {include file='r/hidden.tpl' name="projectadmin_participants_address_id"
        class="on_change_update ocu-p:projectadmin_participants ocu-m:get_address_categories ocu-f:projectadmin_participants_address_category_id"}

    {include file='r/select.tpl' name="projectadmin_participants_address_category_id" title="projectadmin_address_category" collapse='' class="required"}
    {include file='r/checkbox.tpl' name="projectadmin_participants_auto_plan_approv" title="projectadmin_auto_plan_approv_manager" collapse='' value="TRUE"}
    
    {include file='r/textarea.tpl' name="projectadmin_participants_purpose" title="projectadmin_remark" collapse='' class="t-mid"}
</fieldset>
  
{include file='Basic/edit_popform_addi.tpl' edit_addi_list=$addi_fields
    edit_addi_section='projectadmin_participants' edit_addi_target='projectadmin_participants' edit_addi_collapse=''}

<fieldset class="noborder" id="projectadmin_participants_small_save_btn">
    <p class="formstyle"><span class="dialog_make_btn16 ok ui-corner-all" onclick="projectadmin_participants.save_values();"></span></p>
</fieldset>
</form>
