<fieldset class="noborder">
    {include file='r/hidden.tpl' name="correspondence_edit"}{* What entry do we edit - If empty = add *}
    {include file='r/hidden.tpl' name="correspondence_orig_id"}{* ID we make a copy of *}
    {include file='r/hidden.tpl' name="correspondence_attachments_cnt"}{* Number of attachments - needed for copy *}
    {include file='r/hidden.tpl' name="correspondence_confirm_keep_original_valid"}{* Confirm if keep original valid or not *}
    {include file='r/checkbox.tpl' name="correspondence_update_document" title="correspondence_update_document" labelclass="label2" default=TRUE}
    
    {include file='r/checkbox.tpl' name="correspondence_is_valid" title="correspondence_is_valid"}
    {$get_wps = ""}
    {if $correspondence_use_work_package}
        {$get_wps = "ocu-p:correspondence ocu-m:get_work_packages ocu-f:correspondence_work_package"}
    {/if}
    {include file='r/select-project.tpl' name="correspondence_project" title="correspondence_project"
        class="is_project required on_change_update {$get_wps} t-mid"
        list=$projects_list id="id" text="project"
        add_icons_file="project" filter_favourite_list=$projects_favourite_list}
</fieldset>

{if $correspondence_use_work_package}
    <fieldset class="borderbottom">
        {include file='r/select.tpl' name="correspondence_work_package" title="correspondence_work_package_name" class="t-mid"}
    </fieldset>
{/if}
    
<fieldset class="borderbottom">
    {include file='r/input-corresondence_type.tpl' name="correspondence_type" title="correspondence_type" 
        class="required t-mid" list=$types_list}
    {include file='r/checkbox.tpl' name="correspondence_duplicate_document_new" title="correspondence_duplicate_document_new" 
        hide=TRUE labelclass="label2" collapse="formcoll" default=FALSE}
</fieldset>

<fieldset class="borderbottom" id="correspondence_file_upload" style="display:none;">
    {include file='r/file_type.tpl' name="correspondence_file" title="correspondence_file" allow_delete=FALSE targettype="files" targetdata="temp_type_any"}
</fieldset>

<fieldset class="noborder">
    {include file='r/checkbox.tpl' name="correspondence_is_serial" title="correspondence_is_serial" labelclass='label2'}
</fieldset>
    
<fieldset class="borderbottom" id="correspondence_receiver_one_fields">
    {include file='r/ajaxselect.tpl' name='correspondence_receiver_one' title="correspondence_receiver"
        class="addressselect fulltext_search t-mid"
        add_icons_file="project_participants"
        filter_project_participants_project_field="correspondence_project"}
</fieldset>
    
<fieldset class="borderbottom" id="correspondence_receiver_group_fields">
    {include file='r/ajaxselect.tpl' name='correspondence_receiver_group' title="correspondence_receiver_group"
        class="addressgrpselect fulltext_search t-mid"}
    {*{include file='r/select.tpl' name="correspondence_receiver_group" title="correspondence_receiver"
        list=$address_groups id="id" text="name" group_by="project" group_by_list=$address_groups_groups noempty=TRUE
        collapse="formcoll"}*}
</fieldset>
    
<fieldset class="borderbottom">
    {include file='r/input.tpl' name="correspondence_subject" title="correspondence_subject" class="required t-mid" maxlength=80
         add_icons_file="number_generation" ng_project_id="correspondence_project" ng_subject="Dokumente/Documents"}
    
    {include file='r/date.tpl' name="correspondence_date" title="correspondence_date" class="required"}
</fieldset>

<fieldset class="noborder" id="correspondence_copies_section">
    {include file='r/many.tpl' name="correspondence_copies" title="correspondence_copy_to"
        add_method="correspondence.copies.add_open"
        class="removeable"}
</fieldset>

<fieldset class="bordertop" id="correspondence_fee_section" style="background-color: rgba(255, 255, 180, 0.25);">
    <legend style="background: linear-gradient(to bottom, rgba(255,255,180,0.7) 0%,rgba(255,255,180,0.15) 50%,rgba(255,255,180,0) 100%);">{$i.basic_feeadmin}:</legend>
    {include file='r/checkbox.tpl' name="correspondence_duplicate_fee" title="correspondence_duplicate_fee"
        hide=TRUE labelclass="label2" default=FALSE}
    {if $project_use_currency}{* $$$$$$$$$$$$$ *}
        {include file='r/select.tpl' name='correspondence_fee_currency_id' title="correspondence_fee_currency" class="" labelclass="label2" collapse='formcoll'
            list=$currencies_list id="id" text="name" mapdata="exchange_rate"}
        {include file='r/input.tpl' name="correspondence_fee_exchange_rate" title="correspondence_fee_exchange_rate" collapse='formcoll' class="numberi18n" labelclass="label2"}
        <hr style="width: 95%;" style="clear:both;" />
    {/if}
    
    {include file='r/date.tpl' name="correspondence_fee_date" title="correspondence_fee_date" collapse='formcoll' class="dateUS"}
    {include file='r/date.tpl' name="correspondence_due_date" title="correspondence_due_date" collapse='formcoll' class="dateUS"}
    {include file='r/input.tpl' name="correspondence_fee_no" title="correspondence_fee_no" add_icons_file="fee_number" 
        addi_target_ids="['correspondence_subject']" addi_target_if_empty = 'true' 
        collapse='formcoll' class="required t-mid" maxlength=30}{*}addi_target_ids is an JS array{*}
        
    {include file='r/select.tpl' name="correspondence_fee_account_name" title="correspondence_fee_account_name" list=$fee_accounts_list id="id" text="name" 
        collapse='formcoll' class="is_fee_account"}
    
    <hr style="width: 95%;" style="clear:both;" />
    {if !$project_use_currency}{* ------------- *}
        {include file='r/input.tpl' name="correspondence_fee_value" title="correspondence_fee_value" collapse='formcoll' class="numberi18n calculator"}
    {else}{* $$$$$$$$$$$$$ *}
        {include file='r/view.tpl' name="correspondence_fee_value_internal" title="correspondence_fee_value" collapse='formcoll' class="numberi18n" default='0'}
        {include file='r/input.tpl' name="correspondence_fee_value" title="correspondence_fee_value_otcurr" collapse='formcoll' class="numberi18n calculator"}
    {/if}
    {include file='r/input.tpl' name="correspondence_vat" title="correspondence_vat" collapse='formcoll' class="numberi18n calculator"}    
    
    <hr style="width: 95%;" style="clear:both;" />
    {include file='r/input.tpl' name="correspondence_discount" title="correspondence_discount" 
        class="numberi18n t-small" collapse='formcoll' add_icons_file='warning_small' past_span_text=$i.correspondence_discount_both}
    {include file='r/date.tpl' name="correspondence_discount_date" title="correspondence_discount_date" 
        class="dateUS" collapse='formcoll'}
        
    <hr style="width: 95%;" style="clear:both;" />
    <legend style="background: rgba(255,255,180,0);">{$i.correspondence_fee_period}</legend>
    {include file='r/date.tpl' name="correspondence_from_date" title="filter_from_date"
        collapse='formcoll'}
    {include file='r/date.tpl' name="correspondence_to_date" title="filter_to_date"
        collapse='formcoll'}
</fieldset>
        
{include file='Basic/edit_popform_addi.tpl' edit_addi_list=$correspondence_addi_list  
    edit_addi_section='correspondence' edit_addi_target='correspondence' edit_addi_collapse='formcoll'}
