Merge pull request #12682 from eileenmcnaughton/date_extension
[civicrm-core.git] / templates / CRM / Price / Form / PriceSet.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 5 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2018 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 *}
26 {crmRegion name="price-set-1"}
27 <div id="priceset" class="crm-section price_set-section">
28 {if $priceSet.help_pre}
29 <div class="messages help">{$priceSet.help_pre}</div>
30 {/if}
31
32 {assign var='adminFld' value=false}
33 {if call_user_func(array('CRM_Core_Permission','check'), 'administer CiviCRM') }
34 {assign var='adminFld' value=true}
35 {/if}
36
37 {foreach from=$priceSet.fields item=element key=field_id}
38 {* Skip 'Admin' visibility price fields WHEN this tpl is used in online registration unless user has administer CiviCRM permission. *}
39 {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}
40 {if $element.help_pre}<span class="content description">{$element.help_pre}</span><br />{/if}
41 <div class="crm-section {$element.name}-section">
42 {if ($element.html_type eq 'CheckBox' || $element.html_type == 'Radio') && $element.options_per_line}
43 {assign var="element_name" value="price_"|cat:$field_id}
44 <div class="label">{$form.$element_name.label}</div>
45 <div class="content {$element.name}-content">
46 {assign var="elementCount" value="0"}
47 {assign var="optionCount" value="0"}
48 {assign var="rowCount" value="0"}
49 {foreach name=outer key=key item=item from=$form.$element_name}
50 {assign var="elementCount" value=`$elementCount+1`}
51 {if is_numeric($key) }
52 {assign var="optionCount" value=`$optionCount+1`}
53 {if $optionCount == 1}
54 {assign var="rowCount" value=`$rowCount+1`}
55 <div class="price-set-row {$element.name}-row{$rowCount}">
56 {/if}
57 <span class="price-set-option-content">{$form.$element_name.$key.html}</span>
58 {if $optionCount == $element.options_per_line || $elementCount == $form.$element_name|@count}
59 </div>
60 {assign var="optionCount" value="0"}
61 {/if}
62 {/if}
63 {/foreach}
64 {if $element.help_post}
65 <div class="description">{$element.help_post}</div>
66 {/if}
67 </div>
68 {else}
69
70 {assign var="element_name" value="price_"|cat:$field_id}
71
72 <div class="label">{$form.$element_name.label}</div>
73 <div class="content {$element.name}-content">
74 {$form.$element_name.html}
75 {if $element.html_type eq 'Text'}
76 {if $element.is_display_amounts}
77 <span class="price-field-amount{if $form.$element_name.frozen EQ 1} sold-out-option{/if}">
78 {foreach item=option from=$element.options}
79 {if ($option.tax_amount || $option.tax_amount == "0") && $displayOpt && $invoicing}
80 {assign var="amount" value=`$option.amount+$option.tax_amount`}
81 {if $displayOpt == 'Do_not_show'}
82 {$amount|crmMoney}
83 {elseif $displayOpt == 'Inclusive'}
84 {$amount|crmMoney}
85 <span class='crm-price-amount-label'> {ts 1=$taxTerm 2=$option.tax_amount|crmMoney}(includes %1 of %2){/ts}</span>
86 {else}
87 {$option.amount|crmMoney}
88 <span class='crm-price-amount-label'> + {$option.tax_amount|crmMoney} {$taxTerm}</span>
89 {/if}
90 {else}
91 {$option.amount|crmMoney} {$fieldHandle} {$form.$fieldHandle.frozen}
92 {/if}
93 {if $form.$element_name.frozen EQ 1} ({ts}Sold out{/ts}){/if}
94 {/foreach}
95 </span>
96 {else}
97 {* Not showing amount, but still need to conditionally show Sold out marker *}
98 {if $form.$element_name.frozen EQ 1}
99 <span class="sold-out-option">({ts}Sold out{/ts})<span>
100 {/if}
101 {/if}
102 {/if}
103 {if $element.help_post}<br /><span class="description">{$element.help_post}</span>{/if}
104 </div>
105
106 {/if}
107 {if !empty($extends) && $extends eq "Membership"}
108 {if (!empty($priceSet) && $element.id == $priceSet.auto_renew_membership_field) || (empty($priceSet) && $element.name == 'membership_amount')}
109 <div id="allow_auto_renew">
110 <div class='crm-section auto-renew'>
111 <div class='label'></div>
112 <div class='content' id="auto_renew_section">
113 {if isset($form.auto_renew) }
114 {$form.auto_renew.html}&nbsp;{$form.auto_renew.label}
115 {/if}
116 </div>
117 <div class='content' id="force_renew" style='display: none'>{ts}Membership will renew automatically.{/ts}</div>
118 </div>
119 </div>
120 {/if}
121 {/if}
122 <div class="clear"></div>
123 </div>
124 {/if}
125 {/foreach}
126
127 {if $priceSet.help_post}
128 <div class="messages help">{$priceSet.help_post}</div>
129 {/if}
130
131 {include file="CRM/Price/Form/Calculate.tpl"}
132 </div>
133 {/crmRegion}