$ajax = false;
if (
$request->isXhr()
- || (isset($post['ajax'])
- && $post['ajax'] == 'true')
+ || (isset($post['mode'])
+ && $post['mode'] == 'ajax')
) {
$ajax = true;
//retrieve selected members
- $selection = $post['selection'] ?? array();
+ $data = $post['selection'] ?? array();
- $filters->selected = $selection;
+ $filters->selected = $data;
$this->session->filter_members = $filters;
} else {
- $selection = $filters->selected;
+ $data = $filters->selected;
}
// display page
'modals/members_attendance_sheet.html.twig',
[
'page_title' => _T("Attendance sheet configuration"),
- 'ajax' => $ajax,
- 'selection' => $selection
+ 'mode' => $ajax,
+ 'data' => $data
]
);
return $response;
'icon' => 'file alternate'
],
[
- 'name' => 'labels',
+ 'name' => 'labels__directdownload',
'label' => _T('Generate labels'),
'icon' => 'address card'
],
[
- 'name' => 'cards',
+ 'name' => 'cards__directdownload',
'label' => _T('Generate Member Cards'),
'icon' => 'id badge'
],
[
- 'name' => 'csv',
+ 'name' => 'csv__directdownload',
'label' => _T('Export as CSV'),
'icon' => 'file csv'
],
{% set selector = '.delete' %}
{% endif %}
//handle removals
+{% if single_action is defined %}
$('{{ selector }}').off('click').on('click', function(event) {
event.preventDefault();
var _this = $(this);
-
+{% endif %}
{% if extra_check is defined %}
{{ extra_check }}
{% endif %}
alert('{{ _T("An error occurred :(")|e("js") }}');
}
});
+{% if single_action is defined %}
});
+{% endif %}
{% endblock %}
<form action="{% if form.route is defined %}{{ path_for(form.route.name, form.route.args|default([])) }}{% endif %}" method="post" id="listform" class="ui form">
<div class="ui basic fitted segment">
- <table class="listing ui celled table">
- <thead>
- <tr>
+
+ {% if batch_actions is defined and batch_actions|length > 0 %}
+ {{ macros.drawBatchActionsList(batch_actions) }}
+ {% endif %}
+
+ <table class="listing ui celled table">
+ <thead>
+ <tr>
{% block header %}
{% for column in columns %}
<th class="left">
</th>
{% endfor %}
{% if mode != 'ajax' and no_action is not defined or no_action == false %}
- <th class="actions_row">{{ _T('Actions') }}</th>
+ <th class="actions_row">{{ _T('Actions') }}</th>
{% endif %}
{% endblock %}
- </tr>
- </thead>
- <tbody>
- {% block body %}{% endblock %}
- </tbody>
- <tfoot>
- {% block footer %}{% endblock %}
- </tfoot>
- </table>
- </div>
+ </tr>
+ </thead>
+ <tbody>
+ {% block body %}{% endblock %}
+ </tbody>
+ <tfoot>
+ {% block footer %}{% endblock %}
+ </tfoot>
+ </table>
{% if batch_actions is defined and batch_actions|length > 0 %}
- <div class="ui bottom attached segment screen-only selection_menu">
- <div class="ui horizontal list">
- <span class="ui primary ribbon label">{{ _T('For the selection:') }}</span>
- {% for batch_action in batch_actions %}
- {{ macros.drawBatchAction(batch_action.name, batch_action.label, batch_action.icon, batch_action.title ?? null) }}
- {% endfor %}
- </div>
- </div>
+ {{ macros.drawBatchActionsList(batch_actions) }}
{% endif %}
+ </div>
+
{% if is_paginated %}
- <div class="ui basic center aligned fitted segment">
- <div class="ui inverted pagination menu">
- <div class="header item">
- {{ _T('Pages:') }}
- </div>
- {{ pagination|raw }}
+ <div class="ui basic center aligned fitted segment">
+ <div class="ui inverted pagination menu">
+ <div class="header item">
+ {{ _T('Pages:') }}
</div>
+ {{ pagination|raw }}
</div>
+ </div>
{% endif %}
{% block extra_form %}{% endblock %}
{% if batch is defined and batch_actions is defined and batch_actions|length > 0 %}
var _init_page = function(res){
{% if login.isAdmin() or login.isStaff() %}
- {# Use of Javascript to draw specific elements that are not relevant is JS is inactive #}
- var _checklinks = '<div class="checkboxes ui basic horizontal segments"><div class="ui basic fitted segment">' +
- '<a href="#" class="checkall ui blue tertiary button">{{ _T("(Un)Check all")|e('js') }}</a>' +
- ' | <a href="#" class="checkinvert ui blue tertiary button">{{ _T("Invert selection")|e('js') }}</a></div>';
+ {# Use of Javascript to draw specific elements that are not relevant if JS is inactive #}
+ var _checklinks = '<a href="#" class="checkall ui blue tertiary button">{{ _T("(Un)Check all")|e('js') }}</a>' +
+ ' | <a href="#" class="checkinvert ui blue tertiary button">{{ _T("Invert selection")|e('js') }}</a> | ';
{% if _legend_block is not empty %}
- _checklinks += '<div class="ui basic right aligned fitted segment"><a href="#" class="show_legend ui blue tertiary button">{{ _T("Show legend")|e('js') }}</a></div></div>';
+ var _legendlink = '<div class="ui basic right aligned fitted segment"><a href="#" class="show_legend ui blue tertiary button">{{ _T("Show legend")|e('js') }}</a></div></div>';
{% endif %}
-
- $('.listing').before(_checklinks);
- $('.listing').after(_checklinks);
- _bind_check('entries_sel');
- {% endif %}
-
- $('.selection_menu *[type="submit"], .selection_menu *[type="button"]').click(function(event) {
- //mass removal is handled from 2 steps removal
- {% set batch_excludes = ['delete']|merge(batch_excludes|default([])) %}
- if (
- {% for batch_exclude in batch_excludes %}
- {% if not loop.first %} || {% endif %}this.id == '{{ batch_exclude }}'
- {% endfor %}
- ) {
- return;
- }
-
- if (!_checkselection()) {
- return false;
- } else {
+ $('.batch-select-action').before(_checklinks);
+ $('.batch-select-action').dropdown({
+ onChange: function(value, text, $selectedItem) {
+ if (!_checkselection()) {
+ return false;
+ }
+ // Handle direct download actions.
+ if (value.endsWith('__directdownload')) {
+ const _value = value.split('__');
+ var value = _value[0];
+ var _form = $('#listform');
+ _form.append($('<input type="hidden" name="' + value + '" value="true"/>'));
+ _form.submit();
+ // Handle delete.
+ } else if (value == 'delete') {
+ {% include "elements/js/removal.js.twig" with {
+ selector: ".batch-delete",
+ deleteurl: path_for(batch.route.name, batch.route.args|default([])),
+ extra_data: "delete: true, entries_sel: $('#listform input[type=\"checkbox\"]:checked').map(function(){ return $(this).val(); }).get()",
+ method: "POST",
+ loader: "button",
+ loader_parent: ".batch-select-action"
+ } %}
+ }
+ // Handle other custom list actions.
+ {% if batch_selection is defined %}
{% block batch_selection %}{% endblock %}
+ {% endif %}
}
});
+ $('.batch-selection').after(_legendlink);
+ _bind_check('entries_sel');
+ {% endif %}
}
_init_page();
-
- {% include "elements/js/removal.js.twig" with {
- selector: "#delete",
- deleteurl: path_for(batch.route.name, batch.route.args|default([])),
- extra_check: "if (!_checkselection()) { return false; }",
- extra_data: "delete: true, entries_sel: $('#listform input[type=\"checkbox\"]:checked').map(function(){ return $(this).val(); }).get()",
- method: "POST",
- loader: "button"
- } %}
{% endif %}
{% if _legend_block is not empty %}
_bind_legend();
{% endif %}
- {% include "elements/js/removal.js.twig" %}
+ {% include "elements/js/removal.js.twig" with {
+ single_action: "true"
+ } %}
});
</script>
{% endblock %}
</a>
{% endmacro %}
-{% macro drawBatchAction(name, label, icon, title) %}
- <div class="item">
- <button type="submit" id="{{ name }}" name="{{ name }}" class="ui labeled icon tiny button"{% if title %} title="{{ title }}"{% endif %}>
- <i class="{{ icon }} icon"></i> {{ label }}
- </button>
+{% macro drawBatchActionsList(batch_actions) %}
+ <div class="checkboxes ui basic horizontal segments">
+ <div class="ui basic fitted segment batch-selection">
+ <div class="ui blue tertiary dropdown icon button batch-select-action">
+ <i class="tasks icon"></i>
+ {{ _T('For the selection:') }}
+ <i class="dropdown icon"></i>
+ <div class="menu">
+ {% for batch_action in batch_actions %}
+ {{ _self.drawBatchAction(batch_action.name, batch_action.label, batch_action.icon, batch_action.title ?? null) }}
+ {% endfor %}
+ </div>
+ </div>
+ </div>
</div>
{% endmacro %}
+
+{% macro drawBatchAction(name, label, icon, title) %}
+ <span class="ui item batch-action batch-{{ name }}" data-value="{{ name }}"{% if title %} title="{{ title }}"{% endif %}>
+ <i class="{{ icon }} icon"></i> {{ label }}
+ </span>
+{% endmacro %}
{% extends 'pages/contribution_form.html.twig' %}
{% block content %}
- <div id="mass_contributions"{% if mode != 'ajax' %} class="center"{% else %} class="ui modal" title="{{ page_title }}"{% endif %}>
+ <div id="mass_contributions"{% if mode != 'ajax' %} class="center"{% else %} class="ui modal"{% endif %}>
{% if mode == 'ajax' %}
- <div class="fullscreen content scrolling">
+ <div class="header">
+ {% else %}
+ <h2>
{% endif %}
- <form action="{{ form_url }}" method="post">
- {% if mode != 'ajax' %}<h2>{{ page_title }}</h2>{% endif %}
+ {{ page_title }}
+ {% if mode != 'ajax' %}
+ </h2>
+ {% else %}
+ </div>
+ <div class="content scrolling">
+ {% endif %}
+ <form action="{{ form_url }}" method="post" class="ui form">
+ {{ parent() }}
<div class="button-container">
- {{ parent() }}
- <input type="submit" id="masschange" class="button" value="{% if changes is not defined %}{{ _T("Edit") }}{% else %}{{ _T("OK") }}{% endif %}"/>
- <a href="{{ cancel_uri }}" class="button" id="btncancel">{{ _T("Cancel") }}</a>
+ {% if mode != 'ajax' %}
+ <input type="submit" id="masschange" class="ui button" value="{% if changes is not defined %}{{ _T("Edit") }}{% else %}{{ _T("OK") }}{% endif %}"/>
+ <a href="{{ cancel_uri }}" class="ui button" id="btncancel">{{ _T("Cancel") }}</a>
+ {% endif %}
<input type="hidden" name="confirm" value="1"/>
{% if mode == 'ajax' %}<input type="hidden" name="ajax" value="true"/>{% endif %}
{% for key, value in data %}
{% extends (mode == 'ajax') ? "ajax.html.twig" : "page.html.twig" %}
{% block content %}
- <div id="mass_change"{% if mode != 'ajax' %} class="center"{% else %} class="ui modal" title="{{ page_title }}"{% endif %}>
+ <div id="mass_change"{% if mode != 'ajax' %} class="center"{% else %} class="ui modal"{% endif %}>
{% if mode == 'ajax' %}
+ <div class="header">
+ {% else %}
+ <h2>
+ {% endif %}
+ {{ page_title }}
+ {% if mode != 'ajax' %}
+ </h2>
+ {% else %}
+ </div>
<div class="content scrolling">
{% endif %}
<form action="{{ form_url }}" method="post" class="ui form">
- {% if mode != 'ajax' %}<h2>{{ page_title }}</h2>{% endif %}
{% if changes is not defined %}
<p>{{ _T("Only checked fields will be updated.") }}</p>
{# Form entries #}
</ul>
{% endif %}
<div class="button-container">
- <input type="submit" id="masschange" class="ui button" value="{% if changes is not defined %}{{ _T("Edit") }}{% else %}{{ _T("OK") }}{% endif %}"/>
- <a href="{{ cancel_uri }}" class="ui button" id="btncancel">{{ _T("Cancel") }}</a>
+ {% if mode != 'ajax' %}
+ <input type="submit" id="masschange" class="ui button" value="{% if changes is not defined %}{{ _T("Edit") }}{% else %}{{ _T("OK") }}{% endif %}"/>
+ <a href="{{ cancel_uri }}" class="ui button" id="btncancel">{{ _T("Cancel") }}</a>
+ {% endif %}
<input type="hidden" name="confirm" value="1"/>
{% if mode == 'ajax' %}<input type="hidden" name="ajax" value="true"/>{% endif %}
{% for key, value in data %}
{% extends (mode == 'ajax') ? "ajax.html.twig" : "page.html.twig" %}
{% block content %}
- <div id="mass_contributions"{% if mode != 'ajax' %} class="center"{% else %} title="{{ page_title }}"{% endif %}>
- <form action="{{ form_url }}" method="post">
- {% if mode != 'ajax' %}<h2>{{ page_title }}</h2>{% endif %}
- <label for="type">{{ _T("Contribution type") }}</label>
- <select name="type" id="type">
- <option value="{{ constant('Galette\\Entity\\Contribution::TYPE_FEE') }}">{{ _T("Membership") }}</option>
- <option value="{{ constant('Galette\\Entity\\Contribution::TYPE_DONATION') }}">{{ _T("Donation") }}</option>
- </select>
- <div class="button-container">
- <input type="submit" id="masschange" class="button" value="{{ _T("OK") }}"/>
- <a href="{{ cancel_uri }}" class="button" id="btncancel">{{ _T("Cancel") }}</a>
- {% if mode == 'ajax' %}<input type="hidden" name="ajax" value="true"/>{% endif %}
- {% for key, value in data %}
- {% if value is iterable %}
- {% for val in value %}
- <input type="hidden" name="{{ key }}[]" value="{{ val }}"/>
+ <div id="mass_contributions"{% if mode != 'ajax' %} class="center"{% else %} class="ui modal"{% endif %}>
+ {% if mode == 'ajax' %}
+ <div class="header">
+ {% else %}
+ <h2>
+ {% endif %}
+ {{ page_title }}
+ {% if mode != 'ajax' %}
+ </h2>
+ {% else %}
+ </div>
+ <div class="content scrolling">
+ {% endif %}
+ <form action="{{ form_url }}" method="post" class="ui form">
+ <div class="inline field">
+ <label for="type">{{ _T("Contribution type") }}</label>
+ <select name="type" id="type" class="ui dropdown">
+ <option value="{{ constant('Galette\\Entity\\Contribution::TYPE_FEE') }}">{{ _T("Membership") }}</option>
+ <option value="{{ constant('Galette\\Entity\\Contribution::TYPE_DONATION') }}">{{ _T("Donation") }}</option>
+ </select>
+ </div>
+ <div class="button-container">
+ {% if mode != 'ajax' %}
+ <input type="submit" id="masschange" class="ui button" value="{{ _T("OK") }}"/>
+ <a href="{{ cancel_uri }}" class="ui button" id="btncancel">{{ _T("Cancel") }}</a>
+ {% endif %}
+ {% if mode == 'ajax' %}<input type="hidden" name="ajax" value="true"/>{% endif %}
+ {% for key, value in data %}
+ {% if value is iterable %}
+ {% for val in value %}
+ <input type="hidden" name="{{ key }}[]" value="{{ val }}"/>
+ {% endfor %}
+ {% else %}
+ <input type="hidden" name="{{ key }}" value="{{ value }}"/>
+ {% endif %}
{% endfor %}
- {% else %}
- <input type="hidden" name="{{ key }}" value="{{ value }}"/>
- {% endif %}
- {% endfor %}
- {% include "components/forms/csrf.html.twig" %}
+ {% include "components/forms/csrf.html.twig" %}
+ </div>
+ </form>
+ {% if mode == 'ajax' %}
</div>
- </form>
+ {% endif %}
</div>
{% endblock %}
-{% extends (ajax) ? "ajax.html.twig" : "page.html.twig" %}
+{% extends (mode == 'ajax') ? "ajax.html.twig" : "page.html.twig" %}
{% block content %}
- <form action="{{ path_for('attendance_sheet') }}" id="sheet_details_form" method="POST" class="ui form">
- <div class="ui top attached accordion-styled header">
- {{ _T("Some details about your attendance sheet...") }} - <span>{{ _T("%s attendees")|replace({'%s': selection|length}) }}</span>
+ <div id="attendance_sheet_details"{% if mode != 'ajax' %} class="center"{% else %} class="ui modal"{% endif %}>
+ {% if mode == 'ajax' %}
+ <div class="header">
+ {% else %}
+ <h2>
+ {% endif %}
+ {{ page_title }}
+ {% if mode != 'ajax' %}
+ </h2>
+ {% else %}
</div>
- <div class="ui bottom attached accordion-styled segment">
- <div class="active content field">
- <div class="inline field">
- <label for="sheet_type">{{ _T("Sheet type") }}</label>
- <input type="text" name="sheet_type" id="sheet_type" value="{{ _T("Attendance sheet") }}" required/>
+ <div class="content scrolling">
+ {% endif %}
+ <form action="{{ path_for('attendance_sheet') }}" id="sheet_details_form" method="POST" class="ui form">
+ <div class="ui top attached accordion-styled header">
+ {{ _T("Some details about your attendance sheet...") }} - <span>{{ _T("%s attendees")|replace({'%s': data|length}) }}</span>
</div>
- <div class="inline field">
- <label for="sheet_title">{{ _T("Title") }}</label>
- <input type="text" name="sheet_title" id="sheet_title"/>
+ <div class="ui bottom attached accordion-styled segment">
+ <div class="active content field">
+ <div class="inline field">
+ <label for="sheet_type">{{ _T("Sheet type") }}</label>
+ <input type="text" name="sheet_type" id="sheet_type" value="{{ _T("Attendance sheet") }}" required/>
+ </div>
+ <div class="inline field">
+ <label for="sheet_title">{{ _T("Title") }}</label>
+ <input type="text" name="sheet_title" id="sheet_title"/>
+ </div>
+ <div class="inline field">
+ <label for="sheet_sub_title">{{ _T("Subtitle") }}</label>
+ <input type="text" name="sheet_sub_title" id="sheet_sub_title"/>
+ </div>
+ <div class="inline field">
+ <label for="sheet_date">{{ _T("Date") }}</label>
+ <input type="text" name="sheet_date" id="sheet_date"/>
+ <span class="exemple">{{ _T("(yyyy-mm-dd format)") }}</span>
+ </div>
+ <div class="inline field">
+ <label for="sheet_photos">{{ _T("With photos?") }}</label>
+ <input type="checkbox" name="sheet_photos" id="sheet_photos" value="1"/>
+ {% for key, value in data %}
+ <input type="hidden" name="selection[]" value="{{ value }}"/>
+ {% endfor %}
+ {% include 'components/forms/csrf.html.twig' %}
+ </div>
+ </div>
</div>
- <div class="inline field">
- <label for="sheet_sub_title">{{ _T("Subtitle") }}</label>
- <input type="text" name="sheet_sub_title" id="sheet_sub_title"/>
+ {% if mode != 'ajax' %}
+ <div class="ui basic center aligned segment">
+ <button type="submit" class="ui labeled icon primary button">
+ <i class="file pdf icon" aria-hidden="true"></i>
+ {{ _T("Generate") }}
+ </button>
</div>
- <div class="inline field">
- <label for="sheet_date">{{ _T("Date") }}</label>
- <input type="text" name="sheet_date" id="sheet_date"/>
- <span class="exemple">{{ _T("(yyyy-mm-dd format)") }}</span>
- </div>
- <div class="inline field">
- <label for="sheet_photos">{{ _T("With photos?") }}</label>
- <input type="checkbox" name="sheet_photos" id="sheet_photos" value="1"/>
-{% for member in selection %}
- <input type="hidden" name="selection[]" value="{{ member }}"/>
-{% endfor %}
- {% include 'components/forms/csrf.html.twig' %}
- </div>
- </div>
- </div>
-{% if not ajax %}
- <div class="ui basic center aligned segment">
- <button type="submit" class="ui labeled icon primary button">
- <i class="file pdf icon" aria-hidden="true"></i>
- {{ _T("Generate") }}
- </button>
- </div>
-{% endif %}
+ {% endif %}
- </form>
+ </form>
+ {% if mode == 'ajax' %}
+ </div>
+ {% endif %}
+ </div>
{% endblock %}
{% block content %}
{% if members.list is defined or require_mass %}
+ {% if mode != 'ajax' %}
<form action="{% if contribution.id %}{{ path_for("doEditContribution", {"type": type, "id": contribution.id}) }}{% else %}{{ path_for("doAddContribution", {"type": type}) }}{% endif %}" enctype="multipart/form-data" method="post" class="ui form">
+ {% endif %}
{% if contribution.isTransactionPart() %}
{% set mid = contribution.transaction.member %}
<div class="ui top attached accordion-styled header">
</a>
{% endif %}
</div>
- {% if not require_mass %}
<div class="active content">
+ {% if not require_mass %}
<div class="field inline">
<label for="id_adh">{{ _T("Contributor:") }}</label>
<div id="id_adh" class="jsonly search-dropdown ui input nochosen">
<input type="hidden" name="trans_id" value="{% if contribution.transaction != NULL %}{{ contribution.transaction.id }}{% endif %}"/>
</div>
{% endif %}
+ {% if mode != 'ajax' %}
{% include "components/forms/csrf.html.twig" %}
</form>
-{% else %} {# No members #}
+ {% endif %}
+{% elseif mode != 'ajax' %} {# No members #}
<div class="ui warning message" id="warningbox">
<h3>{{ _T("No member registered!") }}</h3>
<p>
'icon': 'trash red'
},
{
- 'name': 'csv',
+ 'name': 'csv__directdownload',
'label': _T("Export as CSV"),
'icon': 'file csv'
}
{% endif %}
{% block batch_selection %}
+ else if (value == 'sendmail') {
{% if existing_mailing == true %}
- if (this.id == 'sendmail') {
- $('body').modal({
- title: '{{ _T("Existing mailing")|e('js') }}',
- class: 'tiny',
- content: '{{ _T("A mailing already exists. Do you want to create a new one or resume the existing?")|e('js') }}',
- actions: [{
- text : '{{ _T("Resume")|e('js') }}',
- class : 'blue cancel',
- click : function() {
- location.href = '{{ path_for('mailing') }}';
- }
- }, {
- text : '{{ _T("New")|e('js') }}',
- class : 'green approve',
- click : function() {
- //add required controls to the form, change its action URI, and send it.
- var _form = $('#listform');
- _form.append($('<input type="hidden" name="mailing_new" value="true"/>'));
- _form.append($('<input type="hidden" name="mailing" value="true"/>'));
- _form.submit();
- }
- }]
- }).modal('show');
- return false;
- }
+ _sendmail(true);
+ {% else %}
+ _sendmail();
{% endif %}
- if (this.id == 'attendance_sheet') {
+ }
+ else if (value == 'attendance_sheet') {
_attendance_sheet_details();
- return false;
}
- if (this.id == 'masscontributions') {
- event.preventDefault();
- $.ajax({
- url: '{{ path_for('batch-memberslist') }}',
- type: "POST",
- data: {
- ajax: true,
- masscontributions: true,
- entries_sel: $('#listform input[type=\"checkbox\"]:checked').map(function(){
- return $(this).val();
- }).get()
- },
- datatype: 'json',
- {% include "elements/js/loader.js.twig" %},
- success: function(res){
- var _res = $(res);
- _bindmassres(_res);
- $('body').append(_res);
-
- _massCheckboxes('#mass_contributions');
-
- $('#mass_contributions').modal({
- actions: [{
- text : '{{ _T("Close")|e('js') }}',
- class : 'cancel'
- }]
- }).modal('show');
- },
- error: function() {
- alert("{{ _T("An error occurred :(")|e('js') }}");
- }
- });
+ else if (value == 'masscontributions') {
+ _masscontributions();
}
- return true;
+ else if (value == 'masschange') {
+ _masschange();
+ }
{% endblock %}
{% block javascripts %}
- {% set batch_excludes = ['masschange'] %}
+ {% set batch_selection = ['masschange', 'masscontributions', 'sendmail', 'attendance_sheet_details'] %}
{{ parent() }}
<script type="text/javascript">
{# Use of Javascript to draw specific elements that are not relevant is JS is inactive #}
$(function(){
- if ( _shq = $('#showhideqry') ) {
- _shq.click(function(){
- $('#sql_qry').toggleClass('hidden');
- return false;
- });
- }
-
$('#savesearch').on('click', function(e) {
e.preventDefault();
});
{% if nb_members != 0 %}
- var _bindmassres = function(res) {
- res.find('#btncancel')
- .on('click', function(e) {
- e.preventDefault();
- res.modal('hide');
- });
+ var _sendmail = function(existing){
+ var _form = $('#listform');
+ _form.append($('<input type="hidden" name="sendmail" value="true"/>'));
+ _form.append($('<input type="hidden" name="mailing_new" value="true"/>'));
+ _form.append($('<input type="hidden" name="mailing" value="true"/>'));
+ var _redirect = '{{ path_for('mailing') }}';
+
+ if (existing) {
+ $('body').modal({
+ title: '{{ _T("Existing mailing")|e('js') }}',
+ class: 'tiny',
+ content: '{{ _T("A mailing already exists. Do you want to create a new one or resume the existing?")|e('js') }}',
+ actions: [{
+ text : '{{ _T("Resume")|e('js') }}',
+ class : 'blue',
+ click : function() {
+ location.href = _redirect;
+ }
+ }, {
+ text : '{{ _T("New")|e('js') }}',
+ class : 'green',
+ click : function() {
+ _form.submit();
+ }
+ }, {
+ text : '{{ _T("Cancel")|e('js') }}',
+ class : 'deny'
+ }]
+ }).modal('show');
+ } else {
+ _form.submit();
+ }
}
+ var _attendance_sheet_details = function(){
+ $.ajax({
+ url: '{{ path_for('attendance_sheet_details') }}',
+ type: "POST",
+ data: {
+ ajax: true,
+ selection: $('#listform input[type=\"checkbox\"]:checked').map(function(){
+ return $(this).val();
+ }).get()
+ },
+ dataType: 'html',
+ {% include "elements/js/loader.js.twig" %},
+ success: function(res){
+ var _res = $(res);
- $('#masschange').off('click').on('click', function(event) {
- event.preventDefault();
- var _this = $(this);
+ $('body').append(_res);
- if (!_checkselection()) {
- return false;
- }
+ $('#attendance_sheet_details').modal({
+ class: 'tiny',
+ onApprove : function() {
+ $('#attendance_sheet_details form').submit();
+ },
+ onDeny: function() {
+ $(this).remove();
+ $('body').dimmer('hide');
+ },
+ actions: [{
+ text : '{{ _T("Continue")|e("js") }}',
+ class : 'blue approve'
+ }, {
+ text : '{{ _T("Cancel")|e("js") }}',
+ class : 'cancel'
+ }]
+ }).modal('show');
+ },
+ error: function() {
+ alert("{{ _T("An error occurred displaying attendance sheet details interface :(")|e('js') }}");
+ }
+ });
+ }
+ var _masscontributions = function(){
$.ajax({
url: '{{ path_for('batch-memberslist') }}',
type: "POST",
data: {
ajax: true,
- masschange: true,
+ masscontributions: true,
entries_sel: $('#listform input[type=\"checkbox\"]:checked').map(function(){
return $(this).val();
}).get()
},
- datatype: 'json',
+ datatype: 'html',
{% include "elements/js/loader.js.twig" %},
success: function(res){
var _res = $(res);
- _bindmassres(_res);
+
+ $('body').append(_res);
_res.find('form').on('submit', function(e) {
e.preventDefault();
var _form = $(this);
var _data = _form.serialize();
+
$.ajax({
url: _form.attr('action'),
type: "POST",
data: _data,
datatype: 'json',
{% include "elements/js/loader.js.twig" %},
- success: function(html) {
- var _html = $(html);
- _bindmassres(_html);
-
- $('#mass_change').remove();
- $('body').append(_html);
+ success: function(data, status, xhr) {
+ var _res = $(data);
- //_initTooltips('#mass_change');
- //_massCheckboxes('#mass_change');
-
- $('#mass_change').modal({
- actions: [{
- text : '{{ _T("Close")|e('js') }}',
- class : 'cancel'
- }]
- }).modal('show');
+ $('#mass_contributions').remove();
+ $('body').append(_res);
- _html.find('form').on('submit', function(e) {
+ _res.find('form').on('submit', function(e) {
e.preventDefault();
var _form = $(this);
var _data = _form.serialize();
datatype: 'json',
{% include "elements/js/loader.js.twig" %},
success: function(res) {
- if (res.success) {
- window.location.href = _form.find('input[name=redirect_uri]').val();
- } else {
- $.ajax({
- url: '{{ path_for('ajaxMessages') }}',
- method: "GET",
- success: function (message) {
- $('#asso_name').after(message);
- }
- });
- }
+ window.location.href = _form.find('input[name=redirect_uri]').val();
+ },
+ error: function() {
+ alert("{{ _T("An error occurred :(")|e('js') }}");
}
});
});
+
+ $('#mass_contributions').modal({
+ onApprove: function() {
+ $('#mass_contributions form').submit();
+ },
+ onDeny: function() {
+ $(this).remove();
+ $('body').dimmer('hide');
+ },
+ actions: [{
+ text : '{{ _T("Continue")|e('js') }}',
+ class : 'blue approve'
+ }, {
+ text : '{{ _T("Cancel")|e('js') }}',
+ class : 'cancel'
+ }]
+ }).modal('show');
},
error: function() {
alert("{{ _T("An error occurred :(")|e('js') }}");
});
});
- $('body').append(_res);
-
- _massCheckboxes('#mass_change');
-
- $('#mass_change').modal({
+ $('#mass_contributions').modal({
+ class: 'tiny',
+ onApprove : function() {
+ $('#mass_contributions form').submit();
+ },
+ onDeny: function() {
+ $(this).remove();
+ $('body').dimmer('hide');
+ },
actions: [{
- text : '{{ _T("Close")|e('js') }}',
+ text : '{{ _T("Continue")|e("js") }}',
+ class : 'blue approve'
+ }, {
+ text : '{{ _T("Cancel")|e("js") }}',
class : 'cancel'
}]
}).modal('show');
+
+ _massCheckboxes('#mass_contributions');
},
error: function() {
alert("{{ _T("An error occurred :(")|e('js') }}");
}
});
- });
-
- var _attendance_sheet_details = function(){
- var _selecteds = [];
- $('table.listing').find('input[type=checkbox]:checked').each(function(){
- _selecteds.push($(this).val());
- });
+ }
+ var _masschange = function(){
$.ajax({
- url: '{{ path_for('attendance_sheet_details') }}',
+ url: '{{ path_for('batch-memberslist') }}',
type: "POST",
data: {
ajax: true,
- selection: _selecteds
+ masschange: true,
+ entries_sel: $('#listform input[type=\"checkbox\"]:checked').map(function(){
+ return $(this).val();
+ }).get()
},
- dataType: 'html',
+ datatype: 'json',
+ {% include "elements/js/loader.js.twig" %},
success: function(res){
- $('body').modal({
- title: '{{ _T("Attendance sheet details")|e("js") }}',
- class: 'tiny',
- content: res,
- actions: [{
- text : '{{ _T("Continue")|e("js") }}',
- class : 'cancel',
- click : function() {
- $('#sheet_details_form').submit();
+ var _res = $(res);
+
+ $('body').append(_res);
+
+ _res.find('form').on('submit', function(e) {
+ e.preventDefault();
+ var _form = $(this);
+ var _data = _form.serialize();
+ $.ajax({
+ url: _form.attr('action'),
+ type: "POST",
+ data: _data,
+ datatype: 'json',
+ {% include "elements/js/loader.js.twig" %},
+ success: function(data, status, xhr) {
+ var _res = $(data);
+
+ $('#mass_change').remove();
+ $('body').append(_res);
+
+ $('#mass_change').modal({
+ onApprove: function() {
+ $('#mass_change form').submit();
+ },
+ onDeny: function() {
+ $(this).remove();
+ $('body').dimmer('hide');
+ },
+ actions: [{
+ text : '{{ _T("Continue")|e('js') }}',
+ class : 'blue approve'
+ }, {
+ text : '{{ _T("Cancel")|e('js') }}',
+ class : 'cancel'
+ }]
+ }).modal('show');
+
+ _res.find('form').on('submit', function(e) {
+ e.preventDefault();
+ var _form = $(this);
+ var _data = _form.serialize();
+ $.ajax({
+ url: _form.attr('action'),
+ type: "POST",
+ data: _data,
+ datatype: 'json',
+ {% include "elements/js/loader.js.twig" %},
+ success: function(res) {
+ window.location.href = _form.find('input[name=redirect_uri]').val();
+ },
+ error: function() {
+ alert("{{ _T("An error occurred :(")|e('js') }}");
+ }
+ });
+ });
+ },
+ error: function() {
+ alert("{{ _T("An error occurred :(")|e('js') }}");
}
+ });
+ });
+
+ $('#mass_change').modal({
+ onApprove: function() {
+ $('#mass_change form').submit();
+ },
+ onDeny: function() {
+ $(this).remove();
+ $('body').dimmer('hide');
+ },
+ actions: [{
+ text : '{{ _T("Continue")|e('js') }}',
+ class : 'blue approve'
}, {
- text : '{{ _T("Cancel")|e("js") }}',
+ text : '{{ _T("Cancel")|e('js') }}',
class : 'cancel'
}]
}).modal('show');
+
+ _massCheckboxes('#mass_change');
},
error: function() {
- alert("{{ _T("An error occurred displaying attendance sheet details interface :(")|e('js') }}");
+ alert("{{ _T("An error occurred :(")|e('js') }}");
}
});
}
return false;
});
$('.checkinvert').click(function(){
+ var _haschecked = false;
$('table.listing :checkbox[name="' + boxelt + '[]"]').each(function(){
- this.checked = !$(this).is(':checked');
+ if ($(this).is(':checked')) {
+ this.checked = false;
+ } else {
+ this.checked = true;
+ _haschecked = true;
+ }
});
+ if (!_haschecked) {
+ _is_checked = true;
+ } else {
+ _is_checked = false;
+ }
return false;
});
};
.ui.primary.buttons .button {
color: darken(@textColor, 15);
}
+
+.ui.upward.dropdown.button:not(.pointing):not(.floating).batch-select-action.active {
+ border-radius: 0;
+}