Merge pull request #1464 from pateljannat/issues-96

feat: redesigned job list
This commit is contained in:
Jannat Patel
2025-04-24 18:35:20 +05:30
committed by GitHub
10 changed files with 232 additions and 105 deletions

View File

@@ -9,18 +9,19 @@
"field_order": [
"job_title",
"location",
"disabled",
"country",
"column_break_5",
"type",
"status",
"disabled",
"section_break_6",
"description",
"company_details_section",
"company_name",
"company_website",
"column_break_11",
"column_break_phkm",
"company_logo",
"company_email_address"
"company_email_address",
"company_details_section",
"description"
],
"fields": [
{
@@ -36,7 +37,7 @@
"fieldtype": "Data",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Location",
"label": "City",
"reqd": 1
},
{
@@ -62,7 +63,8 @@
},
{
"fieldname": "section_break_6",
"fieldtype": "Section Break"
"fieldtype": "Section Break",
"label": "Company Details"
},
{
"fieldname": "description",
@@ -72,8 +74,7 @@
},
{
"fieldname": "company_details_section",
"fieldtype": "Section Break",
"label": "Company Details"
"fieldtype": "Section Break"
},
{
"fieldname": "company_name",
@@ -89,10 +90,6 @@
"label": "Company Website",
"reqd": 1
},
{
"fieldname": "column_break_11",
"fieldtype": "Column Break"
},
{
"fieldname": "company_logo",
"fieldtype": "Attach Image",
@@ -111,13 +108,30 @@
"label": "Company Email Address",
"options": "Email",
"reqd": 1
},
{
"fieldname": "column_break_phkm",
"fieldtype": "Column Break"
},
{
"fieldname": "country",
"fieldtype": "Link",
"label": "Country",
"options": "Country",
"reqd": 1
}
],
"grid_page_length": 50,
"index_web_pages_for_search": 1,
"links": [],
"links": [
{
"link_doctype": "LMS Job Application",
"link_fieldname": "job"
}
],
"make_attachments_public": 1,
"modified": "2025-01-17 12:38:57.134919",
"modified_by": "Administrator",
"modified": "2025-04-24 14:34:35.920242",
"modified_by": "sayali@frappe.io",
"module": "Job",
"name": "Job Opportunity",
"owner": "Administrator",
@@ -157,8 +171,9 @@
"write": 1
}
],
"row_format": "Dynamic",
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "job_title"
}
}

View File

@@ -306,14 +306,20 @@ def get_job_opportunities(filters=None, orFilters=None):
fields=[
"job_title",
"location",
"country",
"type",
"company_name",
"company_logo",
"name",
"creation",
"description",
],
order_by="creation desc",
)
for job in jobs:
job.description = frappe.utils.strip_html_tags(job.description)
job.applicants = frappe.db.count("LMS Job Application", {"job": job.name})
return jobs

View File

@@ -101,4 +101,5 @@ lms.patches.v2_0.allow_guest_access #05-02-2025
lms.patches.v2_0.migrate_batch_student_data #10-02-2025
lms.patches.v2_0.delete_old_enrollment_doctypes
lms.patches.v2_0.delete_unused_custom_fields
lms.patches.v2_0.update_certificate_request_status
lms.patches.v2_0.update_certificate_request_status
lms.patches.v2_0.update_job_city_and_country

View File

@@ -0,0 +1,28 @@
import frappe
def execute():
jobs = frappe.get_all("Job Opportunity", fields=["name", "location"])
for job in jobs:
if "," in job.location:
city, country = job.location.split(",", 1)
city = city.strip()
country = country.strip()
save_country(country, job)
frappe.db.set_value("Job Opportunity", job.name, "location", city)
else:
save_country(job.location, job)
def save_country(country, job):
if frappe.db.exists("Country", country):
frappe.db.set_value("Job Opportunity", job.name, "country", country)
else:
country_mapping = {
"US": "United States",
"USA": "United States",
"UAE": "United Arab Emirates",
}
country = country_mapping.get(country, country)
frappe.db.set_value("Job Opportunity", job.name, "country", country)