fix: profile web form

This commit is contained in:
Jannat Patel
2021-12-09 19:07:04 +05:30
parent 5b4db8fd54
commit fd524f627e
13 changed files with 1362 additions and 192 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -60,7 +60,7 @@
"modified": "2021-12-07 12:15:46.078717",
"modified_by": "Administrator",
"module": "LMS",
"name": "Education Details",
"name": "Education Detail",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",

View File

@@ -4,5 +4,5 @@
# import frappe
from frappe.model.document import Document
class EducationDetails(Document):
class EducationDetail(Document):
pass

View File

@@ -1,30 +1,41 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2021-12-07 12:22:44.139341",
"creation": "2021-12-08 15:31:29.292544",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"skill_name"
"skill"
],
"fields": [
{
"fieldname": "skill_name",
"fieldname": "skill",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Skill Name"
"label": "Skill"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-12-07 12:22:56.769638",
"modified": "2021-12-08 15:31:29.292544",
"modified_by": "Administrator",
"module": "LMS",
"name": "Skill",
"owner": "Administrator",
"permissions": [],
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC"
}

View File

View File

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

View File

@@ -0,0 +1,31 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2021-12-07 12:22:44.139341",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"skill_name"
],
"fields": [
{
"fieldname": "skill_name",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Skill Name",
"options": "Skill"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-12-08 15:31:44.691222",
"modified_by": "Administrator",
"module": "LMS",
"name": "Skills",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC"
}

View File

@@ -0,0 +1,8 @@
# Copyright (c) 2021, Frappe and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class Skills(Document):
pass

View File

@@ -0,0 +1,8 @@
# Copyright (c) 2021, Frappe and Contributors
# See license.txt
# import frappe
import unittest
class TestSkills(unittest.TestCase):
pass

View File

@@ -9,10 +9,11 @@
"title",
"company",
"location",
"description",
"column_break_4",
"current",
"from_date",
"to_date",
"description"
"to_date"
],
"fields": [
{
@@ -48,7 +49,7 @@
"fieldname": "to_date",
"fieldtype": "Date",
"label": "To Date",
"reqd": 1
"mandatory_depends_on": "eval: !doc.current"
},
{
"fieldname": "description",
@@ -60,12 +61,16 @@
"fieldname": "current",
"fieldtype": "Check",
"label": "I am currently working here"
},
{
"fieldname": "column_break_4",
"fieldtype": "Column Break"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-12-07 12:18:39.885407",
"modified": "2021-12-09 16:25:48.104205",
"modified_by": "Administrator",
"module": "LMS",
"name": "Work Experience",

View File

@@ -1,11 +1,36 @@
frappe.ready(function () {
frappe.web_form.after_load = () => {
if (!frappe.utils.get_url_arg("name")) {
window.location.href = `/edit-profile?name=${frappe.session.user}`;
}
$(document).on("click", "input[data-fieldname='current']", (e) => {
if ($(e.currentTarget).prop("checked"))
$("div[data-fieldname='to_date']").addClass("hide");
else
$("div[data-fieldname='to_date']").removeClass("hide");
});
}
frappe.web_form.validate = () => {
let to_date_missing;
const data = frappe.web_form.get_values();
data.work_experience.forEach(exp => {
if (!exp.current && !exp.to_date) {
to_date_missing = true
frappe.msgprint('To Date is mandatory in Work Experience.');
}
});
if (to_date_missing)
return false;
return true;
};
frappe.web_form.after_save = () => {
setTimeout(() => {
window.location.href = `/profile_/${frappe.web_form.get_value(["username"])}`;

View File

@@ -21,7 +21,7 @@
"is_standard": 1,
"login_required": 1,
"max_attachment_size": 0,
"modified": "2021-08-06 14:40:39.013776",
"modified": "2021-12-09 16:17:18.771370",
"modified_by": "Administrator",
"module": "LMS",
"name": "profile",
@@ -173,37 +173,130 @@
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "college",
"fieldtype": "Data",
"fieldname": "education",
"fieldtype": "Table",
"hidden": 0,
"label": "College Name",
"label": "Education",
"max_length": 0,
"max_value": 0,
"options": "Education Detail",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"depends_on": "college",
"fieldname": "branch",
"fieldtype": "Data",
"fieldname": "work_experience",
"fieldtype": "Table",
"hidden": 0,
"label": "Branch",
"label": "Work Experience",
"max_length": 0,
"max_value": 0,
"options": "Work Experience",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "profession",
"fieldtype": "Data",
"fieldname": "certification",
"fieldtype": "Table",
"hidden": 0,
"label": "Profession",
"label": "Certification",
"max_length": 0,
"max_value": 0,
"options": "Certification",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "career_preference",
"fieldtype": "Table",
"hidden": 0,
"label": "Career Preference",
"max_length": 0,
"max_value": 0,
"options": "Career Preference",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "attire",
"fieldtype": "Select",
"hidden": 0,
"label": "Attire Preference",
"max_length": 0,
"max_value": 0,
"options": "Casual\nFormal",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "collaboration",
"fieldtype": "Select",
"hidden": 0,
"label": "Collaboration Preference",
"max_length": 0,
"max_value": 0,
"options": "Individual\nTeam",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "role",
"fieldtype": "Select",
"hidden": 0,
"label": "Role Preference",
"max_length": 0,
"max_value": 0,
"options": "Clearly Defined Role\nUnstructured Role",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "location_preference",
"fieldtype": "Select",
"hidden": 0,
"label": "Location Preference",
"max_length": 0,
"max_value": 0,
"options": "Travel\nClose to Home",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "time",
"fieldtype": "Select",
"hidden": 0,
"label": "Time Preference",
"max_length": 0,
"max_value": 0,
"options": "Flexible Time\nFixed 9-5",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "company_type",
"fieldtype": "Select",
"hidden": 0,
"label": "Company Type",
"max_length": 0,
"max_value": 0,
"options": "Corporate\nStartup",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0