Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-11-23-22-46-27
[civicrm-core.git] / templates / CRM / Event / Cart / Form / Checkout / ParticipantsAndPrices.tpl
1 {include file="CRM/common/TrackingFields.tpl"}
2
3 {if $contact}
4 <div class="messages status no-popup">
5 {ts 1=$contact.display_name}Welcome %1{/ts}. (<a href="{crmURL p='civicrm/event/cart_checkout' q="&cid=0&reset=1"}" title="{ts}Click here to register a different person for this event.{/ts}">{ts 1=$contact.display_name}Not %1, or want to register a different person{/ts}</a>?)</div>
6 {/if}
7
8 {foreach from=$events_in_carts key=index item=event_in_cart}
9 {if !$event_in_cart.main_conference_event_id}
10 {assign var=event_id value=$event_in_cart->event_id}
11 <h3 class="event-title">
12 {$event_in_cart->event->title} ({$event_in_cart->event->start_date|date_format:"%m/%d/%Y %l:%M%p"})
13 </h3>
14 <fieldset class="event_form">
15 <div class="participants crm-section" id="event_{$event_in_cart->event_id}_participants">
16 {foreach from=$event_in_cart->participants item=participant}
17 {include file="CRM/Event/Cart/Form/Checkout/Participant.tpl"}
18 {/foreach}
19 <a class="link-add" href="#" onclick="add_participant({$event_in_cart->event_cart->id}, {$event_in_cart->event_id}); return false;">{ts}Add Another Participant{/ts}</a>
20 </div>
21 {if $event_in_cart->event->is_monetary }
22 <div class="price_choices crm-section">
23 {foreach from=$price_fields_for_event.$event_id key=price_index item=price_field_name}
24 <div class="label">
25 {$form.$price_field_name.label}
26 </div>
27 <div class="content">
28 {$form.$price_field_name.html|replace:'/label>&nbsp;':'/label><br>'}
29 </div>
30 {/foreach}
31 </div>
32 {else}
33 <p>{ts}There is no charge for this event.{/ts}</p>
34 {/if}
35 </fieldset>
36 {/if}
37 {/foreach}
38
39 <div id="crm-submit-buttons" class="crm-submit-buttons">
40 {include file="CRM/common/formButtons.tpl" location="bottom"}
41 </div>
42
43 {include file="CRM/Event/Cart/Form/viewCartLink.tpl"}
44
45 {literal}
46 <script type="text/javascript">
47 //<![CDATA[
48 function add_participant( cart_id, event_id ) {
49 var max_index = 0;
50 var matcher = new RegExp("event_" + event_id + "_participant_(\\d+)");
51
52 cj('#event_' + event_id + '_participants .participant').each(
53 function(index) {
54 matches = matcher.exec(cj(this).attr('id'));
55 index = parseInt(matches[1]);
56 if (index > max_index)
57 {
58 max_index = index;
59 }
60 }
61 );
62
63 // FIXME: this get should be a post according to restful standards
64 cj.get(CRM.url("civicrm/ajax/event/add_participant_to_cart?snippet=1", {cart_id: cart_id, event_id: event_id}),
65 function(data) {
66 cj('#event_' + event_id + '_participants').append(data).trigger('crmLoad');
67 }
68 );
69 }
70
71 function delete_participant( event_id, participant_id )
72 {
73 // FIXME: this get should be a post according to restful standards
74 cj('#event_' + event_id + '_participant_' + participant_id).remove();
75 cj.get(CRM.url("civicrm/ajax/event/remove_participant_from_cart", {id: participant_id}));
76 }
77
78
79 //XXX missing
80 cj('#ajax_error').ajaxError(
81 function( e, xrh, settings, exception ) {
82 cj(this).append('<div class="error">{/literal}{ts escape='js'}Error adding a participant at{/ts}{literal} ' + settings.url + ': ' + exception);
83 }
84 );
85 //]]>
86 </script>
87 {/literal}