feat: job application

This commit is contained in:
Jannat Patel
2024-02-21 12:08:05 +05:30
parent 36c4e2f4dc
commit 5317aa8fb5
8 changed files with 321 additions and 17 deletions

View File

@@ -0,0 +1,14 @@
// Copyright (c) 2024, Frappe and contributors
// For license information, please see license.txt
frappe.ui.form.on("LMS Job Application", {
refresh(frm) {
frm.set_query("user", function (doc) {
return {
filters: {
ignore_user_type: 1,
},
};
});
},
});

View File

@@ -0,0 +1,97 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-02-20 12:15:08.957843",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"user",
"resume",
"column_break_deax",
"job",
"job_title",
"company"
],
"fields": [
{
"fieldname": "user",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "User",
"options": "User",
"reqd": 1
},
{
"fieldname": "resume",
"fieldtype": "Attach",
"label": "Resume",
"reqd": 1
},
{
"fieldname": "column_break_deax",
"fieldtype": "Column Break"
},
{
"fieldname": "job",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Job",
"options": "Job Opportunity",
"reqd": 1
},
{
"fetch_from": "job.job_title",
"fieldname": "job_title",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Job Title",
"read_only": 1
},
{
"fetch_from": "job.company_name",
"fieldname": "company",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Company",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-02-20 20:10:46.943871",
"modified_by": "Administrator",
"module": "Job",
"name": "LMS Job Application",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "LMS Student",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "user"
}

View File

@@ -0,0 +1,39 @@
# Copyright (c) 2024, Frappe and contributors
# For license information, please see license.txt
import frappe
from frappe import _
from frappe.model.document import Document
class LMSJobApplication(Document):
def validate(self):
self.validate_duplicate()
def after_insert(self):
self.send_email_to_employer()
def validate_duplicate(self):
if frappe.db.exists("LMS Job Application", {"job": self.job, "user": self.user}):
frappe.throw(_("You have already applied for this job."))
def send_email_to_employer(self):
company_email = frappe.get_value("Job Opportunity", self.job, "company_email_address")
print(company_email)
if company_email:
subject = _("New Job Applicant")
args = {
"full_name": frappe.db.get_value("User", self.user, "full_name"),
"job_title": self.job_title,
}
frappe.sendmail(
recipients=company_email,
subject=subject,
template="job_application",
args=args,
attachments=[self.resume],
header=[subject, "green"],
retry=3,
)

View File

@@ -0,0 +1,9 @@
# Copyright (c) 2024, Frappe and Contributors
# See license.txt
# import frappe
from frappe.tests.utils import FrappeTestCase
class TestLMSJobApplication(FrappeTestCase):
pass

View File

@@ -0,0 +1,14 @@
<h3>
{{ _("New Job Applicant") }}
</h3>
<br>
<p>
{{ _("{0} has applied for the job position {1}").format(full_name, job_title) }}
</p>
<br>
<p>
<b>
{{ _("You can find their resume attached to this email.") }}
</b>
</p>