Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision ea5d75b5

Von Sven Schöling vor fast 9 Jahren hinzugefügt

  • ID ea5d75b52e043fb3f0d264056df6007049d6a3fd
  • Vorgänger e23a8be0
  • Nachfolger b70da193

Letter Controller rewrite

Jetzt auf einigermassen aktuellem technischen Stand.

Unterschiede anzeigen:

templates/webpages/letter/edit.html
1 1
[%- USE HTML %]
2 2
[%- USE T8 %]
3 3
[%- USE L %]
4
 <h1>[% title %]</h1>
5

  
6
 <form action='letter.pl' method='POST'>
4
[%- USE P %]
5
[%- USE LxERP %]
6
<h1>[% title | html %]</h1>
7 7

  
8
<form action='controller.pl' method='POST'>
8 9
  <input type="hidden" name="letter.id" value="[% letter.id | html %]">
9
  <input type="hidden" name="letter.draft_id" value="[% letter.draft_id | html %]">
10
  <input type="hidden" name="title" value="[% title | html %]">
10
  <input type="hidden" name="draft.id" value="[% draft.id | html %]">
11 11
  <input type="hidden" name="type" value="[% type | html %]">
12
  <input type="hidden" name="print_nextsub" value="print_letter">
13 12

  
13
  [%- PROCESS 'common/flash.html' %]
14 14

  
15
<p>
16
 <table width=100%>
17
  [%- IF SAVED_MESSAGE %]
18
  <tr>
19
    <td colspan=2>[% SAVED_MESSAGE %]</td>
20
  </tr>
21
  <tr height=10px><td></td></tr>
22
  [%- END %]
23
  <tr>
24
   <td width=50%>
25
    <!-- upper left block -->
26
     <table width=90%>
27
      <tr>
28
       <th align='right'>[% 'Customer' | $T8 %]:</th>
29
       <td>
30
        [%- INCLUDE 'generic/multibox.html'
31
             name          = 'letter.customer',
32
             style         = 'width:60%',
33
             DATA          = ALL_CUSTOMERS,
34
             id_sub        = 'vc_keys',
35
             label_key     = 'name',
36
             select        = vc_select,
37
             limit         = MYCONFIG.vclimit,
38
             allow_textbox = 1,
39
             force_textbox = limit_exceeded_all_customer
40
             onChange      = "document.getElementById('update_button').click();" -%]
15
<table width=100%>
16
<tr>
17
 <td width=50%>
18
  <!-- upper left block -->
19
   <table width=90%>
20
    <tr>
21
     <th align='right'>[% 'Customer' | $T8 %]:</th>
22
     <td>[% P.customer_vendor_picker('letter.vc_id', letter.vc_id, type='customer') %]
41 23
[%- IF letter.customer_id %]
42
        <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('customer')">
43
[%- END %]
44
        <input type='hidden' name='letter.oldcustomer' value='[% letter.oldcustomer | html %]'>
45
        <input type='hidden' name='letter.customer_id' value='[% letter.customer_id | html %]'>
46
        <input type='hidden' name='customer_id' value='[% customer_id | html %]'>
47
[%- UNLESS MYCONFIG.vclimit < ALL_CUSTOMERS.size %]
48
        <input type="hidden" name="letter.select[% vc %]" value="1">
24
      <input type="button" value="[% 'Details (one letter abbreviation)' | $T8 %]" onclick="show_vc_details('customer')">
49 25
[%- END %]
50
      </tr>
51
      <tr>
52
       <th align='right'>[% 'Contact Person' | $T8 %]</th>
53
       <td>
54
        [%- INCLUDE 'generic/multibox.html'
55
             name       = 'letter.cp_id',
56
             style      = 'width:100%',
57
             DATA       = ALL_CONTACTS,
58
             id_key     = 'cp_id',
59
             label_sub  = 'ct_labels',
60
             show_empty = 1 -%]
61
       </td>
62
      </tr>
63
      <tr>
64
       <th align='right'>[% 'Your Reference' | $T8 %]:</th>
65
       <td><input name='letter.reference' style='width:70%' value='[% letter.reference %]'></td>
66
      </tr>
67
     </table>
68
    <!-- /upper left block -->
69
   </td>
70
   <td width=50%>
71
    <!-- upper right block -->
72
     <table align=center width=90%>
73
      <tr>
74
       <th align='right'>[% 'Letternumber' | $T8 %]:</th>
75
       <td><input name='letter.letternumber' style='width:70%' value='[% letter.letternumber %]'></td>
76
      </tr>
77
      <tr>
78
       <th align='right'>[% 'Date' | $T8 %]:</th>
79
        <td>[% L.date_tag('letter.date', letter.date, readonly=readonly) %]</td>
80
       </td>
81
      </tr>
82
     </table>
83
    <!-- /upper right block -->
84
   </td>
85
  </tr>
26
     </td>
27
    </tr>
28
    <tr>
29
     <th align='right'>[% 'Contact Person' | $T8 %]</th>
30
     <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>
31
    </tr>
32
    <tr>
33
     <th align='right'>[% 'Your Reference' | $T8 %]:</th>
34
     <td><input name='letter.reference' style='width:70%' value='[% letter.reference | html %]'></td>
35
    </tr>
36
   </table>
37
  <!-- /upper left block -->
38
 </td>
39
 <td width=50%>
40
  <!-- upper right block -->
41
   <table align=center width=90%>
42
    <tr>
43
     <th align='right'>[% 'Letternumber' | $T8 %]:</th>
44
     <td><input name='letter.letternumber' style='width:70%' value='[% letter.letternumber | html %]'></td>
45
    </tr>
46
    <tr>
47
     <th align='right'>[% 'Date' | $T8 %]:</th>
48
      <td>[% L.date_tag('letter.date_as_date', letter.date_as_date, readonly=readonly) %]</td>
49
     </td>
50
    </tr>
51
   </table>
52
  <!-- /upper right block -->
53
 </td>
54
</tr>
86 55

  
87
  <tr height=20></tr>
56
<tr height=20></tr>
88 57

  
89
  <tr>
90
   <td colspan=2 width=100%>
91
    <!-- central block -->
92
     <table width=80%>
93
      <tr>
94
       <th align=right>[% 'Subject' | $T8 %]</th>
95
       <td><textarea name='letter.subject' style='width:100%;font-weight:bold' rows=1>[% letter.subject %]</textarea></td>
96
      </tr>
97
       <th align=right>[% 'Greeting' | $T8 %]</th>
98
       <td><input name='letter.greeting' style='width:100%;font-weight:bold' value="[% letter.greeting | html %]"></td>
99
      </tr>
100
      <tr>
101
      <tr>
102
       <th align=right>[% 'Body' | $T8 %]</th>
103
       <td><textarea name='letter.body' style='width:100%' rows=20>[% letter.body | html %]</textarea></td>
104
      </tr>
105
      <tr height=10></tr>
106
       <th align=right>[% 'Internal Notes' | $T8 %]</th>
107
       <td><textarea name='letter.intnotes' style='width:100%' rows=4>[% letter.intnotes | html %]</textarea></td>
108
      </tr>
58
<tr>
59
 <td colspan=2 width=100%>
60
  <!-- central block -->
61
   <table width=80%>
62
    <tr>
63
     <th align=right>[% 'Subject' | $T8 %]</th>
64
     <td><textarea name='letter.subject' style='width:100%;font-weight:bold' rows=1>[% letter.subject | html %]</textarea></td>
65
    </tr>
66
     <th align=right>[% 'Greeting' | $T8 %]</th>
67
     <td><input name='letter.greeting' style='width:100%;font-weight:bold' value="[% letter.greeting | html %]"></td>
68
    </tr>
69
    <tr>
70
    <tr>
71
     <th align=right>[% 'Body' | $T8 %]</th>
72
     <td><textarea name='letter.body' style='width:100%' rows=20>[% letter.body | html %]</textarea></td>
73
    </tr>
74
    <tr height=10></tr>
75
     <th align=right>[% 'Internal Notes' | $T8 %]</th>
76
     <td><textarea name='letter.intnotes' style='width:100%' rows=4>[% letter.intnotes | html %]</textarea></td>
77
    </tr>
109 78

  
110
      <tr>
111
       <th></th>
112
       <td>
113
        <table width=90%>
114
         <tr>
115
          <td>
116
           <table width=100%>
117
            <tr>
118
             <td>[% 'Employee' | $T8 %]</td>
119
            </tr>
120
            <tr>
121
             <td>
122
              [%- INCLUDE 'generic/multibox.html'
123
                   name          = 'letter.employee_id',
124
                   default       = letter.employee_id,
125
                   style         = 'width:70%;font-weight:bold',
126
                   DATA          = ALL_EMPLOYEES,
127
                   id_key        = 'id',
128
                   label_key     = 'name',
129
                   limit         = vclimit,
130
                   show_empty    = 1,
131
                   allow_textbox = 0,
132
                   force_textbox = limit_exceeded_ALL_EMPLOYEES
133
                   onChange      = "document.getElementById('update_button').click();" -%]
134
             </td>
135
            </tr>
136
            <!-- tr><td><input name="employee_position" style=width:70% value='[% employee_position %]'></td></tr -->
137
           </table>
138
          </td>
139
          <td>
140
           <table width=100%>
141
            <tr>
142
             <td>[% 'Salesman' | $T8 %]</td>
143
            </tr>
144
            <tr>
145
             <td>
146
              [%- INCLUDE 'generic/multibox.html'
147
                   name          = 'letter.salesman_id',
148
                   default       = letter.salesman_id,
149
                   style         = 'width:70%;font-weight:bold',
150
                   DATA          = ALL_SALESMEN,
151
                   id_key        = 'id',
152
                   label_key     = 'name',
153
                   limit         = vclimit,
154
                   show_empty    = 1,
155
                   allow_textbox = 0,
156
                   force_textbox = limit_exceeded_ALL_SALESMAN
157
                   onChange      = "document.getElementById('update_button').click();" -%]
158
             </td>
159
            </tr>
160
           </table>
161
          </td>
162
          <td>
163
          </td>
164
         </tr>
165
        </table>
166
       </td>
167
      </tr>
168
     </table>
169
    <!-- /central block -->
170
   </td>
171
  </tr>
172
  <tr>
173
    <td colspan=3><hr size="3" noshade></td>
174
  </tr>
175
  <tr>
176
   <td>
177
     [% print_options %]
178
   </td>
179
  </tr>
180
 </table>
181
</p>
79
    <tr>
80
     <th></th>
81
     <td>
82
      <table width=90% align='center'>
83
       <tr>
84
        <td>
85
         <table width=100%>
86
          <tr>
87
           <td>[% 'Employee' | $T8 %]</td>
88
          </tr>
89
          <tr>
90
           <td>
91
            [%- L.select_tag('letter.employee_id', employees, default=letter.employee_id, title_key='safe_name', class='bold', allow_empty=1, style='width:70%') %]
92
           </td>
93
          </tr>
94
         </table>
95
        </td>
96
        <td>
97
         <table width=100%>
98
          <tr>
99
           <td>[% 'Salesman' | $T8 %]</td>
100
          </tr>
101
          <tr>
102
           <td>
103
            [%- L.select_tag('letter.salesman_id', employees, default=letter.salesman_id, title_key='safe_name', class='bold', allow_empty=1, style='width:70%') %]
104
           </td>
105
          </tr>
106
         </table>
107
        </td>
108
        <td>
109
        </td>
110
       </tr>
111
      </table>
112
     </td>
113
    </tr>
114
   </table>
115
  <!-- /central block -->
116
 </td>
117
</tr>
118
<tr>
119
  <td colspan=3><hr size="3" noshade></td>
120
</tr>
121
<tr>
122
 <td>
123
   [% print_options %]
124
 </td>
125
</tr>
126
</table>
182 127

  
183
<input type="hidden" name="action" value="dispatcher">
128
<input type="hidden" name="action" value="Letter/dispatch">
184 129
<input class="submit" type="submit" name="action_update" id="update_button" value="[% 'Update' | $T8 %]">
185 130

  
186 131
[%- IF letter.letternumber %]
187
  <input class="submit" type="submit" name="action_print" value="[% 'Print' | $T8 %]">
132
  <input class="submit" type="submit" name="action_print_letter" value="[% 'Print' | $T8 %]">
188 133
[% END %]
189 134

  
190 135
<input class="submit" type="submit" name="action_save" value="[% 'Save' | $T8 %]">
136
[% L.submit_tag('action_delete', LxERP.t8('Delete'), confirm=LxERP.t8('Are you sure you want to delete this letter?')) %]
191 137
<input class="submit" type="submit" name="action_save_letter_draft" value="[% 'Save Draft' | $T8 %]">
192 138

  
193
 </form>
139
</form>
140

  
141

  
142
<script type='text/javascript'>
143
  $(function(){
144
    $('#letter_vc_id').change(function(){
145
      var data = $('form').serializeArray();
146
      data.push({ name: 'action_update_contacts', value: 1 });
147
      $.post('controller.pl', data, kivi.eval_json_result);
148
    })
149
  })
150
</script>

Auch abrufbar als: Unified diff