added filters based on created users, modified code for unsubscribe, displayed related contact lists for all contacts (#240)
This commit is contained in:
parent
fe9b1de337
commit
bbe7eb7a4d
24 changed files with 841 additions and 433 deletions
|
|
@ -108,8 +108,7 @@ class UserCreateTestCase(ObjectsCreation, TestCase):
|
|||
'first_name': '',
|
||||
'last_name': '',
|
||||
'username': '',
|
||||
'role': 'r',
|
||||
'profile_pic': None})
|
||||
'role': 'ADMIN',})
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
|
|
|
|||
324
invoices/templates/invoice_create_1.html
Normal file
324
invoices/templates/invoice_create_1.html
Normal file
|
|
@ -0,0 +1,324 @@
|
|||
{% extends 'sales/base.html' %}
|
||||
{% load staticfiles %}
|
||||
{% block breadcrumb %}
|
||||
{% block extralinks %}
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-tagsinput/1.3.6/jquery.tagsinput.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/themes/start/jquery-ui.css" />
|
||||
{% endblock %}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{% url 'invoices:invoices_list' %}">Invoices</a></li>
|
||||
<li class="breadcrumb-item active">{% if invoice_obj %}Edit{% else %}Create{% endif %}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<div class="crm_invoice" style="">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="crm_form">
|
||||
<div class="row">
|
||||
<div class="col-md-9 p-5 m-auto" style=" background: #fff!important;">
|
||||
<h1 class="text-center pb-3">{% if invoice_obj %}Edit{% else %}Create{% endif %} Invoice</h1>
|
||||
<form id="formid" action='' method="POST" novalidate>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group row">
|
||||
<label for="staticEmail" class="col-sm-4 col-form-label">Invoice
|
||||
Title{% if form.invoice_title.field.required %}<span class="error_marker" style="color:red">
|
||||
*</span>{% endif %} </label>
|
||||
<div class="col-sm-8 pl-0">
|
||||
<!-- <input type="text" class="form-control" id="staticEmail" placeholder="micropyramid"> -->
|
||||
{{ form.invoice_title }}
|
||||
<span class="error" id="id__invoice_title">{{ form.invoice_title.errors }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputPassword" class="col-sm-4 col-form-label"
|
||||
style="margin:auto; padding:inherit;">Invoice
|
||||
Number{% if form.invoice_number.field.required %}<span class="error_marker"
|
||||
style="color:red">*</span>{% endif %}</label>
|
||||
<div class="col-sm-8 pl-0">
|
||||
<!-- <input type="text" class="form-control" id="inputPassword" placeholder="79840PM90"> -->
|
||||
{{ form.invoice_number }}
|
||||
<span class="error" id="id__invoice_number">{{ form.invoice_number.errors }}</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group row">
|
||||
<label for="staticEmail"
|
||||
class="col-sm-4 col-form-label">Status{% if form.status.field.required %}<span
|
||||
class="error_marker" style="color:red">*</span>{% endif %}</label>
|
||||
<div class="col-sm-8 pl-0">
|
||||
<!-- <input type="text" class="form-control" id="staticEmail" placeholder="Lakshmanchandu"> -->
|
||||
{{ form.status }}
|
||||
<span class="error" id="id__status">{{ form.status.errors }}</span>
|
||||
<!-- <span class="error" id="id__name">{{ form.name.errors }}</span> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="col-md-6">
|
||||
<div class="form-group row">
|
||||
<label for="id_contacts" class="col-sm-4 col-form-label">Status{% if form.status.field.required %}<span
|
||||
class="error_marker" style="color:red">*</span>{% endif %}</label>
|
||||
{{ form.status }}
|
||||
<span class="error" id="id__status">{{ form.status.errors }}</span>
|
||||
</div> -->
|
||||
<!-- <div class="row">
|
||||
<div class="col-sm-8 pl-0">
|
||||
<div class="form-group ">
|
||||
<label for="id_contacts" class="required">Status{% if form.status.field.required %}<span
|
||||
class="error_marker" style="color:red">*</span>{% endif %}</label>
|
||||
{{ form.status }}
|
||||
<span class="error" id="id__status">{{ form.status.errors }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<!-- <label>Status</label>
|
||||
<button class="btn status btn-primary">Sent</button> -->
|
||||
<!-- </div> -->
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="form-group mt-5 col-md-6">
|
||||
<!-- <label for="exampleFormControlTextarea1">From Address</label>
|
||||
<textarea class="form-control" id="exampleFormControlTextarea1"
|
||||
placeholder="Micropyramid Informatics, 6th Floor, Krish saphire Building, Madhapur"
|
||||
rows="6"></textarea> -->
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">From Address</label>
|
||||
{{ from_address_form.address_line }}
|
||||
<span class="error" id="id__address_line">{{ from_address_form.address_line.errors }}</span>
|
||||
</div>
|
||||
{{ from_address_form.street }}
|
||||
<span class="error" id="id__street">{{ from_address_form.street.errors }}</span>
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="col-md-4">
|
||||
{{ from_address_form.city }}
|
||||
{{ from_address_form.city.errors }}
|
||||
<span class="error" id="id__city">{{ to_address_form.city.errors }}</span>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{{ from_address_form.state }}
|
||||
<span class="error" id="id__state">{{ from_address_form.state.errors }}</span>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{{ from_address_form.postcode }}
|
||||
<span class="error" id="id__postcode">{{ from_address_form.postcode.errors }}</span>
|
||||
</div>
|
||||
<div class="col-md-12" style="margin-top: 10px;">
|
||||
{{ from_address_form.country }}
|
||||
<span class="error" id="id__country">{{ from_address_form.country.errors }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
<div class="form-group mt-5 col-md-6">
|
||||
<!-- <label for="exampleFormControlTextarea1">To Address</label>
|
||||
<textarea class="form-control" id="exampleFormControlTextarea1" rows="6"
|
||||
placeholder="Micropyramid Informatics, 6th Floor, Krish saphire Building, Madhapur"></textarea> -->
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">To Address</label>
|
||||
{{ to_address_form.address_line }}
|
||||
<span class="error" id="id__address_line_">{{ to_address_form.address_line.errors }}</span>
|
||||
</div>
|
||||
{{ to_address_form.street }}
|
||||
<span class="error" id="id__street_">{{ to_address_form.street.errors }}</span>
|
||||
<div class="row" style="margin-top: 10px;">
|
||||
<div class="col-md-4">
|
||||
{{ to_address_form.city }}
|
||||
{{ to_address_form.city.errors }}
|
||||
<span class="error" id="id__city_">{{ to_address_form.city.errors }}</span>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{{ to_address_form.state }}
|
||||
<span class="error" id="id__state_">{{ to_address_form.state.errors }}</span>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{{ to_address_form.postcode }}
|
||||
<span class="error" id="id__postcode_">{{ to_address_form.postcode.errors }}</span>
|
||||
</div>
|
||||
<div class="col-md-12" style="margin-top: 10px;">
|
||||
{{ to_address_form.country }}
|
||||
<span class="error" id="id__country_">{{ to_address_form.country.errors }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mt-5">
|
||||
<div class="form-group row">
|
||||
<label for="staticEmail" class="col-sm-4 col-form-label">Name
|
||||
{% if form.name.field.required %}<span class="error_marker" style="color:red"> *
|
||||
</span>{% endif %}</label>
|
||||
<div class="col-sm-8 pl-0">
|
||||
<!-- <input type="text" class="form-control" id="staticEmail" placeholder="Lakshmanchandu"> -->
|
||||
{{ form.name }}
|
||||
<span class="error" id="id__name">{{ form.name.errors }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="staticEmail" class="col-sm-4 col-form-label">Email
|
||||
{% if form.email.field.required %}<span class="error_marker" style="color:red"> *
|
||||
</span>{% endif %}</label>
|
||||
<div class="col-sm-8 pl-0">
|
||||
<!-- <input type="text" class="form-control" id="staticEmail"
|
||||
placeholder="lakshman@micropyramid.com"> -->
|
||||
{{ form.email }}
|
||||
<span class="error" id="id__email">{{ form.email.errors }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="staticEmail"
|
||||
class="col-sm-4 col-form-label">Phone{% if form.phone.field.required %}<span
|
||||
class="error_marker" style="color:red"> * </span>{% endif %}</label>
|
||||
<div class="col-sm-8 pl-0">
|
||||
{{ form.phone }}
|
||||
<span class="error" id="id__phone">{{ form.phone.errors }}</span>
|
||||
<!-- <input type="text" class="form-control" id="staticEmail" placeholder="6566589125"> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mt-5">
|
||||
<div class="form-group row">
|
||||
<label for="inputState" class="col-sm-4">Currency{% if form.currency.field.required %}<span
|
||||
class="error_marker" style="color:red"> * </span>{% endif %}</label>
|
||||
<div class="col-sm-8 pl-0">
|
||||
{{ form.currency }}
|
||||
<span class="error" id="id__currency">{{ form.currency.errors }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="staticEmail" class="col-sm-4 col-form-label">Assign To</label>
|
||||
<div class="col-sm-8 pl-0">
|
||||
<!-- <input type="text" class="form-control" id="staticEmail" placeholder="santhrao N"> -->
|
||||
{{form.assigned_to}}
|
||||
<span class="error" id="id__assigned_to">{{ form.assigned_to.errors }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="staticEmail" class="col-sm-4 col-form-label">Due Date
|
||||
{% if form.due_date.field.required %}<span class="error_marker"
|
||||
style="color:red">*</span>{% endif %}</label>
|
||||
<div class="col-sm-8 pl-0">
|
||||
<div id="datepicker1" class='input-group date'>
|
||||
{{ form.due_date }}
|
||||
<span class="input-group-addon">
|
||||
<span class="glyphicon glyphicon-calendar"></span>
|
||||
</span>
|
||||
</div>
|
||||
<span class="error" id="id__due_date">{{ form.due_date.errors }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mt-5">
|
||||
<div class="row pt-0 pb-4">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputCity">Quality Hours{% if form.quantity.field.required %}<span
|
||||
class="error_marker" style="color:red"> * </span>{% endif %}</label>
|
||||
<!-- <input type="text" class="form-control" id="inputCity" placeholder="5:30"> -->
|
||||
{{ form.quantity }}
|
||||
<span class="error" id="id__quantity">{{ form.quantity.errors }}</span>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputState">Rate {% if form.rate.field.required %}<span class="error_marker"
|
||||
style="color:red">*</span>{% endif %}</label>
|
||||
{{ form.rate }}
|
||||
<span class="error" id="id__rate">{{ form.rate.errors }}</span>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="inputZip">Total Amount{% if form.total_amount.field.required %}<span
|
||||
class="error_marker" style="color:red"> * </span>{% endif %}</label>
|
||||
{{ form.total_amount }}
|
||||
<span class="error" id="id__total_amount">{{ form.total_amount.errors }}</span>
|
||||
<!-- <input type="text" class="form-control" id="inputZip" placeholder="5:31"> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mt-1">
|
||||
<div class="form-group">
|
||||
<label for="inputZip">Details</label>
|
||||
{{form.details}}
|
||||
<span class="error" id="id__details">{{ form.details.errors }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-12">
|
||||
<div class="row marl buttons_row form_btn_row text-center">
|
||||
<button class="btn btn-default save" type="submit">Save</button>
|
||||
<a href="{% url 'invoices:invoices_list' %}" class="btn btn-default clear"
|
||||
id="create_user_cancel">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
|
||||
{% block js_block %}
|
||||
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js'></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-tagsinput/1.3.6/jquery.tagsinput.min.js"></script>
|
||||
<script src="https://malsup.github.io/jquery.form.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// $(document).ready(function() {
|
||||
// $('.assigned_users').select2();
|
||||
// });
|
||||
$(document).ready(function () {
|
||||
$("#id_contacts").select2();
|
||||
$("#id_assigned_to").select2();
|
||||
$('#id_currency').select2();
|
||||
var date = new Date();
|
||||
var today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
||||
$('#id_due_date').datetimepicker({
|
||||
'format': 'YYYY-MM-DD',
|
||||
minDate: today
|
||||
})
|
||||
|
||||
|
||||
$('#id_quantity').keyup(calculate);
|
||||
$('#id_rate').keyup(calculate);
|
||||
function calculate(e) {
|
||||
$('#id_total_amount').val($('#id_quantity').val() * $('#id_rate').val());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('form#formid').ajaxForm({
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
url: ".",
|
||||
data: $('#formid').serialize(),
|
||||
success: function (data) {
|
||||
if (data.error) {
|
||||
$('.error').html('')
|
||||
for (var key in data.errors) {
|
||||
$('#id__' + key).html("<p>" + data.errors[key][0] + "</p>");
|
||||
};
|
||||
for (var key in data.from_address_errors) {
|
||||
$('#id__' + key).html("<p>" + data.from_address_errors[key][0] + "</p>");
|
||||
};
|
||||
for (var key in data.to_address_errors) {
|
||||
$('#id__' + key + '_').html("<p>" + data.to_address_errors[key][0] + "</p>");
|
||||
console.log($('#id__' + key + '_'))
|
||||
};
|
||||
$('#submit_btn').removeAttr('disabled')
|
||||
}
|
||||
else {
|
||||
window.location = data.success_url;
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock js_block %}
|
||||
|
|
@ -101,7 +101,7 @@ def invoices_create(request):
|
|||
prefix='from')
|
||||
context["to_address_form"] = InvoiceAddressForm(prefix='to')
|
||||
|
||||
return render(request, 'invoices_create.html', context)
|
||||
return render(request, 'invoice_create_1.html', context)
|
||||
|
||||
if request.method == 'POST':
|
||||
form = InvoiceForm(request.POST, request_user=request.user)
|
||||
|
|
@ -166,7 +166,7 @@ def invoice_edit(request, invoice_id):
|
|||
instance=invoice_obj.from_address)
|
||||
context['to_address_form'] = InvoiceAddressForm(prefix='to',
|
||||
instance=invoice_obj.to_address)
|
||||
return render(request, 'invoices_create.html', context)
|
||||
return render(request, 'invoice_create_1.html', context)
|
||||
|
||||
if request.method == 'POST':
|
||||
form = InvoiceForm(request.POST, instance=invoice_obj,
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ class UpdateLeadTestCase(TestLeadModel, TestCase):
|
|||
'state': "California",
|
||||
'postcode': "579", 'country': "AD",
|
||||
'phone': "+917894563452",
|
||||
'website': "www.gmail.com", 'status': None,
|
||||
'website': "www.gmail.com", 'status': '',
|
||||
'source': "", 'opportunity_amount': "700",
|
||||
'description': "Iam an Lead", 'created_by': self.user}
|
||||
response = self.client.post(url, data)
|
||||
|
|
|
|||
36
marketing/migrations/0009_auto_20190618_1144.py
Normal file
36
marketing/migrations/0009_auto_20190618_1144.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Generated by Django 2.1.7 on 2019-06-18 06:14
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import django.db.models.expressions
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('marketing', '0008_auto_20190612_1905'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ContactUnsubscribedCampaign',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('is_unsubscribed', models.BooleanField(default=False)),
|
||||
],
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='campaign',
|
||||
options={'ordering': ('-created_on',)},
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='contactunsubscribedcampaign',
|
||||
name='campaigns',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='campaign_is_unsubscribed', to='marketing.Campaign'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='contactunsubscribedcampaign',
|
||||
name='contacts',
|
||||
field=models.ForeignKey(on_delete=django.db.models.expressions.Case, related_name='contact_is_unsubscribed', to='marketing.Contact'),
|
||||
),
|
||||
]
|
||||
|
|
@ -260,6 +260,10 @@ class Campaign(models.Model):
|
|||
return self.contact_lists.filter(contacts__is_unsubscribed=True
|
||||
).exclude(contacts__email=None).values_list('contacts__email').count()
|
||||
|
||||
@property
|
||||
def get_all_emails_subscribed_count(self):
|
||||
return self.get_all_emails_count - self.get_all_email_bounces_count - self.get_all_emails_unsubscribed_count
|
||||
|
||||
|
||||
@receiver(models.signals.pre_delete, sender=Campaign)
|
||||
def comment_attachments_delete(sender, instance, **kwargs):
|
||||
|
|
@ -319,3 +323,14 @@ class CampaignCompleted(models.Model):
|
|||
campaign = models.OneToOneField(
|
||||
Campaign, on_delete=models.CASCADE, related_name='campaign_is_completed')
|
||||
is_completed = models.BooleanField(default=False)
|
||||
|
||||
|
||||
class ContactUnsubscribedCampaign(models.Model):
|
||||
""" This Model Is Used To Check If The Contact has Unsubscribed To a Particular Campaign
|
||||
related name : contact_is_unsubscribed
|
||||
"""
|
||||
campaigns = models.ForeignKey(
|
||||
Campaign, on_delete=models.CASCADE, related_name='campaign_is_unsubscribed')
|
||||
contacts = models.ForeignKey(
|
||||
Contact, on_delete=models.Case, related_name='contact_is_unsubscribed')
|
||||
is_unsubscribed = models.BooleanField(default=False)
|
||||
|
|
|
|||
|
|
@ -145,7 +145,8 @@ def run_campaign(campaign, domain='demo.django-crm.io', protocol='https'):
|
|||
# title="company_logo"/>'
|
||||
|
||||
unsubscribe_from_campaign_url = reverse(
|
||||
'marketing:unsubscribe_from_campaign', kwargs={'contact_id': each_contact.id, })
|
||||
'marketing:unsubscribe_from_campaign', kwargs={'contact_id': each_contact.id,
|
||||
'campaign_id': campaign.id})
|
||||
unsubscribe_from_campaign_html = "<br><br/><a href={}>Unsubscribe</a>".format(
|
||||
domain_url + unsubscribe_from_campaign_url)
|
||||
names_dict = {'company_name': each_contact.company_name if each_contact.company_name else '',
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@
|
|||
{% load paginate %}
|
||||
{% block content %}
|
||||
{{ block.super }}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb mb-3">
|
||||
<li class="breadcrumb-item"><a href="{% url 'marketing:contacts_list' %}">Contacts</a></li>
|
||||
<li class="breadcrumb-item active">{{contact_obj.email}}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<div class="main_container ml-5 mr-5">
|
||||
<div class="row marl">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -12,7 +18,7 @@
|
|||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-title text-center">
|
||||
Contact Detail
|
||||
Contact Detail
|
||||
</div>
|
||||
<div class="row marl no-gutters justify-content-center">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -21,7 +27,7 @@
|
|||
<label for="exampleInputEmail1" class="required">
|
||||
Email{% if form.email.field.required %}<span class="error_marker"
|
||||
style="color:red">*</span>{% endif %}</label>
|
||||
<br>
|
||||
<br>
|
||||
{{contact_obj.email}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -30,7 +36,7 @@
|
|||
<label for="exampleInputEmail1" class="required">First
|
||||
Name{% if form.name.field.required %}<span class="error_marker"
|
||||
style="color:red">*</span>{% endif %}</label>
|
||||
<br>
|
||||
<br>
|
||||
{{contact_obj.name}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -39,7 +45,7 @@
|
|||
<label for="exampleInputEmail1" class="required">Last
|
||||
Name{% if form.last_name.field.required %}<span class="error_marker"
|
||||
style="color:red">*</span>{% endif %}</label>
|
||||
<br>
|
||||
<br>
|
||||
{{contact_obj.last_name}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -48,7 +54,7 @@
|
|||
<label for="exampleInputEmail1" class="required">City
|
||||
{% if form.city.field.required %}<span class="error_marker"
|
||||
style="color:red">*</span>{% endif %}</label>
|
||||
<br>
|
||||
<br>
|
||||
{{contact_obj.city}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -57,8 +63,8 @@
|
|||
<label for="exampleInputEmail1" class="required">State
|
||||
{% if form.state.field.required %}<span class="error_marker"
|
||||
style="color:red">*</span>{% endif %}</label>
|
||||
<br>
|
||||
{{contact_obj.state}}
|
||||
<br>
|
||||
{{contact_obj.state}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ urlpatterns = [
|
|||
path('contact-list/<int:pk>/failed/download/',
|
||||
failed_contact_list_download_delete, name='failed_contact_list_download_delete'),
|
||||
path('contact-list/<int:pk>/edit/', edit_contact_list, name='edit_contact_list'),
|
||||
path('cl/list/<int:pk>/delete/', delete_contact_list, name='delete_contact_list'),
|
||||
# path('cl/list/<int:pk>/delete/', delete_contact_list, name='delete_contact_list'),
|
||||
|
||||
path('email-templates/', email_template_list, name='email_template_list'),
|
||||
path('email-templates/create/', email_template_new, name='email_template_new'),
|
||||
|
|
@ -42,7 +42,7 @@ urlpatterns = [
|
|||
path('cm/link/<int:link_id>/e/<int:email_id>/', campaign_link_click, name='campaign_link_click'),
|
||||
path('cm/track-email/<int:campaign_log_id>/contact/<int:email_id>/', campaign_open, name='campaign_open'),
|
||||
path('demo-file-download-for-contacts-list/', demo_file_download, name='demo_file_download'),
|
||||
path('unsubscribe-from-campaign/<int:contact_id>/', unsubscribe_from_campaign, name="unsubscribe_from_campaign"),
|
||||
path('unsubscribe-from-campaign/<int:contact_id>/<int:campaign_id>/', unsubscribe_from_campaign, name="unsubscribe_from_campaign"),
|
||||
path('contacts/<int:contact_id>/view/', contact_detail, name="contact_detail"),
|
||||
path('download-contacts-for-campaign/<int:compaign_id>/', download_contacts_for_campaign, name="download_contacts_for_campaign"),
|
||||
path('create-campaign-from-template/<int:template_id>/', create_campaign_from_template, name="create_campaign_from_template"),
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ from marketing.forms import (ContactForm, ContactListForm, EmailTemplateForm,
|
|||
SendCampaignForm)
|
||||
from marketing.models import (Campaign, CampaignLinkClick, CampaignLog,
|
||||
CampaignOpen, Contact, ContactList,
|
||||
EmailTemplate, Link, Tag, FailedContact)
|
||||
EmailTemplate, Link, Tag, FailedContact, ContactUnsubscribedCampaign)
|
||||
from marketing.tasks import run_campaign, upload_csv_file
|
||||
|
||||
TIMEZONE_CHOICES = [(tz, tz) for tz in pytz.common_timezones]
|
||||
|
|
@ -63,13 +63,14 @@ def dashboard(request):
|
|||
@login_required(login_url='/login')
|
||||
def contact_lists(request):
|
||||
tags = Tag.objects.all()
|
||||
users = User.objects.all()
|
||||
if (request.user.role == "ADMIN"):
|
||||
queryset = ContactList.objects.all()
|
||||
else:
|
||||
queryset = ContactList.objects.filter(
|
||||
Q(created_by=request.user) | Q(visible_to=request.user))
|
||||
# users = User.objects.none()
|
||||
|
||||
users = User.objects.filter(
|
||||
id__in=queryset.values_list('created_by_id', flat=True))
|
||||
if request.GET.get('tag'):
|
||||
queryset = queryset.filter(tags=request.GET.get('tag'))
|
||||
if request.method == 'POST':
|
||||
|
|
@ -94,13 +95,16 @@ def contact_lists(request):
|
|||
|
||||
@login_required(login_url='/login')
|
||||
def contacts_list(request):
|
||||
users = User.objects.all()
|
||||
if (request.user.role == "ADMIN"):
|
||||
contacts = Contact.objects.all()
|
||||
else:
|
||||
contacts = Contact.objects.filter(created_by=request.user)
|
||||
# users = User.objects.none()
|
||||
contacts = Contact.objects.all()
|
||||
contact_ids = request.user.marketing_contactlist.all().values_list('contacts',
|
||||
flat=True)
|
||||
contacts = Contact.objects.filter(id__in=contact_ids)
|
||||
# contacts = Contact.objects.filter(created_by=request.user)
|
||||
users = User.objects.filter(
|
||||
id__in=contacts.values_list('created_by_id', flat=True))
|
||||
|
||||
if request.method == 'GET':
|
||||
context = {'contacts': contacts, 'users': users}
|
||||
return render(request, 'marketing/lists/all.html', context)
|
||||
|
|
@ -253,8 +257,10 @@ def contacts_list_new(request):
|
|||
|
||||
@login_required(login_url='/login')
|
||||
def edit_contact(request, pk):
|
||||
url_redirect_to = None
|
||||
contact_obj = get_object_or_404(Contact, pk=pk)
|
||||
if not (request.user.role == 'ADMIN' or request.user.is_superuser or contact_obj.created_by == request.user):
|
||||
if not (request.user.role == 'ADMIN' or request.user.is_superuser or contact_obj.created_by == request.user or
|
||||
(contact_obj.id in request.user.marketing_contactlist.all().values_list('contacts', flat=True))):
|
||||
raise PermissionDenied
|
||||
if request.method == 'GET':
|
||||
form = ContactForm(instance=contact_obj)
|
||||
|
|
@ -266,6 +272,9 @@ def edit_contact(request, pk):
|
|||
contact = form.save(commit=False)
|
||||
contact.save()
|
||||
form.save_m2m()
|
||||
if request.POST.get('from_url'):
|
||||
return JsonResponse({'error': False,
|
||||
'success_url': reverse('marketing:contact_list_detail', args=(request.POST.get('from_url'),))})
|
||||
return JsonResponse({'error': False, 'success_url': reverse('marketing:contacts_list')})
|
||||
else:
|
||||
return JsonResponse({'error': True, 'errors': form.errors, })
|
||||
|
|
@ -274,9 +283,12 @@ def edit_contact(request, pk):
|
|||
@login_required(login_url='/login')
|
||||
def delete_contact(request, pk):
|
||||
contact_obj = get_object_or_404(Contact, pk=pk)
|
||||
if not (request.user.role == 'ADMIN' or request.user.is_superuser or contact_obj.created_by == request.user):
|
||||
if not (request.user.role == 'ADMIN' or request.user.is_superuser or contact_obj.created_by == request.user or
|
||||
(contact_obj.id in request.user.marketing_contactlist.all().values_list('contacts', flat=True))):
|
||||
raise PermissionDenied
|
||||
contact_obj.delete()
|
||||
if request.GET.get('from_contact'):
|
||||
return redirect(reverse('marketing:contact_list_detail', args=(request.GET.get('from_contact'),)))
|
||||
return redirect('marketing:contacts_list')
|
||||
|
||||
|
||||
|
|
@ -288,11 +300,14 @@ def contact_list_detail(request, pk):
|
|||
contacts_list = contact_list.contacts.all()
|
||||
if request.POST:
|
||||
if request.POST.get('name'):
|
||||
contacts_list = contacts_list.filter(name__icontains=request.POST.get('name'))
|
||||
contacts_list = contacts_list.filter(
|
||||
name__icontains=request.POST.get('name'))
|
||||
if request.POST.get('email'):
|
||||
contacts_list = contacts_list.filter(email=request.POST.get('email'))
|
||||
contacts_list = contacts_list.filter(
|
||||
email=request.POST.get('email'))
|
||||
if request.POST.get('company_name'):
|
||||
contacts_list = contacts_list.filter(company_name=request.POST.get('company_name'))
|
||||
contacts_list = contacts_list.filter(
|
||||
company_name=request.POST.get('company_name'))
|
||||
data = {'contact_list': contact_list, "contacts_list": contacts_list}
|
||||
return render(request, 'marketing/lists/detail.html', data)
|
||||
|
||||
|
|
@ -328,13 +343,14 @@ def failed_contact_list_download_delete(request, pk):
|
|||
|
||||
@login_required(login_url='/login')
|
||||
def email_template_list(request):
|
||||
users = User.objects.all()
|
||||
# users = User.objects.all()
|
||||
if (request.user.is_admin or request.user.is_superuser):
|
||||
queryset = EmailTemplate.objects.all()
|
||||
else:
|
||||
queryset = EmailTemplate.objects.filter(
|
||||
created_by=request.user)
|
||||
# users = User.objects.none()
|
||||
users = User.objects.filter(
|
||||
id__in=queryset.values_list('created_by_id', flat=True))
|
||||
if request.method == 'POST':
|
||||
if request.POST.get('template_name'):
|
||||
queryset = queryset.filter(
|
||||
|
|
@ -399,12 +415,13 @@ def email_template_delete(request, pk):
|
|||
|
||||
@login_required(login_url='/login')
|
||||
def campaign_list(request):
|
||||
users = User.objects.all()
|
||||
# users = User.objects.all()
|
||||
if (request.user.role == "ADMIN"):
|
||||
queryset = Campaign.objects.all()
|
||||
else:
|
||||
queryset = Campaign.objects.all().filter(created_by=request.user)
|
||||
# users = User.objects.none()
|
||||
users = User.objects.filter(
|
||||
id__in=queryset.values_list('created_by_id', flat=True))
|
||||
if request.GET.get('tag'):
|
||||
queryset = queryset.filter(tags=request.GET.get('tag'))
|
||||
if request.method == 'POST':
|
||||
|
|
@ -542,8 +559,12 @@ def campaign_details(request, pk):
|
|||
|
||||
all_contacts = contacts
|
||||
bounced_contacts = contacts.filter(is_bounced=True).distinct()
|
||||
unsubscribe_contacts = contacts.filter(
|
||||
is_unsubscribed=True).distinct()
|
||||
# unsubscribe_contacts = contacts.filter(
|
||||
# is_unsubscribed=True).distinct()
|
||||
unsubscribe_contacts_ids = ContactUnsubscribedCampaign.objects.filter(
|
||||
campaigns=campaign, is_unsubscribed=True).values_list('contacts_id', flat=True)
|
||||
unsubscribe_contacts = Contact.objects.filter(
|
||||
id__in=unsubscribe_contacts_ids)
|
||||
# read_contacts = campaign.marketing_links.filter(Q(clicks__gt=0)).distinct()
|
||||
contact_ids = CampaignOpen.objects.filter(
|
||||
campaign=campaign).values_list('contact_id', flat=True)
|
||||
|
|
@ -730,8 +751,11 @@ def demo_file_download(request):
|
|||
return response
|
||||
|
||||
|
||||
def unsubscribe_from_campaign(request, contact_id):
|
||||
def unsubscribe_from_campaign(request, contact_id, campaign_id):
|
||||
contact_obj = get_object_or_404(Contact, pk=contact_id)
|
||||
campaign_obj = get_object_or_404(Campaign, pk=campaign_id)
|
||||
ContactUnsubscribedCampaign.objects.create(
|
||||
campaigns=campaign_obj, contacts=contact_obj, is_unsubscribed=True)
|
||||
contact_obj.is_unsubscribed = True
|
||||
contact_obj.save()
|
||||
return HttpResponseRedirect('/')
|
||||
|
|
@ -740,8 +764,10 @@ def unsubscribe_from_campaign(request, contact_id):
|
|||
@login_required
|
||||
def contact_detail(request, contact_id):
|
||||
contact_obj = get_object_or_404(Contact, pk=contact_id)
|
||||
|
||||
if not (request.user.role == 'ADMIN' or request.user.is_superuser or contact_obj.created_by == request.user):
|
||||
if not (request.user.role == 'ADMIN' or request.user.is_superuser or contact_obj.created_by == request.user or
|
||||
(contact_obj.id in request.user.marketing_contactlist.all().values_list('contacts', flat=True))):
|
||||
# the above query is for: a contact may be common to multiple contact lists, so query from
|
||||
# a contact list can be created by multiple users
|
||||
raise PermissionDenied
|
||||
if request.method == 'GET':
|
||||
return render(request, 'contact_detail.html', {'contact_obj': contact_obj})
|
||||
|
|
@ -790,9 +816,12 @@ def download_contacts_for_campaign(request, compaign_id):
|
|||
'company_name', 'email', 'name', 'last_name', 'city', 'state')
|
||||
|
||||
if request.GET.get('is_unsubscribed') == 'true':
|
||||
contact_ids = campaign_obj.contact_lists.filter(contacts__is_unsubscribed=True).values_list(
|
||||
'contacts__id', flat=True)
|
||||
contacts = Contact.objects.filter(id__in=contact_ids).values(
|
||||
|
||||
unsubscribe_contacts_ids = ContactUnsubscribedCampaign.objects.filter(
|
||||
campaigns=campaign_obj, is_unsubscribed=True).values_list('contacts_id', flat=True)
|
||||
# contact_ids = campaign_obj.contact_lists.filter(contacts__is_unsubscribed=True).values_list(
|
||||
# 'contacts__id', flat=True)
|
||||
contacts = Contact.objects.filter(id__in=unsubscribe_contacts_ids).values(
|
||||
'company_name', 'email', 'name', 'last_name', 'city', 'state')
|
||||
|
||||
if request.GET.get('is_opened') == 'true':
|
||||
|
|
|
|||
|
|
@ -3,26 +3,26 @@
|
|||
{% block main_menu %}
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<!-- add submenu for contacts-->
|
||||
<li class="nav-item"><a class="nav-link" id="accounts" href="{% url 'marketing:dashboard' %}">Dashboard</a></li>
|
||||
<li class="nav-item mt-2">
|
||||
<li class="nav-item"><a class="nav-link" id="marketing-dashboard" href="{% url 'marketing:dashboard' %}">Dashboard</a></li>
|
||||
<li class="nav-item mt-2 contact_class" id="contact">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
|
||||
style="box-shadow: none; color: #657b88">
|
||||
Contacts
|
||||
</button>
|
||||
<div class="dropdown-menu mt-2">
|
||||
<a class="dropdown-item " href="{% url 'marketing:contact_lists' %}" >Contacts List</a>
|
||||
<a class="dropdown-item contact-list" id="contact-list" href="{% url 'marketing:contact_lists' %}" >Contacts List</a>
|
||||
<!-- <div class="dropdown-divider"></div> -->
|
||||
<a class="dropdown-item" href="{% url 'marketing:contacts_list' %}" >Contacts</a>
|
||||
<a class="dropdown-item contacts" id="contacts" href="{% url 'marketing:contacts_list' %}" >Contacts</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<!-- <li class="nav-item"><a href="{% url 'marketing:contact_lists' %}" class="nav-link" id="contact_lists">Contacts</a>
|
||||
</li> -->
|
||||
<li class="nav-item"><a class="nav-link" id="accounts" href="{% url 'marketing:email_template_list' %}">Email
|
||||
<li class="nav-item"><a class="nav-link" id="email-templates" href="{% url 'marketing:email_template_list' %}">Email
|
||||
templates</a></li>
|
||||
<li class="nav-item"><a class="nav-link" id="contacts" href="{% url 'marketing:campaign_list' %}">Campaigns</a></li>
|
||||
<li class="nav-item"><a class="nav-link" id="campaigns" href="{% url 'marketing:campaign_list' %}">Campaigns</a></li>
|
||||
<!-- <li class="nav-item"><a class="nav-link" id="leads" href="{% url 'leads:list' %}">Leads</a></li>
|
||||
<li class="nav-item"><a class="nav-link" id="opportunities"href="{% url 'opportunities:list' %}">Opportunities</a></li>
|
||||
<li class="nav-item"><a class="nav-link" id="cases" href="{% url 'cases:list' %}">Cases</a></li>
|
||||
|
|
@ -43,8 +43,8 @@
|
|||
{% load compress %}
|
||||
{% load thumbnail %}
|
||||
{% block main_menu %}
|
||||
<ul class="navbar-nav mr-auto">
|
||||
</ul>
|
||||
<!-- <ul class="navbar-nav mr-auto">
|
||||
</ul> -->
|
||||
{% endblock %}
|
||||
{% block header %}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,12 @@
|
|||
{% load common_tags %}
|
||||
{% block content %}
|
||||
{{ block.super }}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb mb-3">
|
||||
<li class="breadcrumb-item"><a href="{% url 'marketing:campaign_list' %}">Campaigns</a></li>
|
||||
<li class="breadcrumb-item active">{{ campaign.title }}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<div class="main_container ml-5 mr-5">
|
||||
<div class="row marl">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -141,6 +147,7 @@
|
|||
<div class="card-body">
|
||||
<div class="card-title text-right">
|
||||
<span class="float-left">Last 5 Opened</span>
|
||||
<span>Click here to download all the opened contacts</span>
|
||||
<a href="{% url 'marketing:download_contacts_for_campaign' campaign.id %}?is_opened=true"
|
||||
class="primary_btn text-center"><i class="fas fa-download mar_right_0"></i></a>
|
||||
</div>
|
||||
|
|
@ -193,7 +200,10 @@
|
|||
<div class="card-body">
|
||||
<div class="card-title text-right">
|
||||
<span class="float-left">Last 5 Unsubscribed</span>
|
||||
<a href="#" class="primary_btn text-center"><i class="fas fa-download mar_right_0"></i></a>
|
||||
<span>Click here to download all the unsubscribed contacts</span>
|
||||
<a href="{% url 'marketing:download_contacts_for_campaign' campaign.id %}?is_unsubscribed=true"
|
||||
title="download bounced contacts" class="primary_btn text-center"><i
|
||||
class="fas fa-download mar_right_0"></i></a>
|
||||
</div>
|
||||
<div class="table-responsive table-bordered">
|
||||
<table class="table">
|
||||
|
|
@ -211,9 +221,7 @@
|
|||
<tr>
|
||||
<td scope="row"><a href="{% url 'marketing:contact_detail' contact.id %}"
|
||||
class="anchor">{{contact.name}}</a></td>
|
||||
<td><a
|
||||
href="{% url 'marketing:download_contacts_for_campaign' campaign.id %}?is_unsubscribed=true"
|
||||
class="anchor">{{contact.email}}</a></td>
|
||||
<td><a href="#" class="anchor">{{contact.email}}</a></td>
|
||||
{% with contacts=contact.contact_list.all %}
|
||||
<td>
|
||||
{% for contact in contacts %}
|
||||
|
|
@ -249,6 +257,7 @@
|
|||
<div class="card-body">
|
||||
<div class="card-title text-right">
|
||||
<span class="float-left">Last 5 Bounced</span>
|
||||
<span>Click here to download all the bounced contacts</span>
|
||||
<a href="{% url 'marketing:download_contacts_for_campaign' campaign.id %}?is_bounced=true"
|
||||
title="download bounced contacts" class="primary_btn text-center"><i
|
||||
class="fas fa-download mar_right_0"></i></a>
|
||||
|
|
|
|||
|
|
@ -69,14 +69,16 @@
|
|||
{% if campaigns_list %}
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Campaign</th>
|
||||
<th width="10%">Receipents</th>
|
||||
<th width="20%">Sent</th>
|
||||
<th width="10%">Unique Opens</th>
|
||||
<th width="10%">Bounces</th>
|
||||
<th width="10%">Unsubscribed</th>
|
||||
<th width="10%">Tags</th>
|
||||
<th width="10%">Actions</th>
|
||||
<th width="15%" class="text-center">Campaign</th>
|
||||
<th width="5%" class="text-center">Receipents</th>
|
||||
<th width="15%" class="text-center">Sent</th>
|
||||
<th width="10%" class="text-center">Created By</th>
|
||||
<th width="10%" class="text-center">Unique Opens</th>
|
||||
<th width="5%" class="text-center">Bounces</th>
|
||||
<th width="5%" class="text-center">Subscribed</th>
|
||||
<th width="5%" class="text-center">Unsubscribed</th>
|
||||
<th width="15%" class="text-center">Tags</th>
|
||||
<th width="10%" class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% endif %}
|
||||
|
|
@ -95,6 +97,9 @@
|
|||
<td>
|
||||
{{ campaign.sent_on_format }}
|
||||
</td>
|
||||
<td>
|
||||
{{ campaign.created_by }}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<!-- <span class="badge badge-secondary">20.6%</span> -->
|
||||
{{campaign.opens_unique}}
|
||||
|
|
@ -105,8 +110,12 @@
|
|||
</td>
|
||||
<td class="text-center">
|
||||
<!-- <span class="badge badge-secondary">15.5%</span> -->
|
||||
{{campaign.get_all_emails_unsubscribed_count}}
|
||||
{{campaign.get_all_emails_subscribed_count}}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<!-- <span class="badge badge-secondary">15.5%</span> -->
|
||||
{{campaign.get_all_emails_unsubscribed_count}}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{% for tag in campaign.tags.all|slice:'3' %}
|
||||
<span class="text-left color{{forloop.counter}} tag_class_camp" id="list_tag"
|
||||
|
|
@ -119,7 +128,7 @@
|
|||
</span></span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="actions">
|
||||
<td class="actions text-center">
|
||||
<a href="{% url 'marketing:campaign_details' campaign.id %}" class="btn btn-success view"><i
|
||||
class="fas fa-eye"></i></a>
|
||||
<!--
|
||||
|
|
|
|||
|
|
@ -9,6 +9,13 @@
|
|||
{% endblock extralinks %}
|
||||
{% block content %}
|
||||
{{ block.super }}
|
||||
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb mb-3">
|
||||
<li class="breadcrumb-item"><a href="{% url 'marketing:campaign_list' %}">Campaigns</a></li>
|
||||
<li class="breadcrumb-item active">{% if campaign_obj %}Edit{% else %}Create{% endif %} Email Template</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<div class="main_container ml-5 mr-5">
|
||||
<div class="row marl">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -109,14 +116,14 @@
|
|||
</div>
|
||||
|
||||
<!-- <div class="filter_col col-md-12"> -->
|
||||
<div class="form-group">
|
||||
<label>Tags</label>
|
||||
<div class="txt-box-div" id="tag-div">
|
||||
<input type="text" name="tags" id="tags_1" class="tags"
|
||||
value="{% if contact_list %}{% for tag in contact_list.tags.all %}{{tag.name}}, {% endfor %}{% endif %}" />
|
||||
</div>
|
||||
<span id="id_tags"></span>
|
||||
<div class="form-group">
|
||||
<label>Tags</label>
|
||||
<div class="txt-box-div" id="tag-div">
|
||||
<input type="text" name="tags" id="tags_1" class="tags"
|
||||
value="{% if contact_list %}{% for tag in contact_list.tags.all %}{{tag.name}}, {% endfor %}{% endif %}" />
|
||||
</div>
|
||||
<span id="id_tags"></span>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
<!--
|
||||
<div class="form-group">
|
||||
|
|
@ -164,7 +171,8 @@
|
|||
</div>
|
||||
<div class="col-md-4 timezone-div" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label for="">Schedule Date Time</label><span class="error_marker" style="color:red"> *</span>
|
||||
<label for="">Schedule Date Time</label><span class="error_marker" style="color:red">
|
||||
*</span>
|
||||
<div class="input-group date" id="datetimepicker1" data-target-input="nearest">
|
||||
<input type="text" class="form-control datetimepicker-input"
|
||||
data-target="#datetimepicker1" name="schedule_date_time" />
|
||||
|
|
@ -301,7 +309,7 @@
|
|||
// $('[name="schedule_date_time"]').datetimepicker({format: 'yyyy-mm-dd hh:ii'});
|
||||
$(function () {
|
||||
|
||||
$(function() {
|
||||
$(function () {
|
||||
$('#tags_1').tagsInput({ width: 'auto' });
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -150,19 +150,20 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% with users=campaign.contact_lists.all %}
|
||||
{% for user in users|slice:'3' %}
|
||||
{% with contacts_lists=campaign.contact_lists.all %}
|
||||
{% for contact in contacts_lists|slice:'3' %}
|
||||
<div>
|
||||
<div>
|
||||
<span class="text-left" id="list_opp_users_">{{user.name}}<span>
|
||||
<span class="text-left" id="list_opp_users_">
|
||||
<a href="{% url 'marketing:contact_list_detail' contact.id %}">{{contact.name}}</a><span>
|
||||
</div>
|
||||
{% empty %}
|
||||
<span class="text-left">None</span>
|
||||
{% endfor %}
|
||||
{% if users|length > 3 %}
|
||||
{% if contact|length > 3 %}
|
||||
<div>
|
||||
<span style="color:white; background-color: #333; padding:0.15em; border-radius: 10%;"
|
||||
class="text-left ml-1" id="list_opp_users">{{users|length|subtract:'3'}}<span>
|
||||
class="text-left ml-1" id="list_opp_users">{{contact|length|subtract:'3'}}<span>
|
||||
more
|
||||
</span></span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,23 +1,58 @@
|
|||
{% extends 'marketing/base.html' %}
|
||||
{% load staticfiles %}
|
||||
{% load paginate %}
|
||||
{% block extralinks %}
|
||||
<style>
|
||||
.detail {
|
||||
font-size: 2em;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{{ block.super }}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb mb-3">
|
||||
<li class="breadcrumb-item"><a href="{% url 'marketing:email_template_list' %}">Email Template</a></li>
|
||||
<li class="breadcrumb-item active">{{email_template.title}}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<div class="main_container ml-5 mr-5">
|
||||
<div class="row marl">
|
||||
<div class="col-md-12">
|
||||
<b class="bold">Title</b>
|
||||
<b class="bold detail">Title</b>
|
||||
<p>{{email_template.title}}</p>
|
||||
<b>Subject </b>
|
||||
<b class="detail">Subject </b>
|
||||
<p>{{email_template.subject}}</p>
|
||||
<b>Body </b>
|
||||
<span>{{email_template.html|safe}}</span>
|
||||
<b class="detail">Body </b>
|
||||
<!-- <span>{{email_template.html|safe}}</span> -->
|
||||
|
||||
<div id="editor-container">
|
||||
{{ email_template.html|safe }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block js_block %}
|
||||
<script>
|
||||
|
||||
var quill = new Quill('#editor-container', {
|
||||
modules: {
|
||||
toolbar: [
|
||||
['code-block']
|
||||
]
|
||||
},
|
||||
theme: 'snow'
|
||||
});
|
||||
quill.disable();
|
||||
|
||||
$('.ql-toolbar').hide();
|
||||
$('#editor-container').css('border', 'none');
|
||||
$('.ql-editor').css('margin', '0');
|
||||
$('.ql-editor').css('padding', '0');
|
||||
// $('#editor-container').css('height','0');
|
||||
|
||||
</script>
|
||||
{% endblock js_block %}
|
||||
|
|
@ -66,11 +66,13 @@
|
|||
{% if email_templates %}
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">S. No</th>
|
||||
<th width="55%">Template Name</th>
|
||||
<th width="15%" class="text-center">Create Campaign</th>
|
||||
<th width="5%" class="text-center">S. No</th>
|
||||
<th width="20%" class="text-center">Template Name</th>
|
||||
<th width="15%" class="text-center">Created By</th>
|
||||
<th width="10%" class="text-center">Created On</th>
|
||||
<th width="10%" class="text-center">Create Campaign</th>
|
||||
<!-- <th width="15%">Preview</th> -->
|
||||
<th width="15%">Actions</th>
|
||||
<th width="15%" class="text-center">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% endif %}
|
||||
|
|
@ -86,13 +88,15 @@
|
|||
<td scope="row"><a
|
||||
href="{% url 'marketing:email_template_detail' email_template.id %}">{{ email_template.title }}</a>
|
||||
</td>
|
||||
<td scope="row">{{ email_template.created_by }}</td>
|
||||
<td scope="row">{{ email_template.created_on }}</td>
|
||||
<td class="text-center"><a
|
||||
href="{% url 'marketing:create_campaign_from_template' email_template.id %}" class="a_color"
|
||||
data-toggle="tooltip" data-placement="bottom"
|
||||
title="Create a new campaign with this template"><i class="fas fa-calendar-plus"></i></a></td>
|
||||
<!-- <td><a href="{% url 'marketing:email_template_detail' email_template.id %}" class="a_color"><i
|
||||
class="fas fa-eye"></i> View Template</a></td> -->
|
||||
<td class="actions">
|
||||
<td class="actions text-center">
|
||||
<a href="{% url 'marketing:email_template_detail' email_template.id %}" class="btn btn-info edit"><i
|
||||
class="fas fa-eye"></i></a>
|
||||
<a href="{% url 'marketing:email_template_edit' email_template.id %}"
|
||||
|
|
|
|||
|
|
@ -2,133 +2,138 @@
|
|||
{% load staticfiles %}
|
||||
{% block content %}
|
||||
{{ block.super }}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb mb-3">
|
||||
<li class="breadcrumb-item"><a href="{% url 'marketing:email_template_list' %}">Email Template</a></li>
|
||||
<li class="breadcrumb-item active">{% if email_template %}Edit{% else %}Create{% endif %} Email Template</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<div class="main_container ml-5 mr-5">
|
||||
<div class="row marl">
|
||||
<div class="col-md-12">
|
||||
<form id="add_form" method="POST" action='' novalidate>
|
||||
<div class="overview_form_block row marl justify-content-center">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-title text-center">
|
||||
{% if email_template %}Edit{% else %}Create{% endif %} Email Template
|
||||
</div>
|
||||
<form>
|
||||
<div class="row marl">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="">Title</label><span class="error_marker" style="color:red"> *</span>
|
||||
<input type="text" class="form-control" name="title"
|
||||
value="{% if email_template %}{{ email_template.title }}{% endif %}"
|
||||
placeholder="Enter Template Title">
|
||||
</div>
|
||||
<span id="id_title"></span>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="">Subject</label><span class="error_marker" style="color:red"> *</span>
|
||||
<input type="text" class="form-control" name="subject"
|
||||
value="{% if email_template %}{{ email_template.subject }}{% endif %}"
|
||||
placeholder="Enter Template Subject">
|
||||
</div>
|
||||
<span id="id_subject"></span>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label>HTML Code</label><span class="error_marker" style="color:red"> *</span>
|
||||
<div id="editor-container">
|
||||
{% if email_template %}{{ email_template.html|safe }}{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="html" id="html_content">
|
||||
<span id="id_html"></span>
|
||||
</div>
|
||||
<!-- <div class="col-md-12 text-center">
|
||||
<div class="row marl">
|
||||
<div class="col-md-12">
|
||||
<form id="add_form" method="POST" action='' novalidate>
|
||||
<div class="overview_form_block row marl justify-content-center">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="card-title text-center">
|
||||
{% if email_template %}Edit{% else %}Create{% endif %} Email Template
|
||||
</div>
|
||||
<form>
|
||||
<div class="row marl">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="">Title</label><span class="error_marker" style="color:red"> *</span>
|
||||
<input type="text" class="form-control" name="title"
|
||||
value="{% if email_template %}{{ email_template.title }}{% endif %}"
|
||||
placeholder="Enter Template Title">
|
||||
</div>
|
||||
<span id="id_title"></span>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label for="">Subject</label><span class="error_marker" style="color:red"> *</span>
|
||||
<input type="text" class="form-control" name="subject"
|
||||
value="{% if email_template %}{{ email_template.subject }}{% endif %}"
|
||||
placeholder="Enter Template Subject">
|
||||
</div>
|
||||
<span id="id_subject"></span>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label>HTML Code</label><span class="error_marker" style="color:red"> *</span>
|
||||
<div id="editor-container">
|
||||
{% if email_template %}{{ email_template.html|safe }}{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="html" id="html_content">
|
||||
<span id="id_html"></span>
|
||||
</div>
|
||||
<!-- <div class="col-md-12 text-center">
|
||||
<pre id="myPrecious"></pre>
|
||||
<div id="justText"></div>
|
||||
<div id="justHtml"></div>
|
||||
</div> -->
|
||||
<div class="col-md-12 text-center">
|
||||
<div class="row marl buttons_row text-center form_btn_row">
|
||||
<button type="submit" class="btn btn-default save">Save
|
||||
Template</button>
|
||||
<a href="{% url 'marketing:email_template_list' %}"
|
||||
class="btn btn-default clear">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 text-center">
|
||||
<div class="row marl buttons_row text-center form_btn_row">
|
||||
<button type="submit" class="btn btn-default save">Save
|
||||
Template</button>
|
||||
<a href="{% url 'marketing:email_template_list' %}" class="btn btn-default clear">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block js_block %}
|
||||
<script src="{% static 'js/ajaxForm.js' %}"></script>
|
||||
<!-- <script src="https://malsup.github.com/jquery.form.js"></script> -->
|
||||
<script>
|
||||
var quill = new Quill('#editor-container', {
|
||||
modules: {
|
||||
toolbar: [
|
||||
[{ header: [1, 2, false] }],
|
||||
['bold', 'italic', 'underline'],
|
||||
['code-block']
|
||||
]
|
||||
},
|
||||
placeholder: 'Compose an epic...',
|
||||
theme: 'snow' // or 'bubble'
|
||||
var quill = new Quill('#editor-container', {
|
||||
modules: {
|
||||
toolbar: [
|
||||
[{ header: [1, 2, false] }],
|
||||
['bold', 'italic', 'underline'],
|
||||
['code-block']
|
||||
]
|
||||
},
|
||||
placeholder: 'Compose an epic...',
|
||||
theme: 'snow' // or 'bubble'
|
||||
});
|
||||
|
||||
if(quill.root.innerHTML !== "<p><br></p>"){
|
||||
if (quill.root.innerHTML !== "<p><br></p>") {
|
||||
$('#html_content').val(quill.root.innerHTML);
|
||||
}
|
||||
|
||||
|
||||
var preciousContent = document.getElementById('myPrecious');
|
||||
var justTextContent = document.getElementById('justText');
|
||||
var justHtmlContent = document.getElementById('justHtml');
|
||||
var preciousContent = document.getElementById('myPrecious');
|
||||
var justTextContent = document.getElementById('justText');
|
||||
var justHtmlContent = document.getElementById('justHtml');
|
||||
|
||||
quill.on('text-change', function () {
|
||||
var delta = quill.getContents();
|
||||
var text = quill.getText();
|
||||
var justHtml = quill.root.innerHTML;
|
||||
quill.on('text-change', function () {
|
||||
var delta = quill.getContents();
|
||||
var text = quill.getText();
|
||||
var justHtml = quill.root.innerHTML;
|
||||
/*preciousContent.innerHTML = JSON.stringify(delta);
|
||||
justTextContent.innerHTML = text;
|
||||
justHtmlContent.innerHTML = justHtml;*/
|
||||
$('#html_content').val(justHtml);
|
||||
});
|
||||
$('#html_content').val(justHtml);
|
||||
});
|
||||
|
||||
|
||||
$('.save_btn').click(function (e) {
|
||||
e.preventDefault();
|
||||
$("form#add_form").submit()
|
||||
})
|
||||
$('.save_btn').click(function (e) {
|
||||
e.preventDefault();
|
||||
$("form#add_form").submit()
|
||||
})
|
||||
|
||||
$('form#add_form').ajaxForm({
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
url: $(this).attr('action'),
|
||||
data: $(this).serialize(),
|
||||
success: function (data) {
|
||||
console.log("data", data)
|
||||
if (data.error == false) {
|
||||
window.location = "{% url 'marketing:email_template_list' %}";
|
||||
} else {
|
||||
/*$(document).ajaxStop($.unblockUI);*/
|
||||
// $.unblockUI();
|
||||
$('p.failure').remove();
|
||||
for (var key in data.errors) {
|
||||
$('#id_' + key).html('<p class="error failure"> *' + data.errors[key] + '</p>');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, errmsg, err) {
|
||||
console.log('error data', errmsg, err)
|
||||
}
|
||||
});
|
||||
$('form#add_form').ajaxForm({
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
url: $(this).attr('action'),
|
||||
data: $(this).serialize(),
|
||||
success: function (data) {
|
||||
console.log("data", data)
|
||||
if (data.error == false) {
|
||||
window.location = "{% url 'marketing:email_template_list' %}";
|
||||
} else {
|
||||
/*$(document).ajaxStop($.unblockUI);*/
|
||||
// $.unblockUI();
|
||||
$('p.failure').remove();
|
||||
for (var key in data.errors) {
|
||||
$('#id_' + key).html('<p class="error failure"> *' + data.errors[key] + '</p>');
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function (xhr, errmsg, err) {
|
||||
console.log('error data', errmsg, err)
|
||||
}
|
||||
});
|
||||
</script>
|
||||
{% endblock js_block %}
|
||||
|
|
@ -4,9 +4,13 @@
|
|||
{% block content %}
|
||||
{{ block.super }}
|
||||
|
||||
{% block extralinks %}
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
|
||||
{% endblock extralinks %}
|
||||
|
||||
<div class="main_container ml-5 mr-5">
|
||||
<div class="row marl">
|
||||
|
||||
<div class="filter_row list_filter_row row marl col-md-12 mb-2">
|
||||
<div class="">
|
||||
<div class="card">
|
||||
|
|
@ -22,13 +26,6 @@
|
|||
value="{{request.POST.contact_name}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="filter_col col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">Email</label>
|
||||
<input type="text" class="form-control" placeholder="Contact Email" name="contact_email"
|
||||
value="{{request.POST.contact_email}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="filter_col col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">Created By</label>
|
||||
|
|
@ -43,6 +40,13 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="filter_col col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="exampleInputEmail1">Email</label>
|
||||
<input type="text" class="form-control" placeholder="Contact Email" name="contact_email"
|
||||
value="{{request.POST.contact_email}}">
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="tab_status" id="tab_status">
|
||||
<div class="filter_col col-2">
|
||||
<div class="form-group buttons_row">
|
||||
|
|
@ -57,31 +61,30 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 mt-2">
|
||||
<div class="heading text-right">
|
||||
<span class="float-left">All Contacts - {{contacts|length }}</span>
|
||||
<span class="filter_toggle">
|
||||
<a href="#" class="primary_btn"><i class="fas fa-filter"></i></a>
|
||||
</span>
|
||||
<a href="{% url 'marketing:contact_list_new' %}" class="secondary_btn">Add New Contact List</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
<div class="table_container_row no_mar_top">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="table-responsive">
|
||||
<div class="card-title text-right">
|
||||
<span class="float-left">Contacts - {{ contacts|length }}</span>
|
||||
<span class="filter_toggle">
|
||||
<a href="#" class="primary_btn"><i class="fas fa-filter"></i></a>
|
||||
</span>
|
||||
<a href="{% url 'marketing:contact_list_new' %}" class="primary_btn">Add New Contact List</a>
|
||||
</div>
|
||||
<div class="table-responsive table-bordered ">
|
||||
<table class="table">
|
||||
{% if contacts %}
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%">ID</th>
|
||||
<th width="10%">Name</th>
|
||||
<th width="5%">S. No</th>
|
||||
<th width="20%">Name</th>
|
||||
<th width="10%">Email</th>
|
||||
<!-- <th width="10%" class="text-center">Active</th> -->
|
||||
<th width="15%" class="text-center">UnSubscribed</th>
|
||||
<th width="12%" class="text-center">Bounced</th>
|
||||
<th width="13%">Actions</th>
|
||||
<th width="15%">Created by</th>
|
||||
<th width="15%">Created On</th>
|
||||
<th width="15%">Related Contact List</th>
|
||||
<th width="10%">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% endif %}
|
||||
|
|
@ -93,232 +96,55 @@
|
|||
{% endif %}
|
||||
{% for contact in contacts %}
|
||||
<tr style="text-align:center;">
|
||||
<td scope="row">{{forloop.counter}}</td>
|
||||
<td> <a href="{% url 'marketing:contact_detail' contact.id %}">{{contact.name}}</a> </td>
|
||||
<td>{{contact.email}}</td>
|
||||
<!-- <td class="text-center">{{contact.is_active}}</td> -->
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">{{contact.is_unsubscribed}}</span>
|
||||
<td scope="row">{{ forloop.counter }}</td>
|
||||
<td><a href="{% url 'marketing:contact_detail' contact.id %}">{{ contact.name }}</td>
|
||||
<td class="text-center">{{ contact.email }}</td>
|
||||
<td>{{ contact.created_by }}</td>
|
||||
<td>{{ contact.created_on }}</td>
|
||||
<td>
|
||||
{% for contact_list in contact.contact_list.all %}
|
||||
<span> <a
|
||||
href="{% url 'marketing:contact_list_detail' contact_list.id %}">{{contact_list.name}}</a>
|
||||
</span>
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">{{contact.is_bounced}}</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="{% url 'marketing:edit_contact' contact.id %}" data-toggle="tooltip"
|
||||
data-placement="bottom" title="" class="green box"><i class="far fa-edit"></i></a>
|
||||
<td class="actions text-center">
|
||||
<a href="{% url 'marketing:edit_contact' contact.id %}" class="btn btn-success edit edit_contact"
|
||||
data-other-contacts-lists='{{contact.contact_list.all|length}}'><i class="fas fa-edit"></i></a>
|
||||
<!-- <a href="#" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="#" class="purple box"><i class="fas fa-upload"></i></a> -->
|
||||
<a href="{% url 'marketing:delete_contact' contact.id %}" class="red box remove_account"><i
|
||||
class="far fa-trash-alt"></i></a>
|
||||
<a href="{% url 'marketing:delete_contact' contact.id %}"
|
||||
class="btn btn-danger delete remove_account"
|
||||
data-other-contacts-lists='{{contact.contact_list.all|length}}'><i
|
||||
class="fas fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr style="text-align:center;">
|
||||
<td colspan="6">No records found!</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
<!--not required-->
|
||||
<!-- <tr style="text-align:center;">
|
||||
<td scope="row">1</td>
|
||||
<td>Micropyramid</td>
|
||||
<td class="text-center">23</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">15%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">20%</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="/contacts/1/edit/" data-toggle="tooltip" data-placement="bottom" title=""
|
||||
class="green box"><i class="far fa-edit"></i></a>
|
||||
<a href="/contacts/1/edit/" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="/contacts/1/edit/" class="purple box"><i class="fas fa-upload"></i></a>
|
||||
<a href="/contacts/1/delete/" class="red box remove_account"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="text-align:center;">
|
||||
<td scope="row">2</td>
|
||||
<td>Peeljobs</td>
|
||||
<td class="text-center">23</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">70%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">20%</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="/contacts/1/edit/" data-toggle="tooltip" data-placement="bottom" title=""
|
||||
class="green box"><i class="far fa-edit"></i></a>
|
||||
<a href="/contacts/1/edit/" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="/contacts/1/edit/" class="purple box"><i class="fas fa-upload"></i></a>
|
||||
<a href="/contacts/1/delete/" class="red box remove_account"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="text-align:center;">
|
||||
<td scope="row">3</td>
|
||||
<td>Study Signal</td>
|
||||
<td class="text-center">23</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">70%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">20%</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="/contacts/1/edit/" data-toggle="tooltip" data-placement="bottom" title=""
|
||||
class="green box"><i class="far fa-edit"></i></a>
|
||||
<a href="/contacts/1/edit/" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="/contacts/1/edit/" class="purple box"><i class="fas fa-upload"></i></a>
|
||||
<a href="/contacts/1/delete/" class="red box remove_account"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="text-align:center;">
|
||||
<td scope="row">4</td>
|
||||
<td>Django Crm</td>
|
||||
<td class="text-center">23</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">70%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">20%</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="/contacts/1/edit/" data-toggle="tooltip" data-placement="bottom" title=""
|
||||
class="green box"><i class="far fa-edit"></i></a>
|
||||
<a href="/contacts/1/edit/" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="/contacts/1/edit/" class="purple box"><i class="fas fa-upload"></i></a>
|
||||
<a href="/contacts/1/delete/" class="red box remove_account"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="text-align:center;">
|
||||
<td scope="row">5</td>
|
||||
<td>Refactored
|
||||
</td>
|
||||
<td class="text-center">23</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">70%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">20%</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="/contacts/1/edit/" data-toggle="tooltip" data-placement="bottom" title=""
|
||||
class="green box"><i class="far fa-edit"></i></a>
|
||||
<a href="/contacts/1/edit/" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="/contacts/1/edit/" class="purple box"><i class="fas fa-upload"></i></a>
|
||||
<a href="/contacts/1/delete/" class="red box remove_account"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="text-align:center;">
|
||||
<td scope="row">6</td>
|
||||
<td>Refactored</td>
|
||||
<td class="text-center">23</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">70%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">20%</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="/contacts/1/edit/" data-toggle="tooltip" data-placement="bottom" title=""
|
||||
class="green box"><i class="far fa-edit"></i></a>
|
||||
<a href="/contacts/1/edit/" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="/contacts/1/edit/" class="purple box"><i class="fas fa-upload"></i></a>
|
||||
<a href="/contacts/1/delete/" class="red box remove_account"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="text-align:center;">
|
||||
<td scope="row">7</td>
|
||||
<td>Artbnkr</td>
|
||||
<td class="text-center">23</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">70%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">20%</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="/contacts/1/edit/" data-toggle="tooltip" data-placement="bottom" title=""
|
||||
class="green box"><i class="far fa-edit"></i></a>
|
||||
<a href="/contacts/1/edit/" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="/contacts/1/edit/" class="purple box"><i class="fas fa-upload"></i></a>
|
||||
<a href="/contacts/1/delete/" class="red box remove_account"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="text-align:center;">
|
||||
<td scope="row">8</td>
|
||||
<td>Now Finance</td>
|
||||
<td class="text-center">125</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">45%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">65%</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="/contacts/1/edit/" data-toggle="tooltip" data-placement="bottom" title=""
|
||||
class="green box"><i class="far fa-edit"></i></a>
|
||||
<a href="/contacts/1/edit/" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="/contacts/1/edit/" class="purple box"><i class="fas fa-upload"></i></a>
|
||||
<a href="/contacts/1/delete/" class="red box remove_account"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="text-align:center;">
|
||||
<td scope="row">9</td>
|
||||
<td>Goshoppi</td>
|
||||
<td class="text-center">154</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">5%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">54%</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="/contacts/1/edit/" data-toggle="tooltip" data-placement="bottom" title=""
|
||||
class="green box"><i class="far fa-edit"></i></a>
|
||||
<a href="/contacts/1/edit/" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="/contacts/1/edit/" class="purple box"><i class="fas fa-upload"></i></a>
|
||||
<a href="/contacts/1/delete/" class="red box remove_account"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="text-align:center;">
|
||||
<td scope="row">10</td>
|
||||
<td>Techond</td>
|
||||
<td class="text-center">23</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box dark_grey">15%</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge box sky_blue">20%</span>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<a href="/contacts/1/edit/" data-toggle="tooltip" data-placement="bottom" title=""
|
||||
class="green box"><i class="far fa-edit"></i></a>
|
||||
<a href="/contacts/1/edit/" class="sky_blue box"><i class="far fa-copy"></i></a>
|
||||
<a href="/contacts/1/edit/" class="purple box"><i class="fas fa-upload"></i></a>
|
||||
<a href="/contacts/1/delete/" class="red box remove_account"><i class="far fa-trash-alt"></i></a>
|
||||
</td>
|
||||
</tr> -->
|
||||
<!-- not reqiuired-->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% ifequal contacts|length 0 %}
|
||||
<h6 class="text-center">No Contacts Found</h6>
|
||||
{% endifequal %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="marl row text-center mt-5">
|
||||
{% show_pages %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="marl row text-center mt-5">
|
||||
{% show_pages %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block js_block %}
|
||||
<script>
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
$(".filter_toggle").click(function () {
|
||||
$(".list_filter_row").toggle();
|
||||
});
|
||||
$('#id_tag').select2();
|
||||
|
||||
$("a[rel='page']").click(function (e) {
|
||||
e.preventDefault();
|
||||
|
|
@ -329,9 +155,31 @@
|
|||
$(".remove_account").click(function (e) {
|
||||
e.preventDefault()
|
||||
url = $(this).attr('href')
|
||||
if (!confirm('Are you sure you want to delete?'))
|
||||
return;
|
||||
window.location = $(this).attr('href')
|
||||
var contact_lists = parseInt($(this).attr('data-other-contacts-lists'));
|
||||
if (contact_lists > 1) {
|
||||
if (!confirm('Are you sure you want to delete? this contact exists in other contact lists, deleting this will delete this contact from other contact lists too!'))
|
||||
return;
|
||||
window.location = $(this).attr('href');
|
||||
} else {
|
||||
if (!confirm('Are you sure you want to delete?'))
|
||||
return;
|
||||
window.location = $(this).attr('href');
|
||||
}
|
||||
})
|
||||
|
||||
$(".edit_contact").click(function (e) {
|
||||
e.preventDefault()
|
||||
url = $(this).attr('href')
|
||||
console.log(url)
|
||||
var contact_lists = parseInt($(this).attr('data-other-contacts-lists'));
|
||||
console.log(contact_lists);
|
||||
if (contact_lists > 1) {
|
||||
if (!confirm('Are you sure you want to edit? this contact exists in other contact lists, editing this will change this contact information in other contact lists too!'))
|
||||
return;
|
||||
window.location = $(this).attr('href');
|
||||
} else {
|
||||
window.location = $(this).attr('href');
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@
|
|||
{% load paginate %}
|
||||
{% block content %}
|
||||
{{ block.super }}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb mb-5">
|
||||
<li class="breadcrumb-item"><a href="{% url 'marketing:contact_lists' %}">Contact List</a></li>
|
||||
<li class="breadcrumb-item active">{{contact_list.name}}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<div class="main_container ml-5 mr-5">
|
||||
<div class="row marl">
|
||||
<div class="filter_row list_filter_row row marl col-md-12 mb-2">
|
||||
|
|
@ -61,7 +67,7 @@
|
|||
<span class="filter_toggle">
|
||||
<a href="#" class="primary_btn"><i class="fas fa-filter"></i></a>
|
||||
</span>
|
||||
<a href="{% url 'marketing:contact_list_new' %}" class="primary_btn">Add New Contact</a>
|
||||
<a href="{% url 'marketing:contact_list_new' %}" class="primary_btn">Add New Contact List</a>
|
||||
</div>
|
||||
<div class="table-responsive table-bordered ">
|
||||
<table class="table">
|
||||
|
|
@ -94,11 +100,13 @@
|
|||
<td>{{ contact.name }}</td>
|
||||
<td> <a href="{% url 'marketing:contact_detail' contact.id %}">{{ contact.email }}</a> </td>
|
||||
<td class="actions">
|
||||
<a href="{% url 'marketing:edit_contact' contact.id %}" class="btn btn-success edit"><i
|
||||
class="fas fa-edit"></i></a>
|
||||
<a href="{% url 'marketing:edit_contact' contact.id %}?from_contact={{contact_list.id}}"
|
||||
class="btn btn-success edit edit_contact"
|
||||
data-other-contacts-lists='{{contact.contact_list.all|length}}'><i class="fas fa-edit"></i></a>
|
||||
<!-- <a href="/contacts/1/edit/" class="btn btn-info duplicate"><i class="fas fa-copy"></i></a> -->
|
||||
<a href="{% url 'marketing:delete_contact' contact.id %}"
|
||||
class="btn btn-danger delete remove_account"><i class="fas fa-trash"></i></a>
|
||||
<a href="{% url 'marketing:delete_contact' contact.id %}?from_contact={{contact_list.id}}"
|
||||
class="btn btn-danger delete remove_account"
|
||||
data-other-contacts-lists='{{contact.contact_list.all|length}}'><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
|
|
@ -128,12 +136,42 @@
|
|||
});
|
||||
$('#id_tag').select2();
|
||||
|
||||
// $(".remove_account").click(function (e) {
|
||||
// e.preventDefault()
|
||||
// url = $(this).attr('href')
|
||||
// if (!confirm('Are you sure you want to delete?'))
|
||||
// return;
|
||||
// window.location = $(this).attr('href')
|
||||
// })
|
||||
|
||||
$(".remove_account").click(function (e) {
|
||||
e.preventDefault()
|
||||
url = $(this).attr('href')
|
||||
if (!confirm('Are you sure you want to delete?'))
|
||||
return;
|
||||
window.location = $(this).attr('href')
|
||||
var contact_lists = parseInt($(this).attr('data-other-contacts-lists'));
|
||||
if (contact_lists > 1) {
|
||||
if (!confirm('Are you sure you want to delete? this contact exists in other contact lists, deleting this will delete this contact from other contact lists too!'))
|
||||
return;
|
||||
window.location = $(this).attr('href');
|
||||
} else {
|
||||
if (!confirm('Are you sure you want to delete?'))
|
||||
return;
|
||||
window.location = $(this).attr('href');
|
||||
}
|
||||
})
|
||||
|
||||
$(".edit_contact").click(function (e) {
|
||||
e.preventDefault()
|
||||
url = $(this).attr('href')
|
||||
console.log(url)
|
||||
var contact_lists = parseInt($(this).attr('data-other-contacts-lists'));
|
||||
console.log(contact_lists);
|
||||
if (contact_lists > 1) {
|
||||
if (!confirm('Are you sure you want to edit? this contact exists in other contact lists, editing this will change this contact information in other contact lists too!'))
|
||||
return;
|
||||
window.location = $(this).attr('href');
|
||||
} else {
|
||||
window.location = $(this).attr('href');
|
||||
}
|
||||
})
|
||||
|
||||
$("a[rel='page']").click(function (e) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,12 @@
|
|||
{% load paginate %}
|
||||
{% block content %}
|
||||
{{ block.super }}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb mb-3">
|
||||
<li class="breadcrumb-item"><a href="{% url 'marketing:contacts_list' %}">Contacts</a></li>
|
||||
<li class="breadcrumb-item active">Edit</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<div class="main_container ml-5 mr-5">
|
||||
<div class="row marl">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -59,6 +65,7 @@
|
|||
style="color:red">*</span>{% endif %}</label>
|
||||
{{ form.state }}
|
||||
<span class="error" id="id__state">{{ form.state.errors }}</span>
|
||||
<input type="hidden" name="from_url" value="{{request.GET.from_contact}}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@
|
|||
<span class="filter_toggle">
|
||||
<a href="#" class="primary_btn"><i class="fas fa-filter"></i></a>
|
||||
</span>
|
||||
<a href="{% url 'marketing:contact_list_new' %}" class="primary_btn">Add New Contact</a>
|
||||
<a href="{% url 'marketing:contact_list_new' %}" class="primary_btn">Add New Contact List</a>
|
||||
</div>
|
||||
<div class="table-responsive table-bordered ">
|
||||
<table class="table">
|
||||
|
|
@ -86,7 +86,7 @@
|
|||
<tr>
|
||||
<th width="5%">S. No</th>
|
||||
<th width="20%">Name</th>
|
||||
<th width="10%">No .of Contacts</th>
|
||||
<th width="10%">No. of Contacts</th>
|
||||
<th width="20%">Created by</th>
|
||||
<th width="15%">Last Activity</th>
|
||||
<th width="15%" class="text-center">Tags</th>
|
||||
|
|
@ -116,12 +116,14 @@
|
|||
<span class="text-center">No Tags!</span>
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td class="actions">
|
||||
<td class="actions text-center">
|
||||
<a href="{% url 'marketing:edit_contact_list' contact_list.id %}" class="btn btn-success edit"><i
|
||||
class="fas fa-edit"></i></a>
|
||||
<!-- <a href="/contacts/1/edit/" class="btn btn-info duplicate"><i class="fas fa-copy"></i></a> -->
|
||||
{% comment %}
|
||||
<a href="{% url 'marketing:delete_contact_list' contact_list.id %}"
|
||||
class="btn btn-danger delete remove_account"><i class="fas fa-trash"></i></a>
|
||||
{% endcomment %}
|
||||
</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@
|
|||
{% endblock extralinks %}
|
||||
{% block content %}
|
||||
{{ block.super }}
|
||||
<nav aria-label="breadcrumb">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{% url 'marketing:contact_lists' %}">Contact List</a></li>
|
||||
<li class="breadcrumb-item active">{% if contact_list %}Edit{% else %}Create{% endif %}</li>
|
||||
</ol>
|
||||
</nav>
|
||||
<div class="main_container ml-5 mr-5" id="cover_screen">
|
||||
<div class="row marl" id="position_abs">
|
||||
<div class="col-md-12">
|
||||
|
|
@ -43,10 +49,13 @@
|
|||
</div>
|
||||
<div class="filter_col col-md-12">
|
||||
<div class="form-group">
|
||||
<label>Contacts File
|
||||
<label>Contacts File <span class="error">*</span>
|
||||
</label>
|
||||
<input type="file" class="form-control" name="contacts_file">
|
||||
<span id="id_contacts_file"></span>
|
||||
<!-- <span>
|
||||
{% if contact_list.contacts.all|length > 0 %} <a href="#">Download Previous File</a>{% endif %}
|
||||
</span> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="filter_col col-md-12">
|
||||
|
|
|
|||
|
|
@ -98,12 +98,35 @@
|
|||
{% block js_block %}{% endblock js_block %}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
word = window.location.pathname.split('/')[1]
|
||||
word = window.location.pathname.split('/')[1];
|
||||
if(word == ""){
|
||||
$("#dashboard").addClass('active')
|
||||
$("#dashboard").addClass('active');
|
||||
}
|
||||
else{
|
||||
$('#' + word).addClass('active')
|
||||
$('#' + word).addClass('active');
|
||||
}
|
||||
marketing_word = window.location.pathname.split('/')[2];
|
||||
if(marketing_word == ""){
|
||||
$("#marketing-dashboard").addClass('active');
|
||||
}
|
||||
// console.log(marketing_word.substring(0,7) === 'contact');
|
||||
else if(marketing_word.substring(0,7) === "contact"){
|
||||
$("#contact").css({'border-bottom':'3px solid #099CBE,'});
|
||||
$(".contact_class").css('border-bottom','3px solid #099CBE');
|
||||
marketing_word = window.location.pathname.split('/')[2]
|
||||
// console.log(marketing_word)
|
||||
// console.log(marketing_word == 'contact-list')
|
||||
// console.log(marketing_word == 'contacts')
|
||||
if (marketing_word == 'contact-list'){
|
||||
$(".contact-list").css('background','#e5e5e5');
|
||||
}
|
||||
if (marketing_word == 'contacts'){
|
||||
$(".contacts").css('background','#e5e5e5');
|
||||
}
|
||||
// $("#contacts").css('background','#e5e5e5');
|
||||
}
|
||||
else{
|
||||
$('#' + marketing_word).addClass('active')
|
||||
}
|
||||
});
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in a new issue