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