6 <h1>[% title | html %]</h1>
 
   8 <form action='controller.pl' method='POST'>
 
   9   <input type="hidden" name="letter.id" value="[% letter.id | html %]">
 
  10   <input type="hidden" name="draft.id" value="[% draft.id | html %]">
 
  11   <input type="hidden" name="type" value="[% type | html %]">
 
  13   [%- INCLUDE 'common/flash.html' %]
 
  15   <div id="oe_tabs" class="tabwidget">
 
  17     <li><a href="#ui-tabs-letter">[% LxERP.t8("Letter") %]</a></li>
 
  19     <li><a href="controller.pl?action=RecordLinks/ajax_list&object_model=Letter&object_id=[% HTML.url(letter.id) %]">[% LxERP.t8("Linked Records") %]</a></li>
 
  23    <div id="ui-tabs-letter">
 
  28   <!-- upper left block -->
 
  31      <th align='right'>[% 'Customer' | $T8 %]:</th>
 
  32      <td>[% P.customer_vendor_picker('letter.vc_id', letter.vc_id, type='customer') %]
 
  33 [%- IF letter.customer_id %]
 
  34       <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('customer')">
 
  39      <th align='right'>[% 'Contact Person' | $T8 %]</th>
 
  40      <td>[% L.select_tag('letter.cp_id', letter.cp_id ? letter.customer.contacts : [], value_key='cp_id', title_key='full_name', default=letter.cp_id) %]</td>
 
  43      <th align='right'>[% 'Your Reference' | $T8 %]:</th>
 
  44      <td><input name='letter.reference' style='width:70%' value='[% letter.reference | html %]'></td>
 
  47   <!-- /upper left block -->
 
  50   <!-- upper right block -->
 
  51    <table align=center width=90%>
 
  53      <th align='right'>[% 'Letternumber' | $T8 %]:</th>
 
  54      <td><input name='letter.letternumber' style='width:70%' value='[% letter.letternumber | html %]'></td>
 
  57      <th align='right'>[% 'Date' | $T8 %]:</th>
 
  58       <td>[% L.date_tag('letter.date_as_date', letter.date_as_date, readonly=readonly) %]</td>
 
  62   <!-- /upper right block -->
 
  69  <td colspan=2 width=100%>
 
  70   <!-- central block -->
 
  73      <th align=right>[% 'Subject' | $T8 %]</th>
 
  74      <td><textarea name='letter.subject' style='width:100%;font-weight:bold' rows=1>[% letter.subject | html %]</textarea></td>
 
  76      <th align=right>[% 'Greeting' | $T8 %]</th>
 
  77      <td><input name='letter.greeting' style='width:100%;font-weight:bold' value="[% letter.greeting | html %]"></td>
 
  81      <th align=right>[% 'Body' | $T8 %]</th>
 
  82      <td>[% L.textarea_tag('letter.body_as_restricted_html', letter.body_as_restricted_html, style='width:100%', rows=20, class="texteditor") %]</td>
 
  85      <th align=right>[% 'Internal Notes' | $T8 %]</th>
 
  86      <td><textarea name='letter.intnotes' style='width:100%' rows=4>[% letter.intnotes | html %]</textarea></td>
 
  92       <table width=90% align='center'>
 
  97            <td>[% 'Employee' | $T8 %]</td>
 
 101             [%- L.select_tag('letter.employee_id', employees, default=letter.employee_id, title_key='safe_name', class='bold', allow_empty=1, style='width:70%') %]
 
 109            <td>[% 'Salesman' | $T8 %]</td>
 
 113             [%- L.select_tag('letter.salesman_id', employees, default=letter.salesman_id, title_key='safe_name', class='bold', allow_empty=1, style='width:70%') %]
 
 125   <!-- /central block -->
 
 129   <td colspan=3><hr size="3" noshade></td>
 
 140   [%- LxERP.t8("Loading...") %]
 
 144 <input type="hidden" name="action" value="Letter/dispatch">
 
 145 <input class="submit" type="submit" name="action_update" id="update_button" value="[% 'Update' | $T8 %]">
 
 147 [%- IF letter.letternumber %]
 
 148   <input class="submit" type="submit" name="action_print_letter" value="[% 'Print' | $T8 %]">
 
 151 <input class="submit" type="submit" name="action_save" value="[% 'Save' | $T8 %]">
 
 152 [% L.submit_tag('action_delete', LxERP.t8('Delete'), confirm=LxERP.t8('Are you sure you want to delete this letter?')) %]
 
 153 <input class="submit" type="submit" name="action_save_letter_draft" value="[% 'Save Draft' | $T8 %]">
 
 158 <script type='text/javascript'>
 
 160     $('#letter_vc_id').change(function(){
 
 161       var data = $('form').serializeArray();
 
 162       data.push({ name: 'action_update_contacts', value: 1 });
 
 163       $.post('controller.pl', data, kivi.eval_json_result);