Added task and issue webforms and few fixes

This commit is contained in:
Kanchan Chauhan 2016-03-23 14:14:38 +05:30
parent 2d832bba70
commit e14389ec6e
5 changed files with 473 additions and 17 deletions

View File

@ -1,4 +1,437 @@
[
{
"allow_comments": 1,
"allow_delete": 1,
"allow_edit": 1,
"allow_multiple": 1,
"breadcrumbs": "[{\"title\":\"Collaborative Project Management\", \"name\":\"projects?project=Collaborative Project Management\"}]",
"doc_type": "Task",
"docstatus": 0,
"doctype": "Web Form",
"introduction_text": null,
"is_standard": 1,
"login_required": 1,
"modified": "2016-03-06 02:09:28.583572",
"name": "tasks",
"page_name": "tasks",
"published": 1,
"success_message": null,
"success_url": "/projects?project=Collaborative Project Management",
"title": "Tasks",
"web_form_fields": [
{
"default": null,
"description": null,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
"label": "Project",
"options": "Project",
"read_only": 1,
"reqd": 1
},
{
"default": null,
"description": null,
"fieldname": "subject",
"fieldtype": "Data",
"hidden": 0,
"label": "Subject",
"options": null,
"read_only": 0,
"reqd": 1
},
{
"default": null,
"description": null,
"fieldname": "description",
"fieldtype": "Text",
"hidden": 0,
"label": "Details",
"options": null,
"read_only": 0,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "priority",
"fieldtype": "Select",
"hidden": 0,
"label": "Priority",
"options": "Low\nMedium\nHigh\nUrgent",
"read_only": 0,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "exp_start_date",
"fieldtype": "Date",
"hidden": 0,
"label": "Expected Start Date",
"options": null,
"read_only": 0,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "exp_end_date",
"fieldtype": "Date",
"hidden": 0,
"label": "Expected End Date",
"options": null,
"read_only": 0,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"label": "Status",
"options": "Open\nWorking\nPending Review\nOverdue\nClosed\nCancelled",
"read_only": 0,
"reqd": 0
}
],
"web_page_link_text": null
},
{
"allow_comments": 0,
"allow_delete": 1,
"allow_edit": 0,
"allow_multiple": 0,
"breadcrumbs": "[{\"title\":\"Collaborative Project Management\", \"name\":\"project?project=Collaborative Project Management\"}]",
"doc_type": "Time Log",
"docstatus": 0,
"doctype": "Web Form",
"introduction_text": null,
"is_standard": 0,
"login_required": 1,
"modified": "2016-03-11 12:26:41.147028",
"name": "time-log",
"page_name": "time-log",
"published": 1,
"success_message": null,
"success_url": "/test?project=Collaborative Project Management",
"title": "Time Log",
"web_form_fields": [
{
"default": null,
"description": null,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
"label": "Project",
"options": "Project",
"read_only": 1,
"reqd": 1
},
{
"default": null,
"description": null,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"label": "Title",
"options": null,
"read_only": 1,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "employee",
"fieldtype": "Link",
"hidden": 0,
"label": "Employee",
"options": "Employee",
"read_only": 1,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "from_time",
"fieldtype": "Date",
"hidden": 0,
"label": "From Time",
"options": null,
"read_only": 1,
"reqd": 1
},
{
"default": null,
"description": null,
"fieldname": "to_time",
"fieldtype": "Date",
"hidden": 0,
"label": "To Time",
"options": null,
"read_only": 1,
"reqd": 1
},
{
"default": "0",
"description": null,
"fieldname": "hours",
"fieldtype": "Data",
"hidden": 0,
"label": "Hours",
"options": null,
"read_only": 1,
"reqd": 0
},
{
"default": null,
"description": "Will be updated when batched.",
"fieldname": "time_log_batch",
"fieldtype": "Link",
"hidden": 0,
"label": "Time Log Batch",
"options": "Time Log Batch",
"read_only": 0,
"reqd": 0
},
{
"default": "Open",
"description": null,
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"label": "Status",
"options": "Open\nWorking\nPending Review\nClosed\nCancelled",
"read_only": 1,
"reqd": 1
},
{
"default": null,
"description": null,
"fieldname": "note",
"fieldtype": "Text",
"hidden": 0,
"label": "Note",
"options": null,
"read_only": 1,
"reqd": 0
}
],
"web_page_link_text": null
},
{
"allow_comments": 1,
"allow_delete": 1,
"allow_edit": 1,
"allow_multiple": 1,
"breadcrumbs": "[{\"title\":\"Collaborative Project Management\", \"name\":\"projects?project=Collaborative Project Management\"}]",
"doc_type": "Issue",
"docstatus": 0,
"doctype": "Web Form",
"introduction_text": null,
"is_standard": 1,
"login_required": 1,
"modified": "2016-03-11 13:10:53.133110",
"name": "issues-view",
"page_name": "issues-view",
"published": 1,
"success_message": null,
"success_url": "/projects?project=Collaborative Project Management",
"title": "Issues-view",
"web_form_fields": [
{
"default": null,
"description": null,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
"label": "Project",
"options": "Project",
"read_only": 1,
"reqd": 1
},
{
"default": null,
"description": null,
"fieldname": "subject",
"fieldtype": "Data",
"hidden": 0,
"label": "Subject",
"options": null,
"read_only": 1,
"reqd": 1
},
{
"default": null,
"description": null,
"fieldname": "description",
"fieldtype": "Text",
"hidden": 0,
"label": "Description",
"options": null,
"read_only": 1,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "raised_by",
"fieldtype": "Data",
"hidden": 0,
"label": "Raised By (Email)",
"options": "Email",
"read_only": 1,
"reqd": 0
},
{
"default": "Today",
"description": null,
"fieldname": "opening_date",
"fieldtype": "Date",
"hidden": 0,
"label": "Opening Date",
"options": null,
"read_only": 1,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "resolution_date",
"fieldtype": "Datetime",
"hidden": 0,
"label": "Resolution Date",
"options": null,
"read_only": 0,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "resolution_details",
"fieldtype": "Data",
"hidden": 0,
"label": "Resolution Details",
"options": null,
"read_only": 0,
"reqd": 0
},
{
"default": "Open",
"description": null,
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"label": "Status",
"options": "Open\nReplied\nHold\nClosed",
"read_only": 0,
"reqd": 0
}
],
"web_page_link_text": null
},
{
"allow_comments": 1,
"allow_delete": 1,
"allow_edit": 1,
"allow_multiple": 1,
"breadcrumbs": "[{\"title\":\"Collaborative Project Management\", \"name\":\"projects?project=Collaborative Project Management\"}]",
"doc_type": "Task",
"docstatus": 0,
"doctype": "Web Form",
"introduction_text": null,
"is_standard": 1,
"login_required": 1,
"modified": "2016-03-15 00:00:39.230196",
"name": "tasks-view",
"page_name": "tasks-view",
"published": 1,
"success_message": null,
"success_url": "/projects?project=Collaborative Project Management",
"title": "Tasks-view",
"web_form_fields": [
{
"default": null,
"description": null,
"fieldname": "project",
"fieldtype": "Link",
"hidden": 0,
"label": "Project",
"options": "Project",
"read_only": 1,
"reqd": 1
},
{
"default": null,
"description": null,
"fieldname": "subject",
"fieldtype": "Data",
"hidden": 0,
"label": "Subject",
"options": null,
"read_only": 1,
"reqd": 1
},
{
"default": null,
"description": null,
"fieldname": "description",
"fieldtype": "Data",
"hidden": 0,
"label": "Details",
"options": null,
"read_only": 1,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "exp_start_date",
"fieldtype": "Date",
"hidden": 0,
"label": "Expected Start Date",
"options": null,
"read_only": 1,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "exp_end_date",
"fieldtype": "Date",
"hidden": 0,
"label": "Expected End Date",
"options": null,
"read_only": 1,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "priority",
"fieldtype": "Select",
"hidden": 0,
"label": "Priority",
"options": "Low\nMedium\nHigh\nUrgent",
"read_only": 1,
"reqd": 0
},
{
"default": null,
"description": null,
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"label": "Status",
"options": "Open\nWorking\nPending Review\nOverdue\nClosed\nCancelled",
"read_only": 0,
"reqd": 0
}
],
"web_page_link_text": null
},
{
"allow_comments": 1,
"allow_delete": 1,

View File

@ -23,8 +23,29 @@
.content_display{
padding: 5px;
font-weight: normal;
font-size: 12px;
vertical-align: middle;
color: #6c7680;
}
.close-btn{
display: none;
}
.content_display:hover .close-btn{
display : block;
}
.btn-link{
padding: 0 10px 0 0;
}
.bold {
font-weight: bold;
}
.task-btn, .issue-btn, .timelog-btn{
padding: 8px;
}

View File

@ -20,9 +20,9 @@
{% endblock %}
{% block style %}
<style>
{% include "templates/includes/projects.css" %}
</style>
<style>
{% include "templates/includes/projects.css" %}
</style>
{% endblock %}
@ -51,14 +51,14 @@
<h3>{{ _("Tasks") }}</h3>
</div>
<div class="btn-group btn-toggle">
<button class="btn btn-xs btn-open-tasks" style="float:left;">Open</button>
<button class="btn btn-xs btn-closed-tasks">Close</button>
<button class="btn btn-link btn-open-tasks"><span class="indicator orange"></span>Open</button>
<button class="btn btn-link btn-closed-tasks"><span class="indicator green"></span>Closed</button>
</div>
<div class='project-tasks'>
{% include "erpnext/templates/includes/projects/project_tasks.html" %}
</div>
{% if doc.tasks|length > 4 %}
{% if doc.tasks|length > 9 %}
<p><a id= 'more-tasks' class='more-tasks small underline'>{{ _("More") }}</a><p>
{% endif %}
</div>
@ -74,14 +74,14 @@
<h3>{{ _("Issues") }}</h3>
</div>
<div class="btn-group btn-toggle">
<button class="btn btn-xs btn-open-issues" style="float:left;">Open</button>
<button class="btn btn-xs btn-closed-issues">Close</button>
<button class="btn btn-link btn-open-issues"><span class="indicator red"></span>Open</button>
<button class="btn btn-link btn-closed-issues"><span class="indicator green"></span>Closed</button>
</div>
<div class='project-issues'>
{% include "erpnext/templates/includes/projects/project_issues.html" %}
</div>
{% if doc.issues|length > 4 %}
{% if doc.issues|length > 9 %}
<p><a id='more-issues' class='more-issues small underline'>{{ _("More") }}</a><p>
{% endif %}
</div>
@ -94,7 +94,7 @@
<div class='project-timelogs'>
{% include "erpnext/templates/includes/projects/project_timelogs.html" %}
</div>
{% if doc.timelogs|length > 1 %}
{% if doc.timelogs|length > 9 %}
<p><a class='more-timelogs small underline'>{{ _("More") }}</a><p>
{% endif %}
{% else %}

View File

@ -61,8 +61,8 @@ frappe.ready(function() {
success: function(data) {
$('.project-'+ item).html(data.message);
$('.project-'+ item +'-section .btn-group .btn-primary').removeClass('btn-primary');
$('.btn-'+ item_status +'-'+ item).addClass( "btn-primary" );
$('.project-'+ item +'-section .btn-group .bold').removeClass('bold');
$('.btn-'+ item_status +'-'+ item).addClass( "bold" );
$(".more-"+ item).toggle(true);
}
});

View File

@ -71,12 +71,14 @@ def get_tasks(project, start=0, search=None, item_status=None):
limit_start=start, limit_page_length=10)
for task in tasks:
print task._comments
task.todo = frappe.get_all('ToDo',filters={'reference_name':task.name, 'reference_type':'Task'},
fields=["assigned_by", "owner", "modified", "modified_by"])
if task.todo:
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(_comments or "[]"))
return tasks
@frappe.whitelist()