@@ -151,9 +151,9 @@
{{ contact.created_by }} |
{{ contact.created_on_arrow }} |
- {% for contact_list in contact.contact_lists %}
+ {% for contact_list in contact.contact_list.all %}
{{contact_list.1}}
+ href="{% url 'marketing:contact_list_detail' contact_list.id %}">{{contact_list.name}}
{% empty %}
None
@@ -366,6 +366,11 @@
$(".filter_toggle").click(function () {
$(".list_filter_row").toggle();
});
+ search = "{{search}}"
+ if (search == 'True') {
+ $(".list_filter_row").show();
+ }
+
$('#id_tag').select2();
$('#delete_all').hide()
$('#delete_all_bounced').hide()
diff --git a/marketing/tests.py b/marketing/tests.py
index 79f0e3e4..be266357 100644
--- a/marketing/tests.py
+++ b/marketing/tests.py
@@ -8,7 +8,7 @@ from django.core.management import call_command
from django.shortcuts import reverse
from django.test import Client, TestCase
from django.test.utils import override_settings
-from haystack import connections
+# from haystack import connections
from common.models import User
from marketing.models import (Campaign, CampaignLinkClick, CampaignLog,
@@ -145,9 +145,9 @@ class TestMarketingModel(object):
@override_settings(HAYSTACK_CONNECTIONS=TEST_INDEX )
class TestTemplates(TestMarketingModel, TestCase):
- def setUp(self):
- super(TestTemplates, self).setUp()
- connections.reload('default')
+ # def setUp(self):
+ # super(TestTemplates, self).setUp()
+ # connections.reload('default')
def test_templates(self):
url1 = reverse('marketing:dashboard')
@@ -253,9 +253,9 @@ class TestDasboardView(TestMarketingModel, TestCase):
@override_settings(HAYSTACK_CONNECTIONS=TEST_INDEX )
class TestContactListsListPage(TestMarketingModel, TestCase):
- def setUp(self):
- super(TestContactListsListPage, self).setUp()
- connections.reload('default')
+ # def setUp(self):
+ # super(TestContactListsListPage, self).setUp()
+ # # connections.reload('default')
def test_contact_lists_list_page(self):
self.client.login(username='john@example.com', password='password')
@@ -282,13 +282,13 @@ class TestContactListsListPage(TestMarketingModel, TestCase):
@override_settings(HAYSTACK_CONNECTIONS=TEST_INDEX )
class TestContactsListPage(TestMarketingModel, TestCase):
- def setUp(self):
- super(TestContactsListPage, self).setUp()
- connections.reload('default')
+ # def setUp(self):
+ # super(TestContactsListPage, self).setUp()
+ # connections.reload('default')
# connections = ConnectionHandler(TEST_INDEX )
def test_contacts_list_page(self):
- connections.reload('default')
+ # connections.reload('default')
self.client.login(username='john@example.com', password='password')
response = self.client.get(
reverse('marketing:contacts_list'))
diff --git a/marketing/urls.py b/marketing/urls.py
index 307b7dd3..4aefaaf3 100644
--- a/marketing/urls.py
+++ b/marketing/urls.py
@@ -77,6 +77,6 @@ urlpatterns = [
path('edit-blocked-email//', edit_blocked_email, name="edit_blocked_email"),
path('delete-blocked-email//', delete_blocked_email, name="delete_blocked_email"),
- path('search-marketing-contact-emails/', include('haystack.urls')),
+ # path('search-marketing-contact-emails/', include('haystack.urls')),
# path('elastic-search/', contacts_list_elastic_search),
]
diff --git a/marketing/views.py b/marketing/views.py
index caae92a3..3a1c054e 100644
--- a/marketing/views.py
+++ b/marketing/views.py
@@ -21,7 +21,7 @@ from common.utils import convert_to_custom_timezone
from common.models import User
from marketing.forms import (ContactForm, ContactListForm, EmailTemplateForm,
SendCampaignForm, EmailCampaignForm, BlockedDomainsForm,
- BlockedEmailForm, MarketingContactEmailSearchForm)
+ BlockedEmailForm)
from marketing.models import (Campaign, CampaignLinkClick, CampaignLog,
CampaignOpen, Contact, ContactList,
EmailTemplate, Link, Tag, FailedContact, ContactUnsubscribedCampaign,
@@ -31,8 +31,8 @@ from marketing.tasks import (run_campaign, upload_csv_file,
send_campaign_email_to_admin_contact,
update_elastic_search_index)
from common.access_decorators_mixins import marketing_access_required, MarketingAccessRequiredMixin, admin_login_required
-from haystack.generic_views import SearchView
-from haystack.query import SearchQuerySet
+# from haystack.generic_views import SearchView
+# from haystack.query import SearchQuerySet
TIMEZONE_CHOICES = [(tz, tz) for tz in pytz.common_timezones]
@@ -93,15 +93,16 @@ def dashboard(request):
def contact_lists(request):
tags = Tag.objects.all()
if (request.user.role == "ADMIN"):
- queryset = ContactList.objects.all()
+ queryset = ContactList.objects.all().order_by('-created_on')
else:
queryset = ContactList.objects.filter(
- Q(created_by=request.user) | Q(visible_to=request.user))
+ Q(created_by=request.user) | Q(visible_to=request.user)).order_by('-created_on')
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'))
+ search = False
if request.method == 'POST':
post_tags = request.POST.getlist('tag')
@@ -116,9 +117,15 @@ def contact_lists(request):
if request.POST.get('tag'):
queryset = queryset.filter(tags__id__in=post_tags)
request_tags = request.POST.getlist('tag')
+ if (
+ request.POST.get('contact_list_name')or
+ request.POST.get('created_by')or
+ request.POST.get('created_by')
+ ):
+ search = True #for filter form to show in contactlist
data = {'contact_lists': queryset, 'tags': tags, 'users': users,
- 'request_tags': request.POST.getlist('tag'), }
+ 'request_tags': request.POST.getlist('tag'),'search':search }
return render(request, 'marketing/lists/index.html', data)
@@ -445,12 +452,13 @@ def failed_contact_list_download_delete(request, pk):
def email_template_list(request):
# users = User.objects.all()
if (request.user.role == 'ADMIN' or request.user.is_superuser):
- queryset = EmailTemplate.objects.all()
+ queryset = EmailTemplate.objects.all().order_by('-created_on')
else:
queryset = EmailTemplate.objects.filter(
- created_by=request.user)
+ created_by=request.user).order_by('-created_on')
users = User.objects.filter(
id__in=queryset.values_list('created_by_id', flat=True))
+ search = False
if request.method == 'POST':
if request.POST.get('template_name'):
queryset = queryset.filter(
@@ -459,8 +467,11 @@ def email_template_list(request):
if request.POST.get('created_by'):
queryset = queryset.filter(
created_by=request.POST.get('created_by'))
-
- data = {'email_templates': queryset, 'users': users}
+ if (request.POST.get('template_name')or
+ request.POST.get('created_by')
+ ):
+ search =True
+ data = {'email_templates': queryset, 'users': users, 'search':search}
return render(request, 'marketing/email_template/index.html', data)
@@ -534,6 +545,7 @@ def campaign_list(request):
id__in=queryset.values_list('created_by_id', flat=True))
if request.GET.get('tag'):
queryset = queryset.filter(tags=request.GET.get('tag'))
+ search = False
if request.method == 'POST':
if request.POST.get('campaign_name'):
queryset = queryset.filter(
@@ -542,8 +554,12 @@ def campaign_list(request):
if request.POST.get('created_by'):
queryset = queryset.filter(
created_by=request.POST.get('created_by'))
-
- data = {'campaigns_list': queryset, 'users': users}
+ #shows the filter form in marketing-Campaigns after any search is requested
+ if (request.POST.get('campaign_name')or
+ request.POST.get('created_by')
+ ):
+ search = True
+ data = {'campaigns_list': queryset,'search':search ,'users': users}
return render(request, 'marketing/campaign/index.html', data)
@@ -1285,23 +1301,24 @@ def delete_blocked_email(request, blocked_email_id):
@login_required(login_url='/login')
@marketing_access_required
def contacts_list_elastic_search(request):
+ search = False
if (request.user.role == "ADMIN"):
- # contacts = Contact.objects.filter(is_bounced=False)
- contacts = SearchQuerySet().filter(is_bounced='false').models(Contact)
- bounced_contacts = SearchQuerySet().filter(is_bounced='true').models(Contact)
- failed_contacts = SearchQuerySet().models(FailedContact).filter()
- # bounced_contacts = Contact.objects.filter(is_bounced=True)
- # failed_contacts = FailedContact.objects.all()
+ contacts = Contact.objects.filter(is_bounced=False)
+ # contacts = SearchQuerySet().filter(is_bounced='false').models(Contact)
+ # bounced_contacts = SearchQuerySet().filter(is_bounced='true').models(Contact)
+ # failed_contacts = SearchQuerySet().models(FailedContact).filter()
+ bounced_contacts = Contact.objects.filter(is_bounced=True)
+ failed_contacts = FailedContact.objects.all()
contact_lists = ContactList.objects.all()
else:
contact_ids = request.user.marketing_contactlist.all().values_list('contacts',
flat=True)
- contacts = SearchQuerySet().filter(is_bounced='false', id__in=contact_ids).models(Contact)
- bounced_contacts = SearchQuerySet().filter(is_bounced='true', id__in=contact_ids).models(Contact)
- failed_contacts = SearchQuerySet().models(FailedContact).filter(created_by_id=str(request.user.id))
- # contacts = Contact.objects.filter(id__in=contact_ids).exclude(is_bounced=True)
- # bounced_contacts = Contact.objects.filter(id__in=contact_ids, is_bounced=True)
- # failed_contacts = FailedContact.objects.filter(created_by=request.user)
+ # contacts = SearchQuerySet().filter(is_bounced='false', id__in=contact_ids).models(Contact)
+ # bounced_contacts = SearchQuerySet().filter(is_bounced='true', id__in=contact_ids).models(Contact)
+ # failed_contacts = SearchQuerySet().models(FailedContact).filter(created_by_id=str(request.user.id))
+ contacts = Contact.objects.filter(id__in=contact_ids).exclude(is_bounced=True)
+ bounced_contacts = Contact.objects.filter(id__in=contact_ids, is_bounced=True)
+ failed_contacts = FailedContact.objects.filter(created_by=request.user)
contact_lists = ContactList.objects.filter(created_by=request.user)
# contacts = Contact.objects.filter(created_by=request.user)
@@ -1311,6 +1328,7 @@ def contacts_list_elastic_search(request):
if request.method == 'GET':
context = {'contacts': contacts, 'users': users, 'contact_lists': contact_lists,
'bounced_contacts': bounced_contacts, 'failed_contacts': failed_contacts,
+ 'search':search,
}
return render(request, 'search_contact_emails.html', context)
@@ -1328,10 +1346,10 @@ def contacts_list_elastic_search(request):
bounced_contacts = bounced_contacts.filter(email__icontains=data.get('email'))
failed_contacts = failed_contacts.filter(email__icontains=data.get('email'))
- if data.get('domain_name'):
- contacts = contacts.filter(email_domain__icontains=data.get('domain_name'))
- bounced_contacts = bounced_contacts.filter(email_domain__icontains=data.get('domain_name'))
- failed_contacts = failed_contacts.filter(email_domain__icontains=data.get('domain_name'))
+ # if data.get('domain_name'):
+ # contacts = contacts.filter(email_domain__icontains=data.get('domain_name'))
+ # bounced_contacts = bounced_contacts.filter(email_domain__icontains=data.get('domain_name'))
+ # failed_contacts = failed_contacts.filter(email_domain__icontains=data.get('domain_name'))
if data.get('created_by'):
contacts = contacts.filter(created_by_id=data.get('created_by'))
@@ -1339,12 +1357,21 @@ def contacts_list_elastic_search(request):
failed_contacts = failed_contacts.filter(created_by_id=data.get('created_by'))
if data.get('contact_list'):
- contacts = contacts.filter(contact_lists_id=data.get('contact_list'))
- bounced_contacts = bounced_contacts.filter(contact_lists_id=data.get('contact_list'))
- failed_contacts = failed_contacts.filter(contact_lists_id=data.get('contact_list'))
+ contacts = contacts.filter(contact_list__id=data.get('contact_list'))
+ bounced_contacts = bounced_contacts.filter(contact_list__id=data.get('contact_list'))
+ failed_contacts = failed_contacts.filter(contact_list__id=data.get('contact_list'))
+ # shows filter form in marketing-contact if any search
+ if (
+ data.get('name')or
+ data.get('email')or
+ data.get('created_by')or
+ data.get('contact_list')
+ ):
+ search = True
context = {'contacts': contacts, 'users': users, 'contact_lists': contact_lists,
'bounced_contacts': bounced_contacts, 'failed_contacts': failed_contacts,
+ 'search':search,
}
return render(request, 'search_contact_emails.html', context)
@@ -1353,7 +1380,6 @@ def contacts_list_elastic_search(request):
# form_class = MarketingContactEmailSearchForm
# def get_query(self):
-# import pdb; pdb.set_trace()
# if self.form.is_valid():
# return self.form.cleaned_data["email_domain"]
@@ -1367,5 +1393,4 @@ def contacts_list_elastic_search(request):
# # def get_context_data(self, *args, **kwargs):
# # context = super(MarketingContactEmailSearch, self).get_context_data(*args, **kwargs)
-# # import pdb; pdb.set_trace()
# # return context
\ No newline at end of file
diff --git a/opportunity/templates/create_opportunity.html b/opportunity/templates/create_opportunity.html
index 0b883f49..85d1983f 100644
--- a/opportunity/templates/create_opportunity.html
+++ b/opportunity/templates/create_opportunity.html
@@ -145,7 +145,7 @@
id="id_assigned_to">
{% for user in users %}
{% endfor %}
@@ -503,36 +503,169 @@
}
}
- $("#id_teams").change(function (e) {
- try {
- var users = []
- $('#id_teams option:selected').each(function () {
- // users.push($(this).attr('data-users'))
- _data = $(this).attr('data-users');
- if (!users) {
- // users = []
- } else {
- users = users.concat(_data.split(','))
- }
- })
- // users = $('option:selected', this).attr('data-users')
- // if (!users) {
- // users = []
- // } else {
- // users = users.split(',')
- // }
- console.log('selected users teams data', users)
- var existingUsers = $('#id_assigned_to').val();
- var allUsers = users.concat(existingUsers)
- console.log(existingUsers)
- if (users.length) {
- $('#_id_assigned_to').select2().val(allUsers).trigger('change');
+ function find_dict(dict, id){
+ var index = dict.map(function(o) { return o.team; }).indexOf(parseInt(id));
+ return dict[index]['users']
+ }
+ $("#id_teams").change(function (e) {
+ var teams = []
+ var all_users = []
+ var selected_teams = []
+ var selected_users = []
+ var assigned_users = []
+ $.get("{% url 'opportunities:get_teams_and_users' %}", function(data){
+ // console.log(data)
+ if(($('#id_teams').val()).length==0){
+ $('#id_assigned_to option').each(function () {
+ $(this).removeAttr('disabled')
+ })
+ $('#id_assigned_to').select2().trigger('change');
+
+ }
+
+ teams = data['teams']
+ all_users = data['users']
+ try {
+ var users = []
+ $('#id_teams option:selected').each(function () {
+ // users.push($(this).attr('data-users'))
+ _data = $(this).attr('data-users');
+ selected_teams.push($(this).val())
+ selected_users.push(find_dict(teams, $(this).val()))
+ // console.log("s_users", selected_users)
+ var un_select_users = [].concat.apply([], selected_users)
+ // console.log('un select users', un_select_users);
+
+
+ $('#id_assigned_to option').each(function () {
+ if($.inArray(parseInt($(this).val()), un_select_users) != -1){
+ $(this).attr('disabled', 'disabled')
+ $('#id_assigned_to').select2();
+
+ }
+ else{
+ $(this).show()
+ $(this).removeAttr('disabled')
+ $('#id_assigned_to').select2();
+
+ }
+ }
+ )
+
+
+ if (!selected_teams) {
+ users = []
+ $('#id_assigned_to option').each(function () {
+ $(this).removeAttr('disabled')
+ })
+ $('#id_assigned_to').select2();
+ } else {
+ users = users.concat(_data.split(','))
+ }
+ });
+ $('#id_teams option').each(function () {
+ if ($(this).is(':selected')) {
+ _data = $(this).attr('data-users').split(',')
+ // console.log(' selected', $(this).attr('data-users').split(','))
+ // console.log('selected', $(this).attr('data-users'))
+ }
+ else {
+ _unselected = $(this).attr('data-users').split(',')
+ // console.log('un selected', $(this).attr('data-users').split(','))
+ }
+ });
+ // console.log('selected users teams data', users)
+ var existingUsers = $('#id_assigned_to').val();
+ var allUsers = users
+ $('#_id_assigned_to').select2().val(allUsers).trigger('change');
+ if (users.length) {
+
+ }
+ } catch (error) {
+ console.log(error)
+ $('#_id_assigned_to').select2().val([]).trigger('change');
}
- } catch (error) {
- console.log(error)
- $('#_id_assigned_to').select2().val(existingUsers).trigger('change');
- }
+ })
+
+ });
+
+ $(document).ready(function($) {
+
+ var teams = []
+ var all_users = []
+ var selected_teams = []
+ var selected_users = []
+ var assigned_users = []
+ $.get("{% url 'leads:get_teams_and_users' %}", function(data){
+
+ if(($('#id_teams').val()).length==0){
+ $('#id_assigned_to option').each(function () {
+ $(this).removeAttr('disabled')
+ })
+ // $('#id_assigned_to').select2().val([]).trigger('change');
+
+ }
+
+ teams = data['teams']
+ all_users = data['users']
+ try {
+ var users = []
+ $('#id_teams option:selected').each(function () {
+ // users.push($(this).attr('data-users'))
+ _data = $(this).attr('data-users');
+ selected_teams.push($(this).val())
+ selected_users.push(find_dict(teams, $(this).val()))
+ var un_select_users = [].concat.apply([], selected_users)
+
+
+ $('#id_assigned_to option').each(function () {
+ if($.inArray(parseInt($(this).val()), un_select_users) != -1){
+ // $(this).attr('disabled', 'disabled')
+ $(this).attr('disabled', 'disabled')
+ $('#id_assigned_to').select2();
+
+ }
+ else{
+ $(this).show()
+ $(this).removeAttr('disabled')
+ $('#id_assigned_to').select2();
+
+ }
+ }
+ )
+
+ if (!selected_teams) {
+ users = []
+ $('#id_assigned_to option').each(function () {
+ $(this).removeAttr('disabled')
+ })
+ $('#id_assigned_to').select2();
+ } else {
+ users = users.concat(_data.split(','))
+ }
+ });
+ $('#id_teams option').each(function () {
+ if ($(this).is(':selected')) {
+ _data = $(this).attr('data-users').split(',')
+ }
+ else {
+ _unselected = $(this).attr('data-users').split(',')
+ }
+ });
+ var existingUsers = $('#id_assigned_to').val();
+ // var allUsers = users.concat(existingUsers)
+ var allUsers = users
+ // console.log(existingUsers)
+ $('#_id_assigned_to').select2().val(allUsers).trigger('change');
+ if (users.length) {
+
+ }
+ } catch (error) {
+ console.log(error)
+ $('#_id_assigned_to').select2().val([]).trigger('change');
+ }
+ })
});
diff --git a/opportunity/urls.py b/opportunity/urls.py
index 83940957..5b78b1ac 100644
--- a/opportunity/urls.py
+++ b/opportunity/urls.py
@@ -4,7 +4,7 @@ from opportunity.views import (
OpportunityDetailView, update_opportunity,
DeleteOpportunityView, GetContactView,
GetOpportunitiesView,
- AddCommentView,
+ AddCommentView, get_teams_and_users,
UpdateCommentView, DeleteCommentView, AddAttachmentsView, DeleteAttachmentsView)
@@ -31,4 +31,6 @@ urlpatterns = [
AddAttachmentsView.as_view(), name="add_attachment"),
path('attachment/remove/', DeleteAttachmentsView.as_view(),
name="remove_attachment"),
+ path('get_teams_and_users/', get_teams_and_users,
+ name="get_teams_and_users"),
]
diff --git a/opportunity/views.py b/opportunity/views.py
index 72a82f6a..66bc8059 100644
--- a/opportunity/views.py
+++ b/opportunity/views.py
@@ -24,6 +24,19 @@ from common.access_decorators_mixins import (
sales_access_required, marketing_access_required, SalesAccessRequiredMixin, MarketingAccessRequiredMixin)
from teams.models import Teams
+
+@login_required
+def get_teams_and_users(request):
+ data = {}
+ teams = Teams.objects.all()
+ teams_data = [{'team': team.id, 'users': [
+ user.id for user in team.users.all()]} for team in teams]
+ users = User.objects.all().values_list("id", flat=True)
+ data['teams'] = teams_data
+ data['users'] = list(users)
+ return JsonResponse(data)
+
+
class OpportunityListView(SalesAccessRequiredMixin, LoginRequiredMixin, TemplateView):
model = Opportunity
context_object_name = "opportunity_list"
@@ -39,7 +52,8 @@ class OpportunityListView(SalesAccessRequiredMixin, LoginRequiredMixin, Template
Q(created_by=self.request.user.id))
if self.request.GET.get('tag', None):
- queryset = queryset.filter(tags__in = self.request.GET.getlist('tag'))
+ queryset = queryset.filter(
+ tags__in=self.request.GET.getlist('tag'))
request_post = self.request.POST
if request_post:
@@ -58,7 +72,8 @@ class OpportunityListView(SalesAccessRequiredMixin, LoginRequiredMixin, Template
queryset = queryset.filter(
contacts=request_post.get('contacts'))
if request_post.get('tag'):
- queryset = queryset.filter(tags__in=request_post.getlist('tag'))
+ queryset = queryset.filter(
+ tags__in=request_post.getlist('tag'))
return queryset.distinct()
def get_context_data(self, **kwargs):
@@ -145,7 +160,8 @@ def create_opportunity(request):
# email.content_subtype = "html"
# email.send()
if request.POST.getlist('teams', []):
- user_ids = Teams.objects.filter(id__in=request.POST.getlist('teams')).values_list('users', flat=True)
+ user_ids = Teams.objects.filter(id__in=request.POST.getlist(
+ 'teams')).values_list('users', flat=True)
assinged_to_users_ids = opportunity_obj.assigned_to.all().values_list('id', flat=True)
for user_id in user_ids:
if user_id not in assinged_to_users_ids:
@@ -155,9 +171,10 @@ def create_opportunity(request):
opportunity_obj.teams.add(*request.POST.getlist('teams'))
current_site = get_current_site(request)
- recipients = list(opportunity_obj.assigned_to.all().values_list('id', flat=True))
+ recipients = list(
+ opportunity_obj.assigned_to.all().values_list('id', flat=True))
send_email_to_assigned_user.delay(recipients, opportunity_obj.id, domain=current_site.domain,
- protocol=request.scheme)
+ protocol=request.scheme)
if request.POST.getlist('contacts', []):
opportunity_obj.contacts.add(
@@ -227,7 +244,8 @@ class OpportunityDetailView(SalesAccessRequiredMixin, LoginRequiredMixin, Detail
user_assgn_list = [
assigned_to.id for assigned_to in
context['object'].assigned_to.all()]
- user_assigned_accounts = set(self.request.user.account_assigned_users.values_list('id', flat=True))
+ user_assigned_accounts = set(
+ self.request.user.account_assigned_users.values_list('id', flat=True))
if context['object'].account:
opportunity_account = set([context['object'].account.id])
else:
@@ -250,11 +268,14 @@ class OpportunityDetailView(SalesAccessRequiredMixin, LoginRequiredMixin, Detail
comments = context["opportunity_record"].opportunity_comments.all()
if self.request.user.is_superuser or self.request.user.role == 'ADMIN':
- users_mention = list(User.objects.filter(is_active=True).values('username'))
+ users_mention = list(User.objects.filter(
+ is_active=True).values('username'))
elif self.request.user != context['object'].created_by:
- users_mention = [{'username': context['object'].created_by.username}]
+ users_mention = [
+ {'username': context['object'].created_by.username}]
else:
- users_mention = list(context['object'].assigned_to.all().values('username'))
+ users_mention = list(
+ context['object'].assigned_to.all().values('username'))
context.update({
"comments": comments,
@@ -298,7 +319,8 @@ def update_opportunity(request, pk):
opportunity_obj = form.save(commit=False)
if request.POST.get('stage') in ['CLOSED WON', 'CLOSED LOST']:
opportunity_obj.closed_by = request.user
- previous_assigned_to_users = list(opportunity_obj.assigned_to.all().values_list('id', flat=True))
+ previous_assigned_to_users = list(
+ opportunity_obj.assigned_to.all().values_list('id', flat=True))
opportunity_obj.save()
opportunity_obj.contacts.clear()
@@ -337,7 +359,8 @@ def update_opportunity(request, pk):
opportunity_obj.assigned_to.clear()
if request.POST.getlist('teams', []):
- user_ids = Teams.objects.filter(id__in=request.POST.getlist('teams')).values_list('users', flat=True)
+ user_ids = Teams.objects.filter(id__in=request.POST.getlist(
+ 'teams')).values_list('users', flat=True)
assinged_to_users_ids = opportunity_obj.assigned_to.all().values_list('id', flat=True)
for user_id in user_ids:
if user_id not in assinged_to_users_ids:
@@ -350,10 +373,12 @@ def update_opportunity(request, pk):
opportunity_obj.teams.clear()
current_site = get_current_site(request)
- assigned_to_list = list(opportunity_obj.assigned_to.all().values_list('id', flat=True))
- recipients = list(set(assigned_to_list) - set(previous_assigned_to_users))
+ assigned_to_list = list(
+ opportunity_obj.assigned_to.all().values_list('id', flat=True))
+ recipients = list(set(assigned_to_list) -
+ set(previous_assigned_to_users))
send_email_to_assigned_user.delay(recipients, opportunity_obj.id, domain=current_site.domain,
- protocol=request.scheme)
+ protocol=request.scheme)
if request.POST.getlist('contacts', []):
opportunity_obj.contacts.add(
@@ -480,7 +505,7 @@ class AddCommentView(LoginRequiredMixin, CreateView):
comment_id = comment.id
current_site = get_current_site(self.request)
send_email_user_mentions.delay(comment_id, 'opportunity', domain=current_site.domain,
- protocol=self.request.scheme)
+ protocol=self.request.scheme)
return JsonResponse({
"comment_id": comment.id, "comment": comment.comment,
"commented_on": comment.commented_on,
@@ -514,7 +539,7 @@ class UpdateCommentView(LoginRequiredMixin, View):
comment_id = self.comment_obj.id
current_site = get_current_site(self.request)
send_email_user_mentions.delay(comment_id, 'opportunity', domain=current_site.domain,
- protocol=self.request.scheme)
+ protocol=self.request.scheme)
return JsonResponse({
"commentid": self.comment_obj.id,
"comment": self.comment_obj.comment,
diff --git a/requirements.txt b/requirements.txt
index 68dd34e0..89ced9a3 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -26,4 +26,4 @@ codacy-coverage==1.3.11
django-haystack==2.8.0
elasticsearch==2.3
python-memcached==1.59
-boto
+boto
\ No newline at end of file
diff --git a/static/css/main.scss b/static/css/main.scss
index d9b9343f..2550cd1f 100644
--- a/static/css/main.scss
+++ b/static/css/main.scss
@@ -1,23 +1,22 @@
@import "ref.scss";
-*{
- font-family: 'Quicksand', sans-serif;
+* {
+ font-family: "Quicksand", sans-serif;
}
body {
- font-family: 'Quicksand', sans-serif;
+ font-family: "Quicksand", sans-serif;
padding: 0;
font-weight: 500;
margin: 0;
font-size: 14px;
background: #f7f7f9;
- @media(min-width:$large){
- font-size:17px;
+ @media (min-width: $large) {
+ font-size: 17px;
}
- @media(min-width: $mob_min) and (max-width: $smob_max){
+ @media (min-width: $mob_min) and (max-width: $smob_max) {
padding-top: 50px;
}
}
.login_register_body {
-
}
/**{
font-size: 15px;
@@ -25,15 +24,15 @@ body {
font-size:17px;
}
}*/
-.no_mar_top{
- margin-top:0 !important;
-}
+.no_mar_top {
+ margin-top: 0 !important;
+}
.marl {
margin-left: 0;
margin-right: 0;
}
-.no-padding{
- padding:0;
+.no-padding {
+ padding: 0;
}
.login_row {
}
@@ -52,50 +51,51 @@ body {
}
}
}
-a{
- &:hover{
- text-decoration:none;
+a {
+ &:hover {
+ text-decoration: none;
}
}
-.anchor{
- color: darken($text_color, 15%)!important;
+.anchor {
+ color: darken($text_color, 15%) !important;
}
.login_form_block {
- margin-top: 30px;
- padding:50px 15px;
- .welcome{
- margin-bottom: 20px;
- text-align: center;
- }
- .forgot{
+ margin-top: 30px;
+ padding: 50px 15px;
+ .welcome {
+ margin-bottom: 20px;
+ text-align: center;
+ }
+ .forgot {
+ font-size: 13px;
+ display: block;
+ color: darken($text_color2, 15%);
+ a {
+ display: inline-block;
+ color: $dark_sky;
+ margin-bottom: 10px;
font-size: 13px;
- display: block;
- color: darken($text_color2, 15%);
- a{
- display: inline-block;
- color: $dark_sky;
- margin-bottom: 10px;
- font-size: 13px;
- }
}
+ }
.form-group {
margin-bottom: 15px;
}
- .errorlist li{
+ .errorlist li {
color: red;
font-size: 0.83rem;
}
label {
font-size: 14px;
color: darken($text_color2, 15%);
- font-weight:500;
+ font-weight: 500;
}
- .form-control, input {
+ .form-control,
+ input {
color: $text_color;
min-height: 40px;
font-size: 13px;
letter-spacing: 0.5px;
- border:1px solid #ddd;
+ border: 1px solid #ddd;
//Instead of the line below you could use @include box-shadow($shadow-1, $shadow-2, $shadow-3, $shadow-4, $shadow-5, $shadow-6, $shadow-7, $shadow-8, $shadow-9, $shadow-10)
box-shadow: none;
//Instead of the line below you could use @include border-radius($radius, $vertical-radius)
@@ -109,15 +109,15 @@ a{
font-weight: 600;
color: $white;
width: 100%;
- outline:none;
+ outline: none;
padding: 10px 20px;
- &:hover{
- text-decoration:none;
+ &:hover {
+ text-decoration: none;
}
}
- .checkbox{
+ .checkbox {
text-align: center;
- input[type=checkbox]{
+ input[type="checkbox"] {
vertical-align: middle;
margin: 0;
margin-top: 1px;
@@ -126,16 +126,15 @@ a{
}
}
-
/* inner_pages starts here */
/*.main_body_bg_color{
background: #fff;
}*/
-.primary_btn{
+.primary_btn {
background: $login_btn_bg;
color: #fff;
- border:none;
+ border: none;
font-size: 0.9rem;
font-weight: 500;
text-transform: capitalize;
@@ -144,138 +143,136 @@ a{
border-radius: 3px;
padding: 2px 10px;
line-height: 1.5rem;
- bordeR: none;
+ border: none;
cursor: pointer;
- &:hover{
+ &:hover {
background: darken($login_btn_bg, 10%);
color: #fff;
}
- @media(min-width:$large){
- font-size:1rem;
- svg{
+ @media (min-width: $large) {
+ font-size: 1rem;
+ svg {
position: relative;
top: 0px;
}
}
- svg{
+ svg {
display: inline-block;
margin-right: 5px;
}
}
-.secondary_btn{
+.secondary_btn {
@extend .primary_btn;
background: $blue;
- &:hover{
+ &:hover {
background: darken($blue, 10%);
}
}
-.tertiary_btn{
-
+.tertiary_btn {
}
-header{
- .navbar{
+header {
+ .navbar {
background: #fff;
- border:none;
- border:1px solid #ddd;
- padding:0 15px;
- @media(min-width: $mob_min) and (max-width: $smob_max){
+ border: none;
+ border: 1px solid #ddd;
+ padding: 0 15px;
+ @media (min-width: $mob_min) and (max-width: $smob_max) {
padding: 5px 15px;
}
- .navbar-brand{
+ .navbar-brand {
color: darken($text_color, 10%);
font-weight: 600;
margin-right: 50px;
- &:hover{
+ &:hover {
color: $login_btn_bg;
}
}
- .navbar-toggler{
- svg{
+ .navbar-toggler {
+ svg {
color: #333;
}
}
- .navbar-nav{
- .nav-item{
- a{
- color: lighten($text_color,5%) !important;
+ .navbar-nav {
+ .nav-item {
+ a {
+ color: lighten($text_color, 5%) !important;
font-weight: 500;
font-size: 0.9rem;
- padding:10px 15px;
+ padding: 10px 15px;
display: inline-block;
padding-top: 16px;
border-bottom: 3px solid #fff;
- @media(min-width: $mob_min) and (max-width: $smob_max) {
- padding:5px 10px;
+ @media (min-width: $mob_min) and (max-width: $smob_max) {
+ padding: 5px 10px;
}
- @media(min-width:$large){
- font-size:1rem;
+ @media (min-width: $large) {
+ font-size: 1rem;
}
- &:hover{
- color:darken($text_color,5%) !important;
+ &:hover {
+ color: darken($text_color, 5%) !important;
border-bottom: 3px solid $dark_sky;
}
- &.active{
- color:darken($text_color,5%) !important;
+ &.active {
+ color: darken($text_color, 5%) !important;
border-bottom: 3px solid $dark_sky;
}
}
}
- .open{
- a{
+ .open {
+ a {
background: $login_btn_bg !important;
-
}
}
- li{
- .dropdown-toggle{
- img{
+ li {
+ .dropdown-toggle {
+ img {
+ width: 25px;
+ height: 25px;
+ }
+ }
+ .dropdown-menu {
+ padding: 0;
+ a {
+ font-size: 0.9rem;
+ padding: 8px 10px;
+ color: darken($text_color, 5%);
+ border: none !important;
+ svg {
+ display: inline-block;
+ margin-right: 5px;
+ font-size: 0.75rem;
+ }
+ @media (min-width: $large) {
+ font-size: 0.95rem;
+ }
+ &:hover {
+ border: none !important;
+ }
+ }
+ }
+ }
+ &.navbar-right {
+ .dropdown {
+ .dropdown-toggle {
+ img {
width: 25px;
height: 25px;
}
}
- .dropdown-menu{
- padding:0;
- a{
- font-size: 0.9rem;
- padding:8px 10px;
- color: darken($text_color,5%);
- border:none !important;
- svg{
- display: inline-block;
- margin-right: 5px;
- font-size: 0.75rem;
- }
- @media(min-width:$large){
- font-size:0.95rem;
- }
- &:hover{
- border:none !important;
- }
- }
- }
- }
- &.navbar-right{
- .dropdown{
- .dropdown-toggle{
- img{
- width: 25px;
- height: 25px;
- }
- }
- a{
+ a {
color: #fff;
- &.nav-link{
- padding:11px 15px;
- border-bottom:3px solid #fff;
+ &.nav-link {
+ padding: 11px 15px;
+ border-bottom: 3px solid #fff;
+ }
+ &:hover {
+ color: darken($text_color, 5%) !important;
+ border-bottom: 3px solid $dark_sky;
}
- &:hover{
- color:darken($text_color,5%) !important;
- border-bottom: 3px solid $dark_sky;
- }
}
}
}
- /* li{
+ /* li{
a{
&:hover{
color:lighten($text_color,15%);
@@ -283,26 +280,26 @@ header{
}
}*/
}
- .navbar-form{
- .form-group{
- .form-control{
- border-radius:3px;
- border:none;
+ .navbar-form {
+ .form-group {
+ .form-control {
+ border-radius: 3px;
+ border: none;
}
}
- .btn{
- border-radius:3px;
- padding:7px 12px;
- border:none;
+ .btn {
+ border-radius: 3px;
+ padding: 7px 12px;
+ border: none;
background: $green;
- &.btn-default{
+ &.btn-default {
color: #fff;
}
}
}
}
}
-/* inner_pages ends here */
+/* inner_pages ends here */
/* CSS used here will be applied after bootstrap.css */
$color_1: #ff7788;
@@ -314,8 +311,8 @@ $color_2: #000;
.notifications {
min-width: 420px;
font-size: 12px;
- padding:0;
- border:none;
+ padding: 0;
+ border: none;
a.content {
text-decoration: none;
background: #ccc;
@@ -338,12 +335,12 @@ $color_2: #000;
}
.notification-heading {
padding: 2px 10px;
- background:lighten($text_color,5%);
- border-top:1px solid lighten($text_color,10%);
+ background: lighten($text_color, 5%);
+ border-top: 1px solid lighten($text_color, 10%);
}
.notification-footer {
padding: 2px 10px;
- background:$green;
+ background: $green;
}
.dropdown-menu.divider {
margin: 5px 0;
@@ -351,14 +348,14 @@ $color_2: #000;
.item-title {
font-size: 12px;
color: darken($text_color, 15%);
- margin:0;
+ margin: 0;
}
.notification-item {
padding: 10px;
margin: 5px;
background: #ccc;
border-radius: 4px;
- p{
+ p {
margin: 0;
color: #fff;
margin-top: 6px;
@@ -366,217 +363,230 @@ $color_2: #000;
}
/* main_container stats here */
-.main_container{
+.main_container {
padding-top: 0;
- .heading_create{
- .heading{
+ .heading_create {
+ .heading {
font-size: 1.1rem;
text-transform: uppercase;
letter-spacing: 1px;
color: darken($text_color, 15%);
- h4{
+ h4 {
font-size: 1.1rem;
- font-weight: 800;
+ font-weight: 800;
}
}
-
- .search-row{
- .form-group{
- .input-group{
- .left-dropdown{
- .filters-button{
+
+ .search-row {
+ .form-group {
+ .input-group {
+ .left-dropdown {
+ .filters-button {
font-size: 12px;
background: #fff;
- border:none;
- box-shadow:none;
- margin-top:1px;
+ border: none;
+ box-shadow: none;
+ margin-top: 1px;
}
- .dropdown-menu{
- li{
- a{
+ .dropdown-menu {
+ li {
+ a {
font-size: 12px;
}
- &.checkbox{
+ &.checkbox {
color: #000;
- padding-left:10px;
+ padding-left: 10px;
font-size: 12px;
letter-spacing: 0.4px;
- input[type=checkbox]{
- margin:0;
- margin-left:-10px;
- margin-top:1px;
- margin-right:10px;
+ input[type="checkbox"] {
+ margin: 0;
+ margin-left: -10px;
+ margin-top: 1px;
+ margin-right: 10px;
}
}
}
}
}
- .form-control{
+ .form-control {
height: 29px;
border: none;
margin-top: 2px;
}
- .search{
+ .search {
background: $green;
color: #fff;
- border:none;
- padding:5px 13px;
- margin-top:2px;
+ border: none;
+ padding: 5px 13px;
+ margin-top: 2px;
}
}
}
- .extra_option_btn{
+ .extra_option_btn {
font-size: 12px;
background: #5b636e;
- border:none;
- color:#fff;
- padding-top:7px;
+ border: none;
+ color: #fff;
+ padding-top: 7px;
padding-bottom: 7px;
- &.add-filter-button{
+ &.add-filter-button {
background-color: $dark_sky;
}
}
- .dropdown-menu{
+ .dropdown-menu {
font-size: 12px;
}
}
}
-
/* filter_row starts here */
- .filter_row{
- margin-top:10px;
- .card{
- border:1px solid #ccc;
- .card-body{
- padding:0px 0;
- .card-title{
+ .filter_row {
+ margin-top: 10px;
+ .card {
+ border: 1px solid #ccc;
+ .card-body {
+ padding: 0px 0;
+ .card-title {
background: #e5e5e5;
- padding:6px 10px;
+ padding: 6px 10px;
font-weight: 600;
font-size: 1rem;
}
- .form-group{
+ .form-group {
margin-bottom: 10px;
- label{
+ label {
color: black;
font-size: 0.85rem;
font-weight: 600;
text-transform: none;
}
- .form-control{
+ .form-control {
border-radius: 0;
box-shadow: none;
font-size: 0.85rem;
}
- &.buttons_row{
+ &.buttons_row {
margin-top: 30px;
}
}
}
}
- .table_container_row{
+ .table_container_row {
margin-top: 0;
}
}
/* filter_row ends here */
/* table_container_row starts here */
-
}
-/* main_container ends here */
- .table_container_row{
- margin-top: 10px;
- .card{
- border: none;
- border-radius: 0;
- box-shadow: none;
- .card-title{
- padding:5px 10px !important;
- background: #e5e5e5;
- font-size: 1rem;
- margin-bottom: 0;
- font-weight: 600;
- line-height: 2.3rem;
- &.title_lh{
- line-height: 2rem;
- }
- .dropdown{
- display: inline-block;
- .dropdown-toggle{
- background: $dark_sky;
- font-size: 12px;
- color:#fff;
- border-radius: 0;
- border:none;
- }
- }
- .mark_read{
- background: $inner_page_bg;
- display: inline-block;
- padding:6px 10px;
- margin-left:6px;
- color: $text_color;
- &:hover{
- background:$text_color;
- color: #fff;
- text-decoration: none;
- }
- }
- .total_count{
- margin-top:0px;
+.remove_tag {
+ position: relative;
+}
+.remove_tag .fa-times {
+ color: #000 !important;
+ position: absolute;
+ background: #fff;
+ top: -6px;
+ padding: 1px;
+ border-radius: 50%;
+ font-size: 0.6rem;
+ height: 10px;
+ width: 10px;
+ border: 1px solid #000;
+}
+/* main_container ends here */
+.table_container_row {
+ margin-top: 10px;
+ .card {
+ border: none;
+ border-radius: 0;
+ box-shadow: none;
+ .card-title {
+ padding: 5px 10px !important;
+ background: #e5e5e5;
+ font-size: 1rem;
+ margin-bottom: 0;
+ font-weight: 600;
+ line-height: 2.3rem;
+ &.title_lh {
+ line-height: 2rem;
+ }
+ .dropdown {
+ display: inline-block;
+ .dropdown-toggle {
+ background: $dark_sky;
+ font-size: 12px;
+ color: #fff;
+ border-radius: 0;
+ border: none;
}
}
- .card-body{
- padding:0px 0px;
- table{
+ .mark_read {
+ background: $inner_page_bg;
+ display: inline-block;
+ padding: 6px 10px;
+ margin-left: 6px;
+ color: $text_color;
+ &:hover {
+ background: $text_color;
+ color: #fff;
+ text-decoration: none;
+ }
+ }
+ .total_count {
+ margin-top: 0px;
+ }
+ }
+ .card-body {
+ padding: 0px 0px;
+ table {
border: none;
margin-bottom: 0;
- thead{
- tr{
- th{
+ thead {
+ tr {
+ th {
color: #454545;
font-weight: 900;
font-size: 0.9rem;
border: none;
text-align: left;
- padding:6px;
+ padding: 6px;
border-bottom: 1px solid darken(#f7f7f9, 2%);
}
}
}
- tbody{
- tr{
- td{
+ tbody {
+ tr {
+ td {
vertical-align: middle;
color: #454545;
font-size: 0.83rem;
text-align: left;
font-weight: 500;
- padding:7px 5px;
+ padding: 7px 5px;
border-bottom: 1px solid darken(#f7f7f9, 2%);
- @media(min-width: $large){
- font-size:1rem;
+ @media (min-width: $large) {
+ font-size: 1rem;
}
- a{
- color: lighten($dark_sky,5%);
+ a {
+ color: lighten($dark_sky, 5%);
font-size: 0.85rem;
- &:hover{
- color:$dark_sky;
+ &:hover {
+ color: $dark_sky;
text-decoration: underline;
}
}
- .dropdown{
- .dropdown-toggle{
+ .dropdown {
+ .dropdown-toggle {
background: $dark_sky;
font-size: 12px;
- color:#fff;
+ color: #fff;
border-radius: 0;
- border:none;
- }
+ border: none;
+ }
}
- &.actions{
- a{
- &.box{
+ &.actions {
+ a {
+ &.box {
@extend .box;
line-height: 1.5rem;
width: 1.65rem;
@@ -590,22 +600,22 @@ $color_2: #000;
}
}
}
-
+
/* mail_menu starts here */
- .mail_menu{
- .panel{
+ .mail_menu {
+ .panel {
border-radius: 0;
- padding:0;
- background:none;
- border:0;
- .panel-content{
- padding:0;
- .mail_options{
- margin:0;
+ padding: 0;
+ background: none;
+ border: 0;
+ .panel-content {
+ padding: 0;
+ .mail_options {
+ margin: 0;
padding: 0;
- li{
- list-style:none;
- a{
+ li {
+ list-style: none;
+ a {
display: block;
padding: 10px;
background: $text_color;
@@ -613,16 +623,16 @@ $color_2: #000;
color: white;
text-transform: uppercase;
letter-spacing: 0.6px;
- &:hover{
- background:$green;
+ &:hover {
+ background: $green;
color: #fff;
text-decoration: none;
border-left: 3px solid white;
}
}
- &.active{
- a{
- background:$green;
+ &.active {
+ a {
+ background: $green;
color: #fff;
text-decoration: none;
border-left: 3px solid white;
@@ -634,111 +644,111 @@ $color_2: #000;
}
}
/* mail_menu ends here */
- }
- /* table_container_row ends here */
-/* breadcrumb starts here */
-.breadcrumb{
- margin:0;
- padding:0 15px;
- background: none;
- .breadcrumb-item{
- a{
- color: $dark_sky;
- }
- }
}
-.breadcrumb li+li:before{
- color:$text_color;
+/* table_container_row ends here */
+/* breadcrumb starts here */
+.breadcrumb {
+ margin: 0;
+ padding: 0 15px;
+ background: none;
+ .breadcrumb-item {
+ a {
+ color: $dark_sky;
+ }
+ }
+}
+.breadcrumb li + li:before {
+ color: $text_color;
}
/* breadcrumb ends here */
/* assigned_teams starts here */
-.assigned_teams{
+.assigned_teams {
@extend .filter_row;
- margin-top:0;
+ margin-top: 0;
}
-/* assigned_teams ends here */
+/* assigned_teams ends here */
/* overview_form_block starts here */
-.overview_form_block{
+.overview_form_block {
@extend .filter_row;
- .card-title{
+ .card-title {
min-height: 36px;
padding: 8px 10px !important;
- h5{
+ h5 {
margin-bottom: 0;
position: relative;
font-size: 1rem;
font-weight: 600;
- .title{
+ .title {
position: relative;
top: 2px;
}
}
- .dropdown{
- .dropdown-menu{
- li{
- a{
+ .dropdown {
+ .dropdown-menu {
+ li {
+ a {
font-size: 0.85rem;
color: #454545;
text-transform: capitalize !important;
font-weight: 400;
display: block;
- padding:5px 8px;
+ padding: 5px 8px;
}
}
}
}
}
- .buttons_row{
- margin:0;
+ .buttons_row {
+ margin: 0;
position: relative;
}
- .form-control{
+ .form-control {
border-radius: 0;
box-shadow: none;
font-size: 0.85rem;
}
- margin-top:0;
- .country_class{
- margin-top:10px;
+ margin-top: 0;
+ .country_class {
+ margin-top: 10px;
}
- .shiiping_block{
- margin-top:10px;
- .checkbox{
+ .shiiping_block {
+ margin-top: 10px;
+ .checkbox {
color: $text_color;
}
}
- .filters-button{
+ .filters-button {
border-radius: 0;
}
- .website_block{
- margin-top:10px;
+ .website_block {
+ margin-top: 10px;
}
- .search{
+ .search {
border-radius: 0;
}
- .copy_billing_btn{
- margin-top:10px;
+ .copy_billing_btn {
+ margin-top: 10px;
display: block;
}
}
/* overview_form_block ends here */
/* details_block starts here */
-.details_block{
+.details_block {
@extend .filter_row;
- .form-control{
+ .form-control {
border-radius: 0;
box-shadow: none;
font-size: 12px;
}
}
-.buttons_row{
+.buttons_row {
margin-bottom: 0px;
- button{
+ button {
border-radius: 0;
font-size: 0.85rem;
font-weight: 600;
- &.save{
+ &.save {
background: $dark_sky;
color: #fff;
}
@@ -746,31 +756,30 @@ $color_2: #000;
}
/* details_block ends here */
/* attendees starts here */
-.attendees{
+.attendees {
@extend .filter_row;
}
/* attendees ends here */
-
-
-.case-list-container{
+.case-list-container {
margin-bottom: 15px;
}
-.profile_pic{
+.profile_pic {
text-align: center;
- img{
+ img {
width: 5rem;
height: 5rem;
border-radius: 50%;
}
}
-.error, .errors {
+.error,
+.errors {
color: red;
}
-.required_color{
+.required_color {
color: red;
}
@@ -779,10 +788,10 @@ $color_2: #000;
padding: 0px;
}
-.view-pad{
-padding:0px !important;
- h5{
- width: 90%;
+.view-pad {
+ padding: 0px !important;
+ h5 {
+ width: 90%;
margin-bottom: 0;
position: relative;
font-size: 1rem;
@@ -791,102 +800,101 @@ padding:0px !important;
text-align: left;
padding-top: 0px;
}
- a{
+ a {
float: right;
border-radius: 0;
font-size: 1rem;
padding: 3px 10px;
color: #fff;
margin-top: -4px;
- &:hover{
- text-decoration:none;
+ &:hover {
+ text-decoration: none;
}
}
-
}
-.select2-container{
+.select2-container {
width: 100% !important;
border-radius: 0;
border: 1px solid #ced4da;
}
-.select2-container--default .select2-selection--multiple{
+.select2-container--default .select2-selection--multiple {
border-radius: 0 important;
border: none !important;
}
-.select2-container--open{
+.select2-container--open {
width: inherit !important;
display: block !important;
}
-.created_information{
+.created_information {
padding-left: 15px;
- margin:10px 0;
+ margin: 10px 0;
}
-.pagination{
- li{
- a{
+.pagination {
+ li {
+ a {
padding: 5px 10px;
border: 1px solid #ddd;
font-weight: 600;
- }
- .active{
- background: #369cbe;
- padding: 5px 10px;
- border: 1px solid #369cbe;
- color: #fff;
- }
}
+ .active {
+ background: #369cbe;
+ padding: 5px 10px;
+ border: 1px solid #369cbe;
+ color: #fff;
+ }
+ }
}
.text-center {
- justify-content: center!important;
+ justify-content: center !important;
}
.pull-right {
float: right;
}
.credentials {
- border: 1px solid;
- width: 309px;
- border: 6px solid #040404;
- padding: 30px 0;
- text-align: center;
- position: relative;
- margin-top: 6rem;
+ border: 1px solid;
+ width: 309px;
+ border: 6px solid #040404;
+ padding: 30px 0;
+ text-align: center;
+ position: relative;
+ margin-top: 6rem;
}
-.credentials .heading{
+.credentials .heading {
position: absolute;
display: inline-block;
top: -15px;
left: 17%;
background: #333;
color: #fff;
- padding:3px 10px;
+ padding: 3px 10px;
border-radius: 3px;
}
-.filter_toggle{
+.filter_toggle {
cursor: pointer;
position: relative;
top: 1px;
- @media(min-width: $large){
+ @media (min-width: $large) {
top: 2px;
}
- a{
+ a {
line-height: 1.6rem;
}
- svg{
+ svg {
margin-right: 0;
}
}
-.list_filter_row{
+.list_filter_row {
display: none;
}
-.form_btn_row{
+.form_btn_row {
margin-bottom: 1rem !important;
}
-#list_tag{
+#list_tag {
color: #fff;
border: none;
background: #333;
@@ -897,222 +905,221 @@ padding:0px !important;
display: inline-block;
margin-bottom: 5px;
border-radius: 2px;
- &.color1{
+ &.color1 {
background: darken($dark_sky, 5%);
}
- &.red{
+ &.red {
background: darken($color_cerise_red_approx, 5%);
}
- &.green{
+ &.green {
background: darken($green, 5%);
}
- &.color2{
+ &.color2 {
background: darken($dark_yellow, 10%);
}
- &.color3{
+ &.color3 {
background: darken($color_cerise_red_approx, 1%);
}
- &.color4{
+ &.color4 {
background: darken($dark_yellow, 40%);
}
- &.color5{
+ &.color5 {
background: darken($dark_sky, 30%);
}
- &.color6{
+ &.color6 {
background: darken($green, 1%);
}
- &.color7{
+ &.color7 {
background: blueviolet;
}
- &.color8{
- background:#a2866f;
+ &.color8 {
+ background: #a2866f;
}
- &.color9{
+ &.color9 {
background: cadetblue;
}
- &.color10{
+ &.color10 {
background: cornflowerblue;
}
- &.color11{
+ &.color11 {
background: dodgerblue;
}
- &.color12{
+ &.color12 {
background: blue;
}
- &.color13{
+ &.color13 {
background: coral;
}
- &.color14{
- background:crimson;
+ &.color14 {
+ background: crimson;
}
- &.color15{
+ &.color15 {
background: darkgoldenrod;
}
}
-.nav-tabs{
- li{
- &.nav-item{
- a{
- &.nav-link{
+.nav-tabs {
+ li {
+ &.nav-item {
+ a {
+ &.nav-link {
background: lighten($color_blue_dianne_approx, 45%);
color: #fff;
font-size: 0.83rem;
font-weight: 600;
}
- &.active{
+ &.active {
background: $info_color;
}
}
}
}
}
-.account_field{
+.account_field {
font-size: 0.83rem;
}
-.contact_field{
+.contact_field {
font-size: 0.83rem;
}
-.lead_field{
+.lead_field {
font-size: 0.83rem;
}
-.opportunity_field{
+.opportunity_field {
font-size: 0.83rem;
}
-.form-control-file{
+.form-control-file {
font-size: 0.83rem;
}
-.case_field{
+.case_field {
font-size: 0.83rem;
}
-pre{
+pre {
margin-bottom: 0.5rem;
- a{
-
+ a {
}
}
-#comments_div{
- .list-group-item{
+#comments_div {
+ .list-group-item {
margin-bottom: 0.75rem;
border: none;
background: #f5f5f5;
position: relative;
- .list-row-buttons{
+ .list-row-buttons {
position: absolute;
top: 0;
right: 0;
- .primary_btn{
+ .primary_btn {
border-radius: 0;
}
- .dropdown-menu{
+ .dropdown-menu {
padding: 0;
border-radius: 0;
- li{
- a{
+ li {
+ a {
padding: 8px 8px;
display: block;
text-align: left;
font-size: 0.83rem;
- border-bottom: 1px solid #dedede;
+ border-bottom: 1px solid #dedede;
}
}
}
}
- .stream-post-container{
- pre{
+ .stream-post-container {
+ pre {
font-weight: 600;
- a{
+ a {
font-size: 0.83rem;
}
}
}
- .stream-container{
- .date{
+ .stream-container {
+ .date {
font-size: 0.83rem;
- color: lighten($text_color,10%);
+ color: lighten($text_color, 10%);
}
}
}
}
-#attachment_div{
+#attachment_div {
@extend #comments_div;
}
-.bootstrap-datetimepicker-widget{
+.bootstrap-datetimepicker-widget {
display: block !important;
}
-.count_blocks_row{
+.count_blocks_row {
margin-top: 2rem;
- .item{
+ .item {
background: #fff;
border-radius: 0;
- padding:0;
+ padding: 0;
border: none;
text-align: center;
- .title{
+ .title {
line-height: 2.5rem;
font-weight: 600;
font-size: 0.85rem;
color: #fff;
text-transform: uppercase;
- a{
+ a {
color: #fff;
}
}
- .count{
+ .count {
font-size: 2rem;
font-weight: 600;
padding: 0.5rem 0;
color: #fff;
}
- .more{
+ .more {
font-size: 0.85rem;
- a{
+ a {
color: #fff;
display: block;
font-weight: 600;
padding: 0.35rem;
background: darken($color_cyan_aqua_approx, 10%);
}
- &.green{
- a{
+ &.green {
+ a {
background: darken($color_apricot_peach_approx, 10%);
}
}
- &.blue{
- a{
+ &.blue {
+ a {
background: darken($color_blue_dianne_approx, 10%);
}
}
- &.red{
- a{
+ &.red {
+ a {
background: darken($color_cerise_red_approx, 10%);
}
}
}
- &.sky_blue{
+ &.sky_blue {
background: darken($dark_sky, 10%);
}
- &.red{
+ &.red {
background: darken($color_cerise_red_approx, 10%);
}
- &.green{
+ &.green {
background: darken($green, 5%);
}
- &.yellow{
+ &.yellow {
background: darken($dark_yellow, 10%);
}
}
}
/* open_sections */
-.open_sections{
+.open_sections {
margin-top: 1.5rem;
- .table_container_row{
- .table{
+ .table_container_row {
+ .table {
margin-bottom: 0;
- tbody{
- tr{
- td{
- a{
+ tbody {
+ tr {
+ td {
+ a {
color: #333;
font-weight: 600;
}
@@ -1122,15 +1129,15 @@ pre{
}
}
}
-.errorlist{
- li{
+.errorlist {
+ li {
font-size: 0.83rem;
}
}
/* marketing_pages */
-.side_menu{
+.side_menu {
background: #fff;
position: fixed;
left: 0;
@@ -1138,86 +1145,86 @@ pre{
top: 0;
height: 100%;
border: none;
- .logo_block{
- a{
+ .logo_block {
+ a {
display: block;
- padding:0.75rem 1rem;
+ padding: 0.75rem 1rem;
color: #000;
font-size: 1.35rem;
font-weight: 800;
- .green_color{
+ .green_color {
color: $green;
}
}
}
- .profile_block{
+ .profile_block {
margin-top: 0.5rem;
- ul{
+ ul {
margin: 0;
padding: 0;
padding-left: 1rem;
- li{
+ li {
list-style: none;
display: inline-block;
margin-right: 3px;
- a{
- &.profile_pic{
- img{
+ a {
+ &.profile_pic {
+ img {
width: 2rem;
height: 2rem;
border-radius: 3px;
}
}
- &.box{
+ &.box {
@extend .box;
}
}
}
- }
+ }
}
- .menu_block{
- .main_menu{
+ .menu_block {
+ .main_menu {
margin-top: 1.5rem;
padding: 0;
padding-left: 1rem;
- li{
+ li {
list-style: none;
- a{
+ a {
font-size: 0.83rem;
font-size: 400;
transition: 0.6s all ease-out;
- svg{
+ svg {
display: inline-block;
margin-right: 0.5rem;
font-size: 1.1rem;
}
}
- &.parent_menu{
+ &.parent_menu {
margin: 0;
padding: 0;
margin-bottom: 0.5rem;
list-style: none;
- a{
+ a {
display: inline-block;
color: $text_color;
padding-top: 0.35rem;
padding-bottom: 0.35rem;
transition: 0.6s all ease-out;
- &.red{
+ &.red {
color: $red;
}
- &.green{
+ &.green {
color: $green;
}
- &.purple{
+ &.purple {
color: $purple;
}
}
- .submenu{
+ .submenu {
padding-left: 1.6rem;
margin-top: 0.3rem;
position: relative;
- &::before{
+ &::before {
content: "";
height: 100%;
background: lighten($text_color, 40%);
@@ -1225,30 +1232,30 @@ pre{
position: absolute;
left: 0.5rem;
}
- li{
- a{
+ li {
+ a {
transition: 0.6s all ease-out;
- &.yellow{
- svg{
+ &.yellow {
+ svg {
color: $dark_yellow;
}
- &:hover{
+ &:hover {
color: $dark_yellow;
}
}
- &.d_green{
- svg{
+ &.d_green {
+ svg {
color: $d_green;
}
- &:hover{
- color: $d_green ;
+ &:hover {
+ color: $d_green;
}
}
- &.sky_color{
- svg{
+ &.sky_color {
+ svg {
color: $sky_color;
}
- &:hover{
+ &:hover {
color: $sky_color;
}
}
@@ -1259,45 +1266,45 @@ pre{
}
}
}
-}
-/* side_menu */
-.marketing_pages{
+}
+/* side_menu */
+.marketing_pages {
margin-left: 250px;
margin-bottom: 1rem;
margin-top: 2rem;
}
-.badge{
+.badge {
width: auto !important;
height: auto !important;
font-size: 100%;
border-radius: 10rem;
display: inline-block;
- padding: .05rem 1rem;
+ padding: 0.05rem 1rem;
}
-.a_color{
+.a_color {
color: $text_color !important;
font-weight: 600;
}
-.tooltip-inner{
+.tooltip-inner {
font-size: 0.8rem;
}
#editor-container {
height: 30rem;
}
-.mar_btm{
+.mar_btm {
margin-bottom: 1rem;
}
-.radio_col{
+.radio_col {
font-size: 0.83rem;
margin-bottom: 0.6rem;
- .radio_span{
+ .radio_span {
margin-right: 1rem;
font-size: 0.83rem;
}
}
-.well{
+.well {
background: #efefef;
padding: 10px;
font-size: 0.83rem;
@@ -1305,7 +1312,6 @@ pre{
margin-bottom: 0.5rem;
}
-
.example .btn-toggle {
top: 50%;
transform: translateY(-50%);
@@ -1341,11 +1347,11 @@ pre{
transition: opacity 0.25s;
}
.btn-toggle:before {
- content: 'Off';
+ content: "Off";
left: -4rem;
}
.btn-toggle:after {
- content: 'On';
+ content: "On";
right: -4rem;
opacity: 0.5;
}
@@ -1418,11 +1424,11 @@ pre{
transition: opacity 0.25s;
}
.btn-toggle.btn-lg:before {
- content: 'Off';
+ content: "Off";
left: -5rem;
}
.btn-toggle.btn-lg:after {
- content: 'On';
+ content: "On";
right: -5rem;
opacity: 0.5;
}
@@ -1447,100 +1453,100 @@ pre{
opacity: 0.5;
}
-.hint{
+.hint {
font-size: 0.83rem;
}
-.help_container{
- .heading{
+.help_container {
+ .heading {
font-size: 1.1rem;
font-weight: 600;
color: darken($text_color, 25%);
}
- .desc{
+ .desc {
font-size: 0.83rem;
}
- ul{
+ ul {
margin: 0;
padding: 0;
- li{
+ li {
list-style: none;
margin-bottom: 1rem;
- strong{
+ strong {
display: block;
}
- code{
+ code {
font-size: 0.83rem;
}
}
}
}
-.campaign_det{
- .title{
+.campaign_det {
+ .title {
font-size: 0.83rem;
- .content{
+ .content {
font-size: 0.83rem;
}
- .icon{
- svg{
+ .icon {
+ svg {
font-size: 0.7rem;
margin-left: 0.5rem;
}
}
}
- .subject{
+ .subject {
font-weight: bold;
- margin:0.4rem 0;
+ margin: 0.4rem 0;
color: darken($text_color, 20%);
- .icon{
- svg{
+ .icon {
+ svg {
font-size: 0.7rem;
margin-left: 0.5rem;
}
}
- a{
+ a {
font-size: 0.83rem;
color: darken($text_color, 20%);
- .content{
+ .content {
font-size: 0.83rem;
color: darken($text_color, 20%);
}
}
}
- .recievers{
- .badge{
+ .recievers {
+ .badge {
font-size: 0.83rem;
font-weight: 500;
}
}
}
-.count_status{
+.count_status {
margin: 1rem 0;
- .well{
- .badge{
+ .well {
+ .badge {
font-size: 0.83rem !important;
}
- .label{
+ .label {
font-size: 0.83rem;
font-weight: bold;
}
}
}
-.mar_right_0{
- margin-right: 0!important;
+.mar_right_0 {
+ margin-right: 0 !important;
}
-.demo_clist{
- a{
+.demo_clist {
+ a {
font-size: 0.83rem;
color: darken($text_color, 15%);
font-weight: 600;
text-decoration: underline !important;
}
}
-.table_det_section{
+.table_det_section {
margin-bottom: 1rem;
- .heading{
+ .heading {
font-size: 1.3rem;
font-weight: 600;
}
@@ -1552,13 +1558,14 @@ pre{
padding: 10px;
}
-.help-text{
+.help-text {
font-size: 12px;
color: #a7a7a7a7;
}
.actions {
- .edit, .delete {
+ .edit,
+ .delete {
svg {
path {
fill: white;
@@ -1567,20 +1574,20 @@ pre{
}
}
-.btn-danger{
+.btn-danger {
background-color: #ffc107;
border-color: #ffc107;
- color: #fff!important;
+ color: #fff !important;
}
-.btn-success{
- color: #fff!important;
+.btn-success {
+ color: #fff !important;
background-color: #099cbe;
border-color: #099cbe;
}
-.btn-info{
- color: #fff!important;
- background: #28a745;
- border-color: #35a745;
+.btn-info {
+ color: #fff !important;
+ background: #28a745;
+ border-color: #35a745;
}
diff --git a/tasks/templates/task_create.html b/tasks/templates/task_create.html
index bb0294c0..2a50e138 100644
--- a/tasks/templates/task_create.html
+++ b/tasks/templates/task_create.html
@@ -137,7 +137,7 @@
@@ -217,36 +217,170 @@
}
});
- $("#id_teams").change(function (e) {
- try {
- var users = []
- $('#id_teams option:selected').each(function () {
- // users.push($(this).attr('data-users'))
- _data = $(this).attr('data-users');
- if (!users) {
- // users = []
- } else {
- users = users.concat(_data.split(','))
- }
- })
- // users = $('option:selected', this).attr('data-users')
- // if (!users) {
- // users = []
- // } else {
- // users = users.split(',')
- // }
- console.log('selected users teams data', users)
- var existingUsers = $('#id_assigned_to').val();
- var allUsers = users.concat(existingUsers)
- console.log(existingUsers)
- if (users.length) {
- $('#_id_assigned_to').select2().val(allUsers).trigger('change');
+ function find_dict(dict, id){
+ var index = dict.map(function(o) { return o.team; }).indexOf(parseInt(id));
+ return dict[index]['users']
+ }
+ $("#id_teams").change(function (e) {
+ var teams = []
+ var all_users = []
+ var selected_teams = []
+ var selected_users = []
+ var assigned_users = []
+ $.get("{% url 'leads:get_teams_and_users' %}", function(data){
+ // console.log(data)
+ if(($('#id_teams').val()).length==0){
+ $('#id_assigned_to option').each(function () {
+ $(this).removeAttr('disabled')
+ })
+ $('#id_assigned_to').select2().trigger('change');
+
+ }
+
+ teams = data['teams']
+ all_users = data['users']
+ try {
+ var users = []
+ $('#id_teams option:selected').each(function () {
+ // users.push($(this).attr('data-users'))
+ _data = $(this).attr('data-users');
+ selected_teams.push($(this).val())
+ selected_users.push(find_dict(teams, $(this).val()))
+ // console.log("s_users", selected_users)
+ var un_select_users = [].concat.apply([], selected_users)
+ // console.log('un select users', un_select_users);
+
+
+ $('#id_assigned_to option').each(function () {
+ if($.inArray(parseInt($(this).val()), un_select_users) != -1){
+ $(this).attr('disabled', 'disabled')
+ $('#id_assigned_to').select2();
+
+ }
+ else{
+ $(this).show()
+ $(this).removeAttr('disabled')
+ $('#id_assigned_to').select2();
+
+ }
+ }
+ )
+
+
+ if (!selected_teams) {
+ users = []
+ $('#id_assigned_to option').each(function () {
+ $(this).removeAttr('disabled')
+ })
+ $('#id_assigned_to').select2();
+ } else {
+ users = users.concat(_data.split(','))
+ }
+ });
+ $('#id_teams option').each(function () {
+ if ($(this).is(':selected')) {
+ _data = $(this).attr('data-users').split(',')
+ // console.log(' selected', $(this).attr('data-users').split(','))
+ // console.log('selected', $(this).attr('data-users'))
+ }
+ else {
+ _unselected = $(this).attr('data-users').split(',')
+ // console.log('un selected', $(this).attr('data-users').split(','))
+ }
+ });
+ // console.log('selected users teams data', users)
+ var existingUsers = $('#id_assigned_to').val();
+ var allUsers = users
+ $('#_id_assigned_to').select2().val(allUsers).trigger('change');
+ if (users.length) {
+
+ }
+ } catch (error) {
+ console.log(error)
+ $('#_id_assigned_to').select2().val([]).trigger('change');
}
- } catch (error) {
- console.log(error)
- $('#_id_assigned_to').select2().val(existingUsers).trigger('change');
- }
+ })
+
+ });
+
+ $(document).ready(function($) {
+
+ var teams = []
+ var all_users = []
+ var selected_teams = []
+ var selected_users = []
+ var assigned_users = []
+ $.get("{% url 'leads:get_teams_and_users' %}", function(data){
+
+ if(($('#id_teams').val()).length==0){
+ $('#id_assigned_to option').each(function () {
+ $(this).removeAttr('disabled')
+ })
+ // $('#id_assigned_to').select2().val([]).trigger('change');
+
+ }
+
+ teams = data['teams']
+ all_users = data['users']
+ try {
+ var users = []
+ $('#id_teams option:selected').each(function () {
+ // users.push($(this).attr('data-users'))
+ _data = $(this).attr('data-users');
+ selected_teams.push($(this).val())
+ selected_users.push(find_dict(teams, $(this).val()))
+ var un_select_users = [].concat.apply([], selected_users)
+
+
+ $('#id_assigned_to option').each(function () {
+ if($.inArray(parseInt($(this).val()), un_select_users) != -1){
+ // $(this).attr('disabled', 'disabled')
+ $(this).attr('disabled', 'disabled')
+ $('#id_assigned_to').select2();
+
+ }
+ else{
+ $(this).show()
+ $(this).removeAttr('disabled')
+ $('#id_assigned_to').select2();
+
+ }
+ }
+ )
+
+
+ if (!selected_teams) {
+ users = []
+ $('#id_assigned_to option').each(function () {
+ $(this).removeAttr('disabled')
+ })
+ $('#id_assigned_to').select2();
+ } else {
+ users = users.concat(_data.split(','))
+ }
+ });
+ $('#id_teams option').each(function () {
+ if ($(this).is(':selected')) {
+ _data = $(this).attr('data-users').split(',')
+ }
+ else {
+ _unselected = $(this).attr('data-users').split(',')
+ }
+ });
+ var existingUsers = $('#id_assigned_to').val();
+ // var allUsers = users.concat(existingUsers)
+ var allUsers = users
+ // console.log(existingUsers)
+ $('#_id_assigned_to').select2().val(allUsers).trigger('change');
+ if (users.length) {
+
+ }
+ } catch (error) {
+ console.log(error)
+ $('#_id_assigned_to').select2().val([]).trigger('change');
+ }
+ })
});
diff --git a/tasks/templates/task_detail.html b/tasks/templates/task_detail.html
index a1b45263..b73c73d7 100644
--- a/tasks/templates/task_detail.html
+++ b/tasks/templates/task_detail.html
@@ -35,8 +35,10 @@
@@ -465,4 +467,4 @@
}
})
-{% endblock js_block %}
\ No newline at end of file
+{% endblock js_block %}
diff --git a/tasks/templates/tasks_tasks_list.html b/tasks/templates/tasks_tasks_list.html
index cb1c06b9..88bc59db 100644
--- a/tasks/templates/tasks_tasks_list.html
+++ b/tasks/templates/tasks_tasks_list.html
@@ -1,6 +1,7 @@
{% extends 'sales/base.html' %}
{% load staticfiles %}
{% load paginate %}
+{% load common_tags %}
{% load thumbnail %}
{% block extralinks %}
@@ -169,12 +170,14 @@
|
{{task.created_on_arrow}} |
- {% if request.user == task.created_by or request.user.role == 'ADMIN' %}
-
-
+
-
{% endif %}
|
@@ -232,11 +235,13 @@