Merge pull request #325 from pateljannat/designation-to-category
This commit is contained in:
@@ -120,7 +120,7 @@
|
|||||||
"dt": "User",
|
"dt": "User",
|
||||||
"fetch_from": null,
|
"fetch_from": null,
|
||||||
"fetch_if_empty": 0,
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "designation",
|
"fieldname": "user_category",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"hide_border": 0,
|
"hide_border": 0,
|
||||||
@@ -135,15 +135,15 @@
|
|||||||
"insert_after": "time_zone",
|
"insert_after": "time_zone",
|
||||||
"is_system_generated": 0,
|
"is_system_generated": 0,
|
||||||
"is_virtual": 0,
|
"is_virtual": 0,
|
||||||
"label": "Designation",
|
"label": "User Category",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"mandatory_depends_on": null,
|
"mandatory_depends_on": null,
|
||||||
"modified": "2022-04-19 13:02:18.219508",
|
"modified": "2022-04-19 13:02:18.219508",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "User-designation",
|
"name": "User-user_category",
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
"non_negative": 0,
|
"non_negative": 0,
|
||||||
"options": "CEO/Founder/GM\nCTO/CIO\nVice presiden\n\nDirector/Head of Department\nIT/System manager\nManager (Sales/Marketing/Customer)\nDeveloper/Analyst\nStudent/Freelancer/Just looking\nOthers",
|
"options": "Business Owner\nManager (Sales/Marketing/Customer)\nEmployee\nStudent\nFreelancer/Just looking\nOthers",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"precision": "",
|
"precision": "",
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"signup_settings_section",
|
"signup_settings_section",
|
||||||
"terms_of_use",
|
"terms_of_use",
|
||||||
"terms_page",
|
"terms_page",
|
||||||
"designation",
|
"user_category",
|
||||||
"column_break_9",
|
"column_break_9",
|
||||||
"privacy_policy",
|
"privacy_policy",
|
||||||
"privacy_policy_page",
|
"privacy_policy_page",
|
||||||
@@ -134,15 +134,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"fieldname": "designation",
|
"fieldname": "user_category",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Ask Designation during Signup"
|
"label": "Ask User Category during Signup"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2022-04-19 13:48:45.176536",
|
"modified": "2022-04-20 09:09:12.369728",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Settings",
|
"name": "LMS Settings",
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ def get_palette(full_name):
|
|||||||
return palette[idx % 8]
|
return palette[idx % 8]
|
||||||
|
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def sign_up(email, full_name, verify_terms, designation):
|
def sign_up(email, full_name, verify_terms, user_category):
|
||||||
if is_signup_disabled():
|
if is_signup_disabled():
|
||||||
frappe.throw(_('Sign Up is disabled'), title='Not Allowed')
|
frappe.throw(_('Sign Up is disabled'), title='Not Allowed')
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ def sign_up(email, full_name, verify_terms, designation):
|
|||||||
"email": email,
|
"email": email,
|
||||||
"first_name": escape_html(full_name),
|
"first_name": escape_html(full_name),
|
||||||
"verify_terms": verify_terms,
|
"verify_terms": verify_terms,
|
||||||
"designation": designation,
|
"user_category": user_category,
|
||||||
"country": "",
|
"country": "",
|
||||||
"enabled": 1,
|
"enabled": 1,
|
||||||
"new_password": random_string(10),
|
"new_password": random_string(10),
|
||||||
|
|||||||
@@ -1,32 +1,29 @@
|
|||||||
<form class="signup-form" role="form">
|
<form class="signup-form" role="form">
|
||||||
<div class="page-card-body">
|
<div class="page-card-body">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label sr-only" for="signup_fullname"></label>
|
<label class="form-label sr-only" for="signup_fullname"> {{ _("Full Name") }} </label>
|
||||||
<input type="text" id="signup_fullname" class="form-control" placeholder="{{ _('Jane Doe') }}"
|
<input type="text" id="signup_fullname" class="form-control" placeholder="{{ _('Jane Doe') }}"
|
||||||
required autofocus>
|
required autofocus>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label sr-only" for="signup_email">Email</label>
|
<label class="form-label sr-only" for="signup_email"> {{ _("Email") }} </label>
|
||||||
<input type="email" id="signup_email" class="form-control"
|
<input type="email" id="signup_email" class="form-control"
|
||||||
placeholder="{{ _('jane@example.com') }}" required>
|
placeholder="{{ _('jane@example.com') }}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if frappe.db.get_single_value("LMS Settings", "designation") %}
|
{% if frappe.db.get_single_value("LMS Settings", "user_category") %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label sr-only">Designation</label>
|
<label class="form-label sr-only"> {{ _("User Category") }} </label>
|
||||||
<div class="control-input-wrapper">
|
<div class="control-input-wrapper">
|
||||||
<div class="control-input flex align-center">
|
<div class="control-input flex align-center">
|
||||||
<select type="text" id="designation" data-fieldname="designation" style="color: var(--text-color)"
|
<select type="text" id="user_category" data-fieldname="user_category" style="color: var(--text-muted)"
|
||||||
class="input-with-feedback form-control ellipsis" data-fieldtype="Select" required>
|
class="input-with-feedback form-control ellipsis" data-fieldtype="Select" required>
|
||||||
<option value=""> {{ _("Designation") }} </option>
|
<option value=""> {{ _("Category") }} </option>
|
||||||
<option value="CEO/Founder/GM"> {{ _("CEO/Founder/GM") }} </option>
|
<option value="Business Owner"> {{ _("Business Owner") }} </option>
|
||||||
<option value="CFO">CFO</option><option value="CTO/CIO"> {{ _("CTO/CIO") }} </option>
|
|
||||||
<option value="Vice president"> {{ _("Vice president") }} </option>
|
|
||||||
<option value="Director/Head of Department"> {{ _("Director/Head of Department") }} </option>
|
|
||||||
<option value="IT/System manager"> {{ _("IT/System manager") }} </option>
|
|
||||||
<option value="Manager (Sales/Marketing/Customer)"> {{ _("Manager (Sales/Marketing/Customer)") }} </option>
|
<option value="Manager (Sales/Marketing/Customer)"> {{ _("Manager (Sales/Marketing/Customer)") }} </option>
|
||||||
<option value="Developer/Analyst"> {{ _("Developer/Analyst") }} </option>
|
<option value="Employee"> {{ _("Employee") }} </option>
|
||||||
<option value="Student/Freelancer/Just looking"> {{ _("Student/Freelancer/Just looking") }} </option>
|
<option value="Student"> {{ _("Student") }} </option>
|
||||||
|
<option value="Freelancer/Just looking"> {{ _("Freelancer/Just looking") }} </option>
|
||||||
<option value="Others"> {{ _("Others") }} </option>
|
<option value="Others"> {{ _("Others") }} </option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -45,7 +42,6 @@
|
|||||||
{{ _("I have read and agree to your {0}").format(get_signup_optin_checks()) }}
|
{{ _("I have read and agree to your {0}").format(get_signup_optin_checks()) }}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<p class="help-box small text-muted"></p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,11 +53,25 @@
|
|||||||
<a href="#login" class="blue">{{ _("Have an account? Login") }}</a>
|
<a href="#login" class="blue">{{ _("Have an account? Login") }}</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
frappe.ready(function () {
|
frappe.ready(function () {
|
||||||
$(".signup-form").on("submit", function (e) {
|
$("#user_category").on("change", (e) => {
|
||||||
|
style_category(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".signup-form").on("submit", (e) => {
|
||||||
|
signup(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const style_category = (e) => {
|
||||||
|
let category_color = $(e.currentTarget).val() ? "var(--text-color)" : "var(--text-muted)";
|
||||||
|
$("#user_category").css("color", category_color);
|
||||||
|
}
|
||||||
|
|
||||||
|
const signup = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const email = ($("#signup_email").val() || "").trim();
|
const email = ($("#signup_email").val() || "").trim();
|
||||||
const full_name = frappe.utils.xss_sanitise(($("#signup_fullname").val() || "").trim());
|
const full_name = frappe.utils.xss_sanitise(($("#signup_fullname").val() || "").trim());
|
||||||
@@ -77,11 +87,10 @@
|
|||||||
"email": email,
|
"email": email,
|
||||||
"full_name": full_name,
|
"full_name": full_name,
|
||||||
"verify_terms": $("#signup-terms").prop("checked") ? 1 : 0,
|
"verify_terms": $("#signup-terms").prop("checked") ? 1 : 0,
|
||||||
"designation": $("#designation").val()
|
"user_category": $("#user_category").val()
|
||||||
},
|
},
|
||||||
statusCode: login.login_handlers
|
statusCode: login.login_handlers
|
||||||
})
|
})
|
||||||
return false;
|
return false;
|
||||||
});
|
}
|
||||||
});
|
</script>
|
||||||
</script>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user