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