1 {% extends parent_tpl %}
5 <div class="right aligned bottom floating ui {{ member.getRowClass() }} label">{{ member.getDues() }}</div>
12 {% include "elements/navigate.html.twig" with {"mpath": "editMember"} %}
13 {% include "elements/member_card.html.twig" %}
16 <form action="{% if self_adh %}{{ path_for("storeselfmembers") }}{% elseif not member.id %}{{ path_for("doAddMember") }}{% else %}{{ path_for("doEditMember", {"id": member.id}) }}{% endif %}" method="post" enctype="multipart/form-data" id="form" class="ui form">
18 <div class="ui compact segment">
19 {% if member.hasParent() and not member.isDuplicate() %}
20 <div class="inline field">
21 <span class="ui primary ribbon label">{{ _T("Attached to:") }}</span>
22 <a href="{{ path_for("member", {"id": member.parent.id}) }}" class="ui label">{{ member.parent.sfullname }}</a>
23 {% if not member.id %}
24 <input type="hidden" name="parent_id" value="{{ member.parent.id }}"/>
27 {% if login.isAdmin() or login.isStaff() and (addchild is not defined or not addchild) %}
28 <div class="inline field">
29 <div class="ui toggle checkbox">
30 <input type="checkbox" name="detach_parent" id="detach_parent" value="1"/>
31 <label for="detach_parent">{{ _T("Detach?") }}</label>
35 {% elseif (login.isAdmin() or login.isStaff()) and not member.hasChildren() and members.list is defined %}
36 <input type="checkbox" name="attach" id="attach" value="1"{% if member.isDuplicate() %} checked="checked"{% endif %}/>
37 <label for="attach"><i class="linkify icon"></i> {{ _T("Attach member") }}</label>
38 <span id="parent_id_elt" class="sr-only">
39 <div id="parent_id" class="ui search selection dropdown nochosen">
40 <input type="hidden" name="parent_id" value="{{ member.isDuplicate() and member.parent is defined ? member.parent.id }}">
41 <i class="dropdown icon"></i>
42 <div class="default text">{{ _T("-- select a name --") }}</div>
44 {% for k, v in members.list %}
45 <div class="item" data-value="{{ k }}">{{ v }}</div>
49 <div class="ui tiny icon button" id="reset-contributor"><i class="redo icon"></i><span class="hidden">{{ _T("Reset") }}</span></div>
51 {% if member.isDuplicate() %}
52 <input type="hidden" name="duplicate" value="1" />
54 {% elseif member.hasChildren() %}
55 <div class="inline field">
56 <span class="ui primary ribbon label">{{ _T("Parent of:") }}</span>
57 {% for child in member.children %}
58 <a href="{{ path_for("member", {"id": child.id}) }}" class="ui label">{{ child.sfullname }}</a>{% if not loop.last %}, {% endif %}
64 {# Main form entries #}
65 {% include "components/form.html.twig" %}
67 {% include "components/dynamic_fields.html.twig" with {object: member} %}
68 {% include "elements/edit_socials.html.twig" with {socials: member.socials} %}
70 {% if not member.id and not self_adh %}
71 {% if login.isAdmin() or login.isStaff() %}
72 <div class="ui center aligned yellow segment">
73 <div class="inline field">
74 <label for="redirect_on_create">{{ _T("After member creation:") }}</label>
75 <select name="redirect_on_create" id="redirect_on_create"i class="ui search dropdown nochosen">
76 <option value="{{ constant('Galette\\Entity\\Adherent::AFTER_ADD_DEFAULT') }}"{% if preferences.pref_redirect_on_create == constant('Galette\\Entity\\Adherent::AFTER_ADD_DEFAULT') %} selected="selected"{% endif %}>{{ _T("create a new contribution (default action)") }}</option>
77 <option value="{{ constant('Galette\\Entity\\Adherent::AFTER_ADD_TRANS') }}"{% if preferences.pref_redirect_on_create == constant('Galette\\Entity\\Adherent::AFTER_ADD_TRANS') %} selected="selected"{% endif %}>{{ _T("create a new transaction") }}</option>
78 <option value="{{ constant('Galette\\Entity\\Adherent::AFTER_ADD_NEW') }}"{% if preferences.pref_redirect_on_create == constant('Galette\\Entity\\Adherent::AFTER_ADD_NEW') %} selected="selected"{% endif %}>{{ _T("create another new member") }}</option>
79 <option value="{{ constant('Galette\\Entity\\Adherent::AFTER_ADD_SHOW') }}"{% if preferences.pref_redirect_on_create == constant('Galette\\Entity\\Adherent::AFTER_ADD_SHOW') %} selected="selected"{% endif %}>{{ _T("show member") }}</option>
80 <option value="{{ constant('Galette\\Entity\\Adherent::AFTER_ADD_LIST') }}"{% if preferences.pref_redirect_on_create == constant('Galette\\Entity\\Adherent::AFTER_ADD_LIST') %} selected="selected"{% endif %}>{{ _T("go to members list") }}</option>
81 <option value="{{ constant('Galette\\Entity\\Adherent::AFTER_ADD_HOME') }}"{% if preferences.pref_redirect_on_create == constant('Galette\\Entity\\Adherent::AFTER_ADD_HOME') %} selected="selected"{% endif %}>{{ _T("go to main page") }}</option>
86 <input type="hidden" name="redirect_on_create" value="{{ constant('Galette\\Entity\\Adherent::AFTER_ADD_SHOW') }}"/>
88 {% if addchild is defined and addchild %}
89 <input type="hidden" name="addchild" value="true"/>
92 {% if preferences.pref_mail_method != constant('Galette\\Core\\GaletteMail::METHOD_DISABLED') and (not self_adh and (login.isAdmin() or login.isStaff())) %}
93 <div class="ui center aligned yellow segment">
94 <div class="inline field">
95 <div class="ui toggle checkbox">
96 <input type="checkbox" name="mail_confirm" id="mail_confirm" value="1"{% if member.sendEMail() %} checked="checked"{% endif %}/>
97 <label for="mail_confirm">
99 {{ _T("Notify member his account has been modified") }}
101 {{ _T("Notify member his account has been created") }}
105 <span class="exemple">
107 {{ _T("Member will be notified by email his account has been modified.") }}
109 {{ _T("Member will receive his username and password by email, if he has an address.") }}
116 <div class="ui basic center aligned fitted segment">
117 <button type="submit" name="valid" class="action ui labeled icon primary button">
118 <i class="save icon"></i> {{ _T("Save") }}
120 {% for entry in hidden_elements %}
121 {% if entry.field_id != 'mdp_adh' %}
122 {% set title = null %}
124 {% set size = null %}
125 {% set propname = entry.propname %}
126 {% if entry.field_id == 'activite_adh' %}
127 {% set value = member.isActive() %}
129 {% set value = attribute(member, propname) %}
131 {% set checked = null %}
132 {% set example = null %}
134 {% if value != '' and entry.field_id != 'parent_id' %}
135 {% include "components/forms/hidden.html.twig" with {
136 name: entry.field_id,
143 {% include "components/forms/csrf.html.twig" %}
148 {% block javascripts %}
149 <script type="text/javascript">
150 {% include "elements/js/choose_adh.js.twig" with {"js_chosen_id": "#parent_id"} %}
152 $('#is_company').change(function(){
153 $('#company_field').toggleClass('hidden');
154 $('#company_field').backgroundFade(
161 $(this).backgroundFade(
170 {% if not self_adh %}
172 $('#btngroups, #btnmanagedgroups').click(function(){
173 var _managed = false;
174 if ( $(this).attr('id') == 'btnmanagedgroups' ) {
178 var _form = (_managed) ? 'managed' : 'user';
179 $('#' + _form + 'groups_form input').each(function(){
180 _group = $(this).val().split('|');
181 _groups[_groups.length] = {
187 url: '{{ path_for("ajax_groups") }}',
194 {% include "elements/js/loader.js.twig" with {
195 selector: '#groups_field'
197 success: function(res){
198 _groups_dialog(res, _groups, _managed);
201 alert("{{ _T("An error occurred displaying groups interface :(")|e('js') }}");
207 var _groups_dialog = function(res, _groups, _managed){
208 var _title = '{{ _T("Groups selection")|e('js') }}';
210 _title = '{{ _T("Managed groups selection")|e('js') }}';
214 class: 'fullscreen scrolling',
217 text : '{{ _T("Close")|e('js') }}',
221 _groups_ajax_mapper(res, _groups, _managed);
224 var _groups_ajax_mapper = function(res, _groups, _managed){
225 $('#btnvalid').click(function(){
226 //remove actual groups
227 var _form = (_managed) ? 'managed' : 'user';
228 $('#' + _form + 'groups_form').empty();
229 var _groups = new Array();
230 var _groups_str = '<br/><strong>';
232 _groups_str += '{{ _T("Manager for:")|e('js') }}';
234 _groups_str += '{{ _T("Member of:")|e('js') }}';
236 _groups_str += '</strong> ';
238 $('li[id^="group_"]').each(function(){
240 _gid = this.id.substring(6, this.id.length);
241 _gname = $(this).text();
242 _groups[_groups.length] = this.id.substring(6, this.id.length);
243 var _iname = (_managed) ? 'groups_managed_adh' : 'groups_adh';
244 $('#' + _form + 'groups_form').append(
245 '<input type="hidden" value="' +
246 _gid + '|' + _gname + '|' +
247 '" name="' + _iname + '[]">'
249 if ( _groups.length > 1 ) {
252 _groups_str += _gname;
254 $('#' + _form + 'groups').html(_groups_str);
255 $('#ajax_groups_list').modal('hide');
258 var _none = $('#none_selected').clone();
259 $('li input[type=checkbox]').click(function(e){
262 $('li[id^="group_"]').click(function(){
264 if ( $('#selected_groups ul li').length == 0 ) {
265 $('#selected_groups ul').append(_none);
268 $('#listing a').click(function(e){
270 var _gid = this.href.match(/.*\/(\d+)$/)[1];
271 var _gname = $(this).text();
272 $('#none_selected').remove()
273 if ( $('#group_' + _gid).length == 0 ) {
274 var _li = '<li id="group_' + _gid + '" class="item"><i class="user minus icon"></i><span class="ui content">' + _gname + '</span></li>';
275 $('#selected_groups ul').append(_li);
276 $('#group_' + _gid).click(function(){
278 if ( $('#selected_groups ul li').length == 0 ) {
279 $('#selected_groups ul').append(_none);
288 {% if not self_adh and not member.hasChildren() %}
289 {# Parent selection #}
290 $('#parent_id_elt').removeClass('sr-only');
291 {% if not member.isDuplicate() %}
292 $('#parent_id_elt').hide();
294 $('#attach').on('click', function() {
295 var _checked = $(this).is(':checked');
296 $('#parent_id_elt').toggle();
300 {% if not self_adh %}
301 {% if parent_fields|length > 0 %}
302 $('#detach_parent').on('change', function(){
303 var _checked = $(this).is(':checked');
305 {% for req in parent_fields %}
306 _changes += '#{{ req }}';
307 {% if not loop.last %}
312 $(_changes).attr('required', 'required');
314 $(_changes).removeAttr('required');
318 $('#parent_id').on('change', function(){
319 var _hasParent = $(this).attr('value') != '';
321 {% for req in parent_fields %}
322 _changes += '#{{ req }}';
323 {% if not loop.last %}
328 $(_changes).removeAttr('required');
330 $(_changes).attr('required', 'required');
335 {% include "elements/js/photo_dnd.js.twig" %}
337 $('#ddn_adh').on('blur', function() {
338 var _bdate = $(this).val();
339 if ('{{ _T("Y-m-d") }}' === 'Y-m-d') {
340 _bdate = new Date(_bdate);
343 var _dparts = _bdate.split("/");
344 _bdate = new Date(_dparts[2], _dparts[1] - 1, _dparts[0]);
347 if (! isNaN(_bdate.getTime())) {
348 var _today = new Date();
349 var _age = Math.floor((_today-_bdate) / (365.25 * 24 * 60 * 60 * 1000));
350 $('#member_age').html('{{ _T(" (%age years old)") }}'.replace(/%age/, _age))
352 $('#member_age').html('');