From 7cc99ab63b9a6cd9be162d9877ba16ea611d88a7 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 21 Nov 2022 17:41:42 +0530 Subject: [PATCH 1/3] fix: update tasks route under website route rules --- erpnext/hooks.py | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index f9ddb12d86..4f42cca73b 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -175,6 +175,7 @@ website_route_rules = [ }, }, {"from_route": "/project", "to_route": "Project"}, + {"from_route": "/tasks", "to_route": "Task"}, ] standard_portal_menu_items = [ From 80e45828ae143338f69cc73db198a4e0dd6d4503 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 21 Nov 2022 17:42:53 +0530 Subject: [PATCH 2/3] fix: ux for project view on web --- .../includes/projects/project_tasks.html | 56 ++++++- erpnext/templates/pages/projects.html | 140 ++++++------------ 2 files changed, 101 insertions(+), 95 deletions(-) diff --git a/erpnext/templates/includes/projects/project_tasks.html b/erpnext/templates/includes/projects/project_tasks.html index 2b07a5f0d0..4069d3dcca 100644 --- a/erpnext/templates/includes/projects/project_tasks.html +++ b/erpnext/templates/includes/projects/project_tasks.html @@ -1,5 +1,57 @@ +{% macro task_row(task, indent) %} +
+ +
{{ task.status }}
+
+ {% if task.exp_end_date %} + {{ task.exp_end_date }} + {% else %} + -- + {% endif %} +
+
+ {% if task["_assign"] %} + {% set assigned_users = json.loads(task["_assign"])%} + {% for user in assigned_users %} + {% set user_details = frappe.db.get_value("User", user, + ["full_name", "user_image"], + as_dict = True)%} + {% if user_details.user_image %} + + + + {% else %} + +
+ {{ frappe.utils.get_abbr(user_details.full_name) }} +
+
+ {% endif %} + {% endfor %} + {% endif %} +
+
+ {{ frappe.utils.pretty_date(task.modified) }} +
+
+{% if task.children %} + {% for child in task.children %} + {{ task_row(child, indent + 30) }} + {% endfor %} +{% endif %} +{% endmacro %} + {% for task in doc.tasks %}
- {{ task_row(task, 0) }} + {{ task_row(task, 0) }}
-{% endfor %} +{% endfor %} \ No newline at end of file diff --git a/erpnext/templates/pages/projects.html b/erpnext/templates/pages/projects.html index 6d366c5ffe..cfe1cc8ff6 100644 --- a/erpnext/templates/pages/projects.html +++ b/erpnext/templates/pages/projects.html @@ -9,7 +9,7 @@ {% endblock %} {% block header %} -

{{ doc.project_name }}

+ {% endblock %} {% block style %} @@ -21,57 +21,58 @@ {% endblock %} {% block page_content %} - - {{ progress_bar(doc.percent_complete) }} - -
-

Status:

-

Progress: - {{ doc.percent_complete }} - % -

-

Hours Spent: - {{ doc.actual_time }} -

+
+
+
Status: {{ doc.status }}
+
Progress: {{ doc.percent_complete }}%
+
Hours Spent: {{ doc.actual_time | round }}
+
{{ progress_bar(doc.percent_complete) }} +
+ {% if doc.tasks %} -
-
-
-
-

Tasks

-

Status

-

End Date

-

Assigned To

- -
-
- {% include "erpnext/templates/includes/projects/project_tasks.html" %} -
+
+ + +
+
+
+
+
+
Tasks
+
Status
+
End Date
+
Assignment
+
Modified On
+
+
+ {% include "erpnext/templates/includes/projects/project_tasks.html" %} +
+
{% else %}

{{ _("No Tasks") }}

{% endif %} {% if doc.timesheets %} +
-
-

Timesheets

-

Status

-

From

-

To

-

Modified By

-

Modified On

+
+
Timesheet
+
Status
+
From
+
To
+
Modified By
+
Modified On
- {% include "erpnext/templates/includes/projects/project_timesheets.html" %} + {% include "erpnext/templates/includes/projects/project_timesheets.html" %}
{% else %} @@ -104,70 +105,23 @@
+ { % include "frappe/public/js/frappe/provide.js" % } + { % include "frappe/public/js/frappe/form/formatters.js" % } + {% endblock %} {% macro progress_bar(percent_complete) %} {% if percent_complete %} -
-
+ Project Progress: +
+
+
{% else %}
{% endif %} {% endmacro %} - -{% macro task_row(task, indent) %} -
- -
{{ task.status }}
-
- {% if task.exp_end_date %} - {{ task.exp_end_date }} - {% else %} - -- - {% endif %} -
-
- {% if task["_assign"] %} - {% set assigned_users = json.loads(task["_assign"])%} - {% for user in assigned_users %} - {% set user_details = frappe.db.get_value("User", user, - ["full_name", "user_image"], - as_dict = True)%} - {% if user_details.user_image %} - - - - {% else %} - -
- {{ frappe.utils.get_abbr(user_details.full_name) }} -
-
- {% endif %} - {% endfor %} - {% endif %} -
-
- {{ frappe.utils.pretty_date(task.modified) }} -
-
-{% if task.children %} - {% for child in task.children %} - {{ task_row(child, indent + 30) }} - {% endfor %} -{% endif %} -{% endmacro %} From 5d9960ae5b5731063bde84b7c98737d6a9a70198 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Mon, 21 Nov 2022 19:37:57 +0530 Subject: [PATCH 3/3] feat: handle empty state --- erpnext/templates/pages/projects.html | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/erpnext/templates/pages/projects.html b/erpnext/templates/pages/projects.html index cfe1cc8ff6..9fe4338477 100644 --- a/erpnext/templates/pages/projects.html +++ b/erpnext/templates/pages/projects.html @@ -33,13 +33,13 @@
- {% if doc.tasks %} + {% if doc.tasks %}
@@ -55,11 +55,11 @@
{% else %} -

{{ _("No Tasks") }}

+ {{ empty_state('Task')}} {% endif %} - {% if doc.timesheets %} + {% if doc.timesheets %}
@@ -76,7 +76,7 @@
{% else %} -

{{ _("No Timesheets") }}

+ {{ empty_state('Timesheet')}} {% endif %} {% if doc.attachments %} @@ -121,7 +121,21 @@ aria-valuemax="100" style="width:{{ percent_complete|round|int }}%;">
-{% else %} -
{% endif %} {% endmacro %} + + +{% macro empty_state(section_name) %} +
+
+
+
+
+ Generic Empty State +
+

You haven't created a {{ section_name }} yet

+
+
+
+
+{% endmacro %} \ No newline at end of file