You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

319 lines
14 KiB

{% extends 'c_admin/base.html' %}
{% load staticfiles %}
{% block styles %}
#delete-all-button{
min-width:75px;
padding-left:2px;
padding-right:2px;
}
.yellow{
background-image: linear-gradient(#E7FF1D, #E7FF1D 5%, #E9F399);
}
{% endblock %}
{% block body %}
<div class="box span10">
<div class="box-header well">
<h2><i class="icon-arrow-down"></i>Список контактов <a class="btn" href="{% url 'import_newsletters_contacts' %}">Импорт</a></h2>
</div>
<div class="box-content">
<form class="form-horizontal" method="get">
<fieldset>
<!-- Form Name -->
<legend>Фильтровать контакты <i class="icon-circle-arrow-down"></i> - {{ object_list.paginator.count }} результатов</legend>
<div class="toggled">
<!-- Email -->
<div class="control-group">
<label class="control-label" for="id_email">{{ form.email.label }}</label>
<div class="controls">
{{ form.email }}
</div>
</div>
<!-- Theme -->
<div class="control-group">
<label class="control-label" for="id_theme">{{ form.theme.label }}</label>
<div class="controls">
{{ form.theme }}
</div>
</div>
<!-- Country -->
<div class="control-group">
<label class="control-label" for="id_country">{{ form.country.label }}</label>
<div class="controls">
{{ form.country }}
</div>
</div>
<!-- City -->
<div class="control-group">
<label class="control-label" for="id_city">{{ form.city.label }}</label>
<div class="controls">
{{ form.city }}
</div>
</div>
<!-- Area -->
<div class="control-group">
<label class="control-label" for="id_area">{{ form.area.label }}</label>
<div class="controls">
{{ form.area }}
</div>
</div>
<!-- Exposition -->
<div class="control-group">
<label class="control-label" for="id_exposition">{{ form.exposition.label }}</label>
<div class="controls">
{{ form.exposition }}
</div>
</div>
<!-- Conference -->
<div class="control-group">
<label class="control-label" for="id_conference">{{ form.conference.label }}</label>
<div class="controls">
{{ form.conference }}
</div>
</div>
<!-- event_news -->
<div class="control-group">
<label class="control-label" for="id_conference">{{ form.event_news.label }}</label>
<div class="controls">
{{ form.event_news }}
</div>
</div>
<!-- Mailing list -->
<div class="control-group">
<label class="control-label" for="id_mailinglist">{{ form.mailinglist.label }}</label>
<div class="controls">
{{ form.mailinglist }}
</div>
</div>
<!-- Created from -->
<div class="control-group">
<label class="control-label" for="id_created_from">{{ form.created_from.label }}</label>
<div class="controls">
{{ form.created_from }}
</div>
</div>
<!-- Created to -->
<div class="control-group">
<label class="control-label" for="id_created_to">{{ form.created_to.label }}</label>
<div class="controls">
{{ form.created_to }}
</div>
</div>
<!-- not active -->
<div class="control-group">
<label class="control-label" for="id_not_active">{{ form.not_active.label }}</label>
<div class="controls">
{{ form.not_active }}
</div>
</div>
<!-- not Valid email -->
<div class="control-group">
<label class="control-label" for="id_not_valid">{{ form.not_valid.label }}</label>
<div class="controls">
{{ form.not_valid }}
</div>
</div>
<!-- not subscriber -->
<div class="control-group">
<label class="control-label" for="id_not_subscriber">{{ form.not_subscriber.label }}</label>
<div class="controls">
{{ form.not_subscriber }}
</div>
</div>
<!-- types_choice -->
<div class="control-group">
<label class="control-label" for="id_types_choice">{{ form.types_choice.label }}</label>
<div class="controls">
{{ form.types_choice }}
</div>
</div>
<!-- Buttons -->
<div class="control-group">
<label class="control-label" for="submit"></label>
<div class="controls">
<button id="submit" class="btn btn-primary">Фильтровать</button>
<a href="{% url 'export_contacts' %}" id="export" class="btn yellow">Экспорт<i class="icon-circle-arrow-down"></i></a>
<a href="{% url 'newsletters_mailinglist_create_filter' %}" id="mailinglist" class="btn btn-success" data-toggle="tooltip" data-placement="top" title="Создает новый список рассылки с отфильтрованими контактами"><i class="icon-plus"></i>Создать список рассылки из фильтра</a>
<a href="{% url 'newsletters_mailinglist_create' %}" class="btn btn-success" data-toggle="tooltip" data-placement="top" title="Создает новый список рассылки"><i class="icon-plus"></i>Создать список рассылки</a>
</div>
</div>
</div>
</fieldset>
</form>
<table class="table table-hover">
<thead>
<tr>
<th>Email</th>
<th>Имя</th>
<th>Тестер</th>
<th>Подписчик</th>
<th>Потверждена подписка</th>
<th>Дата создания</th>
<th>Дата редактирования</th>
<th>&nbsp;</th>
<th><a class="btn btn-danger" id="delete-all-button" href="{% url 'newsletters_contact_query_delete' %}" data-toggle="tooltip" data-placement="top" title="Удалит ВСЕ контакты из результата поиска!(не только на первой странице)">Удалить все</a></th>
</tr>
</thead>
<tbody>
{% for item in object_list %}
<tr>
<td>{{ item.email }}</td>
<td>{{ item.first_name }}</td>
<td>{% if item.tester %}<span class="label label-success">да</span>{% else %}
<span class="label label-important">нет</span>{% endif %}</td>
<td>{% if item.subscriber %}<span class="label label-success">да</span>{% else %}
<span class="label label-important">нет</span>{% endif %}</td>
<td>{% if item.activated %}<span class="label label-success">да</span>{% else %}
<span class="label label-important">нет</span>{% endif %}</td>
<td>{{ item.creation_date|date:"Y-m-d H:i" }}</td>
<td>{{ item.modification_date|date:"Y-m-d H:i" }}</td>
<td>
{% if item.contactsettings %}
<a href="{% url 'newsletters_contact_update' item.contactsettings.id %}">Изменить</a>
{% endif %}
</td>
<td><a href="{% url 'newsletters_contact_delete' item.id %}">Удалить</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{# pagination #}
{% include 'c_admin/includes/admin_pagination.html' with page_obj=object_list %}
</div>
{% endblock %}
{% block select2 %}
<link href="{% static 'js/select2-4.0.3/css/select2.min.css' %}" rel="stylesheet"/>
<script src="{% static 'js/select2-4.0.3/js/select2.full.min.js' %}"></script>
{% endblock select2 %}
{% block scripts %}
{# <script src="{% static 'js/select2.min.js' %}"></script>#}
{# <link href="{% static 'js/select/select2.css' %}" rel='stylesheet'>#}
<script>
$(document).ready(function () {
$("#id_theme").select2({width: 283, placeholder: 'Тематики'});
$("#id_country").select2({width: 283, placeholder: 'Страны'});
$("#cities").select2({width: 283, placeholder: 'Города'});
$("#id_area").select2({width: 283, placeholder: 'Географическая зона'});
$("#id_mailinglist").select2({width: 283, placeholder: 'Список рассылки'});
var get_param = window.location.search;
if (!get_param) {
$('.toggled').collapse('hide');
}
$('legend').on('click', function () {
$('.toggled').collapse('toggle');
});
$('#export').on('click', function(event){
event.preventDefault();
window.location = "{% url 'export_contacts' %}" + get_param;
});
$('a#mailinglist').on('click', function(event){
event.preventDefault();
window.location = $(this).attr('href') + get_param;
});
$('#id_created_from').datetimepicker({
todayHighlight: true,
format : 'dd.mm.yyyy',
minView:2
});
$('#id_created_to').datetimepicker({
todayHighlight: true,
format : 'dd.mm.yyyy',
minView:2
});
$('[data-toggle="tooltip"]').tooltip();
$('#delete-all-button').on('click', function(event){
event.preventDefault();
if(confirm("Удалить записи?")) {
var get_param = window.location.search;
var href = $(this).attr('href');
window.location = href+get_param;
}
});
$('select#id_conference').select2({
multiple: true,
ajax: {
url: '/admin/conference/search/?subscribers=1',
width: '550px',
dataType: "json",
quietMillis: 200,
data: function(params){
return {term: params.term,
page: params.page};
},
processResults: function (data) {
return {results: $.map(data, function(obj) {
{# obj.text = obj.label;#}
return {id: obj.id, text: obj.label}
})};
},
},
createTag: function(params) {
return undefined;
},
});
$('select#id_exposition').select2({
multiple: true,
ajax: {
url: '/admin/exposition/search/?subscribers=1',
width: '550px',
dataType: "json",
quietMillis: 200,
data: function(params){
return {term: params.term,
page: params.page};
},
processResults: function (data) {
return {results: $.map(data, function(obj) {
return {id: obj.id, text: obj.label}
})};
},
},
createTag: function(params) {
return undefined;
},
});
})
</script>
{% endblock %}