Merge pull request #18010 from eileenmcnaughton/pex
[civicrm-core.git] / templates / CRM / Price / Form / PriceSet.tpl
CommitLineData
6a488035
TO
1{*
2 +--------------------------------------------------------------------+
1188c7a8 3 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 4 | |
1188c7a8
TO
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
6a488035
TO
8 +--------------------------------------------------------------------+
9*}
a6ae83bb 10{crmRegion name="price-set-1"}
6a488035
TO
11<div id="priceset" class="crm-section price_set-section">
12 {if $priceSet.help_pre}
13 <div class="messages help">{$priceSet.help_pre}</div>
14 {/if}
15
d75f2f47
EM
16 {assign var='adminFld' value=false}
17 {if call_user_func(array('CRM_Core_Permission','check'), 'administer CiviCRM') }
18 {assign var='adminFld' value=true}
19 {/if}
c7b3d063 20
6a488035 21 {foreach from=$priceSet.fields item=element key=field_id}
c7b3d063
DG
22 {* Skip 'Admin' visibility price fields WHEN this tpl is used in online registration unless user has administer CiviCRM permission. *}
23 {if $element.visibility EQ 'public' || ($element.visibility EQ 'admin' && $adminFld EQ true) || $context eq 'standalone' || $context eq 'advanced' || $context eq 'search' || $context eq 'participant' || $context eq 'dashboard' || $action eq 1024}
960dca71 24 {if $element.help_pre}<span class="content description">{$element.help_pre}</span><br />{/if}
6a488035
TO
25 <div class="crm-section {$element.name}-section">
26 {if ($element.html_type eq 'CheckBox' || $element.html_type == 'Radio') && $element.options_per_line}
27 {assign var="element_name" value="price_"|cat:$field_id}
f780dde4
FG
28 <div class="label">{$form.$element_name.label}</div>
29 <div class="content {$element.name}-content">
30 {assign var="elementCount" value="0"}
31 {assign var="optionCount" value="0"}
32 {assign var="rowCount" value="0"}
6a488035 33 {foreach name=outer key=key item=item from=$form.$element_name}
f780dde4
FG
34 {assign var="elementCount" value=`$elementCount+1`}
35 {if is_numeric($key) }
36 {assign var="optionCount" value=`$optionCount+1`}
37 {if $optionCount == 1}
38 {assign var="rowCount" value=`$rowCount+1`}
39 <div class="price-set-row {$element.name}-row{$rowCount}">
40 {/if}
41 <span class="price-set-option-content">{$form.$element_name.$key.html}</span>
42 {if $optionCount == $element.options_per_line || $elementCount == $form.$element_name|@count}
43 </div>
44 {assign var="optionCount" value="0"}
6a488035 45 {/if}
f780dde4 46 {/if}
6a488035
TO
47 {/foreach}
48 {if $element.help_post}
f780dde4 49 <div class="description">{$element.help_post}</div>
6a488035 50 {/if}
f780dde4 51 </div>
6a488035
TO
52 {else}
53
54 {assign var="element_name" value="price_"|cat:$field_id}
55
56 <div class="label">{$form.$element_name.label}</div>
139f5f76 57 <div class="content {$element.name}-content">
139f5f76 58 {$form.$element_name.html}
4dd3f46d
DG
59 {if $element.html_type eq 'Text'}
60 {if $element.is_display_amounts}
61 <span class="price-field-amount{if $form.$element_name.frozen EQ 1} sold-out-option{/if}">
62 {foreach item=option from=$element.options}
63 {if ($option.tax_amount || $option.tax_amount == "0") && $displayOpt && $invoicing}
64 {assign var="amount" value=`$option.amount+$option.tax_amount`}
65 {if $displayOpt == 'Do_not_show'}
66 {$amount|crmMoney}
67 {elseif $displayOpt == 'Inclusive'}
68 {$amount|crmMoney}
7e649aa9 69 <span class='crm-price-amount-label'> {ts 1=$taxTerm 2=$option.tax_amount|crmMoney}(includes %1 of %2){/ts}</span>
4dd3f46d
DG
70 {else}
71 {$option.amount|crmMoney}
72 <span class='crm-price-amount-label'> + {$option.tax_amount|crmMoney} {$taxTerm}</span>
73 {/if}
74 {else}
75 {$option.amount|crmMoney} {$fieldHandle} {$form.$fieldHandle.frozen}
76 {/if}
77 {if $form.$element_name.frozen EQ 1} ({ts}Sold out{/ts}){/if}
78 {/foreach}
6a488035 79 </span>
4dd3f46d
DG
80 {else}
81 {* Not showing amount, but still need to conditionally show Sold out marker *}
82 {if $form.$element_name.frozen EQ 1}
83 <span class="sold-out-option">({ts}Sold out{/ts})<span>
84 {/if}
85 {/if}
6a488035 86 {/if}
4dd3f46d 87 {if $element.help_post}<br /><span class="description">{$element.help_post}</span>{/if}
6a488035 88 </div>
6a488035
TO
89
90 {/if}
ee7f71d9
AS
91 {if !empty($extends) && $extends eq "Membership"}
92 {if (!empty($priceSet) && $element.id == $priceSet.auto_renew_membership_field) || (empty($priceSet) && $element.name == 'membership_amount')}
93 <div id="allow_auto_renew">
94 <div class='crm-section auto-renew'>
95 <div class='label'></div>
81308445 96 <div class='content' id="auto_renew_section">
ee7f71d9
AS
97 {if isset($form.auto_renew) }
98 {$form.auto_renew.html}&nbsp;{$form.auto_renew.label}
99 {/if}
100 </div>
c843169c 101 <div class='content' id="force_renew" style='display: none'>{ts}Membership will renew automatically.{/ts}</div>
4973890f 102 </div>
103 </div>
ee7f71d9 104 {/if}
4973890f 105 {/if}
106 <div class="clear"></div>
4dd3f46d 107 </div>
6a488035
TO
108 {/if}
109 {/foreach}
110
111 {if $priceSet.help_post}
112 <div class="messages help">{$priceSet.help_post}</div>
113 {/if}
114
6a488035 115 {include file="CRM/Price/Form/Calculate.tpl"}
d75f2f47 116</div>
a6ae83bb 117{/crmRegion}