Lines 2-21
Link Here
|
2 |
[% BLOCK edit_contact %] |
2 |
[% BLOCK edit_contact %] |
3 |
<ol id="contact-form"> |
3 |
<ol id="contact-form"> |
4 |
<input type="hidden" name="contact_id" value="[% contact.id %]" /> |
4 |
<input type="hidden" name="contact_id" value="[% contact.id %]" /> |
5 |
<li><label for="contact_name">Contact name: </label> |
5 |
<li><label for="contact_name[% contact.id %]">Contact name: </label> |
6 |
<input type="text" size="40" id="contact_name" name="contact_name" value="[% contact.name %]" /></li> |
6 |
<input type="text" size="40" id="contact_name[% contact.id %]" name="contact_name" value="[% contact.name %]" /></li> |
7 |
<li><label for="contact_position">Position: </label> |
7 |
<li><label for="contact_position[% contact.id %]">Position: </label> |
8 |
<input type="text" size="40" id="contact_position" name="contact_position" value="[% contact.position %]" /></li> |
8 |
<input type="text" size="40" id="contact_position[% contact.id %]" name="contact_position" value="[% contact.position %]" /></li> |
9 |
<li><label for="contact_phone">Phone: </label> |
9 |
<li><label for="contact_phone[% contact.id %]">Phone: </label> |
10 |
<input type="text" size="20" id="contact_phone" name="contact_phone" value="[% contact.phone %]" /> </li> |
10 |
<input type="text" size="20" id="contact_phone[% contact.id %]" name="contact_phone" value="[% contact.phone %]" /> </li> |
11 |
<li><label for="contact_phone_2">Alternative phone: </label> |
11 |
<li><label for="contact_altphone[% contact.id %]">Alternative phone: </label> |
12 |
<input type="text" size="20" id="contact_altphone" name="contact_altphone" value="[% contact.altphone %]" /></li> |
12 |
<input type="text" size="20" id="contact_altphone[% contact.id %]" name="contact_altphone" value="[% contact.altphone %]" /></li> |
13 |
<li><label for="contact_fax">Fax: </label> |
13 |
<li><label for="contact_fax[% contact.id %]">Fax: </label> |
14 |
<input type="text" size="20" id="contact_fax" name="contact_fax" value="[% contact.fax %]" /></li> |
14 |
<input type="text" size="20" id="contact_fax[% contact.id %]" name="contact_fax" value="[% contact.fax %]" /></li> |
15 |
<li><label for="contact_email">Email: </label> |
15 |
<li><label for="contact_email[% contact.id %]">Email: </label> |
16 |
<input type="text" size="40" id="contact_email" name="contact_email" value="[% contact.email %]" /></li> |
16 |
<input type="text" size="40" id="contact_email[% contact.id %]" name="contact_email" value="[% contact.email %]" /></li> |
17 |
<li><label for="contact_notes">Notes: </label> |
17 |
<li><label for="contact_notes[% contact.id %]">Notes: </label> |
18 |
<textarea id="contact_notes" name="contact_notes" cols="40" rows="4">[% contnotes %]</textarea></li> |
18 |
<textarea id="contact_notes[% contact.id %]" name="contact_notes" cols="40" rows="4">[% contnotes %]</textarea></li> |
|
|
19 |
[% IF contact.id %]<li><button class="btn" class="delete-contact"><i class="icon-remove"></i>Delete contact</li>[% END %] |
19 |
</ol> |
20 |
</ol> |
20 |
[% END %] |
21 |
[% END %] |
21 |
[% BLOCK show_contact %] |
22 |
[% BLOCK show_contact %] |
Lines 53-58
if (f.company.value == "") {
Link Here
|
53 |
} |
54 |
} |
54 |
|
55 |
|
55 |
function add_contact() { |
56 |
function add_contact() { |
|
|
57 |
var new_contact = $('#contact-template').clone(); |
58 |
var timestamp = new Date().getTime(); |
59 |
$(new_contact).removeAttr('id'); |
60 |
$('input, textarea', new_contact).each(function () { |
61 |
$(this).attr('id', $(this).attr('id') + '_' + timestamp); |
62 |
}); |
63 |
$('label', new_contact).each(function () { |
64 |
$(this).attr('for', $(this).attr('for') + '_' + timestamp); |
65 |
}); |
66 |
$(new_contact).insertBefore(this); |
67 |
$('input[name="contact_name"]', new_contact).focus(); |
68 |
return false; |
69 |
} |
70 |
|
71 |
function delete_contact() { |
72 |
$(this).parents('fieldset').delete(); |
73 |
return false; |
56 |
} |
74 |
} |
57 |
|
75 |
|
58 |
$(document).ready(function() { |
76 |
$(document).ready(function() { |
Lines 71-76
function add_contact() {
Link Here
|
71 |
'bFilter': false, |
89 |
'bFilter': false, |
72 |
'bInfo': false, |
90 |
'bInfo': false, |
73 |
} ) ); |
91 |
} ) ); |
|
|
92 |
$('.delete-contact').click(delete_contact); |
93 |
$('#add-contact').click(add_contact); |
74 |
}); |
94 |
}); |
75 |
//]]> |
95 |
//]]> |
76 |
</script> |
96 |
</script> |
Lines 115-126
function add_contact() {
Link Here
|
115 |
<li><label for="accountnumber">Account number: </label> |
135 |
<li><label for="accountnumber">Account number: </label> |
116 |
<input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber %]" /></li></ol> |
136 |
<input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber %]" /></li></ol> |
117 |
</fieldset> |
137 |
</fieldset> |
118 |
[% FOREACH contact IN contacts %] |
138 |
<fieldset class="rows"> |
119 |
<fieldset class="supplier-contact rows"> |
139 |
<legend>Contacts</legend> |
|
|
140 |
<fieldset id="contact-template" class="supplier-contact"> |
120 |
<legend>Contact details</legend> |
141 |
<legend>Contact details</legend> |
121 |
[% INCLUDE edit_contact %] |
142 |
[% INCLUDE edit_contact %] |
122 |
</fieldset> |
143 |
</fieldset> |
123 |
[% END %] |
144 |
[% FOREACH contact IN contacts %] |
|
|
145 |
<fieldset class="supplier-contact"> |
146 |
<legend>Contact details</legend> |
147 |
[% INCLUDE edit_contact %] |
148 |
</fieldset> |
149 |
[% END %] |
150 |
<button id="add-contact" class="btn"><i class="icon-plus"></i>Add contact</button> |
151 |
</fieldset> |
124 |
</div> |
152 |
</div> |
125 |
<div class="yui-g"> |
153 |
<div class="yui-g"> |
126 |
<fieldset class="rows"> |
154 |
<fieldset class="rows"> |