diff --git a/Procfile b/Procfile new file mode 100644 index 00000000..c6ee60d4 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +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 65eccb81..e0538805 100644 --- a/README.rst +++ b/README.rst @@ -42,8 +42,16 @@ If you cloned the package from git use virtualenv to install requirements:: Visit our Django web development page [Here](https://micropyramid.com/django-ecommerce-development/) +`Demo`_ Available Here. + +Credentials to CRM Dashboard: + + * **Email:** admin@micropyramid.com + * **Password:** admin + 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://test-django-crm-app.herokuapp.com diff --git a/accounts/views.py b/accounts/views.py index e61f4598..e4ed4ee0 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -4,7 +4,7 @@ from django.contrib.auth.decorators import login_required from accounts.models import Account from common.models import User, Address, Team, Comment from common.utils import INDCHOICES, TYPECHOICES, COUNTRIES, CURRENCY_CODES, CASE_TYPE, PRIORITY_CHOICE, STATUS_CHOICE -from oppurtunity.models import Opportunity, STAGES, SOURCES +from opportunity.models import Opportunity, STAGES, SOURCES from contacts.models import Contact from cases.models import Case from accounts.forms import AccountForm, AccountCommentForm diff --git a/app.json b/app.json new file mode 100644 index 00000000..10ab1cab --- /dev/null +++ b/app.json @@ -0,0 +1,10 @@ +{ + "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/common/migrations/0002_auto_20170926_1752.py b/common/migrations/0002_auto_20170926_1752.py index 47694d31..64dfd01b 100644 --- a/common/migrations/0002_auto_20170926_1752.py +++ b/common/migrations/0002_auto_20170926_1752.py @@ -12,7 +12,7 @@ class Migration(migrations.Migration): dependencies = [ ('auth', '0008_alter_user_username_max_length'), - ('oppurtunity', '0001_initial'), + ('opportunity', '0001_initial'), ('contacts', '0001_initial'), ('common', '0001_initial'), ('leads', '0001_initial'), @@ -32,7 +32,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='comment', name='opportunity', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='opportunity_comments', to='oppurtunity.Opportunity'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='opportunity_comments', to='opportunity.Opportunity'), ), migrations.AddField( model_name='user', diff --git a/common/models.py b/common/models.py index 6726dec6..ce4d7e82 100644 --- a/common/models.py +++ b/common/models.py @@ -54,7 +54,7 @@ class Comment(models.Model): 'accounts.Account', blank=True, null=True, related_name="accounts_comments", on_delete=models.CASCADE) lead = models.ForeignKey('leads.Lead', blank=True, null=True, related_name="leads", on_delete=models.CASCADE) opportunity = models.ForeignKey( - 'oppurtunity.Opportunity', blank=True, null=True, related_name="opportunity_comments", on_delete=models.CASCADE) + 'opportunity.Opportunity', blank=True, null=True, related_name="opportunity_comments", on_delete=models.CASCADE) contact = models.ForeignKey( 'contacts.Contact', blank=True, null=True, related_name="contact_comments", on_delete=models.CASCADE) diff --git a/crm/settings.py b/crm/settings.py index 92557e0f..b420168e 100644 --- a/crm/settings.py +++ b/crm/settings.py @@ -1,4 +1,5 @@ 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__))) @@ -12,7 +13,7 @@ SECRET_KEY = 'mwx@&97%!$fx_*zgj(2ygi^(s=oh5j(cqb$=+-mkd9scbt!0v0' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = ['*'] # Application definition @@ -34,7 +35,7 @@ INSTALLED_APPS = [ 'contacts', 'emails', 'leads', - 'oppurtunity', + 'opportunity', 'planner', 'simple_pagination' ] @@ -71,13 +72,26 @@ WSGI_APPLICATION = 'crm.wsgi.application' # Database # https://docs.djangoproject.com/en/1.10/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), +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'), + } + } + + STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"), ] + # Password validation # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators @@ -115,8 +129,6 @@ USE_TZ = True STATIC_URL = '/static/' -STATICFILES_DIRS = [os.path.join(BASE_DIR, "static"), ] - EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'localhost' diff --git a/crm/urls.py b/crm/urls.py index 0dc23b60..203bd5ca 100644 --- a/crm/urls.py +++ b/crm/urls.py @@ -12,7 +12,7 @@ urlpatterns = [ url(r'^accounts/', include('accounts.urls', namespace='accounts')), url(r'^leads/', include('leads.urls', namespace='leads')), url(r'^contacts/', include('contacts.urls', namespace='contacts')), - url(r'^oppurtunities/', include('oppurtunity.urls', namespace='oppurtunities')), + url(r'^opportunities/', include('opportunity.urls', namespace='opportunities')), url(r'^cases/', include('cases.urls', namespace='cases')), # url(r'^emails/', include('emails.urls', namespace='emails')), # url(r'^planner/', include('planner.urls', namespace='planner')), diff --git a/crm/wsgi.py b/crm/wsgi.py index 16c3006b..340bc438 100644 --- a/crm/wsgi.py +++ b/crm/wsgi.py @@ -1,17 +1,14 @@ -""" -WSGI config for crm project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/ -""" - import os - +import sys from django.core.wsgi import get_wsgi_application +from whitenoise.django import DjangoWhiteNoise + + +PROJECT_DIR = os.path.abspath(__file__) +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 ef3768e2..2f377c6f 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -29,7 +29,7 @@ This project contains the following modules. * Accounts * Cases * Leads - * Oppurtunity + * Opportunity * Planner diff --git a/leads/views.py b/leads/views.py index 0dafdea8..78ec6c75 100644 --- a/leads/views.py +++ b/leads/views.py @@ -239,7 +239,7 @@ def leads_convert(request, pk): opportunity_form = OpportunityForm(request.POST) if opportunity_form.is_valid(): opportunity_form.save() - return HttpResponseRedirect(reverse('oppurtunities:list')) + return HttpResponseRedirect(reverse('opportunities:list')) else: return render(request, 'leads/checkbox.html', { 'post': lead_obj, 'accounts': accounts, 'sources': LEAD_SOURCE, @@ -271,7 +271,7 @@ def add_comment(request): data = { "comment_id": lead_comment.id, "comment": lead_comment.comment, "commented_on": lead_comment.commented_on, - "commented_by": lead_comment.commented_by.user.email + "commented_by": lead_comment.commented_by.email } return JsonResponse(data) else: diff --git a/oppurtunity/__init__.py b/opportunity/__init__.py similarity index 100% rename from oppurtunity/__init__.py rename to opportunity/__init__.py diff --git a/oppurtunity/admin.py b/opportunity/admin.py similarity index 60% rename from oppurtunity/admin.py rename to opportunity/admin.py index f7082a6f..15da3748 100644 --- a/oppurtunity/admin.py +++ b/opportunity/admin.py @@ -1,4 +1,4 @@ from django.contrib import admin -from oppurtunity.models import Opportunity +from opportunity.models import Opportunity admin.site.register(Opportunity) diff --git a/oppurtunity/apps.py b/opportunity/apps.py similarity index 100% rename from oppurtunity/apps.py rename to opportunity/apps.py diff --git a/oppurtunity/forms.py b/opportunity/forms.py similarity index 96% rename from oppurtunity/forms.py rename to opportunity/forms.py index c6ad0f14..4450b289 100644 --- a/oppurtunity/forms.py +++ b/opportunity/forms.py @@ -1,5 +1,5 @@ from django import forms -from oppurtunity.models import Opportunity +from opportunity.models import Opportunity from common.models import Comment diff --git a/oppurtunity/migrations/0001_initial.py b/opportunity/migrations/0001_initial.py similarity index 100% rename from oppurtunity/migrations/0001_initial.py rename to opportunity/migrations/0001_initial.py diff --git a/oppurtunity/migrations/__init__.py b/opportunity/migrations/__init__.py similarity index 100% rename from oppurtunity/migrations/__init__.py rename to opportunity/migrations/__init__.py diff --git a/oppurtunity/models.py b/opportunity/models.py similarity index 100% rename from oppurtunity/models.py rename to opportunity/models.py diff --git a/oppurtunity/tests.py b/opportunity/tests.py similarity index 100% rename from oppurtunity/tests.py rename to opportunity/tests.py diff --git a/oppurtunity/urls.py b/opportunity/urls.py similarity index 96% rename from oppurtunity/urls.py rename to opportunity/urls.py index d5c1fadd..a4a9b19e 100644 --- a/oppurtunity/urls.py +++ b/opportunity/urls.py @@ -1,5 +1,5 @@ from django.conf.urls import url -from oppurtunity import views +from opportunity import views app_name = 'oppurtunity' diff --git a/oppurtunity/views.py b/opportunity/views.py similarity index 92% rename from oppurtunity/views.py rename to opportunity/views.py index b3412ec6..b2ba446f 100644 --- a/oppurtunity/views.py +++ b/opportunity/views.py @@ -10,8 +10,8 @@ from common.models import User, Comment, Team from common.utils import STAGES, SOURCES, CURRENCY_CODES from accounts.models import Account from contacts.models import Contact -from oppurtunity.models import Opportunity -from oppurtunity.forms import OpportunityForm, OpportunityCommentForm +from opportunity.models import Opportunity +from opportunity.forms import OpportunityForm, OpportunityCommentForm # CRUD Operations Start @@ -37,7 +37,7 @@ def opp_list(request): opportunity_list = opportunity_list.filter(account=opp_account) if opp_contact: opportunity_list = opportunity_list.filter(contacts=opp_contact) - return render(request, "oppurtunity/opportunity.html", { + return render(request, "opportunity/opportunity.html", { 'opportunity_list': opportunity_list, 'accounts': accounts, 'contacts': contacts, @@ -71,13 +71,13 @@ def opp_create(request): if request.is_ajax(): return JsonResponse({'error': False}) if request.POST.get("savenewform"): - return HttpResponseRedirect(reverse("oppurtunities:save")) + return HttpResponseRedirect(reverse("opportunities:save")) else: - return HttpResponseRedirect(reverse('oppurtunities:list')) + return HttpResponseRedirect(reverse('opportunities:list')) else: if request.is_ajax(): return JsonResponse({'error': True, 'opportunity_errors': form.errors}) - return render(request, 'oppurtunity/create_opportunity.html', { + return render(request, 'opportunity/create_opportunity.html', { 'opportunity_form': form, 'accounts': accounts, 'users': users, @@ -90,7 +90,7 @@ def opp_create(request): 'contacts_list': contacts_list }) else: - return render(request, 'oppurtunity/create_opportunity.html', { + return render(request, 'opportunity/create_opportunity.html', { 'opportunity_form': form, 'accounts': accounts, 'users': users, @@ -109,7 +109,7 @@ def opp_view(request, pk): opportunity_record = get_object_or_404( Opportunity.objects.prefetch_related("contacts", "account"), id=pk) comments = opportunity_record.opportunity_comments.all() - return render(request, 'oppurtunity/view_opportunity.html', { + return render(request, 'opportunity/view_opportunity.html', { 'opportunity_record': opportunity_record, 'comments': comments }) @@ -146,11 +146,11 @@ def opp_edit(request, pk): opportunity_obj.contacts.add(*request.POST.getlist("contacts")) if request.is_ajax(): return JsonResponse({'error': False}) - return HttpResponseRedirect(reverse('oppurtunities:list')) + return HttpResponseRedirect(reverse('opportunities:list')) else: if request.is_ajax(): return JsonResponse({'error': True, 'opportunity_errors': form.errors}) - return render(request, 'oppurtunity/create_opportunity.html', { + return render(request, 'opportunity/create_opportunity.html', { 'opportunity_form': form, 'opportunity_obj': opportunity_obj, 'accounts': accounts, @@ -164,7 +164,7 @@ def opp_edit(request, pk): 'contacts_list': contacts_list }) else: - return render(request, 'oppurtunity/create_opportunity.html', { + return render(request, 'opportunity/create_opportunity.html', { 'opportunity_form': form, 'opportunity_obj': opportunity_obj, 'accounts': accounts, @@ -185,7 +185,7 @@ def opp_remove(request, pk): opportunity_record.delete() if request.is_ajax(): return JsonResponse({'error': False}) - return HttpResponseRedirect(reverse('oppurtunities:list')) + return HttpResponseRedirect(reverse('opportunities:list')) def contacts(request): @@ -273,6 +273,6 @@ def remove_comment(request): def get_opportunity(request): if request.method == 'GET': opportunities = Opportunity.objects.all() - return render(request, 'oppurtunity/opportunities_list.html', {'opportunities': opportunities}) + return render(request, 'opportunity/opportunities_list.html', {'opportunities': opportunities}) else: return HttpResponse('Invalid Method or Not Authanticated in load_calls') diff --git a/planner/models.py b/planner/models.py index d1348bc5..6330adf2 100644 --- a/planner/models.py +++ b/planner/models.py @@ -23,7 +23,7 @@ class Reminder(models.Model): class Event(models.Model): limit = models.Q(app_label='account', model='Account', id=10) | \ models.Q(app_label='leads', model='Lead', id=13) | \ - models.Q(app_label='oppurtunity', model='Opportunity', id=14) | \ + models.Q(app_label='opportunity', model='Opportunity', id=14) | \ models.Q(app_label='cases', model='Case', id=11) name = models.CharField( pgettext_lazy("Name of the Event", "Event"), diff --git a/planner/views.py b/planner/views.py index a6da2ac4..e2216de3 100644 --- a/planner/views.py +++ b/planner/views.py @@ -8,7 +8,7 @@ # from django.contrib.auth.models import User # from accounts.models import Account # from cases.models import Case -# from oppurtunity.models import Opportunity +# from opportunity.models import Opportunity # from contacts.models import Contact # from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger # from django.db.models import Q diff --git a/requirements.txt b/requirements.txt index 1294d13c..1a18ffc4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,6 @@ Django==1.11.5 django-simple-pagination==1.1.8 pytz==2017.2 psycopg2==2.7.3.1 +gunicorn==19.6.0 +whitenoise==3.1 +dj-database-url==0.4.1 \ No newline at end of file diff --git a/static/js/accounts/view_account.js b/static/js/accounts/view_account.js index 3386a686..3d568527 100644 --- a/static/js/accounts/view_account.js +++ b/static/js/accounts/view_account.js @@ -42,6 +42,7 @@ $("#comment_form").submit(function (e) { ) $("#id_comments").val("") alert("Comment Submitted") + $("#CommentError").html('') } } }) @@ -73,7 +74,7 @@ $("#comment_edit").click(function (e) { $("#comment_name" + data.commentid).html('
' + data.comment + '
') $('#Comments_Accounts_Modal').modal('hide'); $("#id_editcomment").val("") - $("#CommentEditError").hide() + $("#CommentEditError").html('') } } }) diff --git a/static/js/cases/view_case.js b/static/js/cases/view_case.js index 17b8ddf9..5f1652d7 100644 --- a/static/js/cases/view_case.js +++ b/static/js/cases/view_case.js @@ -42,6 +42,7 @@ $("#comment_form").submit(function (e) { ) $("#id_comments").val("") alert("Comment Submitted") + $("#CommentError").html('') } } }) @@ -72,7 +73,7 @@ $("#comment_edit").click(function (e) { $("#comment_name" + data.commentid).html('
' + data.comment + '
') $('#Comments_Cases_Modal').modal('hide'); $("#id_editcomment").val("") - $("#CommentEditError").hide() + $("#CommentEditError").html('') } } }) diff --git a/static/js/contacts/setstatus.js b/static/js/contacts/setstatus.js index a80bd61b..d1edcc01 100644 --- a/static/js/contacts/setstatus.js +++ b/static/js/contacts/setstatus.js @@ -56,7 +56,7 @@ $('body').on('click', '#selectparent', function (e) { gURL = '/leads/get/list/' } else if ($('#parent_type').val() == 'Opportunity') { - gURL = '/oppurtunities/get/list/' + gURL = '/opportunities/get/list/' } else if ($('#parent_type').val() == 'Case') { gURL = '/cases/get/list/' diff --git a/static/js/contacts/view_contact.js b/static/js/contacts/view_contact.js index 7100caac..b0dc8fb4 100644 --- a/static/js/contacts/view_contact.js +++ b/static/js/contacts/view_contact.js @@ -42,6 +42,7 @@ $("#comment_form").submit(function (e) { ) $("#id_comments").val("") alert("Comment Submitted") + $("#CommentError").html("") } } }) @@ -72,7 +73,7 @@ $("#comment_edit").click(function (e) { $("#comment_name" + data.commentid).html('
' + data.comment + '
') $('#Comments_Contacts_Modal').modal('hide'); $("#id_editcomment").val("") - $("#CommentEditError").hide() + $("#CommentEditError").html("") } } }) diff --git a/static/js/opportunities/contacts.js b/static/js/opportunities/contacts.js index c09591d4..f70a0101 100644 --- a/static/js/opportunities/contacts.js +++ b/static/js/opportunities/contacts.js @@ -16,7 +16,7 @@ function getCookie(name) { $('#id_account').change(function(){ var csrftoken = getCookie('csrftoken'); var Account= $("#id_account").val() - $.get("/oppurtunities/contacts/", {"Account":Account, "csrfmiddlewaretoken": csrftoken}, function(data){ + $.get("/opportunities/contacts/", {"Account":Account, "csrfmiddlewaretoken": csrftoken}, function(data){ $("#id_contacts").html("") $.each(data, function (index, value) { $("#id_contacts").append("") @@ -28,7 +28,7 @@ $("#comment_form").submit(function(e){ e.preventDefault() var formData = new FormData($("#comment_form")[0]); $.ajax({ - url : "/oppurtunities/comment_add/", + url : "/opportunities/comment_add/", type : "POST", data : formData, cache: false, @@ -70,7 +70,7 @@ $("#comment_edit").click(function(e){ e.preventDefault() var formData = new FormData($("#comment_edit_form")[0]); $.ajax({ - url : "/oppurtunities/comment_edit/", + url : "/opportunities/comment_edit/", type : "POST", data : formData, cache: false, @@ -92,7 +92,7 @@ function remove_comment(x){ var csrftoken = getCookie('csrftoken'); var warn = confirm("Are You Sure, you Want to Delete this Comment!?") if (warn == true){ - $.post('/oppurtunities/comment_remove/', {"comment_id":x, "csrfmiddlewaretoken": csrftoken, }, function(data){ + $.post('/opportunities/comment_remove/', {"comment_id":x, "csrfmiddlewaretoken": csrftoken, }, function(data){ if(data.error){ alert(data.error) } else { @@ -107,7 +107,7 @@ function editFun(x) { alert("Heloooooooooooooo") $.ajax({ type: "POST", - url: "/oppurtunities/editdetails/", + url: "/opportunities/editdetails/", data: { csrfmiddlewaretoken: csrftoken, tid: x @@ -137,7 +137,7 @@ function editFun(x) { $('#id_account').change(function() { var Account = $("#id_account").val() var csrftoken = getCookie('csrftoken'); - $.get("/oppurtunities/contacts/", { + $.get("/opportunities/contacts/", { "Account": Account, "csrfmiddlewaretoken": csrftoken }, function(data) { @@ -149,4 +149,4 @@ function editFun(x) { }) }); -} \ No newline at end of file +} diff --git a/static/js/opportunities/view_opportunity.js b/static/js/opportunities/view_opportunity.js index becda37c..ca69d967 100644 --- a/static/js/opportunities/view_opportunity.js +++ b/static/js/opportunities/view_opportunity.js @@ -18,7 +18,7 @@ $("#comment_form").submit(function (e) { e.preventDefault() var formData = new FormData($("#comment_form")[0]); $.ajax({ - url: "/oppurtunities/comment/add/", + url: "/opportunities/comment/add/", type: "POST", data: formData, cache: false, @@ -42,6 +42,7 @@ $("#comment_form").submit(function (e) { ) $("#id_comments").val("") alert("Comment Submitted") + $("#CommentError").html("") } } }) @@ -59,7 +60,7 @@ $("#comment_edit").click(function (e) { e.preventDefault() var formData = new FormData($("#comment_edit_form")[0]); $.ajax({ - url: "/oppurtunities/comment/edit/", + url: "/opportunities/comment/edit/", type: "POST", data: formData, cache: false, @@ -72,7 +73,7 @@ $("#comment_edit").click(function (e) { $("#comment_name" + data.commentid).html('
' + data.comment + '
') $('#Comments_Opportunity_Modal').modal('hide'); $("#id_editcomment").val("") - $("#CommentEditError").hide() + $("#CommentEditError").val("") } } }) @@ -87,7 +88,7 @@ function remove_comment(x) { var csrftoken = getCookie('csrftoken'); var con = confirm("Do you want to Delete it for Sure!?") if (con == true) { - $.post('/oppurtunities/comment/remove/', { + $.post('/opportunities/comment/remove/', { "comment_id": x, "csrfmiddlewaretoken": csrftoken, }, function (data) { diff --git a/static/js/setstatus.js b/static/js/setstatus.js index 52597a4e..6015bdc3 100644 --- a/static/js/setstatus.js +++ b/static/js/setstatus.js @@ -56,7 +56,7 @@ $('body').on('click', '#selectparent', function (e) { gURL = '/leads/get/list/' } else if ($('#parent_type').val() == 'Opportunity') { - gURL = '/oppurtunities/get/list/' + gURL = '/opportunities/get/list/' } else if ($('#parent_type').val() == 'Case') { gURL = '/cases/get/list/' @@ -644,4 +644,4 @@ $('body').on('click', '#created-user-modal-body .paginate-me-users', function (e } }); }); -//////////////////////////////////end created user///////////////////////////////////////////////////////////////////// \ No newline at end of file +//////////////////////////////////end created user///////////////////////////////////////////////////////////////////// diff --git a/static/js/view_lead.js b/static/js/view_lead.js new file mode 100644 index 00000000..9b201698 --- /dev/null +++ b/static/js/view_lead.js @@ -0,0 +1,102 @@ +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_form").submit(function (e) { + e.preventDefault() + var formData = new FormData($("#comment_form")[0]); + $.ajax({ + url: "/leads/comment/add/", + type: "POST", + data: formData, + cache: false, + contentType: false, + processData: false, + 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() + "
  • " + ) + $("#id_comments").val("") + alert("Comment Submitted") + $("#CommentError").html("") + } + } + }) +}) + + +function edit_comment(x) { + $('#Comments_Leads_Modal').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: "/leads/comment/edit/", + type: "POST", + data: formData, + cache: false, + contentType: false, + processData: false, + success: function (data) { + if (data.error) { + $("#CommentEditError").html(data.error).show() + } else { + $("#comment_name" + data.commentid).html('
    ' + data.comment + '
    ') + $('#Comments_Leads_Modal').modal('hide'); + $("#id_editcomment").val("") + $("#CommentEditError").html("") + } + } + }) +}) + + +function HideError(e) { + $("#CommentError").hide() +} + +function remove_comment(x) { + var csrftoken = getCookie('csrftoken'); + var con = confirm("Do you want to Delete it for Sure!?") + if (con == true) { + $.post('/leads/comment/remove/', { + "comment_id": x, + "csrfmiddlewaretoken": csrftoken, + }, function (data) { + if (data.error) { + alert(data.error) + } else { + $("#comment" + data.cid).remove() + } + }) + } +} diff --git a/static/staticfiles.json b/static/staticfiles.json new file mode 100644 index 00000000..a97db543 --- /dev/null +++ b/static/staticfiles.json @@ -0,0 +1 @@ +{"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/view_account.html b/templates/accounts/view_account.html index 7a1e9d9f..57f99cd5 100644 --- a/templates/accounts/view_account.html +++ b/templates/accounts/view_account.html @@ -292,7 +292,7 @@ - + {% endfor %} @@ -327,7 +327,7 @@ {{ contact_form.assigned_to.errors }} @@ -638,7 +638,7 @@ {{ contact_form.assigned_to.errors }} @@ -803,7 +803,7 @@ - + {% endfor %} @@ -838,7 +838,7 @@ {{ opportunity_form.assigned_to.errors }} @@ -991,7 +991,7 @@ @@ -158,7 +158,7 @@ {% csrf_token %}