conference fixes

This commit is contained in:
Rushabh Mehta
2018-07-10 14:29:47 +05:30
parent 8e80363941
commit 0104ec2f3d
14 changed files with 506 additions and 448 deletions

View File

@@ -3,6 +3,7 @@
"allow_guest_to_view": 0, "allow_guest_to_view": 0,
"allow_import": 0, "allow_import": 0,
"allow_rename": 0, "allow_rename": 0,
"autoname": "E-CON-2018-.###",
"beta": 0, "beta": 0,
"creation": "2017-07-06 16:20:28.662095", "creation": "2017-07-06 16:20:28.662095",
"custom": 0, "custom": 0,
@@ -14,6 +15,7 @@
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@@ -40,10 +42,46 @@
"reqd": 1, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"fieldname": "conference",
"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": "Conference",
"length": 0,
"no_copy": 0,
"options": "\n2017\n2018",
"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, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@@ -70,10 +108,12 @@
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@@ -100,10 +140,12 @@
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@@ -131,10 +173,12 @@
"reqd": 1, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@@ -161,10 +205,12 @@
"reqd": 1, "reqd": 1,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@@ -191,10 +237,12 @@
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0,
"unique": 0 "unique": 0
}, },
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_in_quick_entry": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
@@ -221,6 +269,7 @@
"reqd": 0, "reqd": 0,
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"translatable": 0,
"unique": 0 "unique": 0
} }
], ],
@@ -234,7 +283,7 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-07-07 11:36:26.163646", "modified": "2018-07-09 18:12:05.062456",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "ERPNext Foundation", "module": "ERPNext Foundation",
"name": "Conference Participant", "name": "Conference Participant",
@@ -243,7 +292,6 @@
"permissions": [ "permissions": [
{ {
"amend": 0, "amend": 0,
"apply_user_permissions": 0,
"cancel": 0, "cancel": 0,
"create": 1, "create": 1,
"delete": 1, "delete": 1,

View File

@@ -7,6 +7,9 @@ import frappe
from frappe.model.document import Document from frappe.model.document import Document
class ConferenceParticipant(Document): class ConferenceParticipant(Document):
def validate(self):
self.conference = '2018'
def on_payment_authorized(self, status_changed_to=None): def on_payment_authorized(self, status_changed_to=None):
self.paid = 1 self.paid = 1
self.save(ignore_permissions=True) self.save(ignore_permissions=True)

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: Conference Participant", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Conference Participant
() => frappe.tests.make('Conference Participant', [
// values to be set
{key: 'value'}
]),
() => {
assert.equal(cur_frm.doc.key, 'value');
},
() => done()
]);
});

View File

@@ -1,20 +0,0 @@
<p>Dear {{ doc.participant_name }},</p>
<p>Thank you for registering for the 2017 ERPNext Conference!</p>
<p>Here are your ticket details:</p>
{% if doc.full_conference_tickets %}
<p>
Full Conference Tickets: {{ doc.full_conference_tickets or 0 }}
</p>
{% endif %}
{% if doc.user_conference_tickets %}
<p>
User Conference Tickets: {{ doc.user_conference_tickets or 0 }}
</p>
{% endif %}
<p>Total Amount: {{ doc.currency }} {{ doc.get_formatted('amount') }}</p>
<p>If you need any help, please email us at foundation@erpnext.com</p>

View File

@@ -0,0 +1,24 @@
<p>Dear {{ doc.participant_name }},</p>
<p>Thank you for registering for the 2018 ERPNext Conference!</p>
<p>Here are your ticket details:</p>
<h4>Ticket Number {{ doc.name}}</h4>
<table class="more-info" border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 300px; padding: 30px 0px">
<tr>
<th style='width: 50%'>Ticket Type</th>
<th style='width: 25%'>Qty</th>
<th style='width: 25%'>Amount</th>
</tr>
<tr>
<td>Conference Tickets + Lunch + Dinner</td>
<td>{{ doc.full_conference_tickets or 0 }}</td>
</tr>
</table>
<h5>Total Amount: {{ doc.currency }} {{ doc.get_formatted('amount') }}</h5>
<p>If you need any help, please email us at foundation@erpnext.com</p>

View File

@@ -1,17 +1,17 @@
frappe.ready(function() { frappe.ready(function() {
// bind events here // bind events here
var calculate = function() { frappe._calculate = function() {
var amount = parseInt($('input[name="full_conference_tickets"]').val() || 0) * 3000 frappe.web_form.field_group.set_value('amount',
+ parseInt($('input[name="user_conference_tickets"]').val() || 0) * 600; parseInt(frappe.web_form.field_group.get_value('full_conference_tickets') || 0) * 4000
$('input[name="amount"]').val(amount); )
}; };
$('input[name="full_conference_tickets"]').on('keyup', function() { setTimeout(() => {
calculate(); $('input[data-fieldname="full_conference_tickets"]').on('keyup', function() {
}); frappe._calculate();
$('input[name="user_conference_tickets"]').on('keyup', function() {
calculate();
}); });
frappe._calculate();
}, 1000);
$('.btn-form-submit').hide(); $('.btn-form-submit').hide();
}) })

View File

@@ -19,7 +19,7 @@
"is_standard": 1, "is_standard": 1,
"login_required": 1, "login_required": 1,
"max_attachment_size": 0, "max_attachment_size": 0,
"modified": "2017-07-07 11:06:02.141890", "modified": "2018-07-09 12:24:07.368873",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "ERPNext Foundation", "module": "ERPNext Foundation",
"name": "buy-tickets-inr", "name": "buy-tickets-inr",
@@ -28,7 +28,7 @@
"payment_gateway": "Razorpay", "payment_gateway": "Razorpay",
"published": 1, "published": 1,
"route": "buy-tickets-inr", "route": "buy-tickets-inr",
"show_sidebar": 1, "show_sidebar": 0,
"sidebar_items": [], "sidebar_items": [],
"success_url": "/conf/2017", "success_url": "/conf/2017",
"title": "Buy Tickets INR", "title": "Buy Tickets INR",
@@ -53,16 +53,6 @@
"read_only": 0, "read_only": 0,
"reqd": 0 "reqd": 0
}, },
{
"fieldname": "user_conference_tickets",
"fieldtype": "Int",
"hidden": 0,
"label": "User Conference Tickets",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0
},
{ {
"default": "INR", "default": "INR",
"fieldname": "currency", "fieldname": "currency",

View File

@@ -1,19 +1,17 @@
frappe.ready(function() { frappe.ready(function() {
// bind events here // bind events here
var calculate = function() { frappe._calculate = function() {
var amount = frappe.web_form.field_group.set_value('amount',
(parseInt($('input[name="full_conference_tickets"]').val() || 0) * 50) parseInt(frappe.web_form.field_group.get_value('full_conference_tickets') || 0) * 60
+ (parseInt($('input[name="user_conference_tickets"]').val() || 0) * 10); )
$('input[name="amount"]').val(amount);
$('input[name="amount"]').closest('.form-group').toggleClass('has-error', amount == 0);
}; };
$('input[name="full_conference_tickets"]').on('keyup', function() { setTimeout(() => {
calculate(); $('input[data-fieldname="full_conference_tickets"]').on('keyup', function() {
}); frappe._calculate();
$('input[name="user_conference_tickets"]').on('keyup', function() {
calculate();
}); });
frappe._calculate();
}, 1000);
$('.btn-form-submit').hide(); $('.btn-form-submit').hide();
}) })

View File

@@ -19,7 +19,7 @@
"is_standard": 1, "is_standard": 1,
"login_required": 1, "login_required": 1,
"max_attachment_size": 0, "max_attachment_size": 0,
"modified": "2017-07-07 11:06:27.726016", "modified": "2018-07-09 12:51:08.338885",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "ERPNext Foundation", "module": "ERPNext Foundation",
"name": "buy-tickets-paypal", "name": "buy-tickets-paypal",
@@ -28,8 +28,14 @@
"payment_gateway": "PayPal", "payment_gateway": "PayPal",
"published": 1, "published": 1,
"route": "buy-tickets-paypal", "route": "buy-tickets-paypal",
"show_sidebar": 1, "show_sidebar": 0,
"sidebar_items": [], "sidebar_items": [
{
"enabled": 1,
"route": "/buy-tickets-paypal",
"title": "My Tickets"
}
],
"success_url": "/conf/2017", "success_url": "/conf/2017",
"title": "Buy Tickets Paypal", "title": "Buy Tickets Paypal",
"web_form_fields": [ "web_form_fields": [
@@ -53,16 +59,6 @@
"read_only": 0, "read_only": 0,
"reqd": 0 "reqd": 0
}, },
{
"fieldname": "user_conference_tickets",
"fieldtype": "Int",
"hidden": 0,
"label": "User Conference Tickets",
"max_length": 0,
"max_value": 0,
"read_only": 0,
"reqd": 0
},
{ {
"default": "USD", "default": "USD",
"fieldname": "currency", "fieldname": "currency",

View File

@@ -1,8 +1,4 @@
import frappe import frappe
from frappe.database import Database
from markdown2 import markdown
from frappe.utils import validate_email_add
def migrate(): def migrate():
pass pass