1 {% extends parent_tpl %}
4 <form action="{% if self_adh %}{{ url_for("storeselfmembers") }}{% elseif not member.id %}{{ url_for("doAddMember") }}{% else %}{{ url_for("doEditMember", {"id": member.id}) }}{% endif %}" method="post" enctype="multipart/form-data" id="form" class="ui form{% if member.id %} edit-member{% endif %}">
6 <div class="ui stackable grid">
8 <div class="sixteen wide tablet six wide computer five wide widescreen column order-2">
9 <div class="position-sticky">
10 <div class="ui basic clearing horizontally fitted segment">
12 <div class="ui left floated basic fitted segment">
13 {% include "elements/navigate.html.twig" with {"mpath": "editMember"} %}
16 <div class="ui right floated basic fitted segment">
17 <div class="ui small spaced buttons">
19 <button type="submit" name="valid" class="action ui labeled icon primary button">
20 <i class="save icon"></i> {{ _T("Save") }}
24 href="{{ url_for("member", {"id": member.id}) }}"
25 class="ui basic labeled icon button"
27 <i class="eye outline icon"></i>
33 {% include "elements/member_card.html.twig" %}
37 <div class="ui{% if not member.id %} compact{% endif %} segment">
38 {% if member.hasParent() and not member.isDuplicate() %}
40 <div class="ui label">
41 <i class="linkify icon"></i>
42 {{ _T("Attached to:") }}
44 <div class="ui celled list">
45 <a href="{{ url_for("member", {"id": member.parent.id}) }}" class="item">{{ member.parent.sfullname }}</a>
47 {% if not member.id %}
48 <input type="hidden" name="parent_id" value="{{ member.parent.id }}"/>
51 {% if login.isAdmin() or login.isStaff() and (addchild is not defined or not addchild) %}
53 <div class="ui toggle checkbox">
54 <input type="checkbox" name="detach_parent" id="detach_parent" value="1"/>
55 <label for="detach_parent">{{ _T("Detach?") }}</label>
59 {% elseif (login.isAdmin() or login.isStaff()) and not member.hasChildren() and members.list is defined %}
60 <div id="attach-checkbox" class="ui{% if member.isDuplicate() %} checked{% endif %} toggle checkbox">
61 <input type="checkbox" name="attach" id="attach" value="1"{% if member.isDuplicate() %} checked="checked"{% endif %}/>
62 <label for="attach"><i class="linkify icon"></i> {{ _T("Attach member") }}</label>
64 <span id="parent_id_elt" class="">
65 <div id="parent_id" class="jsonly search-dropdown ui input nochosen paginated">
66 <input id="parent_id_input" type="text" name="parent_id" value="{{ member.isDuplicate() and member.parent is defined and member.parent is not null ? member.parent.id }}" placeholder="{{ _T("Member ID") }}">
67 <i class="jsonly displaynone dropdown icon"></i>
68 <i class="jsonly displaynone chevron circle right icon tooltip" title="{{ _T("Next results") }}"></i>
69 <div class="jsonly displaynone default text">{{ _T("Search for name or ID and pick member") }}</div>
72 {% if member.isDuplicate() %}
73 <input type="hidden" name="duplicate" value="1" />
75 {% elseif member.hasChildren() %}
77 <div class="ui label">
78 <i class="linkify icon"></i>
79 {{ _T("Parent of:") }}
81 <div class="ui celled list">
82 {% for child in member.children %}
83 <a href="{{ url_for("member", {"id": child.id}) }}" class="item">{{ child.sfullname }}</a>
94 <div class="sixteen wide tablet ten wide computer eleven wide widescreen column">
96 {# Main form entries #}
97 {% include "components/form.html.twig" %}
100 {% include "components/dynamic_fields.html.twig" with {object: member} %}
102 {% if not member.id and not self_adh %}
103 {% if login.isAdmin() or login.isStaff() %}
104 <div class="ui center aligned yellow segment">
105 <div class="inline field">
106 <label for="redirect_on_create">{{ _T("After member creation:") }}</label>
107 <select name="redirect_on_create" id="redirect_on_create"i class="ui search dropdown nochosen">
108 <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>
109 <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>
110 <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>
111 <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>
112 <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>
113 <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>
118 <input type="hidden" name="redirect_on_create" value="{{ constant('Galette\\Entity\\Adherent::AFTER_ADD_SHOW') }}"/>
120 {% if addchild is defined and addchild %}
121 <input type="hidden" name="addchild" value="true"/>
124 {% if preferences.pref_mail_method != constant('Galette\\Core\\GaletteMail::METHOD_DISABLED') and (not self_adh and (login.isAdmin() or login.isStaff())) %}
125 <div class="ui center aligned yellow segment">
126 <div class="inline field">
127 <div class="ui toggle checkbox">
128 <input type="checkbox" name="mail_confirm" id="mail_confirm" value="1"{% if member.sendEMail() %} checked="checked"{% endif %}/>
129 <label for="mail_confirm">
131 {{ _T("Notify member his account has been modified") }}
133 {{ _T("Notify member his account has been created") }}
137 <span class="exemple">
139 {{ _T("Member will be notified by email his account has been modified.") }}
141 {{ _T("Member will receive his username and password by email, if he has an address.") }}
148 <div class="ui basic center aligned fitted segment">
149 <button type="submit" name="valid" class="action ui labeled icon primary button">
150 <i class="save icon"></i> {{ _T("Save") }}
152 {% for entry in hidden_elements %}
153 {% if entry.field_id != 'mdp_adh' %}
154 {% set title = null %}
156 {% set size = null %}
157 {% set propname = entry.propname %}
158 {% if entry.field_id == 'activite_adh' %}
159 {% set value = member.isActive() %}
161 {% set value = attribute(member, propname) %}
163 {% set checked = null %}
164 {% set example = null %}
166 {% if value != '' and entry.field_id != 'parent_id' %}
167 {% include "components/forms/hidden.html.twig" with {
168 name: entry.field_id,
175 {% include "components/forms/csrf.html.twig" %}
186 {% block javascripts %}
187 <script type="text/javascript">
188 {% include "elements/js/choose_adh.js.twig" with {"js_chosen_id": "#parent_id"} %}
189 var _parent_id_input = document.getElementById('parent_id_input');
190 if ( typeof(_parent_id_input) != 'undefined' && _parent_id_input != null ) {
191 document.getElementById('parent_id_input').type = 'hidden';
195 $('#company_field.nocompany').addClass('displaynone');
196 $('#is_company').change(function(){
197 $('#company_field').toggleClass('displaynone');
198 $('#company_field').backgroundFade(
205 $(this).backgroundFade(
214 {% if not self_adh %}
216 $('#btngroups, #btnmanagedgroups').click(function(){
217 var _managed = false;
218 if ( $(this).attr('id') == 'btnmanagedgroups' ) {
222 var _form = (_managed) ? 'managed' : 'user';
223 $('#' + _form + 'groups_form input').each(function(){
224 _group = $(this).val().split('|');
225 _groups[_groups.length] = {
231 url: '{{ url_for("ajax_groups") }}',
238 {% include "elements/js/loader.js.twig" with {
239 selector: '#groups_field'
241 success: function(res){
242 _groups_dialog(res, _groups, _managed);
245 {% include "elements/js/modal.js.twig" with {
246 modal_title_twig: _T("An error occurred displaying groups interface :(")|e("js"),
247 modal_without_content: true,
249 modal_deny_only: true,
250 modal_cancel_text: _T("Close")|e("js"),
251 modal_classname: "redalert",
258 var _groups_dialog = function(res, _groups, _managed){
259 var _title = '{{ _T("Groups selection")|e('js') }}';
261 _title = '{{ _T("Managed groups selection")|e('js') }}';
263 {% include "elements/js/modal.js.twig" with {
264 modal_title: "_title",
265 modal_content: "res",
266 modal_class: "groups-selection fullscreen",
267 modal_content_class: "scrolling",
268 modal_deny_only: true,
269 modal_cancel_text: _T("Close")|e("js")
271 _groups_ajax_mapper(res, _groups, _managed);
274 var _groups_ajax_mapper = function(res, _groups, _managed){
275 $('#btnvalid').click(function(){
276 //remove actual groups
277 var _form = (_managed) ? 'managed' : 'user';
278 $('#' + _form + 'groups_form').empty();
279 var _groups = new Array();
280 var _groups_str = '<br/><strong>';
282 _groups_str += '{{ _T("Manager for:")|e('js') }}';
284 _groups_str += '{{ _T("Member of:")|e('js') }}';
286 _groups_str += '</strong> ';
288 $('li[id^="group_"]').each(function(){
290 _gid = this.id.substring(6, this.id.length);
291 _gname = $(this).text();
292 _groups[_groups.length] = this.id.substring(6, this.id.length);
293 var _iname = (_managed) ? 'groups_managed_adh' : 'groups_adh';
294 $('#' + _form + 'groups_form').append(
295 '<input type="hidden" value="' +
296 _gid + '|' + _gname + '|' +
297 '" name="' + _iname + '[]">'
299 if ( _groups.length > 1 ) {
302 _groups_str += _gname;
304 $('#' + _form + 'groups').html(_groups_str);
305 $('.groups-selection').modal('hide');
309 var _none = $('#none_selected').clone();
310 $('li input[type=checkbox]').click(function(e){
313 $('li[id^="group_"]').click(function(){
315 if ( $('#selected_groups ul li').length == 0 ) {
316 $('#selected_groups ul').append(_none);
321 $('#listing tbody tr').click(function(event){
322 event.preventDefault();
323 var _glink = $(this).find('.username_row a');
324 var _gid = _glink[0].href.match(/.*\/(\d+)$/)[1];
325 var _gname = _glink.text();
326 $('#none_selected').remove()
327 if ( $('#group_' + _gid).length == 0 ) {
328 var _li = '<li id="group_' + _gid + '" class="item">'
329 + '<i class="icons"><i class="users icon"><i class="top right corner minus icon"></i></i></i>'
330 + '<span class="ui content">' + _gname + '</span></li>';
331 $('#selected_groups ul').append(_li);
332 $('#group_' + _gid).click(function(){
334 if ( $('#selected_groups ul li').length == 0 ) {
335 $('#selected_groups ul').append(_none);
340 }).css('cursor', 'pointer').attr('title', '{{ _T("Click on a contribution row to attach it to the current transaction")|e('js') }}');
343 {% if not self_adh and not member.hasChildren() %}
344 {# Parent selection #}
345 {% if not member.isDuplicate() %}
346 $('#parent_id_elt').addClass('displaynone');
348 $('#attach-checkbox').checkbox({
349 onChecked: function() {
350 $('#parent_id_elt').removeClass('displaynone');
352 onUnchecked: function() {
353 $('#parent_id_elt').addClass('displaynone');
358 {% if not self_adh %}
359 {% if parent_fields|length > 0 %}
360 $('#detach_parent').on('change', function(){
361 var _checked = $(this).is(':checked');
363 {% for req in parent_fields %}
364 _changes += '#{{ req }}';
365 {% if not loop.last %}
370 $(_changes).attr('required', 'required');
372 $(_changes).removeAttr('required');
376 $('#parent_id').on('change', function(){
377 var _hasParent = $(this).attr('value') != '';
379 {% for req in parent_fields %}
380 _changes += '#{{ req }}';
381 {% if not loop.last %}
386 $(_changes).removeAttr('required');
388 $(_changes).attr('required', 'required');
393 {% include "elements/js/photo_dnd.js.twig" %}
395 $('#ddn_adh').on('blur', function() {
396 var _bdate = $(this).val();
397 if ('{{ _T("Y-m-d") }}' === 'Y-m-d') {
398 _bdate = new Date(_bdate);
401 var _dparts = _bdate.split("/");
402 _bdate = new Date(_dparts[2], _dparts[1] - 1, _dparts[0]);
405 if (! isNaN(_bdate.getTime())) {
406 var _today = new Date();
407 var _age = Math.floor((_today-_bdate) / (365.25 * 24 * 60 * 60 * 1000));
408 $('#member_age').html('{{ _T(" (%age years old)") }}'.replace(/%age/, _age))
410 $('#member_age').html('');