From f6f20a8d9028d0d8efcf900ae5edd57c4af29f90 Mon Sep 17 00:00:00 2001 From: krantheman Date: Fri, 1 Sep 2023 16:00:12 +0530 Subject: [PATCH] refactor: change salary_type to salary_per --- hrms/hr/doctype/job_opening/job_opening.json | 12 +-- 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, 49 insertions(+), 66 deletions(-) diff --git a/hrms/hr/doctype/job_opening/job_opening.json b/hrms/hr/doctype/job_opening/job_opening.json index 1a9aaed476..6010994915 100644 --- a/hrms/hr/doctype/job_opening/job_opening.json +++ b/hrms/hr/doctype/job_opening/job_opening.json @@ -38,7 +38,7 @@ "lower_range", "upper_range", "column_break_20", - "salary_type", + "salary_per", "publish_salary_range" ], "fields": [ @@ -234,17 +234,17 @@ "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", "idx": 1, "links": [], - "modified": "2023-08-31 14:23:14.826907", + "modified": "2023-09-01 15:37:33.862986", "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,