Merge pull request #209 from davecivicrm/CRM-12145
[civicrm-core.git] / templates / CRM / Member / Form / MembershipType.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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 {* this template is used for adding/editing/deleting membership type *}
27 <h3>{if $action eq 1}{ts}New Membership Type{/ts}{elseif $action eq 2}{ts}Edit Membership Type{/ts}{else}{ts}Delete Membership Type{/ts}{/if}</h3>
28 <div class="crm-block crm-form-block crm-membership-type-form-block">
29
30 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
31 <div class="form-item" id="membership_type_form">
32 {if $action eq 8}
33 <div class="messages status no-popup">
34 {ts}WARNING: Deleting this option will result in the loss of all membership records of this type.{/ts} {ts}This may mean the loss of a substantial amount of data, and the action cannot be undone.{/ts} {ts}Do you want to continue?{/ts}
35 </div>
36 <div> {include file="CRM/common/formButtons.tpl"}</div>
37 {else}
38 <table class="form-layout-compressed">
39 <tr class="crm-membership-type-form-block-name">
40 <td class="label">{$form.name.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_type' field='name' id=$membershipTypeId}{/if}
41 </td>
42 <td>{$form.name.html}<br />
43 <span class="description">{ts}e.g. 'Student', 'Senior', 'Honor Society'...{/ts}</span>
44 </td>
45 </tr>
46 <tr class="crm-membership-type-form-block-description">
47 <td class="label">{$form.description.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_membership_type' field='description' id=$membershipTypeId}{/if}
48 </td>
49 <td>{$form.description.html}<br />
50 <span class="description">{ts}Description of this membership type for internal use. May include eligibility, benefits, terms, etc.{/ts}</span>
51 </td>
52 </tr>
53
54 <tr class="crm-membership-type-form-block-member_org">
55 <td class="label">{$form.member_of_contact.label}</td>
56 <td><label>{$form.member_of_contact.html}</label><br />
57 <span class="description">{ts}Members assigned this membership type belong to which organization (e.g. this is for membership in 'Save the Whales - Northwest Chapter'). NOTE: This organization/group/chapter must exist as a CiviCRM Organization type contact.{/ts}</span>
58 </td>
59 </tr>
60
61 <tr class="crm-membership-type-form-block-minimum_fee">
62 <td class="label">{$form.minimum_fee.label}</td>
63 <td>{$form.minimum_fee.html|crmMoney}<br />
64 <span class="description">{ts}Minimum fee required for this membership type. For free/complimentary memberships - set minimum fee to zero (0).{/ts}</span>
65 </td>
66 </tr>
67 <tr class="crm-membership-type-form-block-financial_type_id">
68 <td class="label">{$form.financial_type_id.label}<span class="marker"> *</span></td>
69 <td>{$form.financial_type_id.html}<br />
70 <span class="description">{ts}Select the financial type assigned to fees for this membership type (for example 'Membership Fees'). This is required for all membership types - including free or complimentary memberships.{/ts}</span>
71 </td>
72 </tr>
73 <tr class="crm-membership-type-form-block-auto_renew">
74 <td class="label">{$form.auto_renew.label}</td>
75 {if $authorize}
76 <td>{$form.auto_renew.html}</td>
77 {else}
78 <td>{ts}You will need to select and configure a supported payment processor (currently Authorize.Net, PayPal Pro, or PayPal Website Standard) in order to offer automatically renewing memberships.{/ts} {docURL page="user/contributions/payment-processors"}</td>
79 {/if}
80 </tr>
81 <tr class="crm-membership-type-form-block-duration_unit_interval">
82 <td class="label">{$form.duration_unit.label}&nbsp;<span class="marker">*</span></td>
83 <td>{$form.duration_interval.html}&nbsp;&nbsp;{$form.duration_unit.html}<br />
84 <span class="description">{ts}Duration of this membership (e.g. 30 days, 2 months, 5 years, 1 lifetime){/ts}</span>
85 </td>
86 </tr>
87 <tr class="crm-membership-type-form-block-period_type">
88 <td class="label">{$form.period_type.label}<span class="marker"> *</span></td>
89 <td>{$form.period_type.html}<br />
90 <span class="description">{ts}Select 'rolling' if membership periods begin at date of signup. Select 'fixed' if membership periods begin on a set calendar date.{/ts} {help id="period-type" file="CRM/Member/Page/MembershipType.hlp"}</span>
91 </td>
92 </tr>
93 <tr id="fixed_start_day_row" class="crm-membership-type-form-block-fixed_period_start_day">
94 <td class="label">{$form.fixed_period_start_day.label}</td>
95 <td>{$form.fixed_period_start_day.html}<br />
96 <span class="description">{ts}Month and day on which a <strong>fixed</strong> period membership or subscription begins. Example: A fixed period membership with Start Day set to Jan 01 means that membership periods would be 1/1/06 - 12/31/06 for anyone signing up during 2006.{/ts}</span>
97 </td>
98 </tr>
99 <tr id="fixed_rollover_day_row" class="crm-membership-type-form-block-fixed_period_rollover_day">
100 <td class="label">{$form.fixed_period_rollover_day.label}</td>
101 <td>{$form.fixed_period_rollover_day.html}<br />
102 <span class="description">{ts}Membership signups on or after this date cover the following calendar year as well. Example: If the rollover day is November 31, membership period for signups during December will cover the following year.{/ts}</span>
103 </td>
104 </tr>
105 <tr id="month_fixed_rollover_day_row" class="crm-membership-type-form-block-fixed_period_rollover_day">
106 <td class="label">{$form.month_fixed_period_rollover_day.label}</td>
107 <td>{$form.month_fixed_period_rollover_day.html}<br />
108 <span class="description">{ts}Membership signups on or after this day of the month cover the rest of the month plus the specified number of months.{/ts}</span>
109 </td>
110 </tr>
111 <tr class="crm-membership-type-form-block-relationship_type_id">
112 <td class="label">{$form.relationship_type_id.label}</td>
113 <td>
114 {if !$membershipRecordsExists}
115 {$form.relationship_type_id.html}
116 <br />
117 {else}
118 {$form.relationship_type_id.html}<div class="status message">{ts}You cannot modify relationship type because there are membership records associated with this membership type.{/ts}</div>
119 {/if}
120 <span class="description">{ts}Memberships can be automatically granted to related contacts by selecting a Relationship Type.{/ts} {help id="rel-type" file="CRM/Member/Page/MembershipType.hlp"}</span>
121 </td>
122 </tr>
123 <tr id="maxRelated" class="crm-membership-type-form-block-max_related">
124 <td class="label">{$form.max_related.label}</td>
125 <td>{$form.max_related.html}<br />
126 <span class="description">{ts}Maximum number of related memberships (leave blank for unlimited).{/ts}</span>
127 </td>
128 </tr>
129 <tr class="crm-membership-type-form-block-visibility">
130 <td class="label">{$form.visibility.label}</td>
131 <td>{$form.visibility.html}<br />
132 <span class="description">{ts}Is this membership type available for self-service signups ('Public') or assigned by CiviCRM 'staff' users only ('Admin'){/ts}</span>
133 </td>
134 </tr>
135 <tr class="crm-membership-type-form-block-weight">
136 <td class="label">{$form.weight.label}</td>
137 <td>{$form.weight.html}</td>
138 </tr>
139 <tr class="crm-membership-type-form-block-is_active">
140 <td class="label">{$form.is_active.label}</td>
141 <td>{$form.is_active.html}</td>
142 </tr>
143 </table>
144 <div class="spacer"></div>
145
146 <fieldset><legend>{ts}Renewal Reminders{/ts}</legend>
147 <div class="help">
148 {capture assign=reminderLink}{crmURL p='civicrm/admin/scheduleReminders' q='reset=1'}{/capture}
149 <div class="icon inform-icon"></div>&nbsp;
150 {ts 1=$reminderLink}Configure membership renewal reminders using <a href="%1">Schedule Reminders</a>. If you have previously configured renewal reminder templates, you can re-use them with your new scheduled reminders.{/ts} {docURL page="user/email/scheduled-reminders"}
151 </div>
152 </fieldset>
153
154 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
155 {/if}
156 <div class="spacer"></div>
157 </div>
158 </div>
159
160 {literal}
161 <script type="text/javascript">
162 cj(function(){
163 // start of member org autocomplete
164 var orgDataUrl = "{/literal}{$dataUrl}{literal}";
165 var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name of an existing contact.{/ts}{literal}";
166 cj('#member_of_contact').autocomplete( orgDataUrl,
167 { width : 180, selectFirst : false, hintText: hintText, matchContains: true, minChars: 1
168 }).result(
169 function(event, data, formatted) {
170 ( parseInt( data[1] ) ) ? cj( "#member_of_contact_id" ).val( data[1] ) : cj( "#member_of_contact_id" ).val('');
171 }).bind('click', function( ) {
172 cj('#member_of_contact_id').val('');
173 });
174
175 {/literal}
176 {if $member_org}
177 {literal} cj('#member_of_contact').val( "{/literal}{$member_org}{literal}");{/literal}
178 {/if}
179
180 {* setdefault in edit mode *}
181 {if $action eq 2}
182 var memberOrgId = "{$member_org_id}";
183 {literal}
184 var dataUrl = "{/literal}{crmURL p='civicrm/ajax/rest' h=0
185 q="className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=contact&org=1&id=" }{literal}" + memberOrgId;
186
187 cj.ajax({
188 url : dataUrl,
189 success : function(html){
190 htmlText = html.split( '|' , 2);
191 cj('input#member_of_contact').val(htmlText[0]);
192 }
193 });
194 {/literal}{/if}{literal}
195 // end of member org autocomplete
196
197 showHidePeriodSettings();
198 cj('#duration_unit').change(function(){
199 showHidePeriodSettings();
200 });
201
202 cj('#period_type').change(function(){
203 showHidePeriodSettings();
204 });
205
206 showHideMaxRelated(cj('#relationship_type_id :selected').val());
207 cj('#relationship_type_id').change(function(){
208 showHideMaxRelated(cj('#relationship_type_id :selected').val());
209 });
210 });
211
212 function showHidePeriodSettings() {
213 if ((cj("#period_type :selected").val() == "fixed") &&
214 (cj("#duration_unit :selected").val() == "year")) {
215 cj('#fixed_start_day_row, #fixed_rollover_day_row').show();
216 cj('#month_fixed_rollover_day_row').hide();
217 cj("#fixed_period_start_day_M, #fixed_period_start_day_d").val("1");
218 cj("#fixed_period_rollover_day_M").val("12");
219 cj("#fixed_period_rollover_day_d").val("31");
220 cj("#month_fixed_rollover_day_row").val("");
221 }
222 else if ((cj("#period_type :selected").val() == "fixed" ) &&
223 (cj("#duration_unit :selected").val() == "month" )) {
224 cj('#month_fixed_rollover_day_row').show();
225 cj('#fixed_start_day_row, #fixed_rollover_day_row').hide();
226 cj("#fixed_period_start_day_M, #fixed_period_start_day_d").val("");
227 cj("#fixed_period_rollover_day_M, #fixed_period_rollover_day_d").val("");
228 }
229 else {
230 cj('#fixed_start_day_row, #fixed_rollover_day_row, #month_fixed_rollover_day_row').hide();
231 cj("#fixed_period_start_day_M, #fixed_period_start_day_d").val("");
232 cj("#fixed_period_rollover_day_M, #fixed_period_rollover_day_d").val("");
233 cj("#month_fixed_rollover_day_row").val("");
234 }
235 }
236
237 //load the auto renew msg if recur allow.
238 {/literal}{if $authorize and $allowAutoRenewMsg}{literal}
239 cj( function(){
240 setReminder( null );
241 });
242 {/literal}{/if}{literal}
243
244 function setReminder( autoRenewOpt ) {
245 //don't process.
246 var allowToProcess = {/literal}'{$allowAutoRenewMsg}'{literal};
247 if ( !allowToProcess ) {
248 return;
249 }
250 if ( !autoRenewOpt ) {
251 autoRenewOpt = cj( 'input:radio[name="auto_renew"]:checked').val();
252 }
253 funName = 'hide();';
254 if ( autoRenewOpt == 1 || autoRenewOpt == 2 ) funName = 'show();';
255 eval( "cj('#autoRenewalMsgId')." + funName );
256 }
257
258 function showHideMaxRelated(relTypeId) {
259 if (relTypeId) {
260 cj('#maxRelated').show();
261 }
262 else {
263 cj('#maxRelated').hide();
264 }
265 }
266 </script>
267 {/literal}