diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 9c4281d2..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,26 +0,0 @@ -Python 3.4: - script: - - export PY_EXE=python3.4 - - virtualenv -p python3 env - - source env/bin/activate - - pip install -r requirements.txt - - python manage.py test --noinput - - coverage run --source=accounts,cases,common,contacts,emails,leads,opportunity,planner manage.py test --noinput - - coverage report -m - except: - - tags - -deploy_live: - stage: deploy - environment: - name: live - script: - - sudo /bin/rm -rf /home/dj_crm/dj_crm/; cp -r . /home/dj_crm/dj_crm - - source /home/dj_crm/env/bin/activate - - pip install -r /home/dj_crm/dj_crm/requirements.txt - - python /home/dj_crm/dj_crm/manage.py migrate --noinput - - sudo /etc/init.d/uwsgi restart - only: - - master - tags: - - github-crm diff --git a/accounts/templates/accounts.html b/accounts/templates/accounts.html index af58ea5c..43cb04fe 100644 --- a/accounts/templates/accounts.html +++ b/accounts/templates/accounts.html @@ -1,6 +1,9 @@ {% extends 'base.html' %} {% load staticfiles %} {% load paginate %} +{% block extralinks %} + +{% endblock %} {% block content %}
@@ -33,10 +36,9 @@
- {{request.POST.assigned_to}} - {% for user in users %} - + {% endfor %} {{ account_form.assigned_to.errors }} @@ -98,7 +100,7 @@
- List of Open Accounts :{% if show_pageitems %} {% show_pageitems %}{% else %}{{open_accounts|length}}{% endif %} + Open Accounts - {% if show_pageitems %} {% show_pageitems %}{% else %}{{open_accounts|length}}{% endif %} @@ -131,7 +133,17 @@ {% if each_account.name %}{{ each_account.name }}{% endif %} {% if each_account.billing_address.city %}{{ each_account.billing_address.city }} {% else %} Not specified {% endif %} {% if each_account.billing_address.state %}{{ each_account.billing_address.state }} {% else %} Not specified {% endif %} - santro@mp.com + + {% with assigned_users=each_account.assigned_to.all %} + {% if assigned_users %} + {% for user in assigned_users %} + {{ user.email }}
+ {% endfor %} + {% else %} + Not Assigned + {% endif %} + {% endwith %} + {% if each_account.industry %}{{ each_account.industry }} {% else %} Not specified {% endif %} {% with tags=each_account.tags.all %} @@ -166,9 +178,11 @@
-
- List of Closed Accounts - {% if show_pageitems %} {% show_pageitems %}{% else %}Total Closed Accounts {{close_accounts|length}}{% endif %} +
+ Close Accounts - {% if show_pageitems %} {% show_pageitems %}{% else %}{{close_accounts|length}}{% endif %} + + +
@@ -177,11 +191,11 @@ - - - - - + + + + + {% endif %} @@ -198,7 +212,17 @@ - + + {% for account in accounts|slice:"15" %} - + - - - - - - - - - - - - - - - - - - - - + {% endfor %}
ID NameCityStateAssigned ToIndustryTagsCityStateAssigned ToIndustryTags Actions
{% if each_account.name %}{{ each_account.name }}{% endif %} {% if each_account.billing_address.city %}{{ each_account.billing_address.city }} {% else %} Not specified {% endif %} {% if each_account.billing_address.state %}{{ each_account.billing_address.state }} {% else %} Not specified {% endif %}santro@mp.com + {% with assigned_users=each_account.assigned_to.all %} + {% if assigned_users %} + {% for user in assigned_users %} + {{ user.email }}
+ {% endfor %} + {% else %} + Not Assigned + {% endif %} + {% endwith %} +
{% if each_account.industry %}{{ each_account.industry }} {% else %} Not specified {% endif %} {% with tags=each_account.tags.all %} @@ -242,7 +266,12 @@ {% endblock %} {% block js_block %} + + + +
@@ -39,21 +45,15 @@
-
-
- {{request.POST.assigned_to}} - - {{ account_form.assigned_to.errors }} - {{ opportunity_form.currency }} - {{opportunity_form.currency.errors}} -
- {{ opportunity_form.amount }} + {{ opportunity_form.amount }} {{opportunity_form.amount.errors}} -
+
+
+
+
+ + {{ opportunity_form.currency }} + {{opportunity_form.currency.errors}}
@@ -97,10 +97,6 @@ {{opportunity_form.contacts.errors}}
-
-
- -
@@ -113,6 +109,15 @@ {{opportunity_form.closed_on.errors}}
+
+
+
+
+ +
+
+
+
{{ opportunity_form.description }} @@ -142,6 +147,8 @@ {% endblock %} {% block js_block %} + + {% endblock js_block %} diff --git a/opportunity/templates/view_opportunity.html b/opportunity/templates/view_opportunity.html index aa7e5bc4..86b41ec2 100644 --- a/opportunity/templates/view_opportunity.html +++ b/opportunity/templates/view_opportunity.html @@ -109,6 +109,18 @@
{% endif %}
+ {% if opportunity_record.tags.all %} +
+
+ + +
+
+ {% endif %}
diff --git a/opportunity/urls.py b/opportunity/urls.py index 06dd4827..2c4da338 100644 --- a/opportunity/urls.py +++ b/opportunity/urls.py @@ -2,7 +2,7 @@ from django.urls import path from opportunity.views import ( OpportunityListView, CreateOpportunityView, OpportunityDetailView, UpdateOpportunityView, DeleteOpportunityView, GetContactView, GetOpportunitiesView, AddCommentView, - UpdateCommentView, DeleteCommentView,AddAttachmentsView,DeleteAttachmentsView) + UpdateCommentView, DeleteCommentView,AddAttachmentsView) app_name = 'opportunity' diff --git a/opportunity/views.py b/opportunity/views.py index 46a6bc59..c61ba30d 100644 --- a/opportunity/views.py +++ b/opportunity/views.py @@ -6,7 +6,7 @@ from django.http import JsonResponse from django.shortcuts import get_object_or_404, redirect from django.template.loader import render_to_string from django.views.generic import CreateView, UpdateView, DetailView, ListView, TemplateView, View -from accounts.models import Account +from accounts.models import Account, Tags from common.models import User, Comment, Team, Attachments from common.utils import STAGES, SOURCES, CURRENCY_CODES from contacts.models import Contact @@ -73,8 +73,7 @@ class CreateOpportunityView(LoginRequiredMixin, CreateView): form = self.get_form() if form.is_valid(): return self.form_valid(form) - else: - return self.form_invalid(form) + return self.form_invalid(form) def form_valid(self, form): opportunity_obj = form.save(commit=False) @@ -101,6 +100,16 @@ class CreateOpportunityView(LoginRequiredMixin, CreateView): opportunity_obj.teams.add(*self.request.POST.getlist('teams')) if self.request.POST.getlist('contacts', []): opportunity_obj.contacts.add(*self.request.POST.getlist('contacts')) + if self.request.POST.get('tags', ''): + tags = self.request.POST.get("tags") + splitted_tags = tags.split(",") + for t in splitted_tags: + tag = Tags.objects.filter(name=t.lower()) + if tag: + tag = tag[0] + else: + tag = Tags.objects.create(name=t.lower()) + opportunity_obj.tags.add(tag) if self.request.is_ajax(): return JsonResponse({'error': False}) if self.request.POST.get("savenewform"): @@ -108,8 +117,7 @@ class CreateOpportunityView(LoginRequiredMixin, CreateView): if self.request.POST.get('from_account'): from_account = self.request.POST.get('from_account') return redirect("accounts:view_account", pk=from_account) - else: - return redirect('opportunities:list') + return redirect('opportunities:list') def form_invalid(self, form): if self.request.is_ajax(): @@ -185,8 +193,7 @@ class UpdateOpportunityView(LoginRequiredMixin, UpdateView): form = self.get_form() if form.is_valid(): return self.form_valid(form) - else: - return self.form_invalid(form) + return self.form_invalid(form) def form_valid(self, form): assigned_to_ids = self.get_object().assigned_to.all().values_list('id', flat=True) @@ -221,7 +228,17 @@ class UpdateOpportunityView(LoginRequiredMixin, UpdateView): opportunity_obj.teams.add(*self.request.POST.getlist('teams')) if self.request.POST.getlist('contacts', []): opportunity_obj.contacts.add(*self.request.POST.getlist('contacts')) - + opportunity_obj.tags.clear() + if self.request.POST.get('tags', ''): + tags = self.request.POST.get("tags") + splitted_tags = tags.split(",") + for t in splitted_tags: + tag = Tags.objects.filter(name=t.lower()) + if tag: + tag = tag[0] + else: + tag = Tags.objects.create(name=t.lower()) + opportunity_obj.tags.add(tag) if self.request.POST.get('from_account'): from_account = self.request.POST.get('from_account') return redirect("accounts:view_account", pk=from_account) @@ -265,12 +282,12 @@ class DeleteOpportunityView(LoginRequiredMixin, View): self.object.delete() if request.is_ajax(): return JsonResponse({'error': False}) - else: - if request.GET.get('view_account'): - account = request.GET.get('view_account') - return redirect("accounts:view_account", pk=account) - else: - return redirect("opportunities:list") + + if request.GET.get('view_account'): + account = request.GET.get('view_account') + return redirect("accounts:view_account", pk=account) + + return redirect("opportunities:list") class GetContactView(LoginRequiredMixin, View): @@ -302,11 +319,10 @@ class AddCommentView(LoginRequiredMixin, CreateView): form = self.get_form() if form.is_valid(): return self.form_valid(form) - else: - return self.form_invalid(form) - else: - data = {'error': "You don't have permission to comment."} - return JsonResponse(data) + return self.form_invalid(form) + + data = {'error': "You don't have permission to comment."} + return JsonResponse(data) def form_valid(self, form): comment = form.save(commit=False) @@ -332,11 +348,10 @@ class UpdateCommentView(LoginRequiredMixin, View): form = OpportunityCommentForm(request.POST, instance=self.comment_obj) if form.is_valid(): return self.form_valid(form) - else: - return self.form_invalid(form) - else: - data = {'error': "You don't have permission to edit this comment."} - return JsonResponse(data) + return self.form_invalid(form) + + data = {'error': "You don't have permission to edit this comment."} + return JsonResponse(data) def form_valid(self, form): self.comment_obj.comment = form.cleaned_data.get("comment") @@ -358,9 +373,9 @@ class DeleteCommentView(LoginRequiredMixin, View): self.object.delete() data = {"cid": request.POST.get("comment_id")} return JsonResponse(data) - else: - data = {'error': "You don't have permission to delete this comment."} - return JsonResponse(data) + + data = {'error': "You don't have permission to delete this comment."} + return JsonResponse(data) class GetOpportunitiesView(LoginRequiredMixin, ListView): @@ -390,11 +405,10 @@ class AddAttachmentsView(LoginRequiredMixin, CreateView): form = self.get_form() if form.is_valid(): return self.form_valid(form) - else: - return self.form_invalid(form) - else: - data = {'error': "You don't have permission to add attachment."} - return JsonResponse(data) + return self.form_invalid(form) + + data = {'error': "You don't have permission to add attachment."} + return JsonResponse(data) def form_valid(self, form): attachment = form.save(commit=False) @@ -420,11 +434,10 @@ class DeleteAttachmentsView(LoginRequiredMixin, View): def post(self, request, *args, **kwargs): self.object = get_object_or_404(Attachments, id=request.POST.get("attachment_id")) - if (request.user == self.object.created_by or request.user.is_superuser or - request.user.role == 'ADMIN'): + if (request.user == self.object.created_by or request.user.is_superuser or request.user.role == 'ADMIN'): self.object.delete() data = {"aid": request.POST.get("attachment_id")} return JsonResponse(data) - else: - data = {'error': "You don't have permission to delete this attachment."} - return JsonResponse(data) \ No newline at end of file + + data = {'error': "You don't have permission to delete this attachment."} + return JsonResponse(data) \ No newline at end of file diff --git a/planner/admin.py b/planner/admin.py index 7a4669a4..98c0f35a 100644 --- a/planner/admin.py +++ b/planner/admin.py @@ -3,6 +3,5 @@ from django.contrib import admin from planner.models import Event, Reminder # Register your models here. - admin.site.register(Event) -admin.site.register(Reminder) \ No newline at end of file +admin.site.register(Reminder) diff --git a/static/css/main.scss b/static/css/main.scss index 26d4ca52..7e63803b 100644 --- a/static/css/main.scss +++ b/static/css/main.scss @@ -72,6 +72,7 @@ a{ } .errorlist li{ color: red; + font-size: 0.83rem; } label { font-size: 14px; @@ -864,8 +865,9 @@ padding:0px !important; } #list_tag{ - background: #e5e5e5; - color: #555; + color: #fff; + border: none; + background: #333; font-weight: 500; padding: 1px 5px; margin-right: 5px; @@ -873,7 +875,21 @@ padding:0px !important; display: inline-block; margin-bottom: 5px; border-radius: 2px; - border: 1px solid #bbb; + &.color1{ + background: darken($dark_sky, 5%); + } + &.red{ + background: darken($color_cerise_red_approx, 5%); + } + &.green{ + background: darken($green, 5%); + } + &.color2{ + background: darken($dark_yellow, 10%); + } + &.color3{ + background: darken($color_apricot_peach_approx, 40%); + } } .nav-tabs{ li{ @@ -973,20 +989,24 @@ pre{ .item{ background: #fff; border-radius: 0; - border: 1px solid #dedede; padding:0; + border: none; text-align: center; .title{ - background: #dedede; line-height: 2.5rem; font-weight: 600; font-size: 0.85rem; + color: #fff; text-transform: uppercase; + a{ + color: #fff; + } } .count{ font-size: 2rem; font-weight: 600; padding: 0.5rem 0; + color: #fff; } .more{ font-size: 0.85rem; @@ -1013,6 +1033,18 @@ pre{ } } } + &.sky_blue{ + background: darken($dark_sky, 10%); + } + &.red{ + background: darken($color_cerise_red_approx, 10%); + } + &.green{ + background: darken($green, 5%); + } + &.yellow{ + background: darken($dark_yellow, 10%); + } } } /* open_sections */ @@ -1021,6 +1053,21 @@ pre{ .table_container_row{ .table{ margin-bottom: 0; + tbody{ + tr{ + td{ + a{ + color: #333; + font-weight: 600; + } + } + } + } } } +} +.errorlist{ + li{ + font-size: 0.83rem; + } } \ No newline at end of file diff --git a/static/css/ref.scss b/static/css/ref.scss index 4cc86e78..05378ea9 100644 --- a/static/css/ref.scss +++ b/static/css/ref.scss @@ -16,6 +16,7 @@ $green:#41B871; $dark_sky:#099CBE; $dark_yellow:#FEA124; $inner_page_bg:#CDCDCD; +$green: #5cca64; diff --git a/templates/base.html b/templates/base.html index 62ed450c..4c3bf7e1 100644 --- a/templates/base.html +++ b/templates/base.html @@ -31,6 +31,7 @@ {% if request.user.is_authenticated %}
santharao{{account.name}} - design - device -
santharao - design - device -
santharao - design - device -
santharao - design - device -
santharao - design - device -
santharao - design - device + {% for tag in account.tags.all|slice:'3' %} + {{tag.name}} + {% empty %} + No Tags + {% endfor %} + {% if account.tags.all|length > 3 %} + {{account.tags.all|length|subtract:'3'}}+ + {% endif %}
@@ -115,48 +97,21 @@ + {% for opportunity in opportunities|slice:"15" %} - Opportunity1 + {{opportunity.name}} - test - test2 - - - - Opportunity2 - - test2 - device - - - - Opportunity5 - - tst3 - device - - - - Opportunity3 - - bug - bugs - - - - Opportunity5 - - edit - delete - - - - Opportunity5 - - webdesign - testing + {% for tag in opportunity.tags.all|slice:'3' %} + {{tag.name}} + {% empty %} + No Tags + {% endfor %} + {% if opportunity.tags.all|length > 3 %} + {{opportunity.tags.all|length|subtract:'3'}}+ + {% endif %} + {% endfor %}