[WIP] Task statuses updated in website
diff --git a/erpnext/projects/doctype/timesheet/timesheet.json b/erpnext/projects/doctype/timesheet/timesheet.json
index 80c384e..59af587 100644
--- a/erpnext/projects/doctype/timesheet/timesheet.json
+++ b/erpnext/projects/doctype/timesheet/timesheet.json
@@ -617,5 +617,5 @@
  "read_only": 0, 
  "read_only_onload": 0, 
  "sort_order": "ASC", 
- "track_seen": 0
+ "track_seen": 1
 }
\ No newline at end of file
diff --git a/erpnext/projects/web_form/tasks/tasks.py b/erpnext/projects/web_form/tasks/tasks.py
index 2334f8b..6f387fe 100644
--- a/erpnext/projects/web_form/tasks/tasks.py
+++ b/erpnext/projects/web_form/tasks/tasks.py
@@ -3,5 +3,8 @@
 import frappe
 
 def get_context(context):
-	# do your magic here
-	pass
+	if frappe.form_dict.project:
+		context.parents = [{'title': frappe.form_dict.project, 'route': '/projects?project='+ frappe.form_dict.project}]
+		
+	elif context.doc and context.doc.get('project'):
+		context.parents = [{'title': context.doc.project, 'route': '/projects?project='+ context.doc.project}]
\ No newline at end of file
diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json
index 037f1e8..f07bc8e 100644
--- a/erpnext/selling/doctype/quotation/quotation.json
+++ b/erpnext/selling/doctype/quotation/quotation.json
@@ -6,6 +6,7 @@
  "beta": 0, 
  "creation": "2013-05-24 19:29:08", 
  "custom": 0, 
+ "default_print_format": "test123", 
  "docstatus": 0, 
  "doctype": "DocType", 
  "document_type": "Document", 
@@ -2125,6 +2126,7 @@
  "hide_toolbar": 0, 
  "icon": "icon-shopping-cart", 
  "idx": 82, 
+ "image_view": 0, 
  "in_create": 0, 
  "in_dialog": 0, 
  "is_submittable": 1, 
@@ -2132,7 +2134,7 @@
  "istable": 0, 
  "max_attachments": 1, 
  "menu_index": 0, 
- "modified": "2016-05-10 12:16:13.978635", 
+ "modified": "2016-07-05 16:44:01.301063", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Quotation", 
diff --git a/erpnext/templates/includes/macros.html b/erpnext/templates/includes/macros.html
index 8dc433a..da21748 100644
--- a/erpnext/templates/includes/macros.html
+++ b/erpnext/templates/includes/macros.html
@@ -12,4 +12,3 @@
     	{%- endif %}
     </div>
 {% endmacro %}
-
diff --git a/erpnext/templates/includes/projects.css b/erpnext/templates/includes/projects.css
index 1f758e3..5a717fc 100644
--- a/erpnext/templates/includes/projects.css
+++ b/erpnext/templates/includes/projects.css
@@ -21,6 +21,7 @@
 .item-timestamp
 {
 	font-size: 10px;
+	margin-left: 15px;
 }
 .page-container .project-item {
 	padding-top: 5px;
diff --git a/erpnext/templates/includes/projects/macros.html b/erpnext/templates/includes/projects/macros.html
deleted file mode 100644
index 5b22583..0000000
--- a/erpnext/templates/includes/projects/macros.html
+++ /dev/null
@@ -1,2 +0,0 @@
-{% macro back_link(doc) %}&back-to=/projects?project={{ doc.name }}&back-to-title={{ doc.project_name }}{% endmacro %}
-
diff --git a/erpnext/templates/includes/projects/project_tasks.html b/erpnext/templates/includes/projects/project_tasks.html
index b4e5cec..e978a7d 100644
--- a/erpnext/templates/includes/projects/project_tasks.html
+++ b/erpnext/templates/includes/projects/project_tasks.html
@@ -1,27 +1,32 @@
-{%- from "templates/includes/projects/macros.html" import back_link -%}
-
 {% for task in doc.tasks %}
 	<div class='task'>
+		<a class="no-decoration task-link {{ task.css_seen }}" href="/tasks?name={{ task.name }}">
 		<div class='row project-item'>
-			<div class='col-xs-1 gravatar-top'>
-				{% if task.todo %}
-				<span class="avatar avatar-small" title="{{ task.todo.owner }}">
-					<img src="{{ task.todo.user_image }}">
-				</span>
-				{% else %}
-				<span class="avatar avatar-small avatar-empty"></span>
-				{% endif %}				
+			<div class='col-xs-9'>
+				<span class="indicator {{ "red" if task.status=="Open" else "green" if task.status=="Closed" else "darkgrey" }}" title="{{ task.status }}"  > {{ task.subject }}</span> 
+	 				<div class="small text-muted item-timestamp"
+	 					title="{{ frappe.utils.pretty_date(task.modified) }}">
+	 					modified {{ frappe.utils.pretty_date(task.modified) }}
+	 				</div>
 			</div>
-			<div class='col-xs-11'>
-				<a class="no-decoration task-link {{ task.css_seen }}" href="/tasks?name={{ task.name }}{{ back_link(doc) }}">
-					<div class="task-subject">{{ task.subject }}</div>
-					<span class="item-timestamp">modified {{ frappe.utils.pretty_date(task.modified) }}</span>
-				</a>
+			<div class='col-xs-1'>{% if task.todo %}
+					{% if task.todo.user_image %}
+						<span class="avatar avatar-small" title="{{ task.todo.owner }}">
+							<img src="{{ task.todo.user_image }}">
+						</span>
+					{% else %}
+						<span class="avatar avatar-small standard-image" title="Assigned to {{ task.todo.owner }}">
+							
+						</span>
+					{% endif %}		
+				{% endif %}	 </div>
+			<div class='col-xs-2'>
 				<span class="pull-right list-comment-count small {{ "text-extra-muted" if task.comment_count==0 else "text-muted" }}">
 					<i class="octicon octicon-comment-discussion"></i>
 						{{ task.comment_count }}
 				</span>
 			</div>
 		</div>
+		</a>
 	</div>
 {% endfor %}
diff --git a/erpnext/templates/includes/projects/project_timelogs.html b/erpnext/templates/includes/projects/project_timelogs.html
deleted file mode 100644
index c9a40b3..0000000
--- a/erpnext/templates/includes/projects/project_timelogs.html
+++ /dev/null
@@ -1,21 +0,0 @@
-{%- from "templates/includes/projects/macros.html" import back_link -%}
-
-{% for timelog in doc.timelogs %}
-<div class='timelog'>
-  <div class='row project-item'>
-    <div class='col-xs-1 gravatar-top'>
-		<span class="avatar avatar-small" title="{{ timelog.modified_by }}"> <img src="{{ timelog.user_image }}"></span>
-	</div> 
-		<div class='col-xs-11'>
-      	<a class="no-decoration timelog-link {{ timelog.css_seen }}" href="/time-log?name={{ timelog.name}}{{ back_link(doc) }}">
-			<div class="timelog-subject">{{ timelog.title }}</div> 
-			<span class="item-timestamp">From {{ frappe.format_date(timelog.from_time) }} to {{ 				frappe.format_date(timelog.to_time) }}</span>
-		</a>
-		<span class="pull-right list-comment-count small {{ "text-extra-muted" if timelog.comment_count==0 else "text-muted" }}">
-			<i class="octicon octicon-comment-discussion"></i>
-				{{ timelog.comment_count }}
-		</span>
-    </div>   
-  </div>
-</div>
-{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/includes/projects/project_timesheets.html b/erpnext/templates/includes/projects/project_timesheets.html
new file mode 100644
index 0000000..fb44017
--- /dev/null
+++ b/erpnext/templates/includes/projects/project_timesheets.html
@@ -0,0 +1,23 @@
+{% for timesheet in doc.timesheets %}
+<div class='timesheet'>
+	<a class="no-decoration timesheet-link {{ timesheet.css_seen }}" href="/timesheet/{{ timesheet.info.name}}">
+		<div class='row project-item'>
+			<div class='col-xs-9'>
+				<span class="indicator {{ "blue" if timesheet.info.status=="Submitted" else "red" if timesheet.info.status=="Draft" else "darkgrey" }}" title="{{ timesheet.info.status }}"  > {{ timesheet.info.name }} </span> 
+				<div class="small text-muted item-timestamp">
+				From {{ frappe.format_date(timesheet.from_time) }} to {{ frappe.format_date(timesheet.to_time) }}
+			</div>
+			</div>
+				<div class='col-xs-1 gravatar-top'>
+				<span class="avatar avatar-small" title="{{ timesheet.info.modified_by }}"> <img src="{{ timesheet.info.user_image }}"></span>
+			</div> 
+			<div class='col-xs-2'>
+				<span class="pull-right list-comment-count small {{ "text-extra-muted" if timesheet.comment_count==0 else "text-muted" }}">
+				<i class="octicon octicon-comment-discussion"></i>
+				{{ timesheet.info.comment_count }}
+				</span> 
+			</div>
+		</div>
+	</a>
+</div>
+{% endfor %}
\ No newline at end of file
diff --git a/erpnext/templates/pages/projects.html b/erpnext/templates/pages/projects.html
index f50d455..aeee602 100644
--- a/erpnext/templates/pages/projects.html
+++ b/erpnext/templates/pages/projects.html
@@ -2,7 +2,6 @@
 
 {% block title %}{{ doc.project_name }}{% endblock %}
 
-{%- from "templates/includes/projects/macros.html" import back_link -%}
 {% block header %}
 	<h1>{{ doc.project_name }}</h1>
 {% endblock %}
@@ -25,11 +24,11 @@
 
 <div class="clearfix">
   <h4 style="float: left;">{{ _("Tasks") }}</h4>
-  <a class="btn btn-secondary btn-default btn-sm" style="float: right; position: relative; top: 10px;" href='/tasks?new=1&project={{ doc.project_name }}{{ back_link(doc) }}'>New task</a>
+  <a class="btn btn-secondary btn-default btn-sm" style="float: right; position: relative; top: 10px;" href='/tasks?new=1&project={{ doc.project_name }}'>New task</a>
 </div>
 
 <p>
-<a class='small underline task-status-switch' data-status='Open'>{{ _("Show closed") }}</a>
+<!-- <a class='small underline task-status-switch' data-status='Open'>{{ _("Show closed") }}</a> -->
 </p>
 
 {% if doc.tasks %}
@@ -46,17 +45,17 @@
 
 <div class='padding'></div>
 
-<h4>{{ _("Time Logs") }}</h4>
+<h4>{{ _("Timesheets") }}</h4>
 
-{% if doc.timelogs %}
+{% if doc.timesheets %}
 	<div class='project-timelogs'>
-	{% include "erpnext/templates/includes/projects/project_timelogs.html" %}
+	{% include "erpnext/templates/includes/projects/project_timesheets.html" %}
 	</div>
-	{% if doc.timelogs|length > 9 %}
+	{% if doc.timesheets|length > 9 %}
 		<p><a class='more-timelogs small underline'>{{ _("More") }}</a><p>
 	{% endif %}
 {% else %}
-	<p class="text-muted">No time logs</p>
+	<p class="text-muted">No time sheets</p>
 {% endif %}
 </div>
 
diff --git a/erpnext/templates/pages/projects.py b/erpnext/templates/pages/projects.py
index 25b3a67..d68770d 100644
--- a/erpnext/templates/pages/projects.py
+++ b/erpnext/templates/pages/projects.py
@@ -11,7 +11,6 @@
 		raise frappe.PermissionError
 		
 	context.no_cache = 1
-	context.show_search = True
 	context.show_sidebar = True
 	project = frappe.get_doc('Project', frappe.form_dict.project)
 
@@ -20,9 +19,8 @@
 	project.tasks = get_tasks(project.name, start=0, item_status='open',
 		search=frappe.form_dict.get("search"))
 
-	project.timelogs = []
-	# project.timelogs = get_timelogs(project.name, start=0,
-		# search=frappe.form_dict.get("search"))
+	project.timesheets = get_timesheets(project.name, start=0,
+		search=frappe.form_dict.get("search"))
 
 
 	context.doc = project
@@ -32,8 +30,8 @@
 	filters = {"project": project}
 	if search:
 		filters["subject"] = ("like", "%{0}%".format(search))
-	if item_status:
-		filters["status"] = item_status
+	# if item_status:
+# 		filters["status"] = item_status
 	tasks = frappe.get_all("Task", filters=filters,
 		fields=["name", "subject", "status", "_seen", "_comments", "modified", "description"],
 		limit_start=start, limit_page_length=10)
@@ -65,27 +63,32 @@
 			"tasks": get_tasks(project, start, item_status=item_status)}
 		}, is_path=True)
 
-def get_timelogs(project, start=0, search=None):
+def get_timesheets(project, start=0, search=None):
 	filters = {"project": project}
 	if search:
-		filters["title"] = ("like", "%{0}%".format(search))
+		filters["activity_type"] = ("like", "%{0}%".format(search))
 
-	timelogs = frappe.get_all('Time Log', filters=filters,
-	fields=['name','title','task','activity_type','from_time','to_time','_comments','_seen','status','modified','modified_by'],
+	timesheets = frappe.get_all('Timesheet Detail', filters=filters,
+	fields=['project','activity_type','from_time','to_time','parent'],
 	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 "[]"))
+	for timesheet in timesheets:
+		timesheet.infos = frappe.get_all('Timesheet', filters={"name": timesheet.parent},
+			fields=['name','_comments','_seen','status','modified','modified_by'],
+			limit_start=start, limit_page_length=10)
 
-		timelog.css_seen = ''
-		if timelog._seen:
-			if frappe.session.user in json.loads(timelog._seen):
-				timelog.css_seen = 'seen'	
-	return timelogs
+		for timesheet.info in timesheet.infos:
+			timesheet.info.user_image = frappe.db.get_value('User', timesheet.info.modified_by, 'user_image')
+
+			timesheet.info.comment_count = len(json.loads(timesheet.info._comments or "[]"))
+
+			timesheet.info.css_seen = ''
+			if timesheet.info._seen:
+				if frappe.session.user in json.loads(timesheet.info._seen):
+					timesheet.info.css_seen = 'seen'		
+	return timesheets
 
 @frappe.whitelist()
-def get_timelog_html(project, start=0):
-	return frappe.render_template("erpnext/templates/includes/projects/project_timelogs.html",
-		{"doc": {"timelogs": get_timelogs(project, start)}}, is_path=True)
+def get_timesheet_html(project, start=0):
+	return frappe.render_template("erpnext/templates/includes/projects/project_timesheets.html",
+		{"doc": {"timesheets": get_timesheets(project, start)}}, is_path=True)