|
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 55-60
if (f.company.value == "") {
Link Here
|
| 55 |
} |
56 |
} |
| 56 |
|
57 |
|
| 57 |
function add_contact() { |
58 |
function add_contact() { |
|
|
59 |
var new_contact = $('#contact-template').clone(); |
| 60 |
var timestamp = new Date().getTime(); |
| 61 |
$(new_contact).removeAttr('id'); |
| 62 |
$('input, textarea', new_contact).each(function () { |
| 63 |
$(this).attr('id', $(this).attr('id') + '_' + timestamp); |
| 64 |
}); |
| 65 |
$('label', new_contact).each(function () { |
| 66 |
$(this).attr('for', $(this).attr('for') + '_' + timestamp); |
| 67 |
}); |
| 68 |
$(new_contact).insertBefore(this); |
| 69 |
$('input[name="contact_name"]', new_contact).focus(); |
| 70 |
return false; |
| 71 |
} |
| 72 |
|
| 73 |
function delete_contact() { |
| 74 |
$(this).parents('fieldset').delete(); |
| 75 |
return false; |
| 58 |
} |
76 |
} |
| 59 |
|
77 |
|
| 60 |
$(document).ready(function() { |
78 |
$(document).ready(function() { |
|
Lines 73-78
function add_contact() {
Link Here
|
| 73 |
'bFilter': false, |
91 |
'bFilter': false, |
| 74 |
'bInfo': false, |
92 |
'bInfo': false, |
| 75 |
} ) ); |
93 |
} ) ); |
|
|
94 |
$('.delete-contact').click(delete_contact); |
| 95 |
$('#add-contact').click(add_contact); |
| 76 |
}); |
96 |
}); |
| 77 |
//]]> |
97 |
//]]> |
| 78 |
</script> |
98 |
</script> |
|
Lines 117-128
function add_contact() {
Link Here
|
| 117 |
<li><label for="accountnumber">Account number: </label> |
137 |
<li><label for="accountnumber">Account number: </label> |
| 118 |
<input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber %]" /></li></ol> |
138 |
<input type="text" size="40" id="accountnumber" name="accountnumber" value="[% accountnumber %]" /></li></ol> |
| 119 |
</fieldset> |
139 |
</fieldset> |
| 120 |
[% FOREACH contact IN contacts %] |
140 |
<fieldset class="rows"> |
| 121 |
<fieldset class="supplier-contact rows"> |
141 |
<legend>Contacts</legend> |
|
|
142 |
<fieldset id="contact-template" class="supplier-contact"> |
| 122 |
<legend>Contact details</legend> |
143 |
<legend>Contact details</legend> |
| 123 |
[% INCLUDE edit_contact %] |
144 |
[% INCLUDE edit_contact %] |
| 124 |
</fieldset> |
145 |
</fieldset> |
| 125 |
[% END %] |
146 |
[% FOREACH contact IN contacts %] |
|
|
147 |
<fieldset class="supplier-contact"> |
| 148 |
<legend>Contact details</legend> |
| 149 |
[% INCLUDE edit_contact %] |
| 150 |
</fieldset> |
| 151 |
[% END %] |
| 152 |
<button id="add-contact" class="btn"><i class="icon-plus"></i>Add contact</button> |
| 153 |
</fieldset> |
| 126 |
</div> |
154 |
</div> |
| 127 |
<div class="yui-g"> |
155 |
<div class="yui-g"> |
| 128 |
<fieldset class="rows"> |
156 |
<fieldset class="rows"> |