Skip to content

Commit

Permalink
refactor: change salary_type to salary_per
Browse files Browse the repository at this point in the history
  • Loading branch information
krantheman committed Sep 1, 2023
1 parent fbef196 commit f6f20a8
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 66 deletions.
12 changes: 6 additions & 6 deletions hrms/hr/doctype/job_opening/job_opening.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"lower_range",
"upper_range",
"column_break_20",
"salary_type",
"salary_per",
"publish_salary_range"
],
"fields": [
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion hrms/hr/doctype/job_opening/job_opening.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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():
Expand Down
96 changes: 39 additions & 57 deletions hrms/templates/generators/job_opening.html
Original file line number Diff line number Diff line change
@@ -1,70 +1,52 @@
{% extends "templates/web.html" %}
{% block page_content %}
<div class="py-20">
<div class="flex mb-16">
<h1 class="my-0 mr-32" style="font-size: 3rem">{{ job_title }}</h1>
<div class="py-12">
<div class="flex">
<div class="mb-4 mr-32">
<h2 class="mt-0">{{ job_title }}</h2>
<div class="flex align-items-center">
<div>
<b>{{ company }}</b>
{{ " · " }}{{ posted_on }}
</div>
</div>
</div>
<div class="ml-auto">
{%- if job_application_route -%}
<a class="btn btn-primary btn-lg"
href="/{{ job_application_route }}/new?job_title={{ doc.name }}">{{ _("Apply Now") }}</a>
href="/{{ job_application_route }}/new?job_title={{ name }}">{{ _("Apply Now") }}</a>
{% else %}
<a class="btn btn-primary btn-lg"
href="/job_application/new?job_title={{ doc.name }}">{{ _("Apply Now") }}</a>
href="/job_application/new?job_title={{ name }}">{{ _("Apply Now") }}</a>
{% endif %}
</div>
</div>
<div class="mb-16" style="font-size: 18px">
<div class="flex mt-3 align-items-center mb-4"
style="--icon-stroke: var(--primary)">
<svg class="icon icon-lg ml-0 mr-1">
<use href="#icon-organization"></use>
</svg>
<p class="mr-3 mb-0">{{ doc.company }}</p>
{%- if department -%}
<svg class="icon icon-lg ml-0 mr-1">
<use href="#icon-branch"></use>
</svg>
<p class="mr-3 mb-0">{{ doc.department }}</p>
{% endif %}
{%- if location -%}
<svg class="icon icon-lg ml-0 mr-1"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 16 16">
<g stroke="var(--primary)" stroke-miterlimit="10">
<path d="M11.467 3.458c1.958 1.957 1.958 5.088.027 7.02L7.97 14l-3.523-3.523a4.945 4.945 0 010-6.993l.026-.026a4.922 4.922 0 016.993 0zm0 0c-.026-.026-.026-.026 0 0z">
</path>
<path d="M7.971 8.259a1.305 1.305 0 100-2.61 1.305 1.305 0 000 2.61z"></path>
</g>
</svg>
<p class="mr-3 mb-0">{{ doc.location }}</p>
{% endif %}
{%- if employment_type -%}
<svg class="icon icon-lg ml-0 mr-1">
<use href="#icon-hr"></use>
</svg>
<p class="mr-3 mb-0">{{ doc.employment_type }}</p>
{% endif %}
<div class="mb-8">
<hr>
<div class="row px-4" style="font-size: 15px">
<div class="col-3">
<div class="text-secondary">Location</div>
<div class="font-weight-bold">{{ location }}</div>
</div>
<div class="col-3">
<div class="text-secondary">Department</div>
<div class="font-weight-bold">{{ department }}</div>
</div>
<div class="col-3">
<div class="text-secondary">Employment Type</div>
<div class="font-weight-bold">{{ employment_type }}</div>
</div>
<div class="col-3">
<div class="text-secondary">Salary Range</div>
<div class="font-weight-bold">
{{ frappe.format_value(frappe.utils.flt(lower_range) ,
currency=currency) }} - {{ frappe.format_value(frappe.utils.flt(upper_range) ,
currency=currency) }} / {{ salary_per.lower() }}
</div>
</div>
</div>
{%- if doc.publish_salary_range -%}
<p>
{{ _("Salary range " + doc.salary_type.lower() ) }}:
<b>{{ frappe.format_value(frappe.utils.flt(doc.lower_range) ,
currency=doc.currency) }} - {{ frappe.format_value(frappe.utils.flt(doc.upper_range) ,
currency=doc.currency) }}
</b>
</p>
{% endif %}
<p class="font-italic">
{%- 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 %}
</p>
<hr>
</div>
{%- if description -%}<p>{{ description }}</p>{% endif %}
</div>
{%- if doc.description -%}<p>{{ description }}</p>{% endif %}
</div>
{% endblock page_content %}
2 changes: 1 addition & 1 deletion hrms/www/jobs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ <h3 class="mt-0 mr-20">{{ jo.job_title }}</h3>
currency=jo.currency) }} - {{ frappe.format_value(frappe.utils.flt(jo.upper_range) ,
currency=jo.currency) }}
</span>
<span class="text-secondary">{{ jo.salary_type.lower() }}</span>
<span class="text-secondary">{{ jo.salary_per.lower() }}</span>
</p>
{% endif %}
</div>
Expand Down
2 changes: 1 addition & 1 deletion hrms/www/jobs/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f6f20a8

Please sign in to comment.