From 32b6cd72f200367b4535208493fe0913258eb2d2 Mon Sep 17 00:00:00 2001 From: Ashwin Date: Wed, 11 Apr 2018 22:21:51 +0530 Subject: [PATCH] 0.2 --- Procfile | 1 - README.rst | 21 +++- .../migrations/0003_auto_20180410_1412.py | 17 +++ accounts/views.py | 2 +- app.json | 10 -- cases/migrations/0003_auto_20180410_1412.py | 17 +++ cases/views.py | 2 +- common/forms.py | 17 +++ common/migrations/0003_auto_20180321_1135.py | 25 ---- common/views.py | 36 ++++-- crm/settings.py | 27 ++--- crm/wsgi.py | 2 - docs/source/index.rst | 3 +- emails/migrations/0002_auto_20180410_1412.py | 17 +++ emails/models.py | 3 + leads/migrations/0002_auto_20180410_1412.py | 17 +++ leads/views.py | 21 ++-- .../migrations/0002_auto_20180410_1412.py | 17 +++ opportunity/views.py | 2 +- planner/migrations/0002_auto_20180410_1412.py | 20 ++++ requirements.txt | 5 +- static/css/main.scss | 26 +++++ static/js/accounts/acc_comment.js | 108 ------------------ static/js/accounts/view_account.js | 77 +++++++------ static/js/cases/view_case.js | 11 +- static/js/contacts/view_contact.js | 11 +- static/js/leadcomments/lead_comments.js | 75 ------------ static/js/{ => leads}/view_lead.js | 12 +- static/js/opportunities/view_opportunity.js | 11 +- static/staticfiles.json | 1 - templates/accounts/accounts.html | 2 +- templates/accounts/create_account.html | 21 +++- templates/accounts/view_account.html | 38 +++--- templates/base.html | 9 +- templates/cases/cases.html | 6 +- templates/cases/create_cases.html | 14 ++- templates/cases/view_case.html | 32 ++++-- templates/change_password.html | 15 ++- templates/contacts/contacts.html | 4 +- templates/contacts/create_contact.html | 15 ++- templates/contacts/view_contact.html | 32 ++++-- templates/leads/create_lead.html | 15 ++- templates/leads/leads.html | 2 +- templates/leads/view_leads.html | 20 ++-- templates/nav_menu.html | 2 + templates/opportunity/create_opportunity.html | 14 ++- templates/opportunity/opportunity.html | 2 +- templates/opportunity/view_opportunity.html | 38 +++--- templates/profile.html | 9 +- templates/users/create.html | 2 +- templates/users/list.html | 2 +- 51 files changed, 482 insertions(+), 426 deletions(-) delete mode 100644 Procfile create mode 100644 accounts/migrations/0003_auto_20180410_1412.py delete mode 100644 app.json create mode 100644 cases/migrations/0003_auto_20180410_1412.py delete mode 100644 common/migrations/0003_auto_20180321_1135.py create mode 100644 emails/migrations/0002_auto_20180410_1412.py create mode 100644 leads/migrations/0002_auto_20180410_1412.py create mode 100644 opportunity/migrations/0002_auto_20180410_1412.py create mode 100644 planner/migrations/0002_auto_20180410_1412.py delete mode 100644 static/js/accounts/acc_comment.js delete mode 100644 static/js/leadcomments/lead_comments.js rename static/js/{ => leads}/view_lead.js (81%) delete mode 100644 static/staticfiles.json diff --git a/Procfile b/Procfile deleted file mode 100644 index c6ee60d4..00000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -web: sh -c 'gunicorn crm.wsgi && pip install -r requirements.txt' \ No newline at end of file diff --git a/README.rst b/README.rst index 396ccee7..fae6498d 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,8 @@ Django-CRM ========== -Django-CRM provides a Customer relationship management dashboard where you can manage customers at sales of the organization. It Provides to manage leads information and its activity, track issues from leads, manage contacts to send emails of their progress. +Django CRM is opensourse CRM developed on django framework. It has all the basic features of CRM to start with. We welcome code contributions and feature requests via github. + .. image:: https://travis-ci.org/MicroPyramid/Django-CRM.svg?branch=master :target: https://travis-ci.org/MicroPyramid/Django-CRM @@ -31,11 +32,19 @@ This project contains the following modules. * Opportunity * Planner -Installation -============ -dependency for debian and ubuntu: - apt install ruby-sass +Installation - Requirements +=========================== + + +Ubuntu 64bit - 16.04 +-------------------- +$ sudo apt-get update && apt-get upgrade -y + +$ sudo apt-get install -y curl wget libpq-dev python3-dev gem ruby ruby-dev build-essential libssl-dev libffi-dev python-dev python-virtualenv python-pip git redis-server libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev tcl8.6-dev tk8.6-dev python-tk + +$ sudo gem install sass + If you cloned the package from git use virtualenv to install requirements:: @@ -54,4 +63,6 @@ Credentials to CRM Dashboard: We welcome your feedback and support, raise github ticket if you want to report a bug. Need new features? `Contact us here`_ .. _contact us here: https://micropyramid.com/contact-us/ + .. _Demo: https://django-crm.micropyramid.com/ + diff --git a/accounts/migrations/0003_auto_20180410_1412.py b/accounts/migrations/0003_auto_20180410_1412.py new file mode 100644 index 00000000..a971054d --- /dev/null +++ b/accounts/migrations/0003_auto_20180410_1412.py @@ -0,0 +1,17 @@ +# Generated by Django 2.0 on 2018-04-10 08:42 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0002_auto_20170926_1752'), + ] + + operations = [ + migrations.AlterModelOptions( + name='account', + options={'ordering': ['-created_on']}, + ), + ] diff --git a/accounts/views.py b/accounts/views.py index e4ed4ee0..9eda6386 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -25,7 +25,7 @@ def accounts_list(request): industry = request.POST.get('industry') if name: - accounts_list = Account.objects.filter(name__icontains=name) + accounts_list = accounts_list.filter(name__icontains=name) if city: accounts_list = accounts_list.filter( billing_address__in=[i.id for i in Address.objects.filter(city__contains=city)]) diff --git a/app.json b/app.json deleted file mode 100644 index 10ab1cab..00000000 --- a/app.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "Django-CRM", - "description": "Customer Relationship Management Dashboard", - "repository": "https://github.com/MicroPyramid/Django-CRM.git", - "addons": ["heroku-postgresql:hobby-dev"], - "scripts": { - "postdeploy": "python manage.py makemigrations && python manage.py migrate && echo \"from common.models import User; User.objects.create_superuser('Admin001', 'admin001')\" | python manage.py shell" - }, - "env": {} -} \ No newline at end of file diff --git a/cases/migrations/0003_auto_20180410_1412.py b/cases/migrations/0003_auto_20180410_1412.py new file mode 100644 index 00000000..a40d2542 --- /dev/null +++ b/cases/migrations/0003_auto_20180410_1412.py @@ -0,0 +1,17 @@ +# Generated by Django 2.0 on 2018-04-10 08:42 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('cases', '0002_auto_20170926_1752'), + ] + + operations = [ + migrations.AlterModelOptions( + name='case', + options={'ordering': ['-created_on']}, + ), + ] diff --git a/cases/views.py b/cases/views.py index 81024a9d..1c5cc204 100644 --- a/cases/views.py +++ b/cases/views.py @@ -25,7 +25,7 @@ def cases_list(request): if not account: account = 0 if name: - cases = Case.objects.filter(name__contains=name) + cases = cases.filter(name__contains=name) if account: cases = cases.filter(account=account) if status: diff --git a/common/forms.py b/common/forms.py index 01e6d8b4..eb4e98ad 100644 --- a/common/forms.py +++ b/common/forms.py @@ -119,3 +119,20 @@ class LoginForm(forms.ModelForm): raise forms.ValidationError("Invalid email and password") return self.cleaned_data + +class ChangePasswordForm(forms.Form): + CurrentPassword = forms.CharField(max_length=100) + Newpassword = forms.CharField(max_length=100) + confirm = forms.CharField(max_length=100) + + def __init__(self, *args, **kwargs): + super(ChangePasswordForm, self).__init__(*args, **kwargs) + + def clean_confirm(self): + if len(self.data.get('confirm')) < 4: + raise forms.ValidationError( + 'Password must be at least 4 characters long!') + if self.data.get('confirm') != self.cleaned_data.get('Newpassword'): + raise forms.ValidationError( + 'Confirm password do not match with new password') + return self.data.get('confirm') diff --git a/common/migrations/0003_auto_20180321_1135.py b/common/migrations/0003_auto_20180321_1135.py deleted file mode 100644 index 55cd99ed..00000000 --- a/common/migrations/0003_auto_20180321_1135.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.5 on 2018-03-21 06:05 -from __future__ import unicode_literals - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('common', '0002_auto_20170926_1752'), - ] - - operations = [ - migrations.AddField( - model_name='user', - name='first_name', - field=models.CharField(blank=True, max_length=150), - ), - migrations.AddField( - model_name='user', - name='last_name', - field=models.CharField(blank=True, max_length=150), - ), - ] diff --git a/common/views.py b/common/views.py index a2529cab..7f5a8e68 100644 --- a/common/views.py +++ b/common/views.py @@ -3,9 +3,10 @@ from django.contrib.auth.decorators import login_required from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponseRedirect, JsonResponse from django.contrib.auth import logout, authenticate, login +from django.contrib.auth.hashers import check_password from common.models import User -from common.forms import UserForm, LoginForm +from common.forms import UserForm, LoginForm, ChangePasswordForm @login_required @@ -15,13 +16,29 @@ def home(request): @login_required def change_pass(request): - return render(request, 'change_password.html') + error, errors = "", "" + form = ChangePasswordForm() + if request.method == 'POST': + form = ChangePasswordForm(request.POST) + if form.is_valid(): + user = request.user + if not check_password(request.POST['CurrentPassword'], user.password): + error = "Invalid old password" + else: + user.set_password(request.POST.get('Newpassword')) + user.is_active = True + user.save() + return HttpResponseRedirect('/') + else: + errors = form.errors + return render(request, "change_password.html", {'error': error, + 'errors': errors}) @login_required def profile(request): user = request.user - user_obj = User.objects.filter(id=user.id) + user_obj = User.objects.get(id=user.id) return render(request, "profile.html", {'user_obj': user_obj}) @csrf_exempt @@ -64,13 +81,13 @@ def users_list(request): active_users = User.objects.filter(is_active=True) inactive_users = User.objects.filter(is_active=False) if first_name: - users_list = User.objects.filter(first_name__icontains=first_name) + users_list = users_list.filter(first_name__icontains=first_name) if last_name: - users_list = User.objects.filter(last_name__icontains=last_name) + users_list = users_list.filter(last_name__icontains=last_name) if username: - users_list = User.objects.filter(username__icontains=username) + users_list = users_list.filter(username__icontains=username) if email: - users_list = User.objects.filter(email__icontains=email) + users_list = users_list.filter(email__icontains=email) return render(request, "users/list.html", { 'users': users_list, 'active_users': active_users, 'per_page': page, 'inactive_users': inactive_users @@ -117,7 +134,10 @@ def edit_user(request, user_id): user_form = UserForm(request.POST, instance=user_obj) if user_form.is_valid(): user_form.save() - return redirect("common:users_list") + if not request.user.is_staff: + return redirect("common:profile") + else: + return redirect("common:users_list") else: return render(request, 'users/create.html', {'user_form': user_form, "errors": user_form.errors}) else: diff --git a/crm/settings.py b/crm/settings.py index 94c045dc..110d0358 100644 --- a/crm/settings.py +++ b/crm/settings.py @@ -1,5 +1,4 @@ import os -import dj_database_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -73,25 +72,19 @@ WSGI_APPLICATION = 'crm.wsgi.application' # Database # https://docs.djangoproject.com/en/1.10/ref/settings/#databases -if 'DATABASE_URL' in os.environ: - DATABASES = { - 'default': dj_database_url.config( - default='sqlite:////{0}'.format( - os.path.join(BASE_DIR, 'db.sqlite3')) - ) - } - STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage' - STATIC_ROOT = (os.path.join(BASE_DIR, "static")) -else: - DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql', + 'NAME': 'dj_crm', + 'USER': 'postgres', + 'PASSWORD': 'root', + 'HOST': '127.0.0.1', + 'PORT': '5432' } +} - STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"), ] +STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"), ] # Password validation diff --git a/crm/wsgi.py b/crm/wsgi.py index 340bc438..f10a4dfd 100644 --- a/crm/wsgi.py +++ b/crm/wsgi.py @@ -1,7 +1,6 @@ import os import sys from django.core.wsgi import get_wsgi_application -from whitenoise.django import DjangoWhiteNoise PROJECT_DIR = os.path.abspath(__file__) @@ -11,4 +10,3 @@ sys.path.append(PROJECT_DIR) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "crm.settings") application = get_wsgi_application() -application = DjangoWhiteNoise(application) diff --git a/docs/source/index.rst b/docs/source/index.rst index f507102d..a3c5765c 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -32,10 +32,9 @@ Installation - Requirements Ubuntu 64bit - 16.04 -------------------- + $ sudo apt-get update && apt-get upgrade -y - $ sudo apt-get install -y curl wget libpq-dev python3-dev gem ruby ruby-dev build-essential libssl-dev libffi-dev python-dev python-virtualenv python-pip git redis-server libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev tcl8.6-dev tk8.6-dev python-tk - $ sudo gem install sass Visit our Django web development page [Here](https://micropyramid.com/django-ecommerce-development/) diff --git a/emails/migrations/0002_auto_20180410_1412.py b/emails/migrations/0002_auto_20180410_1412.py new file mode 100644 index 00000000..4f6577f7 --- /dev/null +++ b/emails/migrations/0002_auto_20180410_1412.py @@ -0,0 +1,17 @@ +# Generated by Django 2.0 on 2018-04-10 08:42 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('emails', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='email', + options={'ordering': ['-id']}, + ), + ] diff --git a/emails/models.py b/emails/models.py index 22ba4c30..b0567cfd 100644 --- a/emails/models.py +++ b/emails/models.py @@ -16,3 +16,6 @@ class Email(models.Model): def __unicode__(self): return self.timedelta + + class Meta: + ordering = ['-id'] diff --git a/leads/migrations/0002_auto_20180410_1412.py b/leads/migrations/0002_auto_20180410_1412.py new file mode 100644 index 00000000..43f4d438 --- /dev/null +++ b/leads/migrations/0002_auto_20180410_1412.py @@ -0,0 +1,17 @@ +# Generated by Django 2.0 on 2018-04-10 08:42 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('leads', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='lead', + options={'ordering': ['-created_on']}, + ), + ] diff --git a/leads/views.py b/leads/views.py index 78ec6c75..9e64a0bd 100644 --- a/leads/views.py +++ b/leads/views.py @@ -12,31 +12,32 @@ from common.models import User, Address, Comment, Team from common.utils import LEAD_STATUS, LEAD_SOURCE, INDCHOICES, TYPECHOICES, COUNTRIES from leads.forms import LeadCommentForm, LeadForm from accounts.forms import AccountForm -from common.forms import BillingAddressForm +from common.forms import BillingAddressForm, ShippingAddressForm from accounts.models import Account from planner.models import Event, Reminder from planner.forms import ReminderForm +from opportunity.forms import OpportunityForm # CRUD Operations Start @login_required def leads_list(request): - lead_obj = Lead.objects.all() + lead_obj = Lead.objects.all().exclude(status='converted') page = request.POST.get('per_page') first_name = request.POST.get('first_name') last_name = request.POST.get('last_name') city = request.POST.get('city') email = request.POST.get('email') if first_name: - lead_obj = Lead.objects.filter(first_name__icontains=first_name) + lead_obj = lead_obj.filter(first_name__icontains=first_name) if last_name: - lead_obj = Lead.objects.filter(last_name__icontains=last_name) + lead_obj = lead_obj.filter(last_name__icontains=last_name) if city: - lead_obj = Lead.objects.filter(address=Address.objects.filter + lead_obj = lead_obj.filter(address=Address.objects.filter (city__icontains=city)) if email: - lead_obj = Lead.objects.filter(email__icontains=email) + lead_obj = lead_obj.filter(email__icontains=email) return render(request, 'leads/leads.html', { 'lead_obj': lead_obj, 'per_page': page}) @@ -66,10 +67,12 @@ def add_lead(request): lead_obj.assigned_to.add(*assignedto_list) lead_obj.teams.add(*teams_list) if request.POST.get('status') == "converted": - Account.objects.create( + account_object = Account.objects.create( created_by=request.user, name=lead_account, email=lead_email, phone=lead_phone ) + account_object.billing_address = address_object + account_object.save() if request.POST.get("savenewform"): return HttpResponseRedirect(reverse("leads:add_lead")) else: @@ -144,10 +147,12 @@ def edit_lead(request, lead_id): lead_obj.teams.clear() lead_obj.teams.add(*teams_list) if request.POST.get('status') == "converted": - Account.objects.create( + account_object = Account.objects.create( created_by=request.user, name=lead_account, email=lead_email, phone=lead_phone ) + account_object.billing_address = dis_address_obj + account_object.save() return HttpResponseRedirect(reverse('leads:list')) else: return render(request, 'leads/create_lead.html', { diff --git a/opportunity/migrations/0002_auto_20180410_1412.py b/opportunity/migrations/0002_auto_20180410_1412.py new file mode 100644 index 00000000..bb0beccd --- /dev/null +++ b/opportunity/migrations/0002_auto_20180410_1412.py @@ -0,0 +1,17 @@ +# Generated by Django 2.0 on 2018-04-10 08:42 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('opportunity', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='opportunity', + options={'ordering': ['-created_on']}, + ), + ] diff --git a/opportunity/views.py b/opportunity/views.py index b2ba446f..f8770f5a 100644 --- a/opportunity/views.py +++ b/opportunity/views.py @@ -28,7 +28,7 @@ def opp_list(request): opp_stage = request.POST.get('stage') opp_source = request.POST.get('lead_source') if opp_name: - opportunity_list = Opportunity.objects.filter(name__contains=opp_name) + opportunity_list = opportunity_list.filter(name__contains=opp_name) if opp_stage: opportunity_list = opportunity_list.filter(stage=opp_stage) if opp_source: diff --git a/planner/migrations/0002_auto_20180410_1412.py b/planner/migrations/0002_auto_20180410_1412.py new file mode 100644 index 00000000..a54970b4 --- /dev/null +++ b/planner/migrations/0002_auto_20180410_1412.py @@ -0,0 +1,20 @@ +# Generated by Django 2.0 on 2018-04-10 08:42 + +from django.db import migrations, models +import django.db.models.deletion +import django.db.models.query_utils + + +class Migration(migrations.Migration): + + dependencies = [ + ('planner', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='event', + name='content_type', + field=models.ForeignKey(blank=True, choices=[(10, 'Account'), (13, 'Lead'), (14, 'Opportunity'), (11, 'Case')], limit_choices_to=django.db.models.query_utils.Q(django.db.models.query_utils.Q(('app_label', 'account'), ('model', 'Account'), ('id', 10), _connector='AND'), django.db.models.query_utils.Q(('app_label', 'leads'), ('model', 'Lead'), ('id', 13), _connector='AND'), django.db.models.query_utils.Q(('app_label', 'opportunity'), ('model', 'Opportunity'), ('id', 14), _connector='AND'), django.db.models.query_utils.Q(('app_label', 'cases'), ('model', 'Case'), ('id', 11), _connector='AND'), _connector='OR'), null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType'), + ), + ] diff --git a/requirements.txt b/requirements.txt index d06c7994..01513008 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,9 +2,6 @@ Django==2.0 django-simple-pagination==1.1.8 pytz==2018.3 psycopg2==2.7.4 -gunicorn==19.7.1 -whitenoise==3.3.1 -dj-database-url==0.4.2 redis django-compressor==2.2 -coverage \ No newline at end of file +coverage diff --git a/static/css/main.scss b/static/css/main.scss index d3d80d14..9846c606 100644 --- a/static/css/main.scss +++ b/static/css/main.scss @@ -634,3 +634,29 @@ $color_2: #000; list-style-type: none; padding: 0px; } + +.view-pad{ +padding:0px !important; + h5{ + width: 79%; + margin-bottom: 0; + position: relative; + font-size: 13px; + display: inline-block; + text-align: left; + padding-top: 0px; + } + a{ + float: right; + margin-right: 95px; + border-radius: 0; + font-size: 12px; + padding: 3px 10px; + color: #fff; + margin-top: -4px; + &:hover{ + text-decoration:none; + } + } + +} diff --git a/static/js/accounts/acc_comment.js b/static/js/accounts/acc_comment.js deleted file mode 100644 index 2d1125be..00000000 --- a/static/js/accounts/acc_comment.js +++ /dev/null @@ -1,108 +0,0 @@ - -/*Cookie Js Starts*/ - -function getCookie(name) { - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; -} - -/*Cookie Js Ends*/ - -/*Comment Add Js Start*/ - -$("#comment_form").submit(function(e){ - e.preventDefault() - var formData = new FormData($("#comment_form")[0]); - $.ajax({ - url : "/accounts/comment/add/", - type : "POST", - data : formData, - cache: false, - contentType: false, - processData: false, - success: function(data){ - if(data.error){ - $("#CommentError").html(data.error).show() - } - else { - $("#comments_div").prepend("
  • "+ - "
    "+ - "
    "+ - ""+ - "
    "+ - "
    "+data.com_user+" Commented
    "+ - "
    "+data.comment+"
    "+ - "
    "+data.comment_date+"
  • " - ) - $("#id_comments").val("") - alert("Comment Submitted") - } - } - }); -}); - -/*Comment Add Js Ends*/ - -/*Comment Remove Js Start*/ - -function edit_comment(x){ - $('#myModal_comment').modal('show'); - comment = $("#comment_name"+x).text() - $("#commentid").val(x) - $("#id_editcomment").val(comment) -} - -$("#comment_edit").click(function(e){ - e.preventDefault() - var formData = new FormData($("#comment_edit_form")[0]); - $.ajax({ - url : "/accounts/comment/edit/", - type : "POST", - data : formData, - cache: false, - contentType: false, - processData: false, - success:function(data){ - if(data.error) { - alert(data.error) - } else { - $("#comment_name"+data.commentid).text(data.comment) - $('#myModal_comment').modal('hide'); - $("#id_editcomment").val("") - } - } - }) -}); - -/*Comment Remove Js Ends*/ - -/*Comment Remove Js Start*/ - -function remove_comment(x){ - var csrftoken = getCookie('csrftoken'); - var warn = confirm("Are You Sure, you Want to Delete this Comment!?") - if (warn == true){ - $.post('/accounts/comment/remove/', {"comment_id":x, "csrfmiddlewaretoken": csrftoken, }, function(data){ - if(data.error){ - alert(data.error) - } else { - $("#comment"+data.cid).remove() - } - }) - } -} - -/*Comment Remove Js Ends*/ \ No newline at end of file diff --git a/static/js/accounts/view_account.js b/static/js/accounts/view_account.js index 3d568527..53a10f82 100644 --- a/static/js/accounts/view_account.js +++ b/static/js/accounts/view_account.js @@ -1,53 +1,61 @@ + +/*Cookie Js Starts*/ + function getCookie(name) { - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } } - } - return cookieValue; + return cookieValue; } -$("#comment_form").submit(function (e) { +/*Cookie Js Ends*/ + +/*Comment Add Js Start*/ + +$("#comment_form").submit(function(e){ e.preventDefault() var formData = new FormData($("#comment_form")[0]); $.ajax({ - url: "/accounts/comment/add/", - type: "POST", - data: formData, + url : "/accounts/comment/add/", + type : "POST", + data : formData, cache: false, contentType: false, processData: false, - success: function (data) { - if (data.error) { + success: function(data){ + if(data.error){ $("#CommentError").html(data.error).show() } else { d = new Date(data.commented_on); - $("#comments_div").prepend("
  • " + - "
    " + - "
    " + - "" + - "
    " + - "
    " + data.commented_by + " Commented
    " + - "
    " + data.comment + "
    " + - "
    " + d.toGMTString() + "
  • " - ) + $("#comments_div").prepend("
  • "+ + "
    "+ + "
    "+ + ""+ + "
    "+ + "
    "+data.comment+"
    "+ + "
    "+data.commented_by+"
    "+d.toGMTString()+"
    " + ) $("#id_comments").val("") alert("Comment Submitted") - $("#CommentError").html('') } } - }) -}) + }); +}); +/*Comment Add Js Ends*/ + +/*Comment Edit Js Start*/ function edit_comment(x) { $('#Comments_Accounts_Modal').modal('show'); @@ -80,12 +88,15 @@ $("#comment_edit").click(function (e) { }) }) +/*Comment Edit Js Ends*/ function HideError(e) { $("#CommentError").hide() $("#CommentEditError").hide() } +/*Comment Remove Js Start*/ + function remove_comment(x) { var csrftoken = getCookie('csrftoken'); var con = confirm("Do you want to Delete it for Sure!?") @@ -102,3 +113,5 @@ function remove_comment(x) { }) } } + +/*Comment Remove Js Ends*/ \ No newline at end of file diff --git a/static/js/cases/view_case.js b/static/js/cases/view_case.js index 5f1652d7..227b96dc 100644 --- a/static/js/cases/view_case.js +++ b/static/js/cases/view_case.js @@ -30,15 +30,14 @@ $("#comment_form").submit(function (e) { } else { d = new Date(data.commented_on); $("#comments_div").prepend("
  • " + - "
    " + - "
    " + + "
    " + + "
    " + "" + - "
    " + - "
    " + data.commented_by + " Commented
    " + - "
    " + data.comment + "
    " + - "
    " + d.toGMTString() + "
  • " + "
    "+data.comment+"
    "+ + "
    "+data.commented_by+"
    "+d.toGMTString()+"
    " ) $("#id_comments").val("") alert("Comment Submitted") diff --git a/static/js/contacts/view_contact.js b/static/js/contacts/view_contact.js index b0dc8fb4..4dab0ab3 100644 --- a/static/js/contacts/view_contact.js +++ b/static/js/contacts/view_contact.js @@ -30,15 +30,14 @@ $("#comment_form").submit(function (e) { } else { d = new Date(data.commented_on); $("#comments_div").prepend("
  • " + - "
    " + - "
    " + + "
    " + + "
    " + "" + - "
    " + - "
    " + data.commented_by + " Commented
    " + - "
    " + data.comment + "
    " + - "
    " + d.toGMTString() + "
  • " + "
    "+data.comment+"
    "+ + "
    "+data.commented_by+"
    "+d.toGMTString()+"
    " ) $("#id_comments").val("") alert("Comment Submitted") diff --git a/static/js/leadcomments/lead_comments.js b/static/js/leadcomments/lead_comments.js deleted file mode 100644 index 9af82b39..00000000 --- a/static/js/leadcomments/lead_comments.js +++ /dev/null @@ -1,75 +0,0 @@ - -function getCookie(name) { - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; -} - - $('#comment_submit').click(function(e) { - e.preventDefault(); - $.ajax({ - url: '/leads/create_comment/', - type: 'POST', - dataType: 'html', - data: $('#comment_form').serialize(), - success: function(response) { - window.location = "" - console.log(response); - }, - error: function(e) { - console.log(e); - } - }); - }); - - - function edit_comment(x){ - $('#myModal').modal('show'); - comment = $("#comment_name"+x).text() - $("#commentid").val(x) - $("#id_editcomment").val(comment) -} -$("#comment_edit").click(function(e){ - e.preventDefault() - $.get('/leads/create_comment/', $("#comment_edit_form").serialize(), function(data){ - if(data.error) - { - $('#id_editcomment').attr('placeholder',data.error); - } - else{ - $("#comment_name"+data.commentid).text(data.comment) - $('#myModal').modal('hide'); -} - - }) - }) - - - - - - -function HideError(e){ - $("#CommentError").hide() -} - -function remove_comment(x){ - var csrftoken = getCookie('csrftoken'); - $.post('/leads/remove_comment/', {"comment_id":x, "csrfmiddlewaretoken": csrftoken,}, function(data){ - $("#comment"+data.cid).remove() - }) -} - - $(function () { - $('#start_date').datetimepicker(); - }); \ No newline at end of file diff --git a/static/js/view_lead.js b/static/js/leads/view_lead.js similarity index 81% rename from static/js/view_lead.js rename to static/js/leads/view_lead.js index 9b201698..b86d4d58 100644 --- a/static/js/view_lead.js +++ b/static/js/leads/view_lead.js @@ -30,15 +30,15 @@ $("#comment_form").submit(function (e) { } else { d = new Date(data.commented_on); $("#comments_div").prepend("
  • " + - "
    " + - "
    " + + "
    " + + "
    " + "" + - "
    " + - "
    " + data.commented_by + " Commented
    " + - "
    " + data.comment + "
    " + - "
    " + d.toGMTString() + "
  • " + "
    "+data.comment+"
    "+ + "
    "+data.commented_by+"
    "+d.toGMTString()+"
    "+ + "
    " ) $("#id_comments").val("") alert("Comment Submitted") diff --git a/static/js/opportunities/view_opportunity.js b/static/js/opportunities/view_opportunity.js index ca69d967..05109cf0 100644 --- a/static/js/opportunities/view_opportunity.js +++ b/static/js/opportunities/view_opportunity.js @@ -30,15 +30,14 @@ $("#comment_form").submit(function (e) { } else { d = new Date(data.commented_on); $("#comments_div").prepend("
  • " + - "
    " + - "
    " + + "
    " + + "
    " + "" + - "
    " + - "
    " + data.commented_by + " Commented
    " + - "
    " + data.comment + "
    " + - "
    " + d.toGMTString() + "
  • " + "
    "+data.comment+"
    "+ + "
    "+data.commented_by+"
    "+d.toGMTString()+"
    " ) $("#id_comments").val("") alert("Comment Submitted") diff --git a/static/staticfiles.json b/static/staticfiles.json deleted file mode 100644 index a97db543..00000000 --- a/static/staticfiles.json +++ /dev/null @@ -1 +0,0 @@ -{"paths": {"admin/js/vendor/xregexp/xregexp.min.js": "admin/js/vendor/xregexp/xregexp.min.c95393b8ca4d.js", "admin/js/vendor/xregexp/xregexp.js": "admin/js/vendor/xregexp/xregexp.1865b1cf5085.js", "admin/js/vendor/xregexp/LICENSE-XREGEXP.txt": "admin/js/vendor/xregexp/LICENSE-XREGEXP.d64cecf4f157.txt", "admin/js/vendor/jquery/jquery.min.js": "admin/js/vendor/jquery/jquery.min.33cabfa15c10.js", "admin/js/vendor/jquery/LICENSE-JQUERY.txt": "admin/js/vendor/jquery/LICENSE-JQUERY.a158210a2737.txt", "admin/js/vendor/jquery/jquery.js": "admin/js/vendor/jquery/jquery.aacc43d6f308.js", "admin/img/gis/move_vertex_off.svg": "admin/img/gis/move_vertex_off.7a23bf31ef8a.svg", "admin/img/gis/move_vertex_on.svg": "admin/img/gis/move_vertex_on.0047eba25b67.svg", "admin/js/admin/DateTimeShortcuts.js": "admin/js/admin/DateTimeShortcuts.1536fb6bea1d.js", "admin/js/admin/RelatedObjectLookups.js": "admin/js/admin/RelatedObjectLookups.d2bdb1018963.js", "admin/fonts/Roboto-Light-webfont.woff": "admin/fonts/Roboto-Light-webfont.b446c2399bb6.woff", "admin/fonts/LICENSE.txt": "admin/fonts/LICENSE.d273d63619c9.txt", "admin/fonts/Roboto-Regular-webfont.woff": "admin/fonts/Roboto-Regular-webfont.ec39515ae8c6.woff", "admin/fonts/Roboto-Bold-webfont.woff": "admin/fonts/Roboto-Bold-webfont.2ad99072841e.woff", "admin/fonts/README.txt": "admin/fonts/README.2c3d0bcdede2.txt", "admin/img/selector-icons.svg": "admin/img/selector-icons.b4555096cea2.svg", "admin/img/LICENSE": "admin/img/LICENSE.2c54f4e1ca1c", "admin/img/icon-yes.svg": "admin/img/icon-yes.d2f9f035226a.svg", "admin/img/icon-changelink.svg": "admin/img/icon-changelink.18d2fd706348.svg", "admin/img/icon-calendar.svg": "admin/img/icon-calendar.ac7aea671bea.svg", "admin/img/sorting-icons.svg": "admin/img/sorting-icons.3a097b59f104.svg", "admin/img/icon-deletelink.svg": "admin/img/icon-deletelink.564ef9dc3854.svg", "admin/img/tooltag-add.svg": "admin/img/tooltag-add.e59d620a9742.svg", "admin/img/icon-clock.svg": "admin/img/icon-clock.e1d4dfac3f2b.svg", "admin/img/icon-unknown-alt.svg": "admin/img/icon-unknown-alt.81536e128bb6.svg", "admin/img/calendar-icons.svg": "admin/img/calendar-icons.39b290681a8b.svg", "admin/img/search.svg": "admin/img/search.7cf54ff789c6.svg", "admin/img/icon-addlink.svg": "admin/img/icon-addlink.d519b3bab011.svg", "admin/img/icon-no.svg": "admin/img/icon-no.439e821418cd.svg", "admin/img/tooltag-arrowright.svg": "admin/img/tooltag-arrowright.bbfb788a849e.svg", "admin/img/inline-delete.svg": "admin/img/inline-delete.fec1b761f254.svg", "admin/img/README.txt": "admin/img/README.837277fa1908.txt", "admin/img/icon-unknown.svg": "admin/img/icon-unknown.a18cb4398978.svg", "admin/img/icon-alert.svg": "admin/img/icon-alert.034cc7d8a67f.svg", "admin/css/forms.css": "admin/css/forms.2003a066ae02.css", "admin/css/dashboard.css": "admin/css/dashboard.7ac78187c567.css", "admin/css/widgets.css": "admin/css/widgets.5e372b41c483.css", "admin/css/login.css": "admin/css/login.a846c0e2ef65.css", "admin/css/rtl.css": "admin/css/rtl.4c867197b256.css", "admin/css/fonts.css": "admin/css/fonts.494e4ec545c9.css", "admin/css/changelists.css": "admin/css/changelists.f6dc691f8d62.css", "admin/css/base.css": "admin/css/base.6b517d0d5813.css", "admin/js/inlines.min.js": "admin/js/inlines.min.d75b9ed03975.js", "admin/js/SelectBox.js": "admin/js/SelectBox.b49f008d186b.js", "admin/js/popup_response.js": "admin/js/popup_response.6ce3197f8fc8.js", "admin/js/actions.js": "admin/js/actions.32861b6cbdf9.js", "admin/js/timeparse.js": "admin/js/timeparse.51258861a46a.js", "admin/js/actions.min.js": "admin/js/actions.min.f51f04edab28.js", "admin/js/core.js": "admin/js/core.fd861d43f0f5.js", "admin/js/prepopulate.min.js": "admin/js/prepopulate.min.f4057ebb9b62.js", "admin/js/inlines.js": "admin/js/inlines.eda404ee376d.js", "admin/js/change_form.js": "admin/js/change_form.9e85003a1a38.js", "admin/js/SelectFilter2.js": "admin/js/SelectFilter2.17009b6d4428.js", "admin/js/jquery.init.js": "admin/js/jquery.init.95b62fa19378.js", "admin/js/prepopulate_init.js": "admin/js/prepopulate_init.0d3b53c37074.js", "admin/js/cancel.js": "admin/js/cancel.1d69cba4b4bf.js", "admin/js/urlify.js": "admin/js/urlify.411bc3bb651c.js", "admin/js/collapse.min.js": "admin/js/collapse.min.dc930adb2821.js", "admin/js/prepopulate.js": "admin/js/prepopulate.ff9208865444.js", "admin/js/collapse.js": "admin/js/collapse.17d715df2104.js", "admin/js/calendar.js": "admin/js/calendar.9ac94d055fbd.js"}, "version": "1.0"} \ No newline at end of file diff --git a/templates/accounts/accounts.html b/templates/accounts/accounts.html index ffb3d168..d524d7b5 100644 --- a/templates/accounts/accounts.html +++ b/templates/accounts/accounts.html @@ -104,7 +104,7 @@ View Edit - + {% endfor %} diff --git a/templates/accounts/create_account.html b/templates/accounts/create_account.html index d7891222..cc6fd3d1 100644 --- a/templates/accounts/create_account.html +++ b/templates/accounts/create_account.html @@ -1,6 +1,9 @@ {% extends 'base.html' %} {% load staticfiles %} {% block breadcrumb %} +{% block extralinks %} + +{% endblock %}

    @@ -183,6 +190,7 @@ {% endblock %} {% block js_block %} + {% endblock js_block %} \ No newline at end of file diff --git a/templates/accounts/view_account.html b/templates/accounts/view_account.html index e0c32187..18792bc4 100644 --- a/templates/accounts/view_account.html +++ b/templates/accounts/view_account.html @@ -163,10 +163,10 @@ @@ -220,16 +222,14 @@
    - - + {% endif %}
    - + {% compress css %} {% endcompress %} - {% block extralinks %}{% endblock %} + {% block extralinks %} {% endblock %}
    @@ -43,6 +43,7 @@ + diff --git a/templates/cases/cases.html b/templates/cases/cases.html index 57a69626..3d916d84 100644 --- a/templates/cases/cases.html +++ b/templates/cases/cases.html @@ -13,7 +13,7 @@
    @@ -128,8 +128,10 @@ View Edit - Delete + Delete + {% if case.status != 'Closed' %} Close + {% endif %} {% endfor %} diff --git a/templates/cases/create_cases.html b/templates/cases/create_cases.html index 819fca6a..5100bce3 100644 --- a/templates/cases/create_cases.html +++ b/templates/cases/create_cases.html @@ -1,6 +1,9 @@ {% extends 'base.html' %} {% load staticfiles %} {% block breadcrumb %} +{% block extralinks %} + +{% endblock %}