Certfication Application Doctype and webform,Certfied Consultant DocType (#14528)

This commit is contained in:
asbasawaraj 2018-06-15 10:04:19 +05:30 committed by Nabin Hait
parent 0e5c8283fa
commit 4c263480c9
24 changed files with 1057 additions and 0 deletions

View File

@ -149,6 +149,7 @@ standard_portal_menu_items = [
{"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": _("Certification"), "route": "/certification", "reference_doctype": "Certification Application"},
]
default_roles = [

View File

@ -0,0 +1,8 @@
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Certification Application', {
refresh: function(frm) {
}
});

View File

@ -0,0 +1,339 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "CA-.YY.-.####",
"beta": 0,
"creation": "2018-06-08 16:12:42.091729",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "name_of_applicant",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Name of Applicant",
"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": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "email",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Email",
"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": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_1",
"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,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "certification_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": "Certification Status",
"length": 0,
"no_copy": 0,
"options": "Yet to appear\nCertified\nNot Certified",
"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,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "payment_details",
"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": "Payment Details",
"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,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "paid",
"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": "Paid",
"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,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "currency",
"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": "Currency",
"length": 0,
"no_copy": 0,
"options": "USD\nINR",
"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,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "amount",
"fieldtype": "Float",
"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": "Amount",
"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,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-06-14 23:17:07.405689",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "Certification Application",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 0,
"role": "Customer",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class CertificationApplication(Document):
pass

View File

@ -0,0 +1,23 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Certification Application", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Certification Application
() => frappe.tests.make('Certification Application', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestCertificationApplication(unittest.TestCase):
pass

View File

@ -0,0 +1,8 @@
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Certified Consultant', {
refresh: function(frm) {
}
});

View File

@ -0,0 +1,304 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "CC-.YY.-.####",
"beta": 0,
"creation": "2018-06-13 17:27:19.838334",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "name_of_consultant",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Name of Consultant",
"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": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break1",
"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,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "certification_application",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Certification Application",
"length": 0,
"no_copy": 0,
"options": "Certification Application",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "section_break1",
"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": "Certification Validity",
"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,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "from_date",
"fieldtype": "Date",
"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": "From",
"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,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_beak2",
"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,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "to_date",
"fieldtype": "Date",
"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": "To",
"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,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-06-14 07:26:12.646293",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "Certified Consultant",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Non Profit Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0
}

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class CertifiedConsultant(Document):
pass

View File

@ -0,0 +1,23 @@
/* eslint-disable */
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Certified Consultant", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Certified Consultant
() => frappe.tests.make('Certified Consultant', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestCertifiedConsultant(unittest.TestCase):
pass

View File

@ -0,0 +1,16 @@
frappe.ready(function() {
// bind events here
$(".page-header-actions-block .btn-primary, .page-header-actions-block .btn-default").addClass('hidden');
$(".text-right .btn-primary").addClass('hidden');
if (frappe.utils.get_url_arg('name')) {
$('.page-content .btn-form-submit').addClass('hidden');
} else {
user_name = frappe.full_name
user_email_id = frappe.session.user
$('[data-fieldname="currency"]').val("INR");
$('[data-fieldname="name_of_applicant"]').val(user_name);
$('[data-fieldname="email"]').val(user_email_id);
$('[data-fieldname="amount"]').val(20000);
}
})

View File

@ -0,0 +1,79 @@
{
"accept_payment": 1,
"allow_comments": 0,
"allow_delete": 0,
"allow_edit": 0,
"allow_incomplete": 0,
"allow_multiple": 1,
"allow_print": 0,
"amount": 0.0,
"amount_based_on_field": 1,
"amount_field": "amount",
"creation": "2018-06-08 16:24:05.805225",
"doc_type": "Certification Application",
"docstatus": 0,
"doctype": "Web Form",
"idx": 0,
"introduction_text": "",
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2018-06-11 16:11:14.544987",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "certification-application",
"owner": "Administrator",
"payment_button_help": "Pay for your certification using RazorPay",
"payment_button_label": "Pay Now",
"payment_gateway": "Razorpay",
"published": 1,
"route": "certification-application",
"show_sidebar": 1,
"sidebar_items": [],
"success_url": "/certification-application",
"title": "Certification Application",
"web_form_fields": [
{
"fieldname": "name_of_applicant",
"fieldtype": "Data",
"hidden": 0,
"label": "Name of Applicant",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "email",
"fieldtype": "Link",
"hidden": 0,
"label": "Email",
"max_length": 0,
"max_value": 0,
"options": "User",
"read_only": 1,
"reqd": 1
},
{
"fieldname": "currency",
"fieldtype": "Select",
"hidden": 0,
"label": "Currency",
"max_length": 0,
"max_value": 0,
"options": "USD\nINR",
"read_only": 1,
"reqd": 0
},
{
"fieldname": "amount",
"fieldtype": "Float",
"hidden": 0,
"label": "Amount",
"max_length": 0,
"max_value": 0,
"read_only": 1,
"reqd": 0
}
]
}

View File

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

View File

@ -0,0 +1,16 @@
frappe.ready(function() {
// bind events here
$(".page-header-actions-block .btn-primary, .page-header-actions-block .btn-default").addClass('hidden');
$(".text-right .btn-primary").addClass('hidden');
if (frappe.utils.get_url_arg('name')) {
$('.page-content .btn-form-submit').addClass('hidden');
} else {
user_name = frappe.full_name
user_email_id = frappe.session.user
$('[data-fieldname="currency"]').val("USD");
$('[data-fieldname="name_of_applicant"]').val(user_name);
$('[data-fieldname="email"]').val(user_email_id);
$('[data-fieldname="amount"]').val(300);
}
})

View File

@ -0,0 +1,80 @@
{
"accept_payment": 1,
"allow_comments": 0,
"allow_delete": 0,
"allow_edit": 0,
"allow_incomplete": 0,
"allow_multiple": 1,
"allow_print": 0,
"amount": 0.0,
"amount_based_on_field": 1,
"amount_field": "amount",
"creation": "2018-06-13 09:22:48.262441",
"currency": "USD",
"doc_type": "Certification Application",
"docstatus": 0,
"doctype": "Web Form",
"idx": 0,
"introduction_text": "",
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2018-06-13 09:26:35.502064",
"modified_by": "Administrator",
"module": "Non Profit",
"name": "certification-application-usd",
"owner": "Administrator",
"payment_button_help": "Pay for your certification using PayPal",
"payment_button_label": "Pay Now",
"payment_gateway": "PayPal",
"published": 1,
"route": "certification-application-usd",
"show_sidebar": 1,
"sidebar_items": [],
"success_url": "/certification-application-usd",
"title": "Certification Application USD",
"web_form_fields": [
{
"fieldname": "name_of_applicant",
"fieldtype": "Data",
"hidden": 0,
"label": "Name of Applicant",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0
},
{
"fieldname": "email",
"fieldtype": "Link",
"hidden": 0,
"label": "Email",
"max_length": 0,
"max_value": 0,
"options": "User",
"read_only": 1,
"reqd": 1
},
{
"fieldname": "currency",
"fieldtype": "Select",
"hidden": 0,
"label": "Currency",
"max_length": 0,
"max_value": 0,
"options": "USD\nINR",
"read_only": 1,
"reqd": 0
},
{
"fieldname": "amount",
"fieldtype": "Float",
"hidden": 0,
"label": "Amount",
"max_length": 0,
"max_value": 0,
"read_only": 1,
"reqd": 0
}
]
}

View File

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

0
erpnext/www/__init__.py Normal file
View File

View File

@ -0,0 +1,86 @@
{% extends "templates/web.html" %}
{% block title %} ERPNext Certification {% endblock %}
{% block page_content %}
{% macro show_currency_options() %}
<p> Certification price is 20,000 INR / 300 USD.</p>
<section>
<input type="radio" name="gender" value="USD" checked> USD <br>
<input type="radio" name="gender" value="INR" style="margin-top: 15px;"> INR <br>
</section>
<div class="section" style="margin-top:10px;"><a class="btn btn-primary next"> Next </a></div>
<script>
frappe.ready(function() {
$('.next').on('click', function() {
if($("input[type=radio]:checked").val() == 'INR'){
window.location = '/certification-application?new=1'
}
else{
window.location = '/certification-application-usd?new=1'
}
})
})
</script>
{% endmacro %}
{% if frappe.session.user=='Guest' %}
<div class='with-border'>
<p>You must first sign up and login to apply for certification.</p>
<p><a href="/login#signup" class=''>Sign Up</a></p>
</div>
{% else %}
{% if all_certifications %}
<h2>Certification History</h2>
<div class="table">
<table class="table table-bordered table-hover">
<thead>
<tr class="active">
<th style="width: 150px">Certification Id</th>
<th style="width: 120px">From</th>
<th style="width: 120px">To</th>
<th style="width: 100px">Amount</th>
</tr>
</thead>
<tbody>
{% for certification in all_certifications %}
<tr>
<td>{{ certification['name'] }}</td>
<td>{{ frappe.format_date(certification['from_date']) }}</td>
<td>{{ frappe.format_date(certification['to_date']) }}</td>
<td>{{ frappe.utils.fmt_money(certification['amount'],currency=frappe.db.get_value("Currency",certification['currency'],"symbol")) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% if not all_certifications %}
{{ show_currency_options() }}
{% elif all_certifications and (frappe.utils.getdate(all_certifications[0]['to_date']) < frappe.utils.getdate(frappe.utils.nowdate())) %}
<p>Your certification has expired. Click on the button below to start a new certification.</p>
{{ show_currency_options() }}
{% elif all_certifications and (frappe.utils.getdate(frappe.utils.add_days(all_certifications[0]['to_date'], -30)) < frappe.utils.getdate(frappe.utils.nowdate()))%}
<p>Your certification is due to expire soon. Click on the button below to start a new certification.</p>
{{ show_currency_options() }}
{% endif %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,20 @@
import frappe
import foundation
no_cache = 1
def get_context(context):
if frappe.session.user != 'Guest':
context.all_certifications = get_all_certifications_of_a_member()
context.show_sidebar = True
def get_all_certifications_of_a_member():
'''Returns all certifications'''
all_certifications = []
all_certifications = frappe.db.sql(""" select cc.name,cc.from_date,cc.to_date,ca.amount,ca.currency
from `tabCertified Consultant` cc
inner join `tabCertification Application` ca
on cc.certification_application = ca.name
where paid = 1 and email = %(user)s order by cc.to_date desc""" ,{'user': frappe.session.user},as_dict=True)
return all_certifications