UI Changes
diff --git a/erpnext/templates/pages/projects.html b/erpnext/templates/pages/projects.html
index fef79ce..199d63c 100644
--- a/erpnext/templates/pages/projects.html
+++ b/erpnext/templates/pages/projects.html
@@ -4,6 +4,10 @@
{%- from "templates/includes/projects/macros.html" import back_link -%}
+{% block header_actions %}
+{% include 'templates/includes/projects/project_search_box.html' %}
+{% endblock %}
+
{% block breadcrumbs %}
<div class="page-breadcrumbs" data-html-block="breadcrumbs">
<ul class="breadcrumb">
@@ -15,11 +19,6 @@
</div>
{% endblock %}
-{% block header %}
-<h1 class= "title">
-{{ doc.project_name }}
-</h1>
-{% endblock %}
{% block style %}
<style>
@@ -30,28 +29,31 @@
{% block page_content %}
-{% include 'templates/includes/projects/project_search_box.html' %}
-
-<!-- {% if frappe.form_dict.q %}
- <p class="text-muted"> <a href="/projects?project={{doc.name}}" class="text-muted">
- Filtered by "{{ frappe.form_dict.q }}" Clear</a></p>
-{% else %}
- <h3>{{ _("Activity Feed") }}</h3>
- <div class='project-timelines timeline-centered'>
- {% include "erpnext/templates/includes/projects/timeline.html" %}
- </div>
- {% if doc.timelines|length > 9 %}
- <p><a class='more-timelines small underline'>{{ _("More") }}</a><p>
- {% endif %}
-
-{% endif %} -->
-
-<div class='padding'></div>
-
-<h3>{{ _("Tasks") }}</h3>
+<div class="row">
+<div class="col-xs-6">
+<h2 class= "title">
+ {{ doc.project_name }}
+</h2>
+</div>
+<div class="col-xs-6">
+ {% if doc.percent_complete %}
+ <div class="progress progress-hg">
+ <div class="progress-bar progress-bar-warning active" role="progressbar"
+ aria-valuenow="{{ doc.percent_complete|round|int }}"
+ aria-valuemin="0" aria-valuemax="100" style="width:{{ doc.percent_complete|round|int }}%;">
+ </div>
+ </div>
+ {% endif %}
+</div>
+</div>
+<hr class="small">
+
+<div class="clearfix">
+ <h4 style="float: left;">{{ _("Tasks") }}</h4>
+ <a class="btn btn-secondary btn-default" style="float: right; position: relative; top: 20px;" href='/tasks?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New task</a>
+</div>
<p>
-<a class='small underline' href='/tasks?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New task</a>
<a class='small underline task-status-switch' data-status='Open'>{{ _("Show closed") }}</a>
</p>
@@ -67,28 +69,9 @@
{% endif %}
-<!-- <div class='padding'></div>
-<h3>{{ _("Issues") }}</h3>
-
-<p>
- <a class='small underline' href='/issues?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New issue</a>
- <a class='small underline issue-status-switch' data-status='Open'>{{ _("Show closed") }}</a>
-</p>
-
-{% if doc.issues %}
- <div class='project-issue-section'>
- <div class='project-issue'>
- {% include "erpnext/templates/includes/projects/project_issues.html" %}
- </div>
- <p><a id='more-issue' style='display: none;' class='more-issues small underline'>{{ _("More") }}</a><p>
- </div>
-{% else %}
- <p class="text-muted">No Issues</p>
-{% endif %} -->
-
<div class='padding'></div>
-<h3>{{ _("Time Logs") }}</h3>
+<h4>{{ _("Time Logs") }}</h4>
{% if doc.timelogs %}
<div class='project-timelogs'>
diff --git a/erpnext/templates/pages/projects.js b/erpnext/templates/pages/projects.js
index a0e0ee0..de9cb76 100644
--- a/erpnext/templates/pages/projects.js
+++ b/erpnext/templates/pages/projects.js
@@ -66,6 +66,7 @@
},
dataType: "json",
success: function(data) {
+ console.log(data.message);
if(typeof data.message == 'undefined') {
$('.project-'+ item).html("No "+ item_status +" "+ item);
$(".more-"+ item).toggle(false);
diff --git a/erpnext/templates/pages/projects.py b/erpnext/templates/pages/projects.py
index c2cb6c7..86f064c 100644
--- a/erpnext/templates/pages/projects.py
+++ b/erpnext/templates/pages/projects.py
@@ -11,67 +11,17 @@
project = frappe.get_doc('Project', frappe.form_dict.project)
project.has_permission('read')
-
- context.issues = frappe.get_all('Issue', filters={'project': project.project_name},
- fields=['subject', 'opening_date', 'resolution_date', 'status', 'name', 'resolution_details','modified','modified_by'])
-
+
project.tasks = get_tasks(project.name, start=0, item_status='open',
search=frappe.form_dict.get("q"))
- project.issues = get_issues(project.name, start=0, item_status='open',
- search=frappe.form_dict.get("q"))
-
project.timelogs = get_timelogs(project.name, start=0,
search=frappe.form_dict.get("q"))
- project.timelines = get_timeline(project.project_name, start=0)
-
-
context.doc = project
-def get_timeline(project, start=10):
- '''Get timeline from project, tasks, issues'''
- issues_condition = ''
- project_issues = get_issues(project)
-
- if project_issues:
- issue_names = '({0})'.format(", ".join(["'{0}'".format(i.name) for i in project_issues]))
- issues_condition = """or (reference_doctype='Issue' and reference_name IN {issue_names})""".format(issue_names=issue_names)
-
-
- timelines = frappe.db.sql("""
- select
- sender_full_name,
- subject, communication_date, comment_type, name, creation, modified_by, reference_doctype, reference_name,
- _liked_by, comment_type, _comments
- from
- tabCommunication
- where
- (reference_doctype='Project' and reference_name=%s)
- or (timeline_doctype='Project' and timeline_name=%s)
- {issues_condition}
- order by
- modified DESC limit {start}, {limit}""".format(
- issues_condition=issues_condition, start=start, limit=10),
- (project, project), as_dict=True);
- for timeline in timelines:
- timeline.user_image = frappe.db.get_value('User', timeline.modified_by, 'user_image')
- return timelines
-
-@frappe.whitelist()
-def get_timelines_html(project, start=0):
- return frappe.render_template("erpnext/templates/includes/projects/timeline.html",
- {"doc": {
- "timelines": get_timeline(project, start)}
- }, is_path=True)
-
-def get_issue_list(project):
- return [issue.name for issue in get_issues(project)]
-
-
-
def get_tasks(project, start=0, search=None, item_status=None):
filters = {"project": project}
if search:
@@ -79,7 +29,7 @@
if item_status:
filters["status"] = item_status
tasks = frappe.get_all("Task", filters=filters,
- fields=["name", "subject", "status", "exp_start_date", "exp_end_date", "priority", "_seen"],
+ fields=["name", "subject", "status", "_seen", "_comments", "modified", "description"],
limit_start=start, limit_page_length=10)
for task in tasks:
@@ -90,8 +40,8 @@
task.todo=task.todo[0]
task.todo.user_image = frappe.db.get_value('User', task.todo.owner, 'user_image')
- if task._comments:
- task.comment_count = len(json.loads(task._comments or "[]"))
+
+ task.comment_count = len(json.loads(task._comments or "[]"))
task.css_seen = ''
if task._seen:
@@ -109,52 +59,23 @@
"tasks": get_tasks(project, start, item_status=item_status)}
}, is_path=True)
-
-
-
-def get_issues(project, start=0, search=None, item_status=None):
- filters = {"project": project}
- if search:
- filters["subject"] = ("like", "%{0}%".format(search))
- if item_status:
- filters["status"] = item_status
- issues = frappe.get_all("Issue", filters=filters,
- fields=["name", "subject", "status", "opening_date", "resolution_date", "resolution_details"],
- order_by='modified desc',
- limit_start=start, limit_page_length=10)
-
- for issue in issues:
- issue.todo = frappe.get_all('ToDo',filters={'reference_name':issue.name, 'reference_type':'Issue'},
- fields=["assigned_by", "owner", "modified", "modified_by"])
- if issue.todo:
- issue.todo=issue.todo[0]
- issue.todo.user_image = frappe.db.get_value('User', issue.todo.owner, 'user_image')
-
- return issues
-
-@frappe.whitelist()
-def get_issue_html(project, start=0, item_status=None):
- return frappe.render_template("erpnext/templates/includes/projects/project_issues.html",
- {"doc": {
- "name": project,
- "project_name": project,
- "issues": get_issues(project, start, item_status=item_status)}
- }, is_path=True)
-
-
-
-
-
def get_timelogs(project, start=0, search=None):
filters = {"project": project}
if search:
filters["title"] = ("like", "%{0}%".format(search))
timelogs = frappe.get_all('Time Log', filters=filters,
- fields=['name','title','task','activity_type','from_time','to_time','hours','status','modified','modified_by'],
+ fields=['name','title','task','activity_type','from_time','to_time','_comments','_seen','status','modified','modified_by'],
limit_start=start, limit_page_length=10)
for timelog in timelogs:
timelog.user_image = frappe.db.get_value('User', timelog.modified_by, 'user_image')
+
+ timelog.comment_count = len(json.loads(timelog._comments or "[]"))
+
+ timelog.css_seen = ''
+ if timelog._seen:
+ if frappe.session.user in json.loads(timelog._seen):
+ timelog.css_seen = 'seen'
return timelogs
@frappe.whitelist()