]> git.agnieray.net Git - galette.git/blob - galette/templates/default/pages/mailings_list.html.twig
Fix number of recipients listing mailings
[galette.git] / galette / templates / default / pages / mailings_list.html.twig
1 {% extends 'elements/list.html.twig' %}
2
3 {% set nb = history.getCount() %}
4
5 {% set form = {
6 'order': {
7 'name': "mailings"
8 }
9 } %}
10
11 {% block infoline %}
12 {% set infoline = {
13 'label': _Tn("%count entry", "%count entries", history.getCount())|replace({"%count": history.getCount()}),
14 'route': {
15 'name': 'mailings_filter'
16 }
17 } %}
18 {{ parent() }}
19 {% endblock %}
20
21 {% block infoline_actions %}
22 <a
23 class="action ui tiny labeled icon button"
24 href="{{ url_for('mailing') }}?mailing_new=true"
25 >
26 <i class="plus circle green icon" aria-hidden="true"></i>
27 {{ _T('Create new mailing') }}
28 </a>
29 {% endblock %}
30
31 {% block header %}
32 {% set columns = [
33 {'label': '#'},
34 {'label': _T("Date"), 'order': constant("Galette\\Filters\\MailingsList::ORDERBY_DATE")},
35 {'label': _T('Sender'), 'order': constant("Galette\\Filters\\MailingsList::ORDERBY_SENDER")},
36 {'label': _T('Recipients')},
37 {'label': _T('Subject'), 'order': constant("Galette\\Filters\\MailingsList::ORDERBY_SUBJECT")},
38 {'label': _T('Att.')},
39 {'label': _T("Sent"), 'order': constant("Galette\\Filters\\MailingsList::ORDERBY_SENT")}
40 ] %}
41 {{ parent() }}
42 {% endblock %}
43
44 {% block search %}
45 <form action="{{ url_for('mailings_filter') }}" method="post" class="ui form filters">
46 <div class="ui secondary yellow segment">
47 <div class="three fields">
48 <div class="two fields">
49 <div class="field">
50 <label for="start_date_filter">{{ _T('since') }}</label>
51 <div class="ui calendar" id="mailings-rangestart">
52 <div class="ui input left icon">
53 <i class="calendar icon" aria-hidden="true"></i>
54 <input placeholder="{{ _T('(yyyy-mm-dd format)') }}" type="text" name="start_date_filter" id="start_date_filter" maxlength="10" size="10" value="{{ history.filters.start_date_filter }}"/>
55 </div>
56 </div>
57 </div>
58 <div class="field">
59 <label for="end_date_filter">{{ _T('until') }}</label>
60 <div class="ui calendar" id="mailings-rangeend">
61 <div class="ui input left icon">
62 <i class="calendar icon" aria-hidden="true"></i>
63 <input placeholder="{{ _T('(yyyy-mm-dd format)') }}" type="text" name="end_date_filter" id="end_date_filter" maxlength="10" size="10" value="{{ history.filters.end_date_filter }}"/>
64 </div>
65 </div>
66 </div>
67 </div>
68 <div class="field">
69 <label for="subject_filter">{{ _T('Subject') }}</label>
70 <input type="text" name="subject_filter" id="subject_filter" value="{{ history.filters.subject_filter }}"/>
71 </div>
72 <div class="field">
73 <label for="sent_filter">{{ _T('Sent mailings:') }}</label>
74 <div class="inline fields">
75 <div class="field">
76 <div class="ui radio checkbox">
77 <input type="radio" name="sent_filter" id="filter_dc_sent" value="{{ constant("Galette\\Core\\MailingHistory::FILTER_DC_SENT") }}"{% if history.filters.sent_filter == constant("Galette\\Core\\MailingHistory::FILTER_DC_SENT") %} checked="checked"{% endif %}>
78 <label for="filter_dc_sent" >{{ _T("Don't care") }}</label>
79 </div>
80 </div>
81 <div class="field">
82 <div class="ui radio checkbox">
83 <input type="radio" name="sent_filter" id="filter_sent" value="{{ constant("Galette\\Core\\MailingHistory::FILTER_SENT") }}"{% if history.filters.sent_filter == constant("Galette\\Core\\MailingHistory::FILTER_SENT") %} checked="checked"{% endif %}>
84 <label for="filter_sent" >{{ _T('Yes') }}</label>
85 </div>
86 </div>
87 <div class="field">
88 <div class="ui radio checkbox">
89 <input type="radio" name="sent_filter" id="filter_not_sent" value="{{ constant("Galette\\Core\\MailingHistory::FILTER_NOT_SENT") }}"{% if history.filters.sent_filter == constant("Galette\\Core\\MailingHistory::FILTER_NOT_SENT") %} checked="checked"{% endif %}>
90 <label for="filter_not_sent" >{{ _T('No') }}</label>
91 </div>
92 </div>
93 </div>
94 </div>
95 </div>
96 <div class="ui right aligned basic fitted segment field">
97 <button type="submit" class="tooltip action ui labeled icon primary button" title="{{ _T('Apply filters') }}" name="filter">
98 <i class="search icon" aria-hidden="true"></i>
99 {{ _T('Filter') }}
100 </button>
101 <button type="submit" name="clear_filter" class="tooltip ui labeled icon button" title="{{ _T('Reset all filters to defaults') }}">
102 <i class="trash alt red icon" aria-hidden="true"></i>
103 {{ _T('Clear filter') }}
104 </button>
105 </div>
106 </div>
107 {% include "components/forms/csrf.html.twig" %}
108 </form>
109 {% endblock %}
110
111 {% block body %}
112 {% for log in logs %}
113 {% set date_format = _T('Y-m-d H:i:s') %}
114 <tr>
115 <td data-scope="row">
116 {% if preferences.pref_show_id %}
117 {{ log.mailing_id }}
118 {% else %}
119 {{ loop.index }}
120 {% endif %}
121 <span class="displaynone">
122 {{ _T('Mailing entry %id')|replace({'%id': log.mailing_id}) }}
123 </span>
124 </td>
125 <td class="" data-title="{{ _T('Date') }}">{{ log.mailing_date|date(date_format) }}</td>
126 <td data-title="{{ _T('Sender') }}">{% if log.mailing_sender == 0 %}{{ _T('Superadmin') }}{% else %}{{ log.mailing_sender_name }}{% endif %}</td>
127 <td data-title="{{ _T('Recipients') }}">{{ log.mailing_recipients|length }}</td>
128 <td data-title="{{ _T('Subject') }}">{{ log.mailing_subject }}</td>
129 <td class="center" data-title="{{ _T('Attachments') }}">{{ log.attachments }}</td>
130 <td class="center{% if log.mailing_sent == 1 %} use{% endif %}" data-title="{{ _T('Sent') }}">
131 {% if log.mailing_sent == 1 %}
132 <i class="ui thumbs up green icon" aria-hidden="true"></i>
133 {% else %}
134 <i class="ui thumbs down red icon" aria-hidden="true"></i>
135 {% endif %}
136 </td>
137 <td class="center actions_row">
138 <a
139 href="{{ url_for("mailingPreview", {"id": log.mailing_id}) }}"
140 class="showdetails"
141 >
142 <i class="ui eye green icon tooltip" aria-hidden="true"></i>
143 <span class="ui special popup">{{ _T("Display mailing '%subject' details in preview window")|replace({'%subject': log.mailing_subject}) }}</span>
144 </a>
145 <a
146 href="{{ url_for('mailing') }}?from={{ log.mailing_id }}"
147 >
148 <i class="ui clone blue icon tooltip" aria-hidden="true"></i>
149 <span class="ui special popup">{{ _T("Use mailing '%subject' as a template for a new one")|replace({'%subject': log.mailing_subject}) }}</span>
150 </a>
151 <a
152 href="{{ url_for("removeMailing", {"id": log.mailing_id}) }}"
153 class="delete"
154 >
155 <i class="ui trash red icon tooltip" aria-hidden="true"></i>
156 <span class="ui special popup">{{ _T("Delete mailing '%subject'")|replace({'%subject': log.mailing_subject}) }}</span>
157 </a>
158 </td>
159 </tr>
160 {% else %}
161 <tr><td colspan="8" class="emptylist">{{ _T('No sent mailing has been stored in the database yet.') }}</td></tr>
162 {% endfor %}
163 {% endblock %}
164
165 {% block javascripts %}
166 <script type="text/javascript">
167 {% include "elements/js/removal.js.twig" with {
168 single_action: "true"
169 } %}
170
171 {# Preview popup #}
172 $('.showdetails').click(function(){
173 $.ajax({
174 url: $(this).attr('href'),
175 type: "POST",
176 data: {
177 ajax: true,
178 },
179 {% include "elements/js/loader.js.twig" with {
180 loader: "action",
181 selector: ".loader_selector"
182 } %},
183 success: function(res){
184 _preview_dialog(res);
185 },
186 error: function() {
187 {% include "elements/js/modal.js.twig" with {
188 modal_title_twig: _T("An error occurred displaying preview :(")|e("js"),
189 modal_without_content: true,
190 modal_class: "mini",
191 modal_deny_only: true,
192 modal_cancel_text: _T("Close")|e("js"),
193 modal_classname: "redalert",
194 } %}
195 }
196 });
197 return false;
198 });
199
200 var _preview_dialog = function(res){
201 {% include "elements/js/modal.js.twig" with {
202 modal_title_twig: _T("Mailing preview")|e("js"),
203 modal_content: "res",
204 modal_class: "scrolling",
205 modal_deny_only: true,
206 modal_cancel_text: _T("Close")|e("js")
207 } %}
208 }
209 </script>
210 {% endblock %}