From aa2105d5882141f842f5b1b68d7386560f6cd0d9 Mon Sep 17 00:00:00 2001 From: krantheman Date: Tue, 22 Aug 2023 15:40:59 +0530 Subject: [PATCH 01/87] feat: add Posted On, Closes On, Employment Type, and Location fields (cherry picked from commit fbd5cd4aa14651daa928adb444e92f35a5dcd945) # Conflicts: # hrms/hr/doctype/job_opening/job_opening.json --- hrms/hr/doctype/job_opening/job_opening.json | 55 ++++++++++++++++++-- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.json b/hrms/hr/doctype/job_opening/job_opening.json index 72d42deefa..a9a34c4883 100644 --- a/hrms/hr/doctype/job_opening/job_opening.json +++ b/hrms/hr/doctype/job_opening/job_opening.json @@ -8,12 +8,19 @@ "document_type": "Document", "engine": "InnoDB", "field_order": [ + "job_details_section", "job_title", - "company", - "status", - "column_break_5", "designation", + "column_break_5", + "status", + "posted_on", + "closes_on", + "section_break_nngy", + "company", "department", + "column_break_dxpv", + "employment_type", + "location", "references_section", "staffing_plan", "planned_vacancies", @@ -181,12 +188,54 @@ "fieldtype": "Int", "label": "Vacancies", "read_only": 1 + }, + { + "default": "Today", + "depends_on": "eval:doc.status == 'Open'", + "fieldname": "posted_on", + "fieldtype": "Date", + "label": "Posted On" + }, + { + "depends_on": "eval:doc.status == 'Open'", + "fieldname": "closes_on", + "fieldtype": "Date", + "label": "Closes On" + }, + { + "fieldname": "employment_type", + "fieldtype": "Link", + "label": "Employment Type", + "options": "Employment Type" + }, + { + "fieldname": "location", + "fieldtype": "Link", + "label": "Location", + "options": "Branch" + }, + { + "fieldname": "section_break_nngy", + "fieldtype": "Section Break", + "label": "Company Details" + }, + { + "fieldname": "column_break_dxpv", + "fieldtype": "Column Break" + }, + { + "fieldname": "job_details_section", + "fieldtype": "Section Break" } ], "icon": "fa fa-bookmark", "idx": 1, "links": [], +<<<<<<< HEAD "modified": "2023-09-14 16:50:39.316079", +======= + "modified": "2023-08-22 15:39:10.430060", +>>>>>>> fbd5cd4aa (feat: add Posted On, Closes On, Employment Type, and Location fields) "modified_by": "Administrator", "module": "HR", "name": "Job Opening", From 7b9ed80a1eb83a53b46c8702115841a57ad24663 Mon Sep 17 00:00:00 2001 From: krantheman Date: Tue, 22 Aug 2023 16:58:32 +0530 Subject: [PATCH 02/87] refactor: set Naming Rule as Expression (cherry picked from commit 8555205f278d5268fc9dd3dce106121482616fa6) # Conflicts: # hrms/hr/doctype/job_opening/job_opening.json --- hrms/hr/doctype/job_opening/job_opening.json | 13 +++++++++++-- hrms/hr/doctype/job_opening/job_opening.py | 4 ++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.json b/hrms/hr/doctype/job_opening/job_opening.json index a9a34c4883..b9722e825b 100644 --- a/hrms/hr/doctype/job_opening/job_opening.json +++ b/hrms/hr/doctype/job_opening/job_opening.json @@ -1,7 +1,11 @@ { "actions": [], +<<<<<<< HEAD "allow_import": 1, "autoname": "field:route", +======= + "autoname": "HR-OPN-.YYYY.-.#### ", +>>>>>>> 8555205f2 (refactor: set Naming Rule as Expression) "creation": "2013-01-15 16:13:36", "description": "Description of a Job Opening", "doctype": "DocType", @@ -231,15 +235,19 @@ "icon": "fa fa-bookmark", "idx": 1, "links": [], +<<<<<<< HEAD <<<<<<< HEAD "modified": "2023-09-14 16:50:39.316079", ======= "modified": "2023-08-22 15:39:10.430060", >>>>>>> fbd5cd4aa (feat: add Posted On, Closes On, Employment Type, and Location fields) +======= + "modified": "2023-08-22 16:53:41.910984", +>>>>>>> 8555205f2 (refactor: set Naming Rule as Expression) "modified_by": "Administrator", "module": "HR", "name": "Job Opening", - "naming_rule": "By fieldname", + "naming_rule": "Expression (old style)", "owner": "Administrator", "permissions": [ { @@ -260,5 +268,6 @@ ], "sort_field": "modified", "sort_order": "ASC", - "states": [] + "states": [], + "title_field": "job_title" } \ No newline at end of file diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index 266a6a21d3..e35906793a 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -7,6 +7,7 @@ import frappe from frappe import _ from frappe.utils import get_link_to_form, getdate +from frappe.model.naming import set_name_from_naming_options from frappe.website.website_generator import WebsiteGenerator from hrms.hr.doctype.staffing_plan.staffing_plan import ( @@ -22,6 +23,9 @@ class JobOpening(WebsiteGenerator): page_title_field="job_title", ) + def autoname(self): + self.name = set_name_from_naming_options(frappe.get_meta(self.doctype).autoname, self) + def validate(self): if not self.route: self.route = frappe.scrub(self.job_title).replace("_", "-") From 59c1a8f16c12ee0a08a43641c16d5389d0c455cf Mon Sep 17 00:00:00 2001 From: krantheman Date: Tue, 22 Aug 2023 17:27:57 +0530 Subject: [PATCH 03/87] feat: add validation for dates (cherry picked from commit e0ea5208bbd4b5d8e627f00711f53fdbaa98c11b) --- hrms/hr/doctype/job_opening/job_opening.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index e35906793a..afb975c704 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -6,8 +6,8 @@ import frappe from frappe import _ -from frappe.utils import get_link_to_form, getdate from frappe.model.naming import set_name_from_naming_options +from frappe.utils import get_link_to_form, getdate from frappe.website.website_generator import WebsiteGenerator from hrms.hr.doctype.staffing_plan.staffing_plan import ( @@ -29,9 +29,17 @@ def autoname(self): def validate(self): if not self.route: self.route = frappe.scrub(self.job_title).replace("_", "-") + self.validate_closes_on() self.validate_current_vacancies() self.update_job_requisition_status() + def validate_closes_on(self): + self.validate_from_to_dates("posted_on", "closes_on") + today = getdate() + closes_on = getdate(self.closes_on) + if closes_on < today: + frappe.throw(_(f"{frappe.bold('Closes On')} cannot be a past date")) + def validate_current_vacancies(self): if not self.staffing_plan: staffing_plan = get_active_staffing_plan_details(self.company, self.designation) From 88f64220f2179eaaa7d282c4bb38fe243de02e03 Mon Sep 17 00:00:00 2001 From: krantheman Date: Tue, 22 Aug 2023 18:15:59 +0530 Subject: [PATCH 04/87] feat: add validation for Posted On date (cherry picked from commit 3d5a95fc61d49895883a87bcca3b1043dde36d47) --- hrms/hr/doctype/job_opening/job_opening.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index afb975c704..38a49ced28 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -29,13 +29,16 @@ def autoname(self): def validate(self): if not self.route: self.route = frappe.scrub(self.job_title).replace("_", "-") - self.validate_closes_on() + self.validate_dates() self.validate_current_vacancies() self.update_job_requisition_status() - def validate_closes_on(self): + def validate_dates(self): self.validate_from_to_dates("posted_on", "closes_on") today = getdate() + posted_on = getdate(self.posted_on) + if posted_on > today: + frappe.throw(_(f"{frappe.bold('Posted On')} cannot be a future date")) closes_on = getdate(self.closes_on) if closes_on < today: frappe.throw(_(f"{frappe.bold('Closes On')} cannot be a past date")) From 78299f1795bb626c2b3d0ea92af145de23c86478 Mon Sep 17 00:00:00 2001 From: krantheman Date: Tue, 22 Aug 2023 21:19:05 +0530 Subject: [PATCH 05/87] feat: add scheduler event to close expired job openings (cherry picked from commit 63efc2f2b9e2dcc93d643f5b1051801ad699a1ff) --- hrms/hooks.py | 1 + hrms/hr/doctype/job_opening/job_opening.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/hrms/hooks.py b/hrms/hooks.py index 27340c8124..8b01201c4e 100644 --- a/hrms/hooks.py +++ b/hrms/hooks.py @@ -215,6 +215,7 @@ "hrms.controllers.employee_reminders.send_work_anniversary_reminders", "hrms.hr.doctype.daily_work_summary_group.daily_work_summary_group.send_summary", "hrms.hr.doctype.interview.interview.send_daily_feedback_reminder", + "hrms.hr.doctype.job_opening.job_opening.close_expired_job_openings", ], "daily_long": [ "hrms.hr.doctype.leave_ledger_entry.leave_ledger_entry.process_expired_allocation", diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index 38a49ced28..aff628c137 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -123,3 +123,13 @@ def get_job_openings( return frappe.get_all( doctype, filters, fields, start=limit_start, page_length=limit_page_length, order_by=order_by ) + + +def close_expired_job_openings(): + today = getdate() + for d in frappe.get_all( + "Job Opening", + filters={"Status": "Open", "closes_on": ["<=", today]}, + fields=["name", "closes_on"], + ): + frappe.set_value("Job Opening", d.name, "status", "Closed") From e78681405e448eabd7f2a9b339eff1f2a98155b5 Mon Sep 17 00:00:00 2001 From: krantheman Date: Wed, 23 Aug 2023 13:06:39 +0530 Subject: [PATCH 06/87] feat: add Closed On field (cherry picked from commit ffa97ee3b35d1001d9e0f5955eee6d9552130362) # Conflicts: # hrms/hr/doctype/job_opening/job_opening.json --- hrms/hr/doctype/job_opening/job_opening.json | 12 +++++- hrms/hr/doctype/job_opening/job_opening.py | 39 ++++++++++++++++---- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.json b/hrms/hr/doctype/job_opening/job_opening.json index b9722e825b..249c8733f0 100644 --- a/hrms/hr/doctype/job_opening/job_opening.json +++ b/hrms/hr/doctype/job_opening/job_opening.json @@ -19,6 +19,7 @@ "status", "posted_on", "closes_on", + "closed_on", "section_break_nngy", "company", "department", @@ -195,7 +196,6 @@ }, { "default": "Today", - "depends_on": "eval:doc.status == 'Open'", "fieldname": "posted_on", "fieldtype": "Date", "label": "Posted On" @@ -230,12 +230,19 @@ { "fieldname": "job_details_section", "fieldtype": "Section Break" + }, + { + "depends_on": "eval:doc.status == 'Closed'", + "fieldname": "closed_on", + "fieldtype": "Date", + "label": "Closed On" } ], "icon": "fa fa-bookmark", "idx": 1, "links": [], <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD "modified": "2023-09-14 16:50:39.316079", ======= @@ -244,6 +251,9 @@ ======= "modified": "2023-08-22 16:53:41.910984", >>>>>>> 8555205f2 (refactor: set Naming Rule as Expression) +======= + "modified": "2023-08-23 11:48:22.678542", +>>>>>>> ffa97ee3b (feat: add Closed On field) "modified_by": "Administrator", "module": "HR", "name": "Job Opening", diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index aff628c137..ac2fb9e3e1 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -33,15 +33,40 @@ def validate(self): self.validate_current_vacancies() self.update_job_requisition_status() + def on_update(self): + old_doc = self.get_doc_before_save() + if not old_doc: + return + + if old_doc.status == "Open" and self.status == "Closed": + today = getdate() + self.closes_on = None + if not self.closed_on: + self.closed_on = today + self.save() + + elif old_doc.status == "Closed" and self.status == "Open": + self.closed_on = None + self.save() + def validate_dates(self): - self.validate_from_to_dates("posted_on", "closes_on") + self.validate_past_future("posted_on", True) + if self.status == "Open": + self.validate_past_future("closes_on", False) + if self.status == "Closed": + self.validate_from_to_dates("posted_on", "closed_on") + self.validate_past_future("closed_on", True) + + def validate_past_future(self, field, is_past): + date = self.get(field) + label = self.meta.get_label(field) today = getdate() - posted_on = getdate(self.posted_on) - if posted_on > today: - frappe.throw(_(f"{frappe.bold('Posted On')} cannot be a future date")) - closes_on = getdate(self.closes_on) - if closes_on < today: - frappe.throw(_(f"{frappe.bold('Closes On')} cannot be a past date")) + if is_past: + if getdate(date) > today: + frappe.throw(_(f"{frappe.bold(label)} cannot be a future date")) + else: + if getdate(date) < today: + frappe.throw(_(f"{frappe.bold(label)} cannot be a past date")) def validate_current_vacancies(self): if not self.staffing_plan: From cff5dbf0884c5b2a97f9353332381df507d1ecb6 Mon Sep 17 00:00:00 2001 From: krantheman Date: Wed, 23 Aug 2023 16:10:57 +0530 Subject: [PATCH 07/87] feat: add Salary Type field (cherry picked from commit a65b7d5f31dfaa044d5f1393ef5297b1736e88bb) # Conflicts: # hrms/hr/doctype/job_opening/job_opening.json --- hrms/hr/doctype/job_opening/job_opening.json | 12 +++++++ hrms/hr/doctype/job_opening/job_opening.py | 1 + .../templates/job_opening_row.html | 32 +++++++++++++------ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.json b/hrms/hr/doctype/job_opening/job_opening.json index 249c8733f0..ba6c232924 100644 --- a/hrms/hr/doctype/job_opening/job_opening.json +++ b/hrms/hr/doctype/job_opening/job_opening.json @@ -43,6 +43,7 @@ "lower_range", "upper_range", "column_break_20", + "salary_type", "publish_salary_range" ], "fields": [ @@ -236,6 +237,13 @@ "fieldname": "closed_on", "fieldtype": "Date", "label": "Closed On" + }, + { + "default": "Per Month", + "fieldname": "salary_type", + "fieldtype": "Select", + "label": "Salary Type", + "options": "Per Hour\nPer Day\nPer Week\nPer Month\nPer Year\nPer Sale" } ], "icon": "fa fa-bookmark", @@ -243,6 +251,7 @@ "links": [], <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD "modified": "2023-09-14 16:50:39.316079", ======= @@ -254,6 +263,9 @@ ======= "modified": "2023-08-23 11:48:22.678542", >>>>>>> ffa97ee3b (feat: add Closed On field) +======= + "modified": "2023-08-23 15:55:02.233809", +>>>>>>> a65b7d5f3 (feat: add Salary Type field) "modified_by": "Administrator", "module": "HR", "name": "Job Opening", diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index ac2fb9e3e1..42f75967c0 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -135,6 +135,7 @@ def get_job_openings( "upper_range", "currency", "job_application_route", + "salary_type", ] filters = filters or {} diff --git a/hrms/hr/doctype/job_opening/templates/job_opening_row.html b/hrms/hr/doctype/job_opening/templates/job_opening_row.html index cc8523ed0a..66340e42fb 100644 --- a/hrms/hr/doctype/job_opening/templates/job_opening_row.html +++ b/hrms/hr/doctype/job_opening/templates/job_opening_row.html @@ -1,18 +1,30 @@ -
-

{{ doc.job_title }}

-

{{ doc.description }}

+
+

{{ doc.job_title }}

+

{{ doc.description or _("No description") }}

{%- if doc.publish_salary_range -%} -

{{_("Salary range per month")}}: {{ frappe.format_value(frappe.utils.flt(doc.lower_range), currency=doc.currency) }} - {{ frappe.format_value(frappe.utils.flt(doc.upper_range), currency=doc.currency) }}

+

+ {{_("Salary Range ")}} ({{_(doc.salary_type)}}): {{ + frappe.format_value(frappe.utils.flt(doc.lower_range), + currency=doc.currency) }} - {{ + frappe.format_value(frappe.utils.flt(doc.upper_range), + currency=doc.currency) }} +

{% endif %}
{%- if doc.job_application_route -%} - - {{ _("Apply Now") }} + + {{ _("Apply Now") }} {% else %} - - {{ _("Apply Now") }} + + {{ _("Apply Now") }} {% endif %}
From 9558158c768779b8633b709a469b4cc150a19a53 Mon Sep 17 00:00:00 2001 From: krantheman Date: Wed, 23 Aug 2023 16:46:43 +0530 Subject: [PATCH 08/87] feat: add link to job route (cherry picked from commit b0e908de40d99ba95984bffdc972125fc0c32209) --- hrms/hr/doctype/job_opening/job_opening.py | 1 + .../templates/job_opening_row.html | 24 ++++--------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index 42f75967c0..d11850bd62 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -136,6 +136,7 @@ def get_job_openings( "currency", "job_application_route", "salary_type", + "route", ] filters = filters or {} diff --git a/hrms/hr/doctype/job_opening/templates/job_opening_row.html b/hrms/hr/doctype/job_opening/templates/job_opening_row.html index 66340e42fb..17a8bad3c2 100644 --- a/hrms/hr/doctype/job_opening/templates/job_opening_row.html +++ b/hrms/hr/doctype/job_opening/templates/job_opening_row.html @@ -1,30 +1,14 @@ -
-

{{ doc.job_title }}

+
+

{{ doc.job_title }}

{{ doc.description or _("No description") }}

{%- if doc.publish_salary_range -%}

- {{_("Salary Range ")}} ({{_(doc.salary_type)}}): {{ + {{_("Salary Range ")}} ({{_(doc.salary_type.lower())}}): {{ frappe.format_value(frappe.utils.flt(doc.lower_range), currency=doc.currency) }} - {{ frappe.format_value(frappe.utils.flt(doc.upper_range), currency=doc.currency) }}

{% endif %} -
- {%- if doc.job_application_route -%} - - {{ _("Apply Now") }} - {% else %} - - {{ _("Apply Now") }} - {% endif %} -
+ {{ _("Learn More →") }}
From 2bae21f6b570b028809364f1488b6f9f42c86c31 Mon Sep 17 00:00:00 2001 From: krantheman Date: Wed, 23 Aug 2023 17:56:02 +0530 Subject: [PATCH 09/87] feat(Job Portal): add Location (cherry picked from commit a0d83bd9593e364f7ffb3d9d30f27f5b789d6f11) --- hrms/hr/doctype/job_opening/job_opening.py | 1 + hrms/hr/doctype/job_opening/templates/job_opening_row.html | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index d11850bd62..ca10c40f5b 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -137,6 +137,7 @@ def get_job_openings( "job_application_route", "salary_type", "route", + "location", ] filters = filters or {} diff --git a/hrms/hr/doctype/job_opening/templates/job_opening_row.html b/hrms/hr/doctype/job_opening/templates/job_opening_row.html index 17a8bad3c2..473bb4ae1e 100644 --- a/hrms/hr/doctype/job_opening/templates/job_opening_row.html +++ b/hrms/hr/doctype/job_opening/templates/job_opening_row.html @@ -1,5 +1,10 @@
-

{{ doc.job_title }}

+
+

{{ doc.job_title }}

+ {%- if doc.location -%} +

({{ doc.location }})

+ {% endif %} +

{{ doc.description or _("No description") }}

{%- if doc.publish_salary_range -%}

From ee84d3c93e36e552a559a65dbf255327e767076c Mon Sep 17 00:00:00 2001 From: krantheman Date: Wed, 23 Aug 2023 21:01:37 +0530 Subject: [PATCH 10/87] feat: improve ui (cherry picked from commit bb44dfabe4f0e0d8b43e5be3a9ec5254c53a13da) --- .../templates/job_opening_row.html | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/hrms/hr/doctype/job_opening/templates/job_opening_row.html b/hrms/hr/doctype/job_opening/templates/job_opening_row.html index 473bb4ae1e..d01287f076 100644 --- a/hrms/hr/doctype/job_opening/templates/job_opening_row.html +++ b/hrms/hr/doctype/job_opening/templates/job_opening_row.html @@ -1,18 +1,21 @@

-
-

{{ doc.job_title }}

- {%- if doc.location -%} -

({{ doc.location }})

+

+ {{ doc.job_title }} {%- if doc.location -%} + ({{ doc.location }}) {% endif %} -

+

{{ doc.description or _("No description") }}

{%- if doc.publish_salary_range -%}

- {{_("Salary Range ")}} ({{_(doc.salary_type.lower())}}): {{ - frappe.format_value(frappe.utils.flt(doc.lower_range), - currency=doc.currency) }} - {{ - frappe.format_value(frappe.utils.flt(doc.upper_range), - currency=doc.currency) }} + + {{_("Salary range " + doc.salary_type.lower())}}: + {{ frappe.format_value(frappe.utils.flt(doc.lower_range), + currency=doc.currency) }} - {{ + frappe.format_value(frappe.utils.flt(doc.upper_range), + currency=doc.currency) }} + +

{% endif %} {{ _("Learn More →") }} From 7cfbcaf711930737ac65915a2678214c8beab61f Mon Sep 17 00:00:00 2001 From: krantheman Date: Thu, 24 Aug 2023 17:08:01 +0530 Subject: [PATCH 11/87] refactor: improve UI (cherry picked from commit 26f6b06adcb1d25c0a4dacfdc13759c0430e3ec4) --- .../templates/job_opening_row.html | 5 +- hrms/templates/generators/job_opening.html | 101 ++++++++++++------ 2 files changed, 73 insertions(+), 33 deletions(-) diff --git a/hrms/hr/doctype/job_opening/templates/job_opening_row.html b/hrms/hr/doctype/job_opening/templates/job_opening_row.html index d01287f076..b5f1251208 100644 --- a/hrms/hr/doctype/job_opening/templates/job_opening_row.html +++ b/hrms/hr/doctype/job_opening/templates/job_opening_row.html @@ -1,10 +1,9 @@ -
-

+
+

{{ doc.job_title }} {%- if doc.location -%} ({{ doc.location }}) {% endif %}

-

{{ doc.description or _("No description") }}

{%- if doc.publish_salary_range -%}

diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index 2cd91b77da..66efdfcdfd 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -1,33 +1,74 @@ -{% extends "templates/web.html" %} - -{% block breadcrumbs %} - {% include "templates/includes/breadcrumbs.html" %} -{% endblock %} - -{% block header %} -

{{ job_title }}

-{% endblock %} - -{% block page_content %} - -{%- if description -%} -
{{ description }}
-{% endif %} - -{%- if publish_salary_range -%} -
{{_("Salary range per month")}}: {{ frappe.format_value(frappe.utils.flt(lower_range), currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range), currency=currency) }}
-{% endif %} - -

- {%- if job_application_route -%} - - {{ _("Apply Now") }} - {% else %} - - {{ _("Apply Now") }} +{% extends "templates/web.html" %} {% block breadcrumbs %} {% include +"templates/includes/breadcrumbs.html" %} {% endblock %} {% block page_content %} +

+

{{ job_title }}

+
+ {%- if job_application_route -%} + + {{ _("Apply Now") }} + {% else %} + + {{ _("Apply Now") }} + {% endif %} +
+
+
+ {%- if department -%} + + + +

{{ doc.department }}

+ {% endif %} {%- if location -%} + + + + + + +

{{ doc.location }}

+ {% endif %} {%- if employment_type -%} + + + +

{{ doc.employment_type }}

{% endif %} +
+{%- if doc.publish_salary_range -%} +

+ {{_("Salary range " + doc.salary_type.lower())}}: + {{ frappe.format_value(frappe.utils.flt(doc.lower_range), + currency=doc.currency) }} - {{ + frappe.format_value(frappe.utils.flt(doc.upper_range), + currency=doc.currency) }} +

- +{% endif %} +

{{ description or _("No description") }}

+
+

+ 20 applications received! +

+ {%- if doc.closes_on -%} +

+ {{_("Closes on ")}} {{ doc.closes_on }} +

+ {% endif %} +
{% endblock %} From bea8789053208b8e2258507d0815d35d1cc2db2b Mon Sep 17 00:00:00 2001 From: krantheman Date: Thu, 24 Aug 2023 17:40:12 +0530 Subject: [PATCH 12/87] feat: add no. of applications received (cherry picked from commit 653975c2f2e47270dba5fb9f858b84f1427af335) --- hrms/hr/doctype/job_opening/job_opening.py | 2 ++ hrms/templates/generators/job_opening.html | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index ca10c40f5b..46468c5a0a 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -113,6 +113,8 @@ def update_job_requisition_status(self): job_requisition.save() def get_context(self, context): + job_applicants = frappe.get_all("Job Applicant", filters={"job_title": self.name}) + context.no_of_applications = len(job_applicants) context.parents = [{"route": "jobs", "title": _("All Jobs")}] diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index 66efdfcdfd..09ff26fa2a 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -62,10 +62,14 @@

{{ job_title }}

{% endif %}

{{ description or _("No description") }}

+ {%- if no_of_applications -%}

- 20 applications received! + {{ no_of_applications }} {{"application" if no_of_applications == 1 else + "applications"}} received!

- {%- if doc.closes_on -%} + {% endif %} {%- if doc.closes_on -%}

{{_("Closes on ")}} {{ doc.closes_on }}

From 0a1e5daf1031ac0c565731bd5e0cfbe5a6679bfa Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 01:31:28 +0530 Subject: [PATCH 13/87] feat: better spacing and other ui changes (cherry picked from commit 25f5d03d48a96c41fc411b0ae9d11006a12f1391) --- hrms/templates/generators/job_opening.html | 147 +++++++++++---------- 1 file changed, 77 insertions(+), 70 deletions(-) diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index 09ff26fa2a..124e4ee6c4 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -1,78 +1,85 @@ {% extends "templates/web.html" %} {% block breadcrumbs %} {% include "templates/includes/breadcrumbs.html" %} {% endblock %} {% block page_content %} -
-

{{ job_title }}

-
- {%- if job_application_route -%} - - {{ _("Apply Now") }} - {% else %} - - {{ _("Apply Now") }} +
+

{{ job_title }}

+
+ {%- if job_application_route -%} + + {{ _("Apply Now") }} + {% else %} + + {{ _("Apply Now") }} + {% endif %} +
+
+
+
+ {%- if department -%} + + + +

{{ doc.department }}

+ {% endif %} {%- if location -%} + + + + + + +

{{ doc.location }}

+ {% endif %} {%- if employment_type -%} + + + +

{{ doc.employment_type }}

+ {% endif %} +
+ {%- if doc.publish_salary_range -%} +

+ {{_("Salary range " + doc.salary_type.lower())}}: + {{ frappe.format_value(frappe.utils.flt(doc.lower_range), + currency=doc.currency) }} - {{ + frappe.format_value(frappe.utils.flt(doc.upper_range), + currency=doc.currency) }} + +

+ {% endif %} {%- if no_of_applications -%} +

+ {{ no_of_applications }} {{"application" if no_of_applications == 1 else + "applications"}} received! +

+ {% endif %} {%- if doc.closes_on -%} +

+ {{_("Closes on ")}} {{ frappe.format_date(doc.closes_on) }} +

{% endif %}
-
-
- {%- if department -%} - - - -

{{ doc.department }}

- {% endif %} {%- if location -%} - - - - - - -

{{ doc.location }}

- {% endif %} {%- if employment_type -%} - - - -

{{ doc.employment_type }}

- {% endif %} -
-{%- if doc.publish_salary_range -%} -

- {{_("Salary range " + doc.salary_type.lower())}}: - {{ frappe.format_value(frappe.utils.flt(doc.lower_range), - currency=doc.currency) }} - {{ - frappe.format_value(frappe.utils.flt(doc.upper_range), - currency=doc.currency) }} - -

-{% endif %} -

{{ description or _("No description") }}

-
- {%- if no_of_applications -%} -

- {{ no_of_applications }} {{"application" if no_of_applications == 1 else - "applications"}} received! -

- {% endif %} {%- if doc.closes_on -%} -

- {{_("Closes on ")}} {{ doc.closes_on }} -

+ + {%- if doc.description -%} +

{{ description }}

{% endif %}
+ {% endblock %} From 434991ae4c5015deca4596a6af3e632213d2bc99 Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 11:59:41 +0530 Subject: [PATCH 14/87] refactor: Closes on and Applications Received on same line (cherry picked from commit a41187a1ad01442d33bd806b8ff7cf0ecccffeab) --- hrms/templates/generators/job_opening.html | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index 124e4ee6c4..a5999b484c 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -2,27 +2,26 @@ "templates/includes/breadcrumbs.html" %} {% endblock %} {% block page_content %}
-
+

{{ job_title }}

{%- if job_application_route -%} - {{ _("Apply Now") }}{{ _("Apply Now") }} {% else %} - {{ _("Apply Now") }}{{ _("Apply Now") }} {% endif %}
-
+ +
{{ job_title }}

{{ doc.employment_type }}

{% endif %}
+ {%- if doc.publish_salary_range -%}

- {{_("Salary range " + doc.salary_type.lower())}}: + {{ _("Salary range " + doc.salary_type.lower() ) }}: {{ frappe.format_value(frappe.utils.flt(doc.lower_range), + >{{ frappe.format_value(frappe.utils.flt(doc.lower_range) , currency=doc.currency) }} - {{ - frappe.format_value(frappe.utils.flt(doc.upper_range), + frappe.format_value(frappe.utils.flt(doc.upper_range) , currency=doc.currency) }}

- {% endif %} {%- if no_of_applications -%} -

- {{ no_of_applications }} {{"application" if no_of_applications == 1 else - "applications"}} received! -

- {% endif %} {%- if doc.closes_on -%} + {% endif %} +

- {{_("Closes on ")}} {{ frappe.format_date(doc.closes_on) }} + + {%- if doc.closes_on -%} {{ _("Closes on " + + frappe.format_date(doc.closes_on) ) }} {%- if no_of_applications -%} {{ + " - " }}{% endif %} {% endif %} {%- if no_of_applications -%} {{ + no_of_applications }} {{ _("application received!" if no_of_applications + == 1 else "applications received!") }} {% endif %} +

- {% endif %}
{%- if doc.description -%}

{{ description }}

{% endif %}
- {% endblock %} From 0f6c47d2274b8e04f61119a23159e95d6930214e Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 14:28:51 +0530 Subject: [PATCH 15/87] feat: add portal page (cherry picked from commit 7d5baff7894ad58359d2560e192c40d1c51bbd89) # Conflicts: # hrms/hooks.py --- hrms/hooks.py | 6 + hrms/templates/generators/job_opening.html | 152 +++++++++------------ hrms/www/jobs/index.html | 5 + hrms/www/jobs/index.py | 4 + 4 files changed, 83 insertions(+), 84 deletions(-) create mode 100644 hrms/www/jobs/index.html create mode 100644 hrms/www/jobs/index.py diff --git a/hrms/hooks.py b/hrms/hooks.py index 8b01201c4e..25feb7e495 100644 --- a/hrms/hooks.py +++ b/hrms/hooks.py @@ -69,10 +69,16 @@ # automatically create page for each record of this doctype website_generators = ["Job Opening"] +<<<<<<< HEAD website_route_rules = [ {"from_route": "/jobs", "to_route": "Job Opening"}, {"from_route": "/hrms/", "to_route": "hrms"}, ] +======= +# website_route_rules = [ +# {"from_route": "/jobs", "to_route": "Job Opening"}, +# ] +>>>>>>> 7d5baff78 (feat: add portal page) # Jinja # ---------- diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index a5999b484c..fc8dbeee36 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -1,85 +1,69 @@ -{% extends "templates/web.html" %} {% block breadcrumbs %} {% include -"templates/includes/breadcrumbs.html" %} {% endblock %} {% block page_content %} - -
-
-

{{ job_title }}

-
- {%- if job_application_route -%} - {{ _("Apply Now") }} - {% else %} - {{ _("Apply Now") }} - {% endif %} -
-
- -
-
- {%- if department -%} - - - -

{{ doc.department }}

- {% endif %} {%- if location -%} - - - - - - -

{{ doc.location }}

- {% endif %} {%- if employment_type -%} - - - -

{{ doc.employment_type }}

- {% endif %} -
- - {%- if doc.publish_salary_range -%} -

- {{ _("Salary range " + doc.salary_type.lower() ) }}: - {{ frappe.format_value(frappe.utils.flt(doc.lower_range) , - currency=doc.currency) }} - {{ - frappe.format_value(frappe.utils.flt(doc.upper_range) , - currency=doc.currency) }} - -

- {% endif %} - -

- - {%- if doc.closes_on -%} {{ _("Closes on " + - frappe.format_date(doc.closes_on) ) }} {%- if no_of_applications -%} {{ - " - " }}{% endif %} {% endif %} {%- if no_of_applications -%} {{ - no_of_applications }} {{ _("application received!" if no_of_applications - == 1 else "applications received!") }} {% endif %} - -

-
- - {%- if doc.description -%} -

{{ description }}

- {% endif %} +{% extends "templates/web.html" %} +{% block page_content %} +
+
+

{{ job_title }}

+
+ {%- if job_application_route -%} + {{ _("Apply Now") }} + {% else %} + {{ _("Apply Now") }} + {% endif %} +
+
+
+
+ {%- if department -%} + + + +

{{ doc.department }}

+ {% endif %} + {%- if location -%} + + + + + + + +

{{ doc.location }}

+ {% endif %} + {%- if employment_type -%} + + + +

{{ doc.employment_type }}

+ {% endif %} +
+ {%- if doc.publish_salary_range -%} +

+ {{ _("Salary range " + doc.salary_type.lower() ) }}: + {{ frappe.format_value(frappe.utils.flt(doc.lower_range) , + currency=doc.currency) }} - {{ frappe.format_value(frappe.utils.flt(doc.upper_range) , + currency=doc.currency) }} + +

+ {% endif %} +

+ + {%- if doc.closes_on -%} {{ _("Closes on " + + frappe.format_date(doc.closes_on, "d MMM, YYYY") ) }} {%- if + no_of_applications -%} {{ " - " }} + {% endif %} + {% endif %} + {%- if + no_of_applications -%} {{ no_of_applications }} {{ _("application + received!" if no_of_applications == 1 else "applications received!") }} + {% endif %} + +

+
+ {%- if doc.description -%}

{{ description }}

{% endif %}
-{% endblock %} +{% endblock page_content %} diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html new file mode 100644 index 0000000000..f7c919bc91 --- /dev/null +++ b/hrms/www/jobs/index.html @@ -0,0 +1,5 @@ +{% extends "templates/web.html" %} +{% block header %} +{% endblock header %} +{% block page_content %} +{% endblock page_content %} diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py new file mode 100644 index 0000000000..5dccf977ff --- /dev/null +++ b/hrms/www/jobs/index.py @@ -0,0 +1,4 @@ +import frappe + +def get_context(context): + context.parents = [{"name": frappe._("My Account"), "route": "/"}] From b9890901180c69f6d04e329af85a27750572df24 Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 15:04:21 +0530 Subject: [PATCH 16/87] refactor: use portal pages instead of doctype list view (cherry picked from commit abbaa106c4c2894a8a9db533bbd14e8e6ba59064) --- hrms/hr/doctype/job_opening/job_opening.py | 37 ------------------ .../templates/job_opening_row.html | 21 ---------- hrms/www/jobs/index.html | 20 ++++++++++ hrms/www/jobs/index.py | 39 ++++++++++++++++++- 4 files changed, 58 insertions(+), 59 deletions(-) delete mode 100644 hrms/hr/doctype/job_opening/templates/job_opening_row.html diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index 46468c5a0a..33d23c0faa 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -118,43 +118,6 @@ def get_context(self, context): context.parents = [{"route": "jobs", "title": _("All Jobs")}] -def get_list_context(context): - context.title = _("Jobs") - context.introduction = _("Current Job Openings") - context.get_list = get_job_openings - - -def get_job_openings( - doctype, txt=None, filters=None, limit_start=0, limit_page_length=20, order_by=None -): - fields = [ - "name", - "status", - "job_title", - "description", - "publish_salary_range", - "lower_range", - "upper_range", - "currency", - "job_application_route", - "salary_type", - "route", - "location", - ] - - filters = filters or {} - filters.update({"status": "Open"}) - - if txt: - filters.update( - {"job_title": ["like", "%{0}%".format(txt)], "description": ["like", "%{0}%".format(txt)]} - ) - - return frappe.get_all( - doctype, filters, fields, start=limit_start, page_length=limit_page_length, order_by=order_by - ) - - def close_expired_job_openings(): today = getdate() for d in frappe.get_all( diff --git a/hrms/hr/doctype/job_opening/templates/job_opening_row.html b/hrms/hr/doctype/job_opening/templates/job_opening_row.html deleted file mode 100644 index b5f1251208..0000000000 --- a/hrms/hr/doctype/job_opening/templates/job_opening_row.html +++ /dev/null @@ -1,21 +0,0 @@ -
-

- {{ doc.job_title }} {%- if doc.location -%} - ({{ doc.location }}) - {% endif %} -

- {%- if doc.publish_salary_range -%} -

- - {{_("Salary range " + doc.salary_type.lower())}}: - {{ frappe.format_value(frappe.utils.flt(doc.lower_range), - currency=doc.currency) }} - {{ - frappe.format_value(frappe.utils.flt(doc.upper_range), - currency=doc.currency) }} - - -

- {% endif %} - {{ _("Learn More →") }} -
diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index f7c919bc91..ec1bf90009 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -1,5 +1,25 @@ {% extends "templates/web.html" %} {% block header %} + Current Job Openings {% endblock header %} {% block page_content %} +
+ {% for jo in job_openings %} +
+

+ {{ jo.job_title }} {%- if jo.location -%}({{ jo.location }}){% endif %} +

+ {%- if jo.publish_salary_range -%} +

+ {{ _("Salary range " + jo.salary_type.lower() ) }}: + {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , + currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , + currency=jo.currency) }} + +

+ {% endif %} + {{ _("Learn More →") }} +
+ {% endfor %} +
{% endblock page_content %} diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index 5dccf977ff..ad9d97b2fc 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -1,4 +1,41 @@ import frappe +from frappe import _ + def get_context(context): - context.parents = [{"name": frappe._("My Account"), "route": "/"}] + context.parents = [{"name": _("My Account"), "route": "/"}] + context.job_openings = get_job_openings() + + +def get_job_openings(txt=None, filters=None, limit_start=0, limit_page_length=20, order_by=None): + fields = [ + "name", + "status", + "job_title", + "description", + "publish_salary_range", + "lower_range", + "upper_range", + "currency", + "job_application_route", + "salary_type", + "route", + "location", + ] + + filters = filters or {} + filters.update({"status": "Open"}) + + if txt: + filters.update( + {"job_title": ["like", "%{0}%".format(txt)], "description": ["like", "%{0}%".format(txt)]} + ) + + return frappe.get_all( + "Job Opening", + filters, + fields, + start=limit_start, + page_length=limit_page_length, + order_by=order_by, + ) From 5060bf481c602926bf5c9f80ed35169703696c9f Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 16:03:00 +0530 Subject: [PATCH 17/87] feat: add branch and employment type to portal page (cherry picked from commit 9082da788b96d68ad571df39d3277f382be1a787) --- hrms/hr/doctype/job_opening/job_opening.py | 2 +- hrms/templates/generators/job_opening.html | 6 ++- hrms/www/jobs/index.css | 3 ++ hrms/www/jobs/index.html | 60 ++++++++++++++++------ hrms/www/jobs/index.py | 2 + 5 files changed, 54 insertions(+), 19 deletions(-) create mode 100644 hrms/www/jobs/index.css diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index 33d23c0faa..e15115d2ef 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -28,7 +28,7 @@ def autoname(self): def validate(self): if not self.route: - self.route = frappe.scrub(self.job_title).replace("_", "-") + self.route = f"jobs/{frappe.scrub(self.job_title).replace('_', '-')}" self.validate_dates() self.validate_current_vacancies() self.update_job_requisition_status() diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index fc8dbeee36..d56c7471f2 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -16,6 +16,10 @@

{{ job_title }}

+ + + +

{{ doc.company }}

{%- if department -%} @@ -59,7 +63,7 @@

{{ job_title }}

{% endif %} {%- if no_of_applications -%} {{ no_of_applications }} {{ _("application - received!" if no_of_applications == 1 else "applications received!") }} + received" if no_of_applications == 1 else "applications received") }} {% endif %}

diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css new file mode 100644 index 0000000000..79ad05e8c4 --- /dev/null +++ b/hrms/www/jobs/index.css @@ -0,0 +1,3 @@ +.primary-stroke { + --icon-stroke: var(--primary); +} diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index ec1bf90009..1c7553b645 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -5,21 +5,47 @@ {% block page_content %}
{% for jo in job_openings %} -
-

- {{ jo.job_title }} {%- if jo.location -%}({{ jo.location }}){% endif %} -

- {%- if jo.publish_salary_range -%} -

- {{ _("Salary range " + jo.salary_type.lower() ) }}: - {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , - currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , - currency=jo.currency) }} - -

- {% endif %} - {{ _("Learn More →") }} -
- {% endfor %} -
+
+
+

{{ jo.job_title }}

+
+ {%- if jo.department -%} + + + +

{{ jo.department }}

+ {% endif %} + {%- if jo.location -%} + + + + + + + +

{{ jo.location }}

+ {% endif %} + {%- if jo.employment_type -%} + + + +

{{ jo.employment_type }}

+ {% endif %} +
+ {%- if jo.publish_salary_range -%} +

+ {{ _("Salary range " + jo.salary_type.lower() ) }}: + {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , + currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , + currency=jo.currency) }} + +

+ {% endif %} + {{ _("Learn More →") }} +
+
+ {% endfor %} +
{% endblock page_content %} diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index ad9d97b2fc..d7346eec2a 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -21,6 +21,8 @@ def get_job_openings(txt=None, filters=None, limit_start=0, limit_page_length=20 "salary_type", "route", "location", + "department", + "employment_type", ] filters = filters or {} From 2d4eb3bb8aaf4fe79a06dda087e9f82827239e7d Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 17:52:23 +0530 Subject: [PATCH 18/87] feat: add closes on and company to portal page (cherry picked from commit f69b950fbbb3945a2e6312783db57f4af457983a) --- hrms/templates/generators/job_opening.html | 20 +++-- hrms/www/jobs/index.css | 12 +++ hrms/www/jobs/index.html | 85 ++++++++++++---------- hrms/www/jobs/index.py | 2 + 4 files changed, 70 insertions(+), 49 deletions(-) diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index d56c7471f2..090a548e21 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -54,18 +54,16 @@

{{ job_title }}

{% endif %} -

- - {%- if doc.closes_on -%} {{ _("Closes on " + - frappe.format_date(doc.closes_on, "d MMM, YYYY") ) }} {%- if - no_of_applications -%} {{ " - " }} - {% endif %} +

+ {%- if doc.closes_on -%} {{ _("Closes on " + + frappe.format_date(doc.closes_on, "d MMM, YYYY") ) }} {%- if + no_of_applications -%} {{ " - " }} {% endif %} - {%- if - no_of_applications -%} {{ no_of_applications }} {{ _("application - received" if no_of_applications == 1 else "applications received") }} - {% endif %} - + {% endif %} + {%- if + no_of_applications -%} {{ no_of_applications }} {{ _("application + received" if no_of_applications == 1 else "applications received") }} + {% endif %}

{%- if doc.description -%}

{{ description }}

{% endif %} diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index 79ad05e8c4..e4e484a26e 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -1,3 +1,15 @@ .primary-stroke { --icon-stroke: var(--primary); } + +.salary { + font-size: 18px +} + +h3 { + font-size: 1.7rem +} + +p { + margin-bottom: 0 +} \ No newline at end of file diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 1c7553b645..fe61fa35fc 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -1,49 +1,58 @@ {% extends "templates/web.html" %} -{% block header %} - Current Job Openings -{% endblock header %} {% block page_content %} -
+
{% for jo in job_openings %} -
-
-

{{ jo.job_title }}

-
- {%- if jo.department -%} - - +
+
+
+

{{ jo.job_title }}

+
+ + -

{{ jo.department }}

- {% endif %} - {%- if jo.location -%} - - - - - - - -

{{ jo.location }}

- {% endif %} - {%- if jo.employment_type -%} - - - -

{{ jo.employment_type }}

- {% endif %} +

{{ jo.company }}

+ {%- if jo.department -%} + + + +

{{ jo.department }}

+ {% endif %} + {%- if jo.location -%} + + + + + + + +

{{ jo.location }}

+ {% endif %} + {%- if jo.employment_type -%} + + + +

{{ jo.employment_type }}

+ {% endif %} +
+ {{ _("Learn More →") }}
- {%- if jo.publish_salary_range -%} -

- {{ _("Salary range " + jo.salary_type.lower() ) }}: - {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , +

+ {%- if jo.publish_salary_range -%} +

+ {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , currency=jo.currency) }} - +

+

{{ jo.salary_type.lower() }}

+ {% endif %} +

+ {%- if jo.closes_on -%} {{ _("Closes on " + + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }} + {% endif %}

- {% endif %} - {{ _("Learn More →") }} +
{% endfor %} diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index d7346eec2a..e3eaa548a4 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -23,6 +23,8 @@ def get_job_openings(txt=None, filters=None, limit_start=0, limit_page_length=20 "location", "department", "employment_type", + "company", + "closes_on", ] filters = filters or {} From a537aad87352e1995845a8b7650a1e1654dc53ad Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 18:16:31 +0530 Subject: [PATCH 19/87] fix: move closes on down (cherry picked from commit db1448a81a3a34f2479dd95177810ab5085ae5d9) --- hrms/www/jobs/index.html | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index fe61fa35fc..e7b3946e57 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -1,10 +1,10 @@ {% extends "templates/web.html" %} {% block page_content %} -
+
{% for jo in job_openings %}
-
-
+
+

{{ jo.job_title }}

@@ -29,16 +29,10 @@

{{ jo.job_title }}

{{ jo.location }}

{% endif %} - {%- if jo.employment_type -%} - - - -

{{ jo.employment_type }}

- {% endif %}
{{ _("Learn More →") }}
-
+
{%- if jo.publish_salary_range -%}

{{ frappe.format_value(frappe.utils.flt(jo.lower_range) , @@ -47,7 +41,7 @@

{{ jo.job_title }}

{{ jo.salary_type.lower() }}

{% endif %} -

+

{%- if jo.closes_on -%} {{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }} {% endif %} From d91c165d835712855e68712f734c5cb2b4769634 Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 21:05:59 +0530 Subject: [PATCH 20/87] feat: add search box (cherry picked from commit 7b55709de7be1c62069982550dff96387490a76e) --- hrms/templates/generators/job_opening.html | 5 ++-- hrms/www/jobs/index.css | 27 ++++++++++++++------- hrms/www/jobs/index.html | 28 +++++++++++++++++----- 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index 090a548e21..8372f76816 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -57,12 +57,11 @@

{{ job_title }}

{%- if doc.closes_on -%} {{ _("Closes on " + frappe.format_date(doc.closes_on, "d MMM, YYYY") ) }} {%- if - no_of_applications -%} {{ " - " }} + no_of_applications -%} {{ " · " }} {% endif %} {% endif %} {%- if - no_of_applications -%} {{ no_of_applications }} {{ _("application - received" if no_of_applications == 1 else "applications received") }} + no_of_applications -%} {{ no_of_applications }} {{ _("applicant" if no_of_applications == 1 else "applicants") }} {% endif %}

diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index e4e484a26e..3ca4010a8f 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -1,15 +1,26 @@ -.primary-stroke { - --icon-stroke: var(--primary); +h3 { + font-size: 1.7rem; +} + +p { + margin-bottom: 0; +} + +.secondary-stroke { + --icon-stroke: var(--secondary); } .salary { - font-size: 18px + font-size: 18px; } -h3 { - font-size: 1.7rem +/* .card { + -webkit-transition: transform 0.1s ease-in-out; } +.card:hover { + transform: scale(1.01); +} */ -p { - margin-bottom: 0 -} \ No newline at end of file +.closes-on { + font-size: 13px; +} diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index e7b3946e57..677d5fdf52 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -1,13 +1,29 @@ {% extends "templates/web.html" %} {% block page_content %}
+
+
+
+ + + + + +
+ +
+
{% for jo in job_openings %} -
+

{{ jo.job_title }}

-
- +
+

{{ jo.company }}

@@ -21,7 +37,7 @@

{{ jo.job_title }}

- + @@ -39,9 +55,9 @@

{{ jo.job_title }}

currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , currency=jo.currency) }}

-

{{ jo.salary_type.lower() }}

+

{{ jo.salary_type.lower() }}

{% endif %} -

+

{%- if jo.closes_on -%} {{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }} {% endif %} From ed29c271a859dbd45fcf2b228a72b5632d7be8c7 Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 22:02:59 +0530 Subject: [PATCH 21/87] feat: add employment_type badge (cherry picked from commit fcabbd191b7549d960fd9077c8c6157f8e8e2a52) --- hrms/www/jobs/index.css | 25 ++++++++++++++------ hrms/www/jobs/index.html | 49 ++++++++++++++++++++++++++++------------ 2 files changed, 53 insertions(+), 21 deletions(-) diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index 3ca4010a8f..78041d41a6 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -14,13 +14,24 @@ p { font-size: 18px; } -/* .card { - -webkit-transition: transform 0.1s ease-in-out; +.smol-text { + font-size: 13px; } -.card:hover { - transform: scale(1.01); -} */ -.closes-on { - font-size: 13px; +.full-time-badge { + background: var(--bg-green); + color: var(--text-on-green); + border-radius: var(--border-radius) } + +.part-time-badge { + background: var(--bg-orange); + color: var(--text-on-orange); + border-radius: var(--border-radius) +} + +.other-badge { + background: var(--bg-blue); + color: var(--text-on-blue); + border-radius: var(--border-radius) +} \ No newline at end of file diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 677d5fdf52..28415cd7a7 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -1,6 +1,6 @@ {% extends "templates/web.html" %} {% block page_content %} -

+
@@ -18,11 +18,11 @@
{% for jo in job_openings %} -
+
-
+

{{ jo.job_title }}

-
+
@@ -46,18 +46,39 @@

{{ jo.job_title }}

{{ jo.location }}

{% endif %}
- {{ _("Learn More →") }} -
-
{%- if jo.publish_salary_range -%} -

- {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , - currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , - currency=jo.currency) }} -

-

{{ jo.salary_type.lower() }}

+
+

+ + {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , + currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , + currency=jo.currency) }} + + {{ jo.salary_type.lower() }} +

+
+ {% endif %} +
+ {%- if job_application_route -%} + {{ _("Apply Now →") }} + {% else %} + {{ _("Apply Now →") }} + {% endif %} +
+
+
+ {%- if jo.employment_type -%} + {%- if jo.employment_type == "Full-time" -%} + {{ jo.employment_type }} + {%- elif jo.employment_type == "Part-time" -%} + {{ jo.employment_type }} + {%- else -%} + {{ jo.employment_type }} + {% endif %} {% endif %} -

+

{%- if jo.closes_on -%} {{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }} {% endif %} From 2e27dccdb43bc7840816b482040c1466025fa5ff Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 22:44:03 +0530 Subject: [PATCH 22/87] fix: spacing (cherry picked from commit eecb4011473cee6902c4f2641e548b8e7f025fa7) --- hrms/www/jobs/index.html | 62 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 28415cd7a7..b076341fff 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -22,32 +22,32 @@

{{ jo.job_title }}

-
- - - -

{{ jo.company }}

- {%- if jo.department -%} +
+
- + -

{{ jo.department }}

- {% endif %} - {%- if jo.location -%} - - - - - - - -

{{ jo.location }}

- {% endif %} -
- {%- if jo.publish_salary_range -%} -
+

{{ jo.company }}

+ {%- if jo.department -%} + + + +

{{ jo.department }}

+ {% endif %} + {%- if jo.location -%} + + + + + + + +

{{ jo.location }}

+ {% endif %} +
+ {%- if jo.publish_salary_range -%}

{{ frappe.format_value(frappe.utils.flt(jo.lower_range) , @@ -56,8 +56,8 @@

{{ jo.job_title }}

{{ jo.salary_type.lower() }}

-
- {% endif %} + {% endif %} +
From cc1d664d26d0f17bf66d11c382feac3e1249e3b1 Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 22:49:27 +0530 Subject: [PATCH 23/87] refactor: change Apply Now to View Job (cherry picked from commit 1d6c78e4c7c8010ae913ab0c173a47e6a86c18bc) --- hrms/www/jobs/index.html | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index b076341fff..08c3f194eb 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -58,15 +58,7 @@

{{ jo.job_title }}

{% endif %}
- + {{ _("View Job →") }}
{%- if jo.employment_type -%} From 0c7e5d137c66da8bba5347e488fad34701d3bb0f Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 25 Aug 2023 23:33:08 +0530 Subject: [PATCH 24/87] refactor: use flex instead of columns (cherry picked from commit d5674aa50647c361160763bba364d723d01f3e25) --- hrms/www/jobs/index.html | 98 ++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 08c3f194eb..80f0a02e1c 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -19,63 +19,63 @@
{% for jo in job_openings %}
-
-
-

{{ jo.job_title }}

-
-
- - - -

{{ jo.company }}

- {%- if jo.department -%} - - - -

{{ jo.department }}

- {% endif %} - {%- if jo.location -%} - - - - - - - -

{{ jo.location }}

- {% endif %} -
- {%- if jo.publish_salary_range -%} -

- - {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , - currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , - currency=jo.currency) }} - - {{ jo.salary_type.lower() }} -

- {% endif %} -
- {{ _("View Job →") }} -
-
+
+

{{ jo.job_title }}

+
{%- if jo.employment_type -%} {%- if jo.employment_type == "Full-time" -%} - {{ jo.employment_type }} + • {{ jo.employment_type }} {%- elif jo.employment_type == "Part-time" -%} - {{ jo.employment_type }} + • {{ jo.employment_type }} {%- else -%} - {{ jo.employment_type }} + • {{ jo.employment_type }} {% endif %} {% endif %} - {%- if jo.closes_on -%} -

- {{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }} -

+
+
+
+
+ + + +

{{ jo.company }}

+ {%- if jo.department -%} + + + +

{{ jo.department }}

+ {% endif %} + {%- if jo.location -%} + + + + + + + +

{{ jo.location }}

{% endif %}
+ {%- if jo.publish_salary_range -%} +

+ + {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , + currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , + currency=jo.currency) }} + + {{ jo.salary_type.lower() }} +

+ {% endif %} +
+
+ {{ _("View Job →") }} + {%- if jo.closes_on -%} +

+ {{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }} +

+ {% endif %}
{% endfor %} From f6d19f06e78c44ff24e8e3b55190c6bbcc2b00e0 Mon Sep 17 00:00:00 2001 From: krantheman Date: Mon, 28 Aug 2023 13:49:28 +0530 Subject: [PATCH 25/87] feat: add filters ui (cherry picked from commit ff05fa7366c787528f5885c6dd80fa88a3cb7107) --- hrms/www/jobs/index.css | 6 +- hrms/www/jobs/index.html | 186 ++++++++++++++++++++++++--------------- hrms/www/jobs/index.py | 109 ++++++++++++++++------- 3 files changed, 196 insertions(+), 105 deletions(-) diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index 78041d41a6..02de00f956 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -6,11 +6,11 @@ p { margin-bottom: 0; } -.secondary-stroke { - --icon-stroke: var(--secondary); +.primary-stroke { + --icon-stroke: var(--primary); } -.salary { +.big-text { font-size: 18px; } diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 80f0a02e1c..fa479ab888 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -1,83 +1,131 @@ {% extends "templates/web.html" %} {% block page_content %} -
-
-
-
- - - - - -
- +
+
+

Filters

+
+

Companies

+ {% for company in companies %} +
+ + +
+ {% endfor %} +
+
+

Departments

+ {% for department in departments %} +
+ + +
+ {% endfor %} +
+
+

Location

+ {% for location in locations %} +
+ + +
+ {% endfor %} +
+
+

Employment Type

+ {% for type in employment_types %} +
+ + +
+ {% endfor %}
- {% for jo in job_openings %} -
-
-

{{ jo.job_title }}

-
- {%- if jo.employment_type -%} - {%- if jo.employment_type == "Full-time" -%} - • {{ jo.employment_type }} - {%- elif jo.employment_type == "Part-time" -%} - • {{ jo.employment_type }} - {%- else -%} - • {{ jo.employment_type }} - {% endif %} - {% endif %} +
+
+
+
+ + + + +
+
-
-
- - - -

{{ jo.company }}

- {%- if jo.department -%} +
+

Showing {{ job_openings|length }} results

+ {% for jo in job_openings %} +
+
+

{{ jo.job_title }}

+
+ {%- if jo.employment_type -%} + {%- if jo.employment_type == "Full-time" -%} + • {{ jo.employment_type }} + {%- elif jo.employment_type == "Part-time" -%} + • {{ jo.employment_type }} + {%- else -%} + • {{ jo.employment_type }} + {% endif %} + {% endif %} +
+
+
+
- + -

{{ jo.department }}

+

{{ jo.company }}

+ {%- if jo.department -%} + + + +

{{ jo.department }}

+ {% endif %} + {%- if jo.location -%} + + + + + + + +

{{ jo.location }}

+ {% endif %} +
+ {%- if jo.publish_salary_range -%} +

+ + {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , + currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , + currency=jo.currency) }} + + {{ jo.salary_type.lower() }} +

{% endif %} - {%- if jo.location -%} - - - - - - - -

{{ jo.location }}

+ {%- if jo.no_of_applications -%} +

+ {{ jo.no_of_applications }} + {{ _(" applicant" if jo.no_of_applications == 1 else " applicants") }} +

+ {% endif %} +
+
+ {{ _("View Job →") }} + {%- if jo.closes_on -%} +

+ {{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }} +

{% endif %}
- {%- if jo.publish_salary_range -%} -

- - {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , - currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , - currency=jo.currency) }} - - {{ jo.salary_type.lower() }} -

- {% endif %} -
-
- {{ _("View Job →") }} - {%- if jo.closes_on -%} -

- {{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }} -

- {% endif %}
-
- {% endfor %} + {% endfor %} +
{% endblock page_content %} diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index e3eaa548a4..6c6ee41e0d 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -1,45 +1,88 @@ import frappe from frappe import _ +from frappe.query_builder import DocType +from frappe.query_builder.functions import Count def get_context(context): context.parents = [{"name": _("My Account"), "route": "/"}] context.job_openings = get_job_openings() + context.companies, context.departments, context.locations, context.employment_types = get_filters( + context.job_openings + ) def get_job_openings(txt=None, filters=None, limit_start=0, limit_page_length=20, order_by=None): - fields = [ - "name", - "status", - "job_title", - "description", - "publish_salary_range", - "lower_range", - "upper_range", - "currency", - "job_application_route", - "salary_type", - "route", - "location", - "department", - "employment_type", - "company", - "closes_on", - ] - - filters = filters or {} - filters.update({"status": "Open"}) - - if txt: - filters.update( - {"job_title": ["like", "%{0}%".format(txt)], "description": ["like", "%{0}%".format(txt)]} - ) + jo = frappe.qb.DocType("Job Opening") + ja = frappe.qb.DocType("Job Applicant") - return frappe.get_all( - "Job Opening", - filters, - fields, - start=limit_start, - page_length=limit_page_length, - order_by=order_by, + query = ( + frappe.qb.from_(jo) + .left_join(ja) + .on(ja.job_title == jo.name) + .select( + jo.name, + jo.status, + jo.job_title, + jo.description, + jo.publish_salary_range, + jo.lower_range, + jo.upper_range, + jo.currency, + jo.job_application_route, + jo.salary_type, + jo.route, + jo.location, + jo.department, + jo.employment_type, + jo.company, + jo.closes_on, + Count(ja.job_title).as_("no_of_applications"), + ) + .where(jo.status == "Open") + .groupby(jo.name) ) + + return query.run(as_dict=True) + + # for filter in filters: + # if filter == "from_date": + # query = query.where(attendance.attendance_date >= filters.from_date) + # elif filter == "to_date": + # query = query.where(attendance.attendance_date <= filters.to_date) + # elif filter == "consider_grace_period": + # continue + # elif filter == "late_entry" and not filters.consider_grace_period: + # query = query.where(attendance.in_time > checkin.shift_start) + # elif filter == "early_exit" and not filters.consider_grace_period: + # query = query.where(attendance.out_time < checkin.shift_end) + # else: + # query = query.where(attendance[filter] == filters[filter]) + + # if txt: + # filters.update( + # {"job_title": ["like", "%{0}%".format(txt)], "description": ["like", "%{0}%".format(txt)]} + # ) + + # return frappe.get_all( + # "Job Opening", + # filters, + # fields, + # start=limit_start, + # page_length=limit_page_length, + # order_by=order_by, + # ) + + +def get_filters(job_openings): + companies, departments, locations, employment_types = ([] for _ in range(4)) + for d in job_openings: + if d.company not in companies: + companies.append(d.company) + if d.department and d.department not in departments: + departments.append(d.department) + if d.location and d.location not in locations: + locations.append(d.location) + if d.employment_type and d.employment_type not in employment_types: + employment_types.append(d.employment_type) + return companies, departments, locations, employment_types From a1cabe1da03dae7f31b0034c556bdfb84dbdd731 Mon Sep 17 00:00:00 2001 From: krantheman Date: Mon, 28 Aug 2023 14:52:08 +0530 Subject: [PATCH 26/87] feat: improve filters ui (cherry picked from commit 0deb9f640ec2a7c8503c651f72e0646ae6b4722a) --- hrms/www/jobs/index.css | 11 +++++++---- hrms/www/jobs/index.html | 30 ++++++++++++++++++------------ hrms/www/jobs/index.js | 0 hrms/www/jobs/index.py | 5 ++++- 4 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 hrms/www/jobs/index.js diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index 02de00f956..46dc0ebbf2 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -10,12 +10,15 @@ p { --icon-stroke: var(--primary); } -.big-text { +.lg-text { font-size: 18px; } -.smol-text { - font-size: 13px; +.md-text { + font-size: 15px; +} +.sm-text { + font-size: 12px; } .full-time-badge { @@ -34,4 +37,4 @@ p { background: var(--bg-blue); color: var(--text-on-blue); border-radius: var(--border-radius) -} \ No newline at end of file +} diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index fa479ab888..55eb3bed0c 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -1,9 +1,15 @@ {% extends "templates/web.html" %} +{% block header %} +

{{ _("Job Openings") }}

+{% endblock header %} {% block page_content %} -
-
-

Filters

-
+
+
+
+

Filters

+ {{ _("Clear All") }} +
+

Companies

{% for company in companies %}
@@ -12,7 +18,7 @@
{% endfor %}
-
+

Departments

{% for department in departments %}
@@ -21,7 +27,7 @@
{% endfor %}
-
+

Location

{% for location in locations %}
@@ -30,7 +36,7 @@
{% endfor %}
-
+

Employment Type

{% for type in employment_types %}
@@ -65,11 +71,11 @@

{{ jo.job_title }}

{%- if jo.employment_type -%} {%- if jo.employment_type == "Full-time" -%} - • {{ jo.employment_type }} + • {{ jo.employment_type }} {%- elif jo.employment_type == "Part-time" -%} - • {{ jo.employment_type }} + • {{ jo.employment_type }} {%- else -%} - • {{ jo.employment_type }} + • {{ jo.employment_type }} {% endif %} {% endif %}
@@ -101,7 +107,7 @@

{{ jo.job_title }}

{%- if jo.publish_salary_range -%}

- + {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , currency=jo.currency) }} @@ -119,7 +125,7 @@

{{ jo.job_title }}

{{ _("View Job →") }} {%- if jo.closes_on -%} -

+

{{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }}

{% endif %} diff --git a/hrms/www/jobs/index.js b/hrms/www/jobs/index.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index 6c6ee41e0d..c4f5736539 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -1,6 +1,5 @@ import frappe from frappe import _ -from frappe.query_builder import DocType from frappe.query_builder.functions import Count @@ -85,4 +84,8 @@ def get_filters(job_openings): locations.append(d.location) if d.employment_type and d.employment_type not in employment_types: employment_types.append(d.employment_type) + companies.sort() + departments.sort() + locations.sort() + employment_types.sort() return companies, departments, locations, employment_types From 29b67d20f7f7c9a40b23c1e5446cfb86f42cdefd Mon Sep 17 00:00:00 2001 From: krantheman Date: Mon, 28 Aug 2023 15:21:36 +0530 Subject: [PATCH 27/87] refactor: clean up filters code (cherry picked from commit 2dc7cc39b3499baff8e49c4b6c802308148e8327) --- hrms/www/jobs/index.html | 47 ++++++++++------------------------------ hrms/www/jobs/index.py | 11 ++++++---- 2 files changed, 18 insertions(+), 40 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 55eb3bed0c..a1340ce3e8 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -9,42 +9,17 @@

{{ _("Job Openings") }}

Filters

{{ _("Clear All") }}
-
-

Companies

- {% for company in companies %} -
- - -
- {% endfor %} -
-
-

Departments

- {% for department in departments %} -
- - -
- {% endfor %} -
-
-

Location

- {% for location in locations %} -
- - -
- {% endfor %} -
-
-

Employment Type

- {% for type in employment_types %} -
- - -
- {% endfor %} -
+ {% for name, values in filters.items() %} +
+

{{ name }}

+ {% for value in values %} +
+ + +
+ {% endfor %} +
+ {% endfor %}
diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index c4f5736539..dcd5fe23f5 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -6,9 +6,7 @@ def get_context(context): context.parents = [{"name": _("My Account"), "route": "/"}] context.job_openings = get_job_openings() - context.companies, context.departments, context.locations, context.employment_types = get_filters( - context.job_openings - ) + context.filters = get_filters(context.job_openings) def get_job_openings(txt=None, filters=None, limit_start=0, limit_page_length=20, order_by=None): @@ -88,4 +86,9 @@ def get_filters(job_openings): departments.sort() locations.sort() employment_types.sort() - return companies, departments, locations, employment_types + return { + "Company": companies, + "Department": departments, + "Location": locations, + "Employment Type": employment_types, + } From 586ac610363a8c5ce1187c26c61a74878622ded0 Mon Sep 17 00:00:00 2001 From: krantheman Date: Tue, 29 Aug 2023 15:38:27 +0530 Subject: [PATCH 28/87] feat: filter functionality (cherry picked from commit a4936ef6bd5665db568763b0eae6dd0f2c2a447f) --- hrms/www/jobs/index.html | 8 +++-- hrms/www/jobs/index.js | 14 ++++++++ hrms/www/jobs/index.py | 74 ++++++++++++++++------------------------ 3 files changed, 49 insertions(+), 47 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index a1340ce3e8..230cec132a 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -11,10 +11,14 @@

{{ _("Job Openings") }}

{% for name, values in filters.items() %}
-

{{ name }}

+

{{ name.title() | replace('_', ' ') }}

{% for value in values %}
- +
{% endfor %} diff --git a/hrms/www/jobs/index.js b/hrms/www/jobs/index.js index e69de29bb2..e4f6d9850e 100644 --- a/hrms/www/jobs/index.js +++ b/hrms/www/jobs/index.js @@ -0,0 +1,14 @@ +$(() => { + const query_params = frappe.utils.get_query_params(); + for (const filter in query_params) { + if (typeof query_params[filter] === "string") { + $("#" + query_params[filter]).prop("checked", true); + } else { + for (const d of query_params[filter]) $("#" + d).prop("checked", true); + } + } + $("input:checkbox").change(function () { + const filters = $("input:checked").serialize(); + window.location.href = "/jobs?" + filters; + }); +}); diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index dcd5fe23f5..8ed3905b59 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -5,11 +5,15 @@ def get_context(context): context.parents = [{"name": _("My Account"), "route": "/"}] - context.job_openings = get_job_openings() - context.filters = get_filters(context.job_openings) + applied_filters = frappe.request.args.to_dict(flat=False) + context.job_openings = get_job_openings(applied_filters) + context.filters = get_all_filters(applied_filters) -def get_job_openings(txt=None, filters=None, limit_start=0, limit_page_length=20, order_by=None): +def get_job_openings( + applied_filters=None, txt=None, limit_start=0, limit_page_length=20, order_by=None +): + jo = frappe.qb.DocType("Job Opening") ja = frappe.qb.DocType("Job Applicant") @@ -40,55 +44,35 @@ def get_job_openings(txt=None, filters=None, limit_start=0, limit_page_length=20 .groupby(jo.name) ) - return query.run(as_dict=True) + for d in applied_filters: + query = query.where(frappe.qb.Field(d).isin(applied_filters[d])) - # for filter in filters: - # if filter == "from_date": - # query = query.where(attendance.attendance_date >= filters.from_date) - # elif filter == "to_date": - # query = query.where(attendance.attendance_date <= filters.to_date) - # elif filter == "consider_grace_period": - # continue - # elif filter == "late_entry" and not filters.consider_grace_period: - # query = query.where(attendance.in_time > checkin.shift_start) - # elif filter == "early_exit" and not filters.consider_grace_period: - # query = query.where(attendance.out_time < checkin.shift_end) - # else: - # query = query.where(attendance[filter] == filters[filter]) + return query.run(as_dict=True) # if txt: # filters.update( # {"job_title": ["like", "%{0}%".format(txt)], "description": ["like", "%{0}%".format(txt)]} # ) - # return frappe.get_all( - # "Job Opening", - # filters, - # fields, - # start=limit_start, - # page_length=limit_page_length, - # order_by=order_by, - # ) +def get_all_filters(applied_filters=None): + job_openings = frappe.get_all( + "Job Opening", + fields=["company", "department", "location", "employment_type"], + ) -def get_filters(job_openings): - companies, departments, locations, employment_types = ([] for _ in range(4)) + companies = applied_filters["company"] if "company" in applied_filters else None + + filters = {} for d in job_openings: - if d.company not in companies: - companies.append(d.company) - if d.department and d.department not in departments: - departments.append(d.department) - if d.location and d.location not in locations: - locations.append(d.location) - if d.employment_type and d.employment_type not in employment_types: - employment_types.append(d.employment_type) - companies.sort() - departments.sort() - locations.sort() - employment_types.sort() - return { - "Company": companies, - "Department": departments, - "Location": locations, - "Employment Type": employment_types, - } + for key, value in d.items(): + if key == "company" or not companies or (companies and d["company"] in companies): + if key not in filters: + filters[key] = [value] + elif value and value not in filters[key]: + filters[key].append(value) + + for d in filters: + filters[d].sort() + + return filters From d334b9dc77fe404fefe6a6c5d306d3dd9349687b Mon Sep 17 00:00:00 2001 From: krantheman Date: Tue, 29 Aug 2023 15:53:13 +0530 Subject: [PATCH 29/87] fix: selection of filters with meta-characters (cherry picked from commit c23632e0ab929a9f06dab3edd7404e1ea3c6b94f) --- hrms/www/jobs/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hrms/www/jobs/index.js b/hrms/www/jobs/index.js index e4f6d9850e..ff2a9520f8 100644 --- a/hrms/www/jobs/index.js +++ b/hrms/www/jobs/index.js @@ -2,9 +2,10 @@ $(() => { const query_params = frappe.utils.get_query_params(); for (const filter in query_params) { if (typeof query_params[filter] === "string") { - $("#" + query_params[filter]).prop("checked", true); + $("#" + $.escapeSelector(query_params[filter])).prop("checked", true); } else { - for (const d of query_params[filter]) $("#" + d).prop("checked", true); + for (const d of query_params[filter]) + $("#" + $.escapeSelector(d)).prop("checked", true); } } $("input:checkbox").change(function () { From afcb0cc6e0a4543d7b74600b6970d9fc5212533f Mon Sep 17 00:00:00 2001 From: krantheman Date: Tue, 29 Aug 2023 18:13:08 +0530 Subject: [PATCH 30/87] feat(ux): scroll up before updating filters (cherry picked from commit 8ab5a532ec563a3d088c439fb45b84bc73d0c5d6) --- hrms/www/jobs/index.html | 5 +++-- hrms/www/jobs/index.js | 28 ++++++++++++++++++++++++---- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 230cec132a..666d47d058 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -18,8 +18,9 @@

{{ _("Job Openings") }}

name="{{ name }}" class="form-check-input" id="{{ value }}" - value="{{ value }}"> - + value="{{ value }}" + role="button"> +
{% endfor %}
diff --git a/hrms/www/jobs/index.js b/hrms/www/jobs/index.js index ff2a9520f8..ccbd0724e0 100644 --- a/hrms/www/jobs/index.js +++ b/hrms/www/jobs/index.js @@ -1,4 +1,12 @@ $(() => { + select_applied_filters(); + $("input:checkbox").change(function () { + const filters = $("input:checked").serialize(); + scroll_up_and_update_filters(filters); + }); +}); + +function select_applied_filters() { const query_params = frappe.utils.get_query_params(); for (const filter in query_params) { if (typeof query_params[filter] === "string") { @@ -8,8 +16,20 @@ $(() => { $("#" + $.escapeSelector(d)).prop("checked", true); } } - $("input:checkbox").change(function () { - const filters = $("input:checked").serialize(); +} + +function scroll_up_and_update_filters(filters) { + if (window.scrollY === 0) { window.location.href = "/jobs?" + filters; - }); -}); + } else { + window.scroll({ + top: 0, + behavior: "smooth", + }); + window.addEventListener("scroll", function () { + if (window.scrollY === 0) { + window.location.href = "/jobs?" + filters; + } + }); + } +} From a6de8de72de8c9bb04603f98de6844ae6214ac8b Mon Sep 17 00:00:00 2001 From: krantheman Date: Tue, 29 Aug 2023 21:37:36 +0530 Subject: [PATCH 31/87] feat(ui): update search bar and bg color (cherry picked from commit 338374a696ea2a19cc33020504986897796195f8) --- hrms/www/jobs/index.css | 10 ++++++--- hrms/www/jobs/index.html | 45 +++++++++++++++++++++++++--------------- hrms/www/jobs/index.js | 5 ++++- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index 46dc0ebbf2..76a47df001 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -1,3 +1,7 @@ +body { + background-color: var(--gray-50); +} + h3 { font-size: 1.7rem; } @@ -24,17 +28,17 @@ p { .full-time-badge { background: var(--bg-green); color: var(--text-on-green); - border-radius: var(--border-radius) + border-radius: var(--border-radius); } .part-time-badge { background: var(--bg-orange); color: var(--text-on-orange); - border-radius: var(--border-radius) + border-radius: var(--border-radius); } .other-badge { background: var(--bg-blue); color: var(--text-on-blue); - border-radius: var(--border-radius) + border-radius: var(--border-radius); } diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 666d47d058..29515f9ed4 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -1,4 +1,7 @@ {% extends "templates/web.html" %} +{% block title %} + {{ _("Job Openings") }} +{% endblock title %} {% block header %}

{{ _("Job Openings") }}

{% endblock header %} @@ -6,8 +9,8 @@

{{ _("Job Openings") }}

-

Filters

- {{ _("Clear All") }} +

{{ _("Filters") }}

+ {{ _("Clear All") }}
{% for name, values in filters.items() %}
@@ -27,23 +30,31 @@

{{ _("Job Openings") }}

{% endfor %}
-
-
-
- - - - - -
- +
+ +
+ + + +
-

Showing {{ job_openings|length }} results

+

Showing {{ job_openings|length }} results

{% for jo in job_openings %}
diff --git a/hrms/www/jobs/index.js b/hrms/www/jobs/index.js index ccbd0724e0..a5e46a8919 100644 --- a/hrms/www/jobs/index.js +++ b/hrms/www/jobs/index.js @@ -4,6 +4,9 @@ $(() => { const filters = $("input:checked").serialize(); scroll_up_and_update_filters(filters); }); + $("#clear-filters").on("click", function () { + scroll_up_and_update_filters(); + }); }); function select_applied_filters() { @@ -18,7 +21,7 @@ function select_applied_filters() { } } -function scroll_up_and_update_filters(filters) { +function scroll_up_and_update_filters(filters="") { if (window.scrollY === 0) { window.location.href = "/jobs?" + filters; } else { From a3fa7c5e6b3cc495945e104ee1dc07e022b2b8fd Mon Sep 17 00:00:00 2001 From: krantheman Date: Wed, 30 Aug 2023 11:55:24 +0530 Subject: [PATCH 32/87] feat: add search functionality (cherry picked from commit f10b6f889b1ee604b672f29fd6048557f566d580) --- hrms/www/jobs/index.css | 2 +- hrms/www/jobs/index.js | 23 +++++++++++++++++++---- hrms/www/jobs/index.py | 14 ++++++-------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index 76a47df001..1a945110e2 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -1,5 +1,5 @@ body { - background-color: var(--gray-50); + background: var(--gray-50); } h3 { diff --git a/hrms/www/jobs/index.js b/hrms/www/jobs/index.js index a5e46a8919..c97339effd 100644 --- a/hrms/www/jobs/index.js +++ b/hrms/www/jobs/index.js @@ -1,16 +1,31 @@ $(() => { - select_applied_filters(); + show_applied_filters(); $("input:checkbox").change(function () { - const filters = $("input:checked").serialize(); + const filters = $("input").serialize(); scroll_up_and_update_filters(filters); }); $("#clear-filters").on("click", function () { scroll_up_and_update_filters(); }); + $("#search-box").bind("search", function () { + const filters = $("input").serialize(); + scroll_up_and_update_filters(filters); + }); + $("#search-box").keyup(function (e) { + if (e.keyCode == 13) { + $(this).trigger("search"); + } + }); }); -function select_applied_filters() { +function show_applied_filters() { const query_params = frappe.utils.get_query_params(); + if ("query" in query_params) { + $("#search-box").val(query_params["query"]); + delete query_params["query"]; + } else if ("query=" in query_params) { + delete query_params["query="]; + } for (const filter in query_params) { if (typeof query_params[filter] === "string") { $("#" + $.escapeSelector(query_params[filter])).prop("checked", true); @@ -21,7 +36,7 @@ function select_applied_filters() { } } -function scroll_up_and_update_filters(filters="") { +function scroll_up_and_update_filters(filters = "") { if (window.scrollY === 0) { window.location.href = "/jobs?" + filters; } else { diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index 8ed3905b59..e2a54e835e 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -10,9 +10,7 @@ def get_context(context): context.filters = get_all_filters(applied_filters) -def get_job_openings( - applied_filters=None, txt=None, limit_start=0, limit_page_length=20, order_by=None -): +def get_job_openings(applied_filters=None, limit_start=0, limit_page_length=20, order_by=None): jo = frappe.qb.DocType("Job Opening") ja = frappe.qb.DocType("Job Applicant") @@ -44,16 +42,16 @@ def get_job_openings( .groupby(jo.name) ) + if "query" in applied_filters: + search = f"%{applied_filters['query'][0]}%" + query = query.where((jo.job_title.like(search)) | (jo.description.like(search))) + del applied_filters["query"] + for d in applied_filters: query = query.where(frappe.qb.Field(d).isin(applied_filters[d])) return query.run(as_dict=True) - # if txt: - # filters.update( - # {"job_title": ["like", "%{0}%".format(txt)], "description": ["like", "%{0}%".format(txt)]} - # ) - def get_all_filters(applied_filters=None): job_openings = frappe.get_all( From a1624e7f243577ed5ea97b5118250061fb44b472 Mon Sep 17 00:00:00 2001 From: krantheman Date: Wed, 30 Aug 2023 17:18:00 +0530 Subject: [PATCH 33/87] feat: add sort by (cherry picked from commit 78981e318a64b45020560a3e838db2e43fc0f148) --- hrms/www/jobs/index.html | 77 ++++++++++++++++++++++++++++------------ hrms/www/jobs/index.js | 30 +++++++++------- hrms/www/jobs/index.py | 58 +++++++++++++++++++----------- 3 files changed, 109 insertions(+), 56 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 29515f9ed4..fc0b4adb63 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -12,7 +12,7 @@

{{ _("Job Openings") }}

{{ _("Filters") }}

{{ _("Clear All") }}
- {% for name, values in filters.items() %} + {% for name, values in all_filters.items() %}

{{ name.title() | replace('_', ' ') }}

{% for value in values %} @@ -30,28 +30,59 @@

{{ _("Job Openings") }}

{% endfor %}
-
- -
- - - - +
+
+ +
+ + + + +
+
+
+
+ + +

Showing {{ job_openings|length }} results

diff --git a/hrms/www/jobs/index.js b/hrms/www/jobs/index.js index c97339effd..bd2641d727 100644 --- a/hrms/www/jobs/index.js +++ b/hrms/www/jobs/index.js @@ -1,32 +1,36 @@ $(() => { - show_applied_filters(); + const query_params = frappe.utils.get_query_params(); + show_applied_filters(query_params); $("input:checkbox").change(function () { const filters = $("input").serialize(); - scroll_up_and_update_filters(filters); + scroll_up_and_update_params(filters); }); $("#clear-filters").on("click", function () { - scroll_up_and_update_filters(); + scroll_up_and_update_params(); }); $("#search-box").bind("search", function () { const filters = $("input").serialize(); - scroll_up_and_update_filters(filters); + scroll_up_and_update_params(filters); }); $("#search-box").keyup(function (e) { if (e.keyCode == 13) { $(this).trigger("search"); } }); + $("[name=sort]").on("click", function () { + const filters = $("input").serialize(); + const sort = $.param({ sort: $(this).text() }); + scroll_up_and_update_params(filters + "&" + sort); + }); }); -function show_applied_filters() { - const query_params = frappe.utils.get_query_params(); - if ("query" in query_params) { - $("#search-box").val(query_params["query"]); - delete query_params["query"]; - } else if ("query=" in query_params) { - delete query_params["query="]; - } +function show_applied_filters(query_params) { for (const filter in query_params) { + if (filter === "query") { + $("#search-box").val(query_params["query"]); + } else if (filter === "query=") { + continue; + } if (typeof query_params[filter] === "string") { $("#" + $.escapeSelector(query_params[filter])).prop("checked", true); } else { @@ -36,7 +40,7 @@ function show_applied_filters() { } } -function scroll_up_and_update_filters(filters = "") { +function scroll_up_and_update_params(filters = "") { if (window.scrollY === 0) { window.location.href = "/jobs?" + filters; } else { diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index e2a54e835e..a3644135ac 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -5,12 +5,13 @@ def get_context(context): context.parents = [{"name": _("My Account"), "route": "/"}] - applied_filters = frappe.request.args.to_dict(flat=False) - context.job_openings = get_job_openings(applied_filters) - context.filters = get_all_filters(applied_filters) + args = frappe.request.args.to_dict(flat=False) + filters, txt, context.order_by = get_filters_txt_and_order_by(args) + context.job_openings = get_job_openings(filters, txt, context.order_by) + context.all_filters = get_all_filters(filters) -def get_job_openings(applied_filters=None, limit_start=0, limit_page_length=20, order_by=None): +def get_job_openings(filters=None, txt=None, order_by=None, limit_start=0, limit_page_length=20): jo = frappe.qb.DocType("Job Opening") ja = frappe.qb.DocType("Job Applicant") @@ -42,35 +43,52 @@ def get_job_openings(applied_filters=None, limit_start=0, limit_page_length=20, .groupby(jo.name) ) - if "query" in applied_filters: - search = f"%{applied_filters['query'][0]}%" - query = query.where((jo.job_title.like(search)) | (jo.description.like(search))) - del applied_filters["query"] + for d in filters: + query = query.where(frappe.qb.Field(d).isin(filters[d])) + + if txt: + query = query.where((jo.job_title.like(f"%{txt}%")) | (jo.description.like(f"%{txt}%"))) - for d in applied_filters: - query = query.where(frappe.qb.Field(d).isin(applied_filters[d])) + if order_by: + print(order_by) return query.run(as_dict=True) -def get_all_filters(applied_filters=None): +def get_all_filters(filters=None): job_openings = frappe.get_all( "Job Opening", fields=["company", "department", "location", "employment_type"], ) - companies = applied_filters["company"] if "company" in applied_filters else None + companies = filters["company"] if "company" in filters else None - filters = {} + all_filters = {} for d in job_openings: for key, value in d.items(): if key == "company" or not companies or (companies and d["company"] in companies): - if key not in filters: - filters[key] = [value] - elif value and value not in filters[key]: - filters[key].append(value) + if key not in all_filters: + all_filters[key] = [value] + elif value and value not in all_filters[key]: + all_filters[key].append(value) - for d in filters: - filters[d].sort() + for d in all_filters: + all_filters[d].sort() - return filters + return all_filters + + +def get_filters_txt_and_order_by(args): + filters = {} + txt = "" + order_by = "Newest Post" + allowed_filters = ["company", "department", "location", "employment_type"] + for d in args: + if d in allowed_filters: + filters[d] = args[d] + elif d == "query": + txt = args["query"][0] + elif d == "sort": + if args["sort"][0] in ["Oldest Post", "Earliest Closing", "Latest Closing"]: + order_by = args["sort"][0] + return filters, txt, order_by From 535b42d22692ad2d25a9287d85f1fcb1c3872fa7 Mon Sep 17 00:00:00 2001 From: krantheman Date: Wed, 30 Aug 2023 19:45:23 +0530 Subject: [PATCH 34/87] fix: losing sort from the params while using input fields (cherry picked from commit 030d2c636ea85d039c4dc16010bced9a37dc1506) --- hrms/www/jobs/index.js | 58 ++++++++++++++++++++++++++---------------- hrms/www/jobs/index.py | 10 +++++--- 2 files changed, 42 insertions(+), 26 deletions(-) diff --git a/hrms/www/jobs/index.js b/hrms/www/jobs/index.js index bd2641d727..c8c4b0e221 100644 --- a/hrms/www/jobs/index.js +++ b/hrms/www/jobs/index.js @@ -1,48 +1,62 @@ $(() => { const query_params = frappe.utils.get_query_params(); - show_applied_filters(query_params); + show_applied_filters(); + $("input:checkbox").change(function () { - const filters = $("input").serialize(); - scroll_up_and_update_params(filters); + scroll_up_and_update_params(get_new_params()); }); + $("#clear-filters").on("click", function () { scroll_up_and_update_params(); }); + $("#search-box").bind("search", function () { - const filters = $("input").serialize(); - scroll_up_and_update_params(filters); + scroll_up_and_update_params(get_new_params()); }); + $("#search-box").keyup(function (e) { if (e.keyCode == 13) { $(this).trigger("search"); } }); + $("[name=sort]").on("click", function () { const filters = $("input").serialize(); const sort = $.param({ sort: $(this).text() }); scroll_up_and_update_params(filters + "&" + sort); }); -}); -function show_applied_filters(query_params) { - for (const filter in query_params) { - if (filter === "query") { - $("#search-box").val(query_params["query"]); - } else if (filter === "query=") { - continue; - } - if (typeof query_params[filter] === "string") { - $("#" + $.escapeSelector(query_params[filter])).prop("checked", true); - } else { - for (const d of query_params[filter]) - $("#" + $.escapeSelector(d)).prop("checked", true); + function show_applied_filters() { + for (const filter in query_params) { + if (filter === "query") { + $("#search-box").val(query_params["query"]); + } else if ( + ["company", "department", "location", "employment_type"].includes( + filter + ) + ) { + if (typeof query_params[filter] === "string") { + $("#" + $.escapeSelector(query_params[filter])).prop("checked", true); + } else { + for (const d of query_params[filter]) + $("#" + $.escapeSelector(d)).prop("checked", true); + } + } else { + continue; + } } } -} -function scroll_up_and_update_params(filters = "") { + function get_new_params() { + return "sort" in query_params + ? $("input").serialize() + "&" + $.param({ sort: query_params["sort"] }) + : $("input").serialize(); + } +}); + +function scroll_up_and_update_params(params = "") { if (window.scrollY === 0) { - window.location.href = "/jobs?" + filters; + window.location.href = "/jobs?" + params; } else { window.scroll({ top: 0, @@ -50,7 +64,7 @@ function scroll_up_and_update_params(filters = "") { }); window.addEventListener("scroll", function () { if (window.scrollY === 0) { - window.location.href = "/jobs?" + filters; + window.location.href = "/jobs?" + params; } }); } diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index a3644135ac..66befa2136 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -5,10 +5,10 @@ def get_context(context): context.parents = [{"name": _("My Account"), "route": "/"}] - args = frappe.request.args.to_dict(flat=False) - filters, txt, context.order_by = get_filters_txt_and_order_by(args) - context.job_openings = get_job_openings(filters, txt, context.order_by) + filters, txt, order_by = get_filters_txt_and_order_by() + context.job_openings = get_job_openings(filters, txt, order_by) context.all_filters = get_all_filters(filters) + context.order_by = order_by def get_job_openings(filters=None, txt=None, order_by=None, limit_start=0, limit_page_length=20): @@ -78,11 +78,13 @@ def get_all_filters(filters=None): return all_filters -def get_filters_txt_and_order_by(args): +def get_filters_txt_and_order_by(): + args = frappe.request.args.to_dict(flat=False) filters = {} txt = "" order_by = "Newest Post" allowed_filters = ["company", "department", "location", "employment_type"] + for d in args: if d in allowed_filters: filters[d] = args[d] From d5a2f4f44d34002892bdad2c52a827606dc1eb07 Mon Sep 17 00:00:00 2001 From: krantheman Date: Wed, 30 Aug 2023 21:33:57 +0530 Subject: [PATCH 35/87] refactor: allowed_filters set on the basis of all_filters (cherry picked from commit 5d00a614946c06fc2d39a0b7800e1086dd6a7f94) --- hrms/www/jobs/index.html | 1 + hrms/www/jobs/index.js | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index fc0b4adb63..0765b40b50 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -6,6 +6,7 @@

{{ _("Job Openings") }}

{% endblock header %} {% block page_content %} +
diff --git a/hrms/www/jobs/index.js b/hrms/www/jobs/index.js index c8c4b0e221..141dbbc5f5 100644 --- a/hrms/www/jobs/index.js +++ b/hrms/www/jobs/index.js @@ -27,14 +27,13 @@ $(() => { }); function show_applied_filters() { + const allowed_filters = Object.keys( + JSON.parse($("#data").data("filters").replace(/'/g, '"')) + ); for (const filter in query_params) { if (filter === "query") { $("#search-box").val(query_params["query"]); - } else if ( - ["company", "department", "location", "employment_type"].includes( - filter - ) - ) { + } else if (allowed_filters.includes(filter)) { if (typeof query_params[filter] === "string") { $("#" + $.escapeSelector(query_params[filter])).prop("checked", true); } else { From b745e976b9725031b4884ea94175da67d092d5d7 Mon Sep 17 00:00:00 2001 From: krantheman Date: Thu, 31 Aug 2023 12:28:18 +0530 Subject: [PATCH 36/87] feat: add sorting functionality (cherry picked from commit 8eab161d8aea58d7e0dcf2fb85472d4ee3872197) --- hrms/www/jobs/index.html | 4 +--- hrms/www/jobs/index.py | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 0765b40b50..d212ec6ad8 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -79,9 +79,7 @@

{{ _("Job Openings") }}

diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index 66befa2136..b2a447be14 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -1,12 +1,20 @@ import frappe from frappe import _ +from frappe.query_builder import Order from frappe.query_builder.functions import Count def get_context(context): context.parents = [{"name": _("My Account"), "route": "/"}] - filters, txt, order_by = get_filters_txt_and_order_by() - context.job_openings = get_job_openings(filters, txt, order_by) + orders = { + "Recent Posts": ["posted_on", Order.desc], + "Early Posts": ["posted_on", Order.asc], + "Urgent Deadlines": ["closes_on", Order.asc], + "Extended Deadlines": ["closes_on", Order.desc], + } + filters, txt, order_by = get_filters_txt_and_order_by(list(orders.keys())) + context.orders = orders.keys() + context.job_openings = get_job_openings(filters, txt, orders[order_by]) context.all_filters = get_all_filters(filters) context.order_by = order_by @@ -50,7 +58,7 @@ def get_job_openings(filters=None, txt=None, order_by=None, limit_start=0, limit query = query.where((jo.job_title.like(f"%{txt}%")) | (jo.description.like(f"%{txt}%"))) if order_by: - print(order_by) + query = query.orderby(order_by[0], order=order_by[1]) return query.run(as_dict=True) @@ -78,11 +86,11 @@ def get_all_filters(filters=None): return all_filters -def get_filters_txt_and_order_by(): +def get_filters_txt_and_order_by(orders): args = frappe.request.args.to_dict(flat=False) filters = {} txt = "" - order_by = "Newest Post" + order_by = orders[0] allowed_filters = ["company", "department", "location", "employment_type"] for d in args: @@ -91,6 +99,6 @@ def get_filters_txt_and_order_by(): elif d == "query": txt = args["query"][0] elif d == "sort": - if args["sort"][0] in ["Oldest Post", "Earliest Closing", "Latest Closing"]: + if args["sort"][0] in orders: order_by = args["sort"][0] return filters, txt, order_by From 48fcac00877334cabd77229335cdfe39509f9124 Mon Sep 17 00:00:00 2001 From: krantheman Date: Thu, 31 Aug 2023 13:08:57 +0530 Subject: [PATCH 37/87] fix: dirty bg color on clicking order item (cherry picked from commit 2a71e6261f7240128839b19098b39f6088ed38da) --- hrms/www/jobs/index.css | 4 ++++ hrms/www/jobs/index.html | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index 1a945110e2..0862b37bde 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -42,3 +42,7 @@ p { color: var(--text-on-blue); border-radius: var(--border-radius); } + +.order-item:active { + background-color: var(--gray-200); +} diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index d212ec6ad8..285d42e137 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -79,7 +79,10 @@

{{ _("Job Openings") }}

From aa21c5eb44060d262d358ae36ed98d276e93cd9c Mon Sep 17 00:00:00 2001 From: krantheman Date: Thu, 31 Aug 2023 13:38:24 +0530 Subject: [PATCH 38/87] fix: .format instead of f strings for translations (cherry picked from commit 69eac61c1a1e7c519531b24049cd10b46c48695a) --- hrms/hr/doctype/job_opening/job_opening.py | 4 ++-- hrms/www/jobs/index.html | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index e15115d2ef..4e2bedb9ca 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -63,10 +63,10 @@ def validate_past_future(self, field, is_past): today = getdate() if is_past: if getdate(date) > today: - frappe.throw(_(f"{frappe.bold(label)} cannot be a future date")) + frappe.throw(_("{} cannot be a future date").format(frappe.bold(label))) else: if getdate(date) < today: - frappe.throw(_(f"{frappe.bold(label)} cannot be a past date")) + frappe.throw(_("{} cannot be a past date").format(frappe.bold(label))) def validate_current_vacancies(self): if not self.staffing_plan: diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 285d42e137..2eabe2d7e3 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -87,7 +87,9 @@

{{ _("Job Openings") }}

-

Showing {{ job_openings|length }} results

+

+ Showing {{ job_openings|length }} {{ "result" if job_openings|length == 1 else "results" }} +

{% for jo in job_openings %}
From 05be798647d0416dd98e0704ff3b65dc206ee23f Mon Sep 17 00:00:00 2001 From: krantheman Date: Thu, 31 Aug 2023 16:17:22 +0530 Subject: [PATCH 39/87] feat: better ui(?) (cherry picked from commit 17130198c987478e679bad299c868bac640c10b3) # Conflicts: # hrms/hr/doctype/job_opening/job_opening.json --- hrms/hr/doctype/job_opening/job_opening.json | 8 ++- hrms/www/jobs/index.css | 15 ++++- hrms/www/jobs/index.html | 68 +++++++++----------- hrms/www/jobs/index.py | 9 ++- 4 files changed, 57 insertions(+), 43 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.json b/hrms/hr/doctype/job_opening/job_opening.json index ba6c232924..15b21cb6a2 100644 --- a/hrms/hr/doctype/job_opening/job_opening.json +++ b/hrms/hr/doctype/job_opening/job_opening.json @@ -196,9 +196,9 @@ "read_only": 1 }, { - "default": "Today", + "default": "Now", "fieldname": "posted_on", - "fieldtype": "Date", + "fieldtype": "Datetime", "label": "Posted On" }, { @@ -252,6 +252,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD "modified": "2023-09-14 16:50:39.316079", ======= @@ -266,6 +267,9 @@ ======= "modified": "2023-08-23 15:55:02.233809", >>>>>>> a65b7d5f3 (feat: add Salary Type field) +======= + "modified": "2023-08-31 14:23:14.826907", +>>>>>>> 17130198c (feat: better ui(?)) "modified_by": "Administrator", "module": "HR", "name": "Job Opening", diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index 0862b37bde..d1cb92dbf2 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -14,14 +14,23 @@ p { --icon-stroke: var(--primary); } -.lg-text { +.text-18 { font-size: 18px; } -.md-text { +.text-15 { font-size: 15px; } -.sm-text { + +.text-14 { + font-size: 14px; +} + +.text-13 { + font-size: 13px; +} + +.text-12 { font-size: 12px; } diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 2eabe2d7e3..9f335606cb 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -8,10 +8,10 @@

{{ _("Job Openings") }}

{% block page_content %}
-
+
-

{{ _("Filters") }}

- {{ _("Clear All") }} +

{{ _("Filters") }}

+ {{ _("Clear All") }}
{% for name, values in all_filters.items() %}
@@ -58,7 +58,7 @@

{{ _("Job Openings") }}

-
{{ _("Job Openings") }}
-

+

Showing {{ job_openings|length }} {{ "result" if job_openings|length == 1 else "results" }}

{% for jo in job_openings %}
-

{{ jo.job_title }}

-
- {%- if jo.employment_type -%} - {%- if jo.employment_type == "Full-time" -%} - • {{ jo.employment_type }} - {%- elif jo.employment_type == "Part-time" -%} - • {{ jo.employment_type }} - {%- else -%} - • {{ jo.employment_type }} - {% endif %} - {% endif %} +
+

{{ jo.company }}

+

{{ jo.job_title }}

+
+
+

{{ jo.posted_on }}

- - - -

{{ jo.company }}

{%- if jo.department -%}

{{ jo.department }}

{% endif %} + {%- if jo.employment_type -%} + + + +

{{ jo.employment_type }}

+ {% endif %} {%- if jo.location -%} {{ jo.job_title }} -

{{ jo.location }}

+

{{ jo.location }}

{% endif %}
+

+ {%- if jo.closes_on -%}{{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }}{% endif %} + {%- if jo.no_of_applications and jo.closes_on -%}{{ " · " }}{% endif %} + {%- if jo.no_of_applications -%} + {{ jo.no_of_applications }} + {{ _(" applicant" if jo.no_of_applications == 1 else " applicants") }} + {% endif %} +

+
+
{%- if jo.publish_salary_range -%} -

- +

+ {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , currency=jo.currency) }} @@ -141,20 +148,7 @@

{{ jo.job_title }}

{{ jo.salary_type.lower() }}

{% endif %} - {%- if jo.no_of_applications -%} -

- {{ jo.no_of_applications }} - {{ _(" applicant" if jo.no_of_applications == 1 else " applicants") }} -

- {% endif %} -
-
- {{ _("View Job →") }} - {%- if jo.closes_on -%} -

- {{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }} -

- {% endif %} + {{ _("View Job →") }}
{% endfor %} diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index b2a447be14..bb1e8da83b 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -2,6 +2,7 @@ from frappe import _ from frappe.query_builder import Order from frappe.query_builder.functions import Count +from frappe.utils import pretty_date def get_context(context): @@ -44,6 +45,7 @@ def get_job_openings(filters=None, txt=None, order_by=None, limit_start=0, limit jo.department, jo.employment_type, jo.company, + jo.posted_on, jo.closes_on, Count(ja.job_title).as_("no_of_applications"), ) @@ -60,7 +62,12 @@ def get_job_openings(filters=None, txt=None, order_by=None, limit_start=0, limit if order_by: query = query.orderby(order_by[0], order=order_by[1]) - return query.run(as_dict=True) + results = query.run(as_dict=True) + + for d in results: + d.posted_on = pretty_date(d.posted_on) + + return results def get_all_filters(filters=None): From a598211f205eb7f3d123bb3e0c50f15c997edf1b Mon Sep 17 00:00:00 2001 From: krantheman Date: Thu, 31 Aug 2023 16:38:35 +0530 Subject: [PATCH 40/87] feat: company name smaller and in blue (cherry picked from commit f9e6c99efb34039ea89351ffdc7f9b397590ab31) --- hrms/www/jobs/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 9f335606cb..448d21b009 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -94,10 +94,10 @@

{{ _("Job Openings") }}

-

{{ jo.company }}

+

{{ jo.company }}

{{ jo.job_title }}

-
+

{{ jo.posted_on }}

From 8031fb8cb65a511ac5bf78506b6da32d7aab8c68 Mon Sep 17 00:00:00 2001 From: krantheman Date: Thu, 31 Aug 2023 18:10:03 +0530 Subject: [PATCH 41/87] feat: make card directly clickable (cherry picked from commit 20093176fbe52200d03558786b80b4188349f88d) --- hrms/www/jobs/index.css | 8 ++++++++ hrms/www/jobs/index.html | 37 +++++++++++++++++++++---------------- hrms/www/jobs/index.js | 4 ++++ 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index d1cb92dbf2..48f0f928ad 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -55,3 +55,11 @@ p { .order-item:active { background-color: var(--gray-200); } + +.zoom { + transition: transform 0.1s; +} + +.zoom:hover { + transform: scale(1.01); +} diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 448d21b009..60c7921822 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -9,12 +9,12 @@

{{ _("Job Openings") }}

-
+

{{ _("Filters") }}

{{ _("Clear All") }}
{% for name, values in all_filters.items() %} -
+

{{ name.title() | replace('_', ' ') }}

{% for value in values %}
@@ -91,30 +91,25 @@

{{ _("Job Openings") }}

Showing {{ job_openings|length }} {{ "result" if job_openings|length == 1 else "results" }}

{% for jo in job_openings %} -
+
-
-

{{ jo.company }}

-

{{ jo.job_title }}

-
-
+

{{ jo.job_title }}

+

{{ jo.posted_on }}

+ + + +

{{ jo.company }}

{%- if jo.department -%}

{{ jo.department }}

{% endif %} - {%- if jo.employment_type -%} - - - -

{{ jo.employment_type }}

- {% endif %} {%- if jo.location -%} {{ jo.job_title }} -

{{ jo.location }}

+

{{ jo.location }}

{% endif %}

@@ -148,7 +143,17 @@

{{ jo.job_title }}

{{ jo.salary_type.lower() }}

{% endif %} - {{ _("View Job →") }} +
+ {%- if jo.employment_type -%} + {%- if jo.employment_type == "Full-time" -%} + • {{ jo.employment_type }} + {%- elif jo.employment_type == "Part-time" -%} + • {{ jo.employment_type }} + {%- else -%} + • {{ jo.employment_type }} + {% endif %} + {% endif %} +
{% endfor %} diff --git a/hrms/www/jobs/index.js b/hrms/www/jobs/index.js index 141dbbc5f5..73de31e499 100644 --- a/hrms/www/jobs/index.js +++ b/hrms/www/jobs/index.js @@ -26,6 +26,10 @@ $(() => { scroll_up_and_update_params(filters + "&" + sort); }); + $("[name=card]").on("click", function () { + window.location.href = this.id; + }); + function show_applied_filters() { const allowed_filters = Object.keys( JSON.parse($("#data").data("filters").replace(/'/g, '"')) From 08b5d0547a1fa05a630a037400b3cffbd8778d90 Mon Sep 17 00:00:00 2001 From: krantheman Date: Thu, 31 Aug 2023 23:14:58 +0530 Subject: [PATCH 42/87] feat: more ui changes (cherry picked from commit a90a9685d14657a5567c1bbaa56d9cf774b7ff53) --- hrms/www/jobs/index.css | 8 +++--- hrms/www/jobs/index.html | 58 +++++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index 48f0f928ad..ffa831bbfd 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -10,10 +10,6 @@ p { margin-bottom: 0; } -.primary-stroke { - --icon-stroke: var(--primary); -} - .text-18 { font-size: 18px; } @@ -63,3 +59,7 @@ p { .zoom:hover { transform: scale(1.01); } + +.light-stroke { + --icon-stroke: var(--gray-500); +} diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 60c7921822..4b5fc99fb1 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -9,10 +9,11 @@

{{ _("Job Openings") }}

-
+ +
{% for name, values in all_filters.items() %}

{{ name.title() | replace('_', ' ') }}

@@ -91,15 +92,26 @@

{{ _("Job Openings") }}

Showing {{ job_openings|length }} {{ "result" if job_openings|length == 1 else "results" }}

{% for jo in job_openings %} -
+

{{ jo.job_title }}

-
-

{{ jo.posted_on }}

+
+ {%- if jo.employment_type -%} + {%- if jo.employment_type == "Full-time" -%} +
• {{ jo.employment_type }}
+ {%- elif jo.employment_type == "Part-time" -%} +
• {{ jo.employment_type }}
+ {%- else -%} +
• {{ jo.employment_type }}
+ {% endif %} + {% endif %}
-
+
@@ -114,25 +126,15 @@

{{ jo.job_title }}

- + -

{{ jo.location }}

+

{{ jo.location }}

{% endif %}
-

- {%- if jo.closes_on -%}{{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }}{% endif %} - {%- if jo.no_of_applications and jo.closes_on -%}{{ " · " }}{% endif %} - {%- if jo.no_of_applications -%} - {{ jo.no_of_applications }} - {{ _(" applicant" if jo.no_of_applications == 1 else " applicants") }} - {% endif %} -

-
-
{%- if jo.publish_salary_range -%}

@@ -143,17 +145,17 @@

{{ jo.job_title }}

{{ jo.salary_type.lower() }}

{% endif %} -
- {%- if jo.employment_type -%} - {%- if jo.employment_type == "Full-time" -%} - • {{ jo.employment_type }} - {%- elif jo.employment_type == "Part-time" -%} - • {{ jo.employment_type }} - {%- else -%} - • {{ jo.employment_type }} - {% endif %} +
+
+

+ {%- if jo.closes_on -%}{{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }}{% endif %} + {%- if jo.no_of_applications and jo.closes_on -%}{{ " · " }}{% endif %} + {%- if jo.no_of_applications -%} + {{ jo.no_of_applications }} + {{ _(" applicant" if jo.no_of_applications == 1 else " applicants") }} {% endif %} -

+

+

{{ _("Posted ") + jo.posted_on }}

{% endfor %} From f749375298bd580bf827e7714858a79b5aca5cba Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 1 Sep 2023 14:07:22 +0530 Subject: [PATCH 43/87] feat: improve footer spacing (cherry picked from commit fbef19695084292b5d7cf4eae8e2db0a564d9e29) --- hrms/www/jobs/index.css | 2 +- hrms/www/jobs/index.html | 37 ++++++++++++++++++++----------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index ffa831bbfd..1d53cb507c 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -61,5 +61,5 @@ p { } .light-stroke { - --icon-stroke: var(--gray-500); + --icon-stroke: var(--gray-400); } diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 4b5fc99fb1..7b52e15f70 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -96,7 +96,7 @@

{{ _("Job Openings") }}

id="{{ jo.route }}" class="mb-8 card border p-6 zoom" role="button"> -
+

{{ jo.job_title }}

{%- if jo.employment_type -%} @@ -110,8 +110,8 @@

{{ jo.job_title }}

{% endif %}
-
-
+
+
@@ -126,7 +126,7 @@

{{ jo.job_title }}

- + @@ -146,19 +146,22 @@

{{ jo.job_title }}

{% endif %}
-
-

- {%- if jo.closes_on -%}{{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }}{% endif %} - {%- if jo.no_of_applications and jo.closes_on -%}{{ " · " }}{% endif %} - {%- if jo.no_of_applications -%} - {{ jo.no_of_applications }} - {{ _(" applicant" if jo.no_of_applications == 1 else " applicants") }} - {% endif %} -

-

{{ _("Posted ") + jo.posted_on }}

-
+
+

+ {{ _("Posted ") }}{{ jo.posted_on }} +

+

+ {%- if jo.no_of_applications -%} + {{ _("Applications received: ") }} + {{ jo.no_of_applications }} + {% endif %} +

+

+ {%- if jo.closes_on -%}{{ _("Closes on ") }}{{ frappe.format_date(jo.closes_on, "d MMM, YYYY") }}{% endif %} +

- {% endfor %} -
+
+ {% endfor %}
+
{% endblock page_content %} From a4f63e702cfcef5409fad5c11db7f3b35387f15a Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 1 Sep 2023 16:00:12 +0530 Subject: [PATCH 44/87] refactor: change salary_type to salary_per (cherry picked from commit f6f20a8d9028d0d8efcf900ae5edd57c4af29f90) # Conflicts: # hrms/hr/doctype/job_opening/job_opening.json --- hrms/hr/doctype/job_opening/job_opening.json | 14 ++- hrms/hr/doctype/job_opening/job_opening.py | 3 +- hrms/templates/generators/job_opening.html | 96 ++++++++------------ hrms/www/jobs/index.html | 2 +- hrms/www/jobs/index.py | 2 +- 5 files changed, 52 insertions(+), 65 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.json b/hrms/hr/doctype/job_opening/job_opening.json index 15b21cb6a2..034b0d753c 100644 --- a/hrms/hr/doctype/job_opening/job_opening.json +++ b/hrms/hr/doctype/job_opening/job_opening.json @@ -43,7 +43,7 @@ "lower_range", "upper_range", "column_break_20", - "salary_type", + "salary_per", "publish_salary_range" ], "fields": [ @@ -239,11 +239,11 @@ "label": "Closed On" }, { - "default": "Per Month", - "fieldname": "salary_type", + "default": "Month", + "fieldname": "salary_per", "fieldtype": "Select", - "label": "Salary Type", - "options": "Per Hour\nPer Day\nPer Week\nPer Month\nPer Year\nPer Sale" + "label": "Salary Paid Per", + "options": "Hour\nDay\nWeek\nMonth\nYear\nSale" } ], "icon": "fa fa-bookmark", @@ -253,6 +253,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD "modified": "2023-09-14 16:50:39.316079", ======= @@ -270,6 +271,9 @@ ======= "modified": "2023-08-31 14:23:14.826907", >>>>>>> 17130198c (feat: better ui(?)) +======= + "modified": "2023-09-01 15:37:33.862986", +>>>>>>> f6f20a8d9 (refactor: change salary_type to salary_per) "modified_by": "Administrator", "module": "HR", "name": "Job Opening", diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index 4e2bedb9ca..143ef8ea8e 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -7,7 +7,7 @@ import frappe from frappe import _ from frappe.model.naming import set_name_from_naming_options -from frappe.utils import get_link_to_form, getdate +from frappe.utils import get_link_to_form, getdate, pretty_date from frappe.website.website_generator import WebsiteGenerator from hrms.hr.doctype.staffing_plan.staffing_plan import ( @@ -116,6 +116,7 @@ def get_context(self, context): job_applicants = frappe.get_all("Job Applicant", filters={"job_title": self.name}) context.no_of_applications = len(job_applicants) context.parents = [{"route": "jobs", "title": _("All Jobs")}] + context.posted_on = pretty_date(self.posted_on) def close_expired_job_openings(): diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index 8372f76816..34e40a74b3 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -1,70 +1,52 @@ {% extends "templates/web.html" %} {% block page_content %} -
-
-

{{ job_title }}

+
+
+
+

{{ job_title }}

+
+
+ {{ company }} + {{ " · " }}{{ posted_on }} +
+
+
{%- if job_application_route -%} {{ _("Apply Now") }} + href="/{{ job_application_route }}/new?job_title={{ name }}">{{ _("Apply Now") }} {% else %} {{ _("Apply Now") }} + href="/job_application/new?job_title={{ name }}">{{ _("Apply Now") }} {% endif %}
-
-
- - - -

{{ doc.company }}

- {%- if department -%} - - - -

{{ doc.department }}

- {% endif %} - {%- if location -%} - - - - - - - -

{{ doc.location }}

- {% endif %} - {%- if employment_type -%} - - - -

{{ doc.employment_type }}

- {% endif %} +
+
+
+
+
Location
+
{{ location }}
+
+
+
Department
+
{{ department }}
+
+
+
Employment Type
+
{{ employment_type }}
+
+
+
Salary Range
+
+ {{ frappe.format_value(frappe.utils.flt(lower_range) , + currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range) , + currency=currency) }} / {{ salary_per.lower() }} +
+
- {%- if doc.publish_salary_range -%} -

- {{ _("Salary range " + doc.salary_type.lower() ) }}: - {{ frappe.format_value(frappe.utils.flt(doc.lower_range) , - currency=doc.currency) }} - {{ frappe.format_value(frappe.utils.flt(doc.upper_range) , - currency=doc.currency) }} - -

- {% endif %} -

- {%- if doc.closes_on -%} {{ _("Closes on " + - frappe.format_date(doc.closes_on, "d MMM, YYYY") ) }} {%- if - no_of_applications -%} {{ " · " }} - {% endif %} - {% endif %} - {%- if - no_of_applications -%} {{ no_of_applications }} {{ _("applicant" if no_of_applications == 1 else "applicants") }} - {% endif %} -

+
+
+ {%- if description -%}

{{ description }}

{% endif %}
- {%- if doc.description -%}

{{ description }}

{% endif %} -
{% endblock page_content %} diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 7b52e15f70..36b5ba5d80 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -142,7 +142,7 @@

{{ jo.job_title }}

currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , currency=jo.currency) }} - {{ jo.salary_type.lower() }} + {{ jo.salary_per.lower() }}

{% endif %}
diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index bb1e8da83b..c868dedd36 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -39,7 +39,7 @@ def get_job_openings(filters=None, txt=None, order_by=None, limit_start=0, limit jo.upper_range, jo.currency, jo.job_application_route, - jo.salary_type, + jo.salary_per, jo.route, jo.location, jo.department, From 58c00a7347acbb5287a4e33c62dbe7f1961cfa14 Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 1 Sep 2023 18:20:43 +0530 Subject: [PATCH 45/87] feat: improve ui (cherry picked from commit 7c5f9274d9297fa57982e3e4d45278a53acbc844) --- hrms/templates/generators/job_opening.html | 81 +++++++++++++++------- 1 file changed, 56 insertions(+), 25 deletions(-) diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index 34e40a74b3..485171977a 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -2,9 +2,9 @@ {% block page_content %}
-
-

{{ job_title }}

-
+
+

{{ job_title }}

+
{{ company }} {{ " · " }}{{ posted_on }} @@ -21,31 +21,62 @@

{{ job_title }}

{% endif %}
-
-
-
-
-
Location
-
{{ location }}
-
-
-
Department
-
{{ department }}
-
-
-
Employment Type
-
{{ employment_type }}
-
-
-
Salary Range
-
- {{ frappe.format_value(frappe.utils.flt(lower_range) , - currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range) , - currency=currency) }} / {{ salary_per.lower() }} +
+
+
+
+
+
+ + + + + + + +
+
+
Location
+
{{ location }}
+
+
+
+
+
+
+ + + +
+
+
Department
+
{{ department }}
+
+
+
+
+
+
+ + + +
+
+
Salary Range
+
+ {{ frappe.format_value(frappe.utils.flt(lower_range) , + currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range) , + currency=currency) }} / {{ salary_per.lower() }} +
+
+
-
{%- if description -%}

{{ description }}

{% endif %}
From ffe6d48acabda3821f6509c4b11711589326b450 Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 1 Sep 2023 18:58:31 +0530 Subject: [PATCH 46/87] feat(ui): use circles for everything (cherry picked from commit 0c9696fa5ed03639057a07706c3730e692212c01) --- hrms/templates/generators/job_opening.html | 80 ++++++++++++++++------ 1 file changed, 60 insertions(+), 20 deletions(-) diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index 485171977a..b474f20bd5 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -4,10 +4,11 @@

{{ job_title }}

-
+
- {{ company }} - {{ " · " }}{{ posted_on }} + {{ "Posted" }} + {{ posted_on }} + {{ " · " }}{{ no_of_applications }}{{ " applicants" }}
@@ -21,11 +22,24 @@

{{ job_title }}

{% endif %}
-
-
+
+
-
-
+
+
+
+ + + +
+
+
Company
+
{{ company }}
+
+
+
+
+
{{ job_title }}
-
-
-
+
+
+
+ + + +
+
+
Salary Range
+
+ {{ frappe.format_value(frappe.utils.flt(lower_range) , + currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range) , + currency=currency) }} / {{ salary_per.lower() }} +
+
+
+
+
+
+
@@ -58,20 +89,29 @@

{{ job_title }}

-
-
-
+
+
+
- +
-
Salary Range
-
- {{ frappe.format_value(frappe.utils.flt(lower_range) , - currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range) , - currency=currency) }} / {{ salary_per.lower() }} -
+
Employment Type
+
{{ employment_type }}
+
+
+
+
+
+
+ + + +
+
+
Closes On
+
{{ frappe.format_date(closes_on, "d MMM, YYYY") }}
From 7bf0766af73f2c2002208d72bfa7fcd3fd73c1c1 Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 1 Sep 2023 19:11:31 +0530 Subject: [PATCH 47/87] feat: render fields conditionally (cherry picked from commit a013069112842f9b3a9180c3e953e5e2286257cb) --- hrms/templates/generators/job_opening.html | 142 +++++++++++---------- 1 file changed, 76 insertions(+), 66 deletions(-) diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index b474f20bd5..7c2091e66e 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -38,83 +38,93 @@

{{ job_title }}

-
-
-
- - - - - - - -
-
-
Location
-
{{ location }}
+ {%- if location -%} +
+
+
+ + + + + + + +
+
+
Location
+
{{ location }}
+
-
-
-
-
- - - -
-
-
Salary Range
-
- {{ frappe.format_value(frappe.utils.flt(lower_range) , - currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range) , - currency=currency) }} / {{ salary_per.lower() }} + {% endif %} + {%- if publish_salary_range -%} +
+
+
+ + + +
+
+
Salary Range
+
+ {{ frappe.format_value(frappe.utils.flt(lower_range) , + currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range) , + currency=currency) }} / {{ salary_per.lower() }} +
-
-
-
-
- - - -
-
-
Department
-
{{ department }}
+ {% endif %} + {%- if department -%} +
+
+
+ + + +
+
+
Department
+
{{ department }}
+
-
-
-
-
- - - -
-
-
Employment Type
-
{{ employment_type }}
+ {% endif %} + {%- if employment_type -%} +
+
+
+ + + +
+
+
Employment Type
+
{{ employment_type }}
+
-
-
-
-
- - - -
-
-
Closes On
-
{{ frappe.format_date(closes_on, "d MMM, YYYY") }}
+ {% endif %} + {%- if closes_on -%} +
+
+
+ + + +
+
+
Closes On
+
{{ frappe.format_date(closes_on, "d MMM, YYYY") }}
+
-
+ {% endif %}
From f9ab5fa27d70a689963b85666a18710e06841740 Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 1 Sep 2023 22:26:24 +0530 Subject: [PATCH 48/87] feat: add color to footer (cherry picked from commit 1519e56e6981b4c59bdb2440938f9332a78c9cf9) --- hrms/templates/generators/job_opening.html | 40 ++++---- hrms/www/jobs/index.css | 5 + hrms/www/jobs/index.html | 107 ++++++++++----------- hrms/www/jobs/index.py | 4 - 4 files changed, 75 insertions(+), 81 deletions(-) diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index 7c2091e66e..f04609d249 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -8,7 +8,7 @@

{{ job_title }}

{{ "Posted" }} {{ posted_on }} - {{ " · " }}{{ no_of_applications }}{{ " applicants" }} + {{ " · " }}{{ no_of_applications }}{{ " applicant" if no_of_applications == 1 else " applicants" }}
@@ -22,25 +22,25 @@

{{ job_title }}

{% endif %}
-
+
-
+
-
+
- +
-
Company
+
{{ _("Company") }}
{{ company }}
{%- if location -%}
-
+
{{ job_title }}
-
Location
+
{{ _("Location") }}
{{ location }}
@@ -63,14 +63,14 @@

{{ job_title }}

{% endif %} {%- if publish_salary_range -%}
-
+
- +
-
Salary Range
+
{{ _("Salary Range") }}
{{ frappe.format_value(frappe.utils.flt(lower_range) , currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range) , @@ -82,14 +82,14 @@

{{ job_title }}

{% endif %} {%- if department -%}
-
+
- +
-
Department
+
{{ _("Department") }}
{{ department }}
@@ -97,14 +97,14 @@

{{ job_title }}

{% endif %} {%- if employment_type -%}
-
+
- +
-
Employment Type
+
{{ _("Employment Type") }}
{{ employment_type }}
@@ -112,14 +112,14 @@

{{ job_title }}

{% endif %} {%- if closes_on -%}
-
+
- +
-
Closes On
+
{{ _("Closes On") }}
{{ frappe.format_date(closes_on, "d MMM, YYYY") }}
diff --git a/hrms/www/jobs/index.css b/hrms/www/jobs/index.css index 1d53cb507c..5efa1fb331 100644 --- a/hrms/www/jobs/index.css +++ b/hrms/www/jobs/index.css @@ -63,3 +63,8 @@ p { .light-stroke { --icon-stroke: var(--gray-400); } + +.footer { + background: var(--gray-50); + border-radius: 0 0 0.75rem 0.75rem +} diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index 36b5ba5d80..f1e3e9becc 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -64,7 +64,7 @@

{{ _("Job Openings") }}

data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> - Sort by: + {{ _("Sort by: ") }}
{{ order_by }} {{ _("Job Openings") }}

- Showing {{ job_openings|length }} {{ "result" if job_openings|length == 1 else "results" }} + {{ _("Showing") }} {{ job_openings|length }} {{ _("result" if job_openings|length == 1 else "results") }}

{% for jo in job_openings %}
-
-

{{ jo.job_title }}

-
- {%- if jo.employment_type -%} - {%- if jo.employment_type == "Full-time" -%} -
• {{ jo.employment_type }}
- {%- elif jo.employment_type == "Part-time" -%} -
• {{ jo.employment_type }}
- {%- else -%} -
• {{ jo.employment_type }}
+
+
+
+

{{ jo.job_title }}

+
{{ jo.company }}
+
+
+ {%- if jo.employment_type -%} + {%- if jo.employment_type == "Full-time" -%} +
• {{ jo.employment_type }}
+ {%- elif jo.employment_type == "Part-time" -%} +
• {{ jo.employment_type }}
+ {%- else -%} +
• {{ jo.employment_type }}
+ {% endif %} {% endif %} - {% endif %} +
-
-
-
- - - -

{{ jo.company }}

+
+ {%- if jo.location -%} +
+
Location
+
{{ jo.location }}
+
+ {% endif %} {%- if jo.department -%} - - - -

{{ jo.department }}

+
+
Department
+
{{ jo.department }}
+
{% endif %} - {%- if jo.location -%} - - - - - - - -

{{ jo.location }}

+ {%- if jo.publish_salary_range -%} +
+
Salary Range
+
+ {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , + currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , + currency=jo.currency) }} / {{ jo.salary_per.lower() }} +
+
{% endif %}
- {%- if jo.publish_salary_range -%} -

- - {{ frappe.format_value(frappe.utils.flt(jo.lower_range) , - currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) , - currency=jo.currency) }} - - {{ jo.salary_per.lower() }} -

- {% endif %}
-
-

- {{ _("Posted ") }}{{ jo.posted_on }} -

-

- {%- if jo.no_of_applications -%} +

{% endfor %} diff --git a/hrms/www/jobs/index.py b/hrms/www/jobs/index.py index c868dedd36..2b56ed573e 100644 --- a/hrms/www/jobs/index.py +++ b/hrms/www/jobs/index.py @@ -2,7 +2,6 @@ from frappe import _ from frappe.query_builder import Order from frappe.query_builder.functions import Count -from frappe.utils import pretty_date def get_context(context): @@ -64,9 +63,6 @@ def get_job_openings(filters=None, txt=None, order_by=None, limit_start=0, limit results = query.run(as_dict=True) - for d in results: - d.posted_on = pretty_date(d.posted_on) - return results From 287675dd15c95de76d92e348868f709f700b3097 Mon Sep 17 00:00:00 2001 From: krantheman Date: Mon, 11 Sep 2023 13:23:24 +0530 Subject: [PATCH 49/87] refactor(ui): add matching icon stroke colors (cherry picked from commit 91c6c200c8e01a716175fd086112e7e3371b76be) --- hrms/templates/generators/job_opening.html | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/hrms/templates/generators/job_opening.html b/hrms/templates/generators/job_opening.html index f04609d249..4b6b5a04a4 100644 --- a/hrms/templates/generators/job_opening.html +++ b/hrms/templates/generators/job_opening.html @@ -24,11 +24,14 @@

{{ job_title }}

-
+
- +
@@ -47,7 +50,7 @@

{{ job_title }}

width: 28px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"> - + @@ -65,7 +68,10 @@

{{ job_title }}

- +
@@ -84,7 +90,10 @@

{{ job_title }}

- +
@@ -99,7 +108,10 @@

{{ job_title }}

- +
@@ -114,7 +126,10 @@

{{ job_title }}

- +
From 6cadaf451fd3746d74a3a02bbda47e9ebb64e1fb Mon Sep 17 00:00:00 2001 From: krantheman Date: Mon, 11 Sep 2023 13:42:45 +0530 Subject: [PATCH 50/87] refactor: use frappe.db.count for counting applicants (cherry picked from commit dc3b697378c41f3c18ce0a7dbca1dce6d670cba7) --- hrms/hr/doctype/job_opening/job_opening.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.py b/hrms/hr/doctype/job_opening/job_opening.py index 143ef8ea8e..1ab6c36f56 100644 --- a/hrms/hr/doctype/job_opening/job_opening.py +++ b/hrms/hr/doctype/job_opening/job_opening.py @@ -113,8 +113,8 @@ def update_job_requisition_status(self): job_requisition.save() def get_context(self, context): - job_applicants = frappe.get_all("Job Applicant", filters={"job_title": self.name}) - context.no_of_applications = len(job_applicants) + job_applicants = frappe.db.count("Job Applicant", {"job_title": self.name}) + context.no_of_applications = job_applicants context.parents = [{"route": "jobs", "title": _("All Jobs")}] context.posted_on = pretty_date(self.posted_on) From 4d7d614702e86dae2725cd1471a580d598d7081e Mon Sep 17 00:00:00 2001 From: krantheman Date: Mon, 11 Sep 2023 13:55:58 +0530 Subject: [PATCH 51/87] fix: card footer alignment (cherry picked from commit 620abcc22cd2469ba84209c3422f9b7a61dc8cd8) --- hrms/www/jobs/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hrms/www/jobs/index.html b/hrms/www/jobs/index.html index f1e3e9becc..b689f6309a 100644 --- a/hrms/www/jobs/index.html +++ b/hrms/www/jobs/index.html @@ -139,7 +139,7 @@

{{ jo.job_title }}

{% endif %}
-