[new] Assessment Manager for grant Review, web portal added
diff --git a/erpnext/non_profit/doctype/grant_application/grant_application.json b/erpnext/non_profit/doctype/grant_application/grant_application.json
index 509f67b..8ada016 100644
--- a/erpnext/non_profit/doctype/grant_application/grant_application.json
+++ b/erpnext/non_profit/doctype/grant_application/grant_application.json
@@ -440,6 +440,35 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "section_break_15", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "amount", 
    "fieldtype": "Float", 
    "hidden": 0, 
@@ -501,6 +530,35 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
+   "fieldname": "column_break_17", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
    "fieldname": "route", 
    "fieldtype": "Data", 
    "hidden": 0, 
@@ -554,6 +612,156 @@
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "assessment_result", 
+   "fieldtype": "Section Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "assessment Result", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "assessment_scale", 
+   "fieldtype": "Int", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "assessment  Scale", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "note", 
+   "fieldtype": "Small Text", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "note", 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "column_break_24", 
+   "fieldtype": "Column Break", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "length": 0, 
+   "no_copy": 0, 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
+  }, 
+  {
+   "allow_bulk_edit": 0, 
+   "allow_on_submit": 0, 
+   "bold": 0, 
+   "collapsible": 0, 
+   "columns": 0, 
+   "fieldname": "assessment_manager", 
+   "fieldtype": "Link", 
+   "hidden": 0, 
+   "ignore_user_permissions": 0, 
+   "ignore_xss_filter": 0, 
+   "in_filter": 0, 
+   "in_global_search": 0, 
+   "in_list_view": 0, 
+   "in_standard_filter": 0, 
+   "label": "assessment  Manager", 
+   "length": 0, 
+   "no_copy": 0, 
+   "options": "User", 
+   "permlevel": 0, 
+   "precision": "", 
+   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
+   "read_only": 0, 
+   "remember_last_selected_value": 0, 
+   "report_hide": 0, 
+   "reqd": 0, 
+   "search_index": 0, 
+   "set_only_once": 0, 
+   "unique": 0
   }
  ], 
  "has_web_view": 1, 
@@ -568,7 +776,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2017-10-30 16:18:40.911012", 
+ "modified": "2017-11-03 13:08:58.718232", 
  "modified_by": "Administrator", 
  "module": "Non Profit", 
  "name": "Grant Application", 
diff --git a/erpnext/non_profit/doctype/grant_application/grant_application.py b/erpnext/non_profit/doctype/grant_application/grant_application.py
index 0634c8a..44127f9 100644
--- a/erpnext/non_profit/doctype/grant_application/grant_application.py
+++ b/erpnext/non_profit/doctype/grant_application/grant_application.py
@@ -27,3 +27,12 @@
 	context.no_breadcrumbs = True
 	context.order_by = 'creation desc'
 	context.introduction ='<div>Grant Application List</div><br><a class="btn btn-primary" href="/my-grant?new=1">Apply for new Grant Application</a>'
+
+@frappe.whitelist(allow_guest=True)
+def assessment_result(title, assessment_scale, note):
+	vote = frappe.get_doc("Grant Application", title)
+	vote.assessment_scale = assessment_scale
+	vote.note = note
+	vote.save()
+	frappe.db.commit()
+	return "Thank you for Assessment Review"
\ No newline at end of file
diff --git a/erpnext/non_profit/doctype/grant_application/templates/grant_application.html b/erpnext/non_profit/doctype/grant_application/templates/grant_application.html
index 8532ea7..5d415e9 100644
--- a/erpnext/non_profit/doctype/grant_application/templates/grant_application.html
+++ b/erpnext/non_profit/doctype/grant_application/templates/grant_application.html
@@ -1,52 +1,95 @@
 {% extends "templates/web.html" %}
 
 {% block page_content %}
-<h1>{{ title }}</h1>
-{% if frappe.user == owner %}
-<p><a class='btn btn-primary btn-sm' href="/my-grant?name={{ name }}">Edit Grant</a></p>
-{% endif %}
-<br>
-<table class='table table-bordered small' style='max-width: 400px; margin-bottom: 0px;'>
-    <tr>
-        <td style='width: 38.2%'>Organization/Indvidual</td>
-        <td>{{ title }}</td>
-    </tr>
-    <tr>
-        <td>Grant Applicant Name</td>
-        <td>{{ grant_applicant_name }}</td>
-    </tr>
-    <tr>
-        <td>Date</td>
-        <td>{{ frappe.format_date(creation) }}</td>
-    </tr>
-    <tr>
-        <td>Status</td>
-        <td>{{ status }}</td>
-    </tr>
-    <tr>
-        <td>Email</td>
-        <td>{{ email }}</td>
-    </tr>
-</table>
-<h3>Please outline your current situation and why you are applying for a grant?</h3>
-<p>{{ grant_description }}</p>
-<h3>Please Describe the purpose of the grant and how it will benfit your organization?</h3>
-<p>{{ grant_purpose }}</p>
-<h3>Amount Requested Details</h3>
-<p>{{ amount }}</p>
-<h3>Have you Recevied grant from us before?</h3>
-<p>{{ grant_past_record }}</p>
-<h3>Contact</h3>
-{% if frappe.user != 'Guest' %}
-<table class='table table-bordered small' style='max-width: 400px; margin-bottom: 0px;'>
-    <tr>
-        <td style='width: 38.2%'>Email</td>
-        <td>{{ email }}</td>
-    </tr>
-</table>
-{% else %}
-<p><a href="/login">You must register and login to view contact details</a></p>
-{% endif %}
-<p><br><a href="/my-grant?new=1" class='btn btn-primary'>Post a New Grant</a></p>
-
+	<h1>{{ title }}</h1>
+	{% if frappe.user == owner %}
+		<p><a class='btn btn-primary btn-sm' href="/my-grant?name={{ name }}">Edit Grant</a></p>
+	{% endif %}
+	<br>
+	<table class='table table-bordered small' style='max-width: 400px; margin-bottom: 0px;'>
+		<tr>
+			<td style='width: 38.2%'>Organization/Indvidual</td>
+			<td>{{ title }}</td>
+		</tr>
+		<tr>
+			<td>Grant Applicant Name</td>
+			<td>{{ grant_applicant_name }}</td>
+		</tr>
+		<tr>
+			<td>Date</td>
+			<td>{{ frappe.format_date(creation) }}</td>
+		</tr>
+		<tr>
+			<td>Status</td>
+			<td>{{ status }}</td>
+		</tr>
+		<tr>
+			<td>Email</td>
+			<td>{{ email }}</td>
+		</tr>
+	</table>
+	<h2>Q. Please outline your current situation and why you are applying for a grant?</h2>
+	<p>	{{ grant_description }}</p>
+	<h2>Q. Please Describe the purpose of the grant and how it will benfit your organization?</h2>
+	<p>{{ grant_purpose }}</p>
+	<h2>Q. Amount Requested Details?</h2>
+	<p>{{ amount }}</p>
+	<h2>Q. Have you Recevied grant from us before?</h2>
+	<p>{{ grant_past_record }}</p>
+	<h3>Contact</h3>
+	{% if frappe.user != 'Guest' %}
+		<table class='table table-bordered small' style='max-width: 400px; margin-bottom: 0px;'>
+			<tr>
+				<td style='width: 38.2%'>Email</td>
+				<td>{{ email }}</td>
+			</tr>
+		</table>
+	{% else %}
+		<p><a href="/login">You must register and login to view contact details</a></p>
+	{% endif %}
+	<br>
+	{% if frappe.session.user == assessment_manager %}
+		{% if not assessment_scale %}
+			<div>
+				<form>
+					<div class="form-group">
+						<label for="scale">Assessment Result (0-10):</label>
+						<input type="text" class="form-control" id="scale">
+					</div>
+					<div class="form-group">
+						<label for="note">Note</label>
+						<input type="text" class="form-control" id="note">
+					</div>
+					<button type="button" class="btn btn-default" data-title= "{{ name }}" id="btn-grant-result">Submit</button>
+				</form>
+			</div>
+		{% else %}
+			<p> Assessment Review done </p>
+		{% endif %}
+	{% else %}
+	<p><br><a href="/my-grant?new=1" class='btn btn-primary'>Post a New Grant</a></p>
+	{% endif %}
+	<script>
+		frappe.ready(function(title) {
+			$(".btn-default").on("click", function() {
+				var scale =  $("#scale").val();
+				var note = $("#note").val();
+				var title = $(this).attr("data-title");
+				console.log(scale, note, title);
+				frappe.call({
+						method: 'erpnext.non_profit.doctype.grant_application.grant_application.assessment_result',
+						args: {
+							assessment_scale: scale,
+							note: note,
+							title: title
+						},
+						callback: function(r) {
+							if(r.message) {
+								frappe.msgprint(r.message)
+							}
+						}
+				})
+			});
+		})
+	</script>
 {% endblock %}
\ No newline at end of file
diff --git a/erpnext/non_profit/doctype/grant_application/templates/grant_application_row.html b/erpnext/non_profit/doctype/grant_application/templates/grant_application_row.html
index 18c1ffe..64ef869 100644
--- a/erpnext/non_profit/doctype/grant_application/templates/grant_application_row.html
+++ b/erpnext/non_profit/doctype/grant_application/templates/grant_application_row.html
@@ -1,9 +1,9 @@
 <div style='margin-bottom: 30px; max-width: 600px;'
-    class='with-border clickable'>
-    <a href="/{{ doc.route }}">
-        <h3 style='margin-top: 0px;'>{{ doc.title }}</h3>
-        <p>
-            <span class='label'>{{ frappe.format_date(doc.creation) }}</span>
-        </p>
-    </a>
+	class='with-border clickable'>
+	<a href="/{{ doc.route }}">
+		<h3 style='margin-top: 0px;'>{{ doc.title }}</h3>
+		<p>
+			<span class='label'>{{ frappe.format_date(doc.creation) }}</span>
+		</p>
+	</a>
 </div>