Skip to content

Commit

Permalink
feat: better ui(?)
Browse files Browse the repository at this point in the history
(cherry picked from commit 1713019)

# Conflicts:
#	hrms/hr/doctype/job_opening/job_opening.json
  • Loading branch information
krantheman authored and mergify[bot] committed Dec 12, 2023
1 parent aa21c5e commit 05be798
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 43 deletions.
8 changes: 6 additions & 2 deletions hrms/hr/doctype/job_opening/job_opening.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@
"read_only": 1
},
{
"default": "Today",
"default": "Now",
"fieldname": "posted_on",
"fieldtype": "Date",
"fieldtype": "Datetime",
"label": "Posted On"
},
{
Expand Down Expand Up @@ -252,6 +252,7 @@
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
"modified": "2023-09-14 16:50:39.316079",
=======
Expand All @@ -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",
Expand Down
15 changes: 12 additions & 3 deletions hrms/www/jobs/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
68 changes: 31 additions & 37 deletions hrms/www/jobs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ <h3 class="mt-0 mb-10">{{ _("Job Openings") }}</h3>
{% block page_content %}
<meta id="data" data-filters="{{ all_filters }}">
<div class="row">
<div class="col-3 md-text">
<div class="col-3 text-15">
<div class="mb-10 flex align-items-center">
<p class="lg-text font-weight-bold">{{ _("Filters") }}</p>
<a id="clear-filters" class="ml-auto sm-text" role="button">{{ _("Clear All") }}</a>
<p class="text-18 font-weight-bold">{{ _("Filters") }}</p>
<a id="clear-filters" class="ml-auto text-12" role="button">{{ _("Clear All") }}</a>
</div>
{% for name, values in all_filters.items() %}
<div class="mb-10">
Expand Down Expand Up @@ -58,7 +58,7 @@ <h3 class="mt-0 mb-10">{{ _("Job Openings") }}</h3>
</div>
<div class="col-4 flex pr-0">
<div class="ml-auto flex align-items-center">
<div class="md-text text-secondary flex"
<div class="text-15 text-secondary flex"
type="button"
data-toggle="dropdown"
aria-haspopup="true"
Expand Down Expand Up @@ -87,37 +87,34 @@ <h3 class="mt-0 mb-10">{{ _("Job Openings") }}</h3>
</div>
</div>
</div>
<p class="text-secondary mb-4 md-text">
<p class="text-secondary mb-4 text-15">
Showing {{ job_openings|length }} {{ "result" if job_openings|length == 1 else "results" }}
</p>
{% for jo in job_openings %}
<div class="mb-8 card border p-6">
<div class="flex">
<h3 class="mt-0 mb-3 mr-20">{{ jo.job_title }}</h3>
<div class="ml-auto font-weight-bold text-nowrap">
{%- if jo.employment_type -%}
{%- if jo.employment_type == "Full-time" -%}
<span class="sm-text py-2 px-3 full-time-badge">• {{ jo.employment_type }}</span>
{%- elif jo.employment_type == "Part-time" -%}
<span class="sm-text py-2 px-4 part-time-badge">• {{ jo.employment_type }}</span>
{%- else -%}
<span class="sm-text py-2 px-4 other-badge">• {{ jo.employment_type }}</span>
{% endif %}
{% endif %}
<div class="mr-20">
<p class="text-secondary text-14 font-weight-bold">{{ jo.company }}</p>
<h3 class="mt-0">{{ jo.job_title }}</h3>
</div>
<div class="ml-auto text-nowrap text-secondary text-14">
<p>{{ jo.posted_on }}</p>
</div>
</div>
<div class="mb-10">
<div class="flex mb-2 align-items-center primary-stroke text-secondary">
<svg class="icon icon-md ml-0 mr-1">
<use href="#icon-organization"></use>
</svg>
<p class="mr-3 ">{{ jo.company }}</p>
{%- if jo.department -%}
<svg class="icon icon-md ml-0 mr-1">
<use href="#icon-branch"></use>
</svg>
<p class="mr-3 ">{{ jo.department }}</p>
{% endif %}
{%- if jo.employment_type -%}
<svg class="icon icon-md ml-0 mr-1">
<use href="#icon-hr"></use>
</svg>
<p class="mr-3 ">{{ jo.employment_type }}</p>
{% endif %}
{%- if jo.location -%}
<svg class="icon icon-md ml-0 mr-1"
xmlns="http://www.w3.org/2000/svg"
Expand All @@ -128,33 +125,30 @@ <h3 class="mt-0 mb-3 mr-20">{{ jo.job_title }}</h3>
<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 ">{{ jo.location }}</p>
<p>{{ jo.location }}</p>
{% endif %}
</div>
<p class="text-secondary font-italic">
{%- 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 %}
</p>
</div>
<div class="flex align-items-end">
{%- if jo.publish_salary_range -%}
<p class="mb-2">
<span class="font-weight-bold lg-text">
<p>
<span class="font-weight-bold text-18">
{{ frappe.format_value(frappe.utils.flt(jo.lower_range) ,
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>
</p>
{% endif %}
{%- if jo.no_of_applications -%}
<p class="text-secondary">
{{ jo.no_of_applications }}
{{ _(" applicant" if jo.no_of_applications == 1 else " applicants") }}
</p>
{% endif %}
</div>
<div class="flex">
<a class="btn btn-primary" href="{{ jo.route }}">{{ _("View Job →") }}</a>
{%- if jo.closes_on -%}
<p class="ml-auto font-italic text-secondary mt-auto sm-text">
{{ _("Closes on " + frappe.format_date(jo.closes_on, "d MMM, YYYY") ) }}
</p>
{% endif %}
<a class="ml-auto btn btn-primary" href="{{ jo.route }}">{{ _("View Job →") }}</a>
</div>
</div>
{% endfor %}
Expand Down
9 changes: 8 additions & 1 deletion hrms/www/jobs/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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"),
)
Expand All @@ -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):
Expand Down

0 comments on commit 05be798

Please sign in to comment.