[new] Grant Application Web Form Added

This commit is contained in:
Vishal 2017-10-31 13:27:49 +05:30
parent 6a4fd7d89e
commit a6a302f8a6
10 changed files with 335 additions and 7 deletions

View File

@ -125,6 +125,7 @@ website_route_rules = [
{"from_route": "/admissions", "to_route": "Student Admission"},
{"from_route": "/boms", "to_route": "BOM"},
{"from_route": "/timesheets", "to_route": "Timesheet"},
{"from_route": "/grant-application", "to_route": "Grant Application"},
]
standard_portal_menu_items = [
@ -144,7 +145,8 @@ standard_portal_menu_items = [
{"title": _("Patient Appointment"), "route": "/patient-appointments", "reference_doctype": "Patient Appointment", "role":"Patient"},
{"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees", "role":"Student"},
{"title": _("Newsletter"), "route": "/newsletters", "reference_doctype": "Newsletter"},
{"title": _("Admission"), "route": "/admissions", "reference_doctype": "Student Admission"}
{"title": _("Admission"), "route": "/admissions", "reference_doctype": "Student Admission"},
{"title": _("Grant Application"), "route": "/grant-application", "reference_doctype": "Grant Application"}
]
default_roles = [

View File

@ -1,6 +1,6 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_guest_to_view": 1,
"allow_import": 0,
"allow_rename": 0,
"autoname": "field:email",
@ -19,7 +19,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "organization",
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
@ -132,6 +132,38 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Open",
"fieldname": "status",
"fieldtype": "Select",
"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": "Status",
"length": 0,
"no_copy": 0,
"options": "Open\nReceived\nIn Progress\nApproved\nRejected\nExpired\nWithdrawan",
"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,
@ -462,20 +494,81 @@
"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,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Route",
"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": "published",
"fieldtype": "Check",
"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": "Show on Website",
"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
}
],
"has_web_view": 0,
"has_web_view": 1,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_field": "image",
"image_view": 0,
"in_create": 0,
"is_published_field": "published",
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-09-22 13:10:32.303551",
"modified": "2017-10-30 16:18:40.911012",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "Grant Application",
@ -501,11 +594,32 @@
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Website Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"route": "grant-application",
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",

View File

@ -3,10 +3,34 @@
# For license information, please see license.txt
from __future__ import unicode_literals
from frappe.model.document import Document
import frappe
from frappe.website.website_generator import WebsiteGenerator
from frappe.contacts.address_and_contact import load_address_and_contact
class GrantApplication(Document):
class GrantApplication(WebsiteGenerator):
_website = frappe._dict(
condition_field = "published",
)
def validate(self):
if not self.route:
self.route = 'grant-application/' + self.scrub(self.name)
def onload(self):
"""Load address and contacts in `__onload`"""
load_address_and_contact(self)
def get_context(self, context):
context.no_cache = True
context.parents = [dict(label='View All ',
route='grant-application', title='View All')]
def get_list_context(context):
context.allow_guest = True
context.no_cache = True
context.no_breadcrumbs = True
context.order_by = 'creation desc'
context.introduction ='<div>Grant Application List</div><br><a class="btn btn-primary" href="/my-jobs?new=1">Apply for new Grant Application</a>'

View File

@ -0,0 +1,52 @@
{% 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>
{% endblock %}

View File

@ -0,0 +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>
</div>

View File

View File

@ -0,0 +1,3 @@
frappe.ready(function() {
// bind events here
})

View File

@ -0,0 +1,117 @@
{
"accept_payment": 0,
"allow_comments": 0,
"allow_delete": 1,
"allow_edit": 1,
"allow_incomplete": 0,
"allow_multiple": 1,
"allow_print": 0,
"amount": 0.0,
"amount_based_on_field": 0,
"creation": "2017-10-30 15:57:10.825188",
"currency": "INR",
"doc_type": "Grant Application",
"docstatus": 0,
"doctype": "Web Form",
"idx": 0,
"introduction_text": "Share as many details as you can to get quick response from organization",
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2017-10-31 13:25:40.670895",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "grant-application",
"owner": "Administrator",
"payment_button_label": "Buy Now",
"published": 1,
"route": "my-grant",
"show_sidebar": 1,
"sidebar_items": [],
"success_url": "/grant-application",
"title": "Grant Application",
"web_form_fields": [
{
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"label": "Organization",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "grant_applicant_name",
"fieldtype": "Data",
"hidden": 0,
"label": "Grant Applicant Name",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "email",
"fieldtype": "Data",
"hidden": 0,
"label": "Email Address",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 1
},
{
"description": "",
"fieldname": "grant_description",
"fieldtype": "Text",
"hidden": 0,
"label": "Please outline your current situation and why you are applying for a grant?",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "grant_purpose",
"fieldtype": "Text",
"hidden": 0,
"label": "Grant Purpose",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 1
},
{
"fieldname": "amount",
"fieldtype": "Float",
"hidden": 0,
"label": "Amount Request",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "grant_past_record",
"fieldtype": "Select",
"hidden": 0,
"label": "Grant History",
"max_length": 0,
"max_value": 0,
"options": "YES\nNO",
"read_only": 0,
"reqd": 0
},
{
"fieldname": "published",
"fieldtype": "Check",
"hidden": 0,
"label": "Show on Website",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0
}
]
}

View File

@ -0,0 +1,7 @@
from __future__ import unicode_literals
import frappe
def get_context(context):
# do your magic here
pass