|
Lines 16-22
Link Here
|
| 16 |
<input type="text" size="40" id="contact_email[% contact.id %]" 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[% contact.id %]">Notes: </label> |
17 |
<li><label for="contact_notes[% contact.id %]">Notes: </label> |
| 18 |
<textarea id="contact_notes[% contact.id %]" 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 |
<li><label for="contact_acqprimary[% contact.id %]">Primary acquisitions contact</label> |
|
|
20 |
[% IF contact.acqprimary %] |
| 21 |
<input type="checkbox" id="contact_acqprimary[% contact.id %]" class="contact_acqprimary" checked="checked"></input> |
| 22 |
[% ELSE %] |
| 23 |
<input type="checkbox" id="contact_acqprimary[% contact.id %]" class="contact_acqprimary"></input> |
| 24 |
[% END %] |
| 25 |
<input type="hidden" class="contact_acqprimary_hidden" name="contact_acqprimary" value="[% contact.acqprimary %]"></input> |
| 26 |
<li><label for="contact_serialsprimary[% contact.id %]">Primary serials contact</label> |
| 27 |
[% IF contact.serialsprimary %] |
| 28 |
<input type="checkbox" id="contact_serialsprimary[% contact.id %]" class="contact_serialsprimary" checked="checked"></input> |
| 29 |
[% ELSE %] |
| 30 |
<input type="checkbox" id="contact_serialsprimary[% contact.id %]" class="contact_serialsprimary"></input> |
| 31 |
[% END %] |
| 32 |
<input type="hidden" class="contact_serialsprimary_hidden" name="contact_serialsprimary" value="[% contact.serialsprimary %]"></input> |
| 33 |
<li><label for="contact_claimacquisition[% contact.id %]">Contact about late orders?</label> |
| 34 |
[% IF contact.claimacquisition %] |
| 35 |
<input type="checkbox" id="contact_claimacquisition[% contact.id %]" class="contact_claimacquisition" checked="checked"></input> |
| 36 |
[% ELSE %] |
| 37 |
<input type="checkbox" id="contact_claimacquisition[% contact.id %]" class="contact_claimacquisition"></input> |
| 38 |
[% END %] |
| 39 |
<input type="hidden" class="contact_claimacquisition_hidden" name="contact_claimacquisition" value="[% contact.claimacquisition %]"></input> |
| 40 |
<li><label for="contact_claimissues[% contact.id %]">Contact about late issues?</label> |
| 41 |
[% IF contact.claimissues %] |
| 42 |
<input type="checkbox" id="contact_claimissues[% contact.id %]" class="contact_claimissues" checked="checked"></input> |
| 43 |
[% ELSE %] |
| 44 |
<input type="checkbox" id="contact_claimissues[% contact.id %]" class="contact_claimissues"></input> |
| 45 |
[% END %] |
| 46 |
<input type="hidden" class="contact_claimissues_hidden" name="contact_claimissues" value="[% contact.claimissues %]"></input> |
| 47 |
</li> |
| 48 |
[% IF contact.id %]<li><button class="btn delete-contact"><i class="icon-remove"></i> Delete contact</li>[% END %] |
| 20 |
</ol> |
49 |
</ol> |
| 21 |
[% END %] |
50 |
[% END %] |
| 22 |
|
51 |
|
|
Lines 32-37
Link Here
|
| 32 |
[% IF ( contact.notes ) %] |
61 |
[% IF ( contact.notes ) %] |
| 33 |
<p><span class="label">Notes: </span>[% contact.notes %]</p> |
62 |
<p><span class="label">Notes: </span>[% contact.notes %]</p> |
| 34 |
[% END %] |
63 |
[% END %] |
|
|
64 |
[% IF ( contact.acqprimary ) %] |
| 65 |
<p><span class="label">Primary acquisitions contact</span></p> |
| 66 |
[% END %] |
| 67 |
[% IF ( contact.serialsprimary ) %] |
| 68 |
<p><span class="label">Primary serials contact</span></p> |
| 69 |
[% END %] |
| 70 |
[% IF ( contact.claimacquisition ) %] |
| 71 |
<p><span class="label">Receives claims for late orders</span></p> |
| 72 |
[% END %] |
| 73 |
[% IF ( contact.claimissues ) %] |
| 74 |
<p><span class="label">Receives claims for late issues</span></p> |
| 75 |
[% END %] |
| 35 |
[% END %] |
76 |
[% END %] |
| 36 |
|
77 |
|
| 37 |
[% INCLUDE 'doc-head-open.inc' %] |
78 |
[% INCLUDE 'doc-head-open.inc' %] |
|
Lines 59-71
function add_contact() {
Link Here
|
| 59 |
$(this).attr('for', $(this).attr('for') + '_' + timestamp); |
100 |
$(this).attr('for', $(this).attr('for') + '_' + timestamp); |
| 60 |
}); |
101 |
}); |
| 61 |
$(new_contact).insertBefore(this); |
102 |
$(new_contact).insertBefore(this); |
|
|
103 |
if ($('.supplier-contact').length === 2) { // First contact |
| 104 |
$.each(['.contact_acqprimary', '.contact_serialsprimary', '.contact_claimacquisition', '.contact_claimissues'], function (idx, checkbox) { |
| 105 |
$(checkbox, new_contact).click(); |
| 106 |
}); |
| 107 |
} |
| 62 |
$('input[name="contact_name"]', new_contact).focus(); |
108 |
$('input[name="contact_name"]', new_contact).focus(); |
| 63 |
return false; |
109 |
return false; |
| 64 |
} |
110 |
} |
| 65 |
|
111 |
|
| 66 |
function delete_contact() { |
112 |
function delete_contact(ev) { |
| 67 |
$(this).parents('fieldset').delete(); |
113 |
$(this).parents('.supplier-contact').remove(); |
| 68 |
return false; |
114 |
ev.preventDefault(); |
| 69 |
} |
115 |
} |
| 70 |
|
116 |
|
| 71 |
$(document).ready(function() { |
117 |
$(document).ready(function() { |
|
Lines 76-83
function delete_contact() {
Link Here
|
| 76 |
], |
122 |
], |
| 77 |
'sDom': 't' |
123 |
'sDom': 't' |
| 78 |
} ) ); |
124 |
} ) ); |
| 79 |
$('.delete-contact').click(delete_contact); |
125 |
$('body').on('click', '.delete-contact', null, delete_contact); |
| 80 |
$('#add-contact').click(add_contact); |
126 |
$('#add-contact').click(add_contact); |
|
|
127 |
$('body').on('click', '.contact_acqprimary', null, function () { |
| 128 |
if ($(this).attr('checked') === 'checked') { |
| 129 |
$('.contact_acqprimary').filter(':checked').not(this).removeAttr('checked'); |
| 130 |
$('.contact_acqprimary_hidden').each(function () { |
| 131 |
$(this).val('0'); |
| 132 |
}); |
| 133 |
} |
| 134 |
$(this).next('.contact_acqprimary_hidden').val('1'); |
| 135 |
}); |
| 136 |
$('body').on('click', '.contact_serialsprimary', null, function () { |
| 137 |
if ($(this).attr('checked') === 'checked') { |
| 138 |
$('.contact_serialsprimary').filter(':checked').not(this).removeAttr('checked'); |
| 139 |
$('.contact_serialsprimary_hidden').each(function () { |
| 140 |
$(this).val('0'); |
| 141 |
}); |
| 142 |
} |
| 143 |
$(this).next('.contact_serialsprimary_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0'); |
| 144 |
}); |
| 145 |
$('body').on('click', '.contact_claimacquisition', null, function () { |
| 146 |
$(this).next('.contact_claimacquisition_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0'); |
| 147 |
}); |
| 148 |
$('body').on('click', '.contact_claimissues', null, function () { |
| 149 |
$(this).next('.contact_claimissues_hidden').val($(this).attr('checked') === 'checked' ? '1' : '0'); |
| 150 |
}); |
| 81 |
}); |
151 |
}); |
| 82 |
//]]> |
152 |
//]]> |
| 83 |
</script> |
153 |
</script> |