|
3 | 3 | return this.each(function () { |
4 | 4 | var form = $(this); |
5 | 5 | var organization = form.find('#id_organization'); |
| 6 | + var from = form.find('#id_from_field'); |
6 | 7 | var poc = form.find('#id_to_poc'); |
7 | 8 | var cc = form.find('#id_cc1'); |
8 | 9 | var reply = form.find('#id_replyto'); |
| 10 | + var purpose = form.find('#id_purpose'); |
9 | 11 | var config = {}; |
10 | 12 |
|
11 | 13 | var readConfig = function() { |
|
24 | 26 | }; |
25 | 27 |
|
26 | 28 | var updatePOC = function() { |
27 | | - var organization = $(this).find('option:selected'); |
| 29 | + var entity = organization.find('option:selected'); |
28 | 30 | var url = config.poc_update_url; |
29 | 31 | $.ajax({ |
30 | 32 | url: url, |
31 | 33 | type: 'GET', |
32 | 34 | cache: false, |
33 | 35 | async: true, |
34 | 36 | dataType: 'json', |
35 | | - data: {entity_id: organization.val()}, |
| 37 | + data: {entity_id: entity.val()}, |
36 | 38 | success: function(response){ |
37 | 39 | if (!response.error) { |
38 | 40 | render_mails_into(poc, response.poc); |
|
43 | 45 | }; |
44 | 46 |
|
45 | 47 | var updateCC = function() { |
46 | | - var organization = $(this).find('option:selected'); |
| 48 | + var entity = organization.find('option:selected'); |
| 49 | + var sdo = from.find('option:selected'); |
47 | 50 | var url = config.cc_update_url; |
48 | 51 | $.ajax({ |
49 | 52 | url: url, |
50 | 53 | type: 'GET', |
51 | 54 | cache: false, |
52 | 55 | async: true, |
53 | 56 | dataType: 'json', |
54 | | - data: {to_entity_id: organization.val()}, |
| 57 | + data: {to_entity_id: organization.val(), |
| 58 | + sdo_id: sdo.val()}, |
55 | 59 | success: function(response){ |
56 | 60 | if (!response.error) { |
57 | 61 | render_mails_into(cc, response.cc); |
|
69 | 73 | var initTriggers = function() { |
70 | 74 | organization.change(updatePOC); |
71 | 75 | organization.change(updateCC); |
| 76 | + from.change(updateCC); |
72 | 77 | reply.keyup(updateFrom); |
73 | 78 | }; |
74 | 79 |
|
75 | 80 | var updateOnInit = function() { |
76 | 81 | updateFrom(); |
| 82 | + updateCC(); |
| 83 | + updatePOC(); |
77 | 84 | }; |
78 | 85 |
|
79 | 86 | var initForm = function() { |
|
0 commit comments