Skip to content

Commit

Permalink
Merge pull request #50 from ashwin31/ashwin_fixes
Browse files Browse the repository at this point in the history
new ui
  • Loading branch information
ashwin31 authored Apr 20, 2018
2 parents b19abcc + 61c13ff commit 86474e4
Show file tree
Hide file tree
Showing 91 changed files with 329 additions and 11,688 deletions.
18 changes: 0 additions & 18 deletions accounts/templates/account_comments.html

This file was deleted.

46 changes: 24 additions & 22 deletions accounts/templates/accounts.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ <h4>Accounts</h4>
<!-- heading_create ends here -->
<!-- filter_row starts here -->
<div class="filter_row row marl">
<div class="col-md-12">
<div class="col-md-3 col-lg-2 col-xl-2">
<div class="card">
<form id="accounts_filter" method="POST" action="">
<div class="card-body">
<div class="card-title">Filters</div>
<div class="row marl">
<div class="filter_col col-md-4">
<div class="filter_col col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">NAME</label>
<label for="exampleInputEmail1">Name</label>
<input type="text" class="form-control" placeholder="Account Name" name="name" {% if request.POST %} value="{{request.POST.name}}" {%endif%}/>
</div>
</div>
<div class="filter_col col-md-4">
<div class="filter_col col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">CITY</label>
<label for="exampleInputEmail1">City</label>
<input type="text" class="form-control" placeholder="City" name="city" {% if request.POST %} value="{{request.POST.city}}" {%endif%}/>
</div>
</div>
<div class="filter_col col-md-4">
<div class="filter_col col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">INDUSTRY</label>
<label for="exampleInputEmail1">Industry</label>
<select class="form-control" id="id_industry" name="industry" >
<option value="">--Select Type of Industry--</option>
{% for each_industry in industries %}
Expand All @@ -60,13 +60,10 @@ <h4>Accounts</h4>
</div>
</div>
</form>
<br clear="all">
</div>
</div>
</div>
<!-- filter_row ends here -->
<!-- accounts list start -->
<div class="table_container_row row marl">
<div class="col-md-9 col-lg-10 col-xl-10">
<div class="table_container_row row marl no-gutters">
<div class="col-md-12">
<div class="card">
<div class="card-body">
Expand All @@ -75,15 +72,15 @@ <h4>Accounts</h4>
<span class="float-right total_count">{% if show_pageitems %} {% show_pageitems %}{% else %}Total Accounts {{accounts_list|length}}{% endif %}</span>
</div>
<div class="table-responsive">
<table class="table table-bordered table-striped table-condensed">
<table class="table ">
<thead>
<tr>
<th width="5%" style="text-align:center;">S.no</th>
<th width="20%" style="text-align:center;">Name</th>
<th width="15%" style="text-align:center;">City</th>
<th width="15%" style="text-align:center;">State</th>
<th width="20%" style="text-align:center;">Industry</th>
<th width="25%" style="text-align:center;">Actions</th>
<th width="5%">ID</th>
<th width="25%">Name</th>
<th width="15%">City</th>
<th width="15%">State</th>
<th width="20%">Industry</th>
<th width="10%">Actions</th>
</tr>
</thead>
<tbody>
Expand All @@ -100,9 +97,9 @@ <h4>Accounts</h4>
<td>{% if each_account.billing_address.state %}{{ each_account.billing_address.state }} {% else %} Not specified {% endif %}</td>
<td>{% if each_account.industry %}{{ each_account.industry }} {% else %} Not specified {% endif %}</td>
<td class="actions">
<a href="{% url 'accounts:view_account' each_account.id %}" class="btn btn-info view"><i class="fas fa-eye"></i> View</a>
<a href="{% url 'accounts:edit_account' each_account.id %}" class="btn btn-success edit"><i class="fas fa-pencil-alt"></i>Edit</a>
<a href="{% url 'accounts:remove_account' each_account.id %}" class="btn btn-danger delete remove_account"><i class="fas fa-trash-alt"></i>Delete</a>
{# <a href="{% url 'accounts:view_account' each_account.id %}" class="btn btn-info view"><i class="fas fa-eye"></i> View</a> #}
<a href="{% url 'accounts:edit_account' each_account.id %}" class="btn btn-success edit"><i class="fas fa-pencil-alt"></i></a>
<a href="{% url 'accounts:remove_account' each_account.id %}" class="btn btn-danger delete remove_account"><i class="fas fa-trash-alt"></i></a>
</td>
</tr>
{% endfor %}
Expand All @@ -120,6 +117,11 @@ <h6 class="text-center">No Acccount Records Found</h6>
<br clear="all">
</div>
</div>
</div>
</div>
<!-- filter_row ends here -->
<!-- accounts list start -->

<!-- accounts list end -->
</div>
<!-- main_container ends here -->
Expand Down
38 changes: 0 additions & 38 deletions accounts/templates/accounts_list.html

This file was deleted.

12 changes: 9 additions & 3 deletions accounts/templates/view_account.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% block breadcrumb1 %}
{% block breadcrumb %}
<!-- breadcrumb starts here -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
Expand All @@ -9,7 +9,7 @@
</ol>
</nav>
<!-- breadcrumb ends here -->
{% endblock breadcrumb1 %}
{% endblock breadcrumb %}
{% block content %}
<!-- ACCOUNTS VIEW STARTS -->
<div class="main_container" id="maincontainer">
Expand Down Expand Up @@ -1997,7 +1997,13 @@ <h4 class="modal-title" id="myLargeModalLabel" style="text-align:center;">CASES<
url = $(this).attr('href')
if (!confirm('Are you sure you want to delete?'))
return;
window.location = $(this).attr('href')
$.ajax({
type:"POST",
url: url,
success: function(){
location.reload(true);
}
});
});
</script>
<script type="text/javascript">
Expand Down
3 changes: 1 addition & 2 deletions accounts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
url(r'^(?P<account_id>\d*)/view/$', views.view_account, name="view_account"),
url(r'^(?P<edid>\d*)/edit/$', views.edit_account, name="edit_account"),
url(r'^(?P<aid>\d*)/delete/$', views.remove_account, name="remove_account"),
url(r'^get/list/$', views.get_accounts, name='get_accounts'),
# comments

url(r'^comment/add/$', views.add_comment, name='add_comment'),
url(r'^comment/edit/$', views.edit_comment, name='edit_comment'),
url(r'^comment/remove/$', views.remove_comment, name='remove_comment'),
Expand Down
17 changes: 0 additions & 17 deletions accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,20 +240,3 @@ def remove_comment(request):
return JsonResponse({"error": "You Dont have permisions to delete"})
else:
return HttpResponse("Something Went Wrong")


# Comments Section Ends


@login_required
def get_accounts(request):
if request.method == 'GET':
if request.user.is_authenticated:
accounts = Account.objects.all()
return render(request, 'accounts_list.html', {
'accounts': accounts})
else:
return HttpResponseRedirect('accounts/login')
else:
return HttpResponse('Invalid Method or Not Authanticated in load_calls')
return HttpResponse('Oops!! Something Went Wrong.. in load_calls')
22 changes: 13 additions & 9 deletions cases/templates/cases.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ <h4>Cases</h4>
<!-- heading_create ends here -->
<!-- filter_row starts here -->
<div class="filter_row row marl">
<div class="col-md-12">
<div class="col-md-3 col-xl-2">
<div class="card">
<form id="cases_filter" method="POST" action="" >
<div class="card-body">
<div class="card-title">Filters</div>
<div class="row marl">
<div class="filter_col col-md-3">
<div class="filter_col col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">Name</label>
<input type="text" class="form-control" placeholder="Name" name="name" value="{{request.POST.name}}">
</div>
</div>
<div class="filter_col col-md-3">
<div class="filter_col col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">Status</label>
<select class="form-control" id="id_status" name="status" >
Expand All @@ -45,7 +45,7 @@ <h4>Cases</h4>
</select>
</div>
</div>
<div class="filter_col col-md-3">
<div class="filter_col col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">Priority</label>
<select class="form-control" id="id_priority" name="priority" >
Expand All @@ -56,7 +56,7 @@ <h4>Cases</h4>
</select>
</div>
</div>
<div class="filter_col col-md-3">
<div class="filter_col col-md-12">
<div class="form-group">
<label for="exampleInputEmail1">Account</label>
<select class="form-control" id="id_account" name="account">
Expand All @@ -81,10 +81,9 @@ <h4>Cases</h4>
<br clear="all">
</div>
</div>
</div>
<!-- filter_row ends here -->
<!-- cases_list starts here -->
<div class="table_container_row row marl">
<div class="col-md-9 col-xl-10">
<!-- cases_list starts here -->
<div class="table_container_row row marl no-gutters">
<div class="col-md-12">
<div class="card">

Expand Down Expand Up @@ -148,6 +147,11 @@ <h6 class="text-center">No Cases Records Found</h6>
</div>
</div>
<!-- cases_list ends here -->
</div>

</div>
<!-- filter_row ends here -->

</div>
<!-- main_container ends here -->
{% endblock %}
Expand Down
7 changes: 4 additions & 3 deletions cases/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,11 @@ def edit_case(request, case_id):
@login_required
def remove_case(request, case_id):
if request.method == 'POST':
cid = request.POST['case_id']
get_object_or_404(Case, id=cid).delete()
get_object_or_404(Case, id=case_id).delete()
if request.is_ajax():
return JsonResponse({'error': False})
count = Case.objects.filter(Q(assigned_to=request.user) | Q(created_by=request.user)).count()
data = {"case_id": cid, "count": count}
data = {"case_id": case_id, "count": count}
return JsonResponse(data)
else:
Case.objects.filter(id=case_id).delete()
Expand Down
8 changes: 7 additions & 1 deletion common/templates/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@
<div class="filter_col col-md-12">
<div class="form-group">
<label for="id_role">User Role{% if user_form.role.field.required %}<span class="error">*</span>{% endif %}</label>
{{ user_form.role }}
{% if request.user.role == 'ADMIN' %}
{{ user_form.role }}
{% else %}
<select name="role">
<option value="{{user_obj.role}}">{{user_obj.role}}</option>
</select>
{% endif %}
<span class="error">{{ user_form.role.errors }}</span>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion common/urls.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from django.conf.urls import url
from common import views
from django.contrib.auth import views as auth_views

app_name = 'common'


urlpatterns = [
url(r'^$', views.home, name="home"),
url(r'^login/$', views.login_crm, name="login"),
url(r'^forgot-password/$', views.forgot_password, name="forgot_password"),
url(r'^logout/$', views.logout_crm, name="logout"),
url(r'^change-password/$', views.change_pass, name="change_pass"),
url(r'^profile/$', views.profile, name="profile"),
Expand Down
11 changes: 7 additions & 4 deletions common/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,18 @@ def login_crm(request):
login(request, user)
return HttpResponseRedirect('/')
else:
return render(request, "login.html", {"error": True, "inactiveuser": form.errors})
return render(request, "login.html", {"error": True, "message": "Your Account is InActive. Please Contact Administrator"})
else:
return render(request, "login.html", {"error": True, "usernone": form.errors})
return render(request, "login.html", {"error": True, "message": "Your Account is not Found. Please Contact Administrator"})
else:
return render(request, "login.html", {"error": True, "errors": form.errors})
return render(request, "login.html", {"error": True, "message": "Your username and password didn't match. Please try again."})
return render(request, 'login.html')


def forgot_password(request):
return render(request, 'forgot_password.html')


def logout_crm(request):
logout(request)
request.session.flush()
Expand Down Expand Up @@ -135,7 +139,6 @@ def view_user(request, user_id):
})


@admin_required
def edit_user(request, user_id):
user_obj = get_object_or_404(User, id=user_id)
user_form = UserForm(instance=user_obj)
Expand Down
Loading

0 comments on commit 86474e4

Please sign in to comment.