feat: job application
This commit is contained in:
0
lms/job/doctype/lms_job_application/__init__.py
Normal file
0
lms/job/doctype/lms_job_application/__init__.py
Normal file
14
lms/job/doctype/lms_job_application/lms_job_application.js
Normal file
14
lms/job/doctype/lms_job_application/lms_job_application.js
Normal 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,
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
});
|
||||
97
lms/job/doctype/lms_job_application/lms_job_application.json
Normal file
97
lms/job/doctype/lms_job_application/lms_job_application.json
Normal 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"
|
||||
}
|
||||
39
lms/job/doctype/lms_job_application/lms_job_application.py
Normal file
39
lms/job/doctype/lms_job_application/lms_job_application.py
Normal 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,
|
||||
)
|
||||
@@ -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
|
||||
14
lms/templates/emails/job_application.html
Normal file
14
lms/templates/emails/job_application.html
Normal 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>
|
||||
|
||||
Reference in New Issue
Block a user