fix: job reporting
This commit is contained in:
@@ -9,10 +9,10 @@
|
|||||||
"field_order": [
|
"field_order": [
|
||||||
"job_title",
|
"job_title",
|
||||||
"location",
|
"location",
|
||||||
|
"disabled",
|
||||||
"column_break_5",
|
"column_break_5",
|
||||||
"type",
|
"type",
|
||||||
"status",
|
"status",
|
||||||
"job_opportunity_status",
|
|
||||||
"section_break_6",
|
"section_break_6",
|
||||||
"description",
|
"description",
|
||||||
"company_details_section",
|
"company_details_section",
|
||||||
@@ -51,19 +51,12 @@
|
|||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "Pending",
|
"default": "Open",
|
||||||
"fieldname": "status",
|
"fieldname": "status",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Status",
|
"label": "Status",
|
||||||
"options": "Pending\nApproved\nRejected"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"default": "Open",
|
|
||||||
"fieldname": "job_opportunity_status",
|
|
||||||
"fieldtype": "Select",
|
|
||||||
"label": "Job Opportunity Status",
|
|
||||||
"options": "Open\nClosed"
|
"options": "Open\nClosed"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -109,11 +102,17 @@
|
|||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Application Form Link",
|
"label": "Application Form Link",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "disabled",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Disabled"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2021-12-30 12:10:08.849547",
|
"modified": "2022-01-11 14:56:42.509351",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Job",
|
"module": "Job",
|
||||||
"name": "Job Opportunity",
|
"name": "Job Opportunity",
|
||||||
|
|||||||
@@ -1,8 +1,29 @@
|
|||||||
# Copyright (c) 2021, Frappe and contributors
|
# Copyright (c) 2021, Frappe and contributors
|
||||||
# For license information, please see license.txt
|
# For license information, please see license.txt
|
||||||
|
|
||||||
# import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
from frappe.utils.user import get_system_managers
|
||||||
|
from frappe import _
|
||||||
|
from frappe.utils import get_link_to_form
|
||||||
|
|
||||||
class JobOpportunity(Document):
|
class JobOpportunity(Document):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def report(job, reason):
|
||||||
|
args = {
|
||||||
|
"job": job,
|
||||||
|
"job_url": get_link_to_form("Job Opportunity", job),
|
||||||
|
"user": frappe.session.user
|
||||||
|
}
|
||||||
|
system_managers = get_system_managers(only_name=True)
|
||||||
|
user = frappe.db.get_value("User", frappe.session.user, "full_name")
|
||||||
|
subject = _("User {0} has reported the job post {1}").format(user, job)
|
||||||
|
frappe.sendmail(
|
||||||
|
recipients = system_managers,
|
||||||
|
subject=subject,
|
||||||
|
header=[subject, "green"],
|
||||||
|
template = "job_report",
|
||||||
|
args=args,
|
||||||
|
now=True)
|
||||||
|
|||||||
@@ -1479,16 +1479,26 @@ pre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.job-card-info {
|
.job-card-info {
|
||||||
padding: 0 1.5rem;
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.company-logo {
|
.company-logo {
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-size: 88px;
|
background-size: 37px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.job-card-parent {
|
.job-card-parent {
|
||||||
display: grid;
|
display: grid;
|
||||||
row-gap: 1rem;
|
row-gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.job-card-logo-section {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.job-detail-card {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|||||||
7
school/templates/emails/job_report.html
Normal file
7
school/templates/emails/job_report.html
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{% set job_link = "<a href='" + job_url + "'>" + job + "</a>" %}
|
||||||
|
|
||||||
|
|
||||||
|
<p>{{ _("Hey,") }}</p>
|
||||||
|
<p>{{ _("{0} has reported a job post for the following reason.").format(user) }}</p>
|
||||||
|
<p>{{ reason }}</p>
|
||||||
|
<p>{{ _("Please take appropriate action at {0}").format(job_link) }}</p>
|
||||||
21
school/templates/job_card.html
Normal file
21
school/templates/job_card.html
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<div class="job-card">
|
||||||
|
<div class="job-card-info">
|
||||||
|
<div class="d-flex mb-3">
|
||||||
|
<div class="course-card-pills">{{ _(job.type) }}</div>
|
||||||
|
<div class="course-card-pills">{{ job.location }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="card-heading">{{ _(job.job_title) }}</div>
|
||||||
|
<div class="mt-1">
|
||||||
|
<a class="dark-links" href="{{ job.company_website }}">{{ job.company_name }}</a>
|
||||||
|
</div>
|
||||||
|
{% if show_edit_link and job.owner == frappe.session.user %}
|
||||||
|
<a href="/job-opportunity?name={{ job.name }}">Edit</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="job-card-logo-section">
|
||||||
|
<div class="small">Posted on: {{ frappe.utils.format_date(job.creation, "medium") }}</div>
|
||||||
|
<div class="avatar avatar-medium" title="{{ job.company_name}}">
|
||||||
|
<span class="avatar-frame company-logo" style="background-image: url( {{ job.company_logo | urlencode }} );"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
{% extends "templates/base.html" %}
|
{% extends "templates/base.html" %}
|
||||||
{% from "www/hackathons/macros/card.html" import null_card %}
|
|
||||||
{% block title %}{{ _('Community') }}{% endblock %}
|
{% block title %}{{ _('Community') }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
{% extends "templates/base.html" %}
|
{% extends "templates/base.html" %}
|
||||||
{% from "www/hackathons/macros/card.html" import null_card %}
|
|
||||||
{% block title %}{{ 'Courses' }}{% endblock %}
|
{% block title %}{{ 'Courses' }}{% endblock %}
|
||||||
{% block head_include %}
|
{% block head_include %}
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
{% extends "templates/base.html" %}
|
{% extends "templates/base.html" %}
|
||||||
{% from "www/hackathons/macros/card.html" import null_card %}
|
|
||||||
{% block title %}{{ _('Job Openings') }}{% endblock %}
|
{% block title %}{{ _('Job Openings') }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@@ -16,20 +15,8 @@
|
|||||||
<div class="job-card-parent">
|
<div class="job-card-parent">
|
||||||
{% for job in jobs %}
|
{% for job in jobs %}
|
||||||
<div class="common-card-style course-card">
|
<div class="common-card-style course-card">
|
||||||
<div class="job-card">
|
{% set show_edit_link = False %}
|
||||||
<div class="avatar avatar-large" title="{{ job.company_name}}">
|
{% include "school/templates/job_card.html" %}
|
||||||
<span class="avatar-frame company-logo" style="background-image: url( {{ job.company_logo | urlencode }} );"></span>
|
|
||||||
</div>
|
|
||||||
<div class="job-card-info">
|
|
||||||
<div class="d-flex mb-1">
|
|
||||||
<div class="course-card-pills">{{ _(job.type) }}</div>
|
|
||||||
<div class="course-card-pills">{{ job.location }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-heading">{{ _(job.job_title) }}</div>
|
|
||||||
<div>{{ job.company_name }}</div>
|
|
||||||
</div>
|
|
||||||
<div class="small">Posted on: {{ frappe.utils.format_date(job.creation, "medium") }}</div>
|
|
||||||
</div>
|
|
||||||
<a class="stretched-link" href="/jobs/{{ job.name }}"></a>
|
<a class="stretched-link" href="/jobs/{{ job.name }}"></a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -37,8 +24,8 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<div class="empty-state text-center">
|
<div class="empty-state text-center">
|
||||||
<img class="icon icon-xl" src="/assets/frappe/icons/timeless/message.svg">
|
<img class="icon icon-xl" src="/assets/frappe/icons/timeless/message.svg">
|
||||||
<div class="course-home-headings mt-4 mb-0" style="color: inherit;"> {{ _("No open positions") }} </div>
|
<div class="course-home-headings mt-4 mb-0" style="color: inherit;"> {{ _("No open jobs") }} </div>
|
||||||
<div class="small mb-6"> {{ _("There are no job openings available.") }} </div>
|
<div class="small mb-6"> {{ _("There are no job openings at present.") }} </div>
|
||||||
{% if allow_posting %}
|
{% if allow_posting %}
|
||||||
<a class="button is-secondary dark-links m-auto" href="/job-opportunity?new=1">{{ _("Post a Job") }}</a>
|
<a class="button is-secondary dark-links m-auto" href="/job-opportunity?new=1">{{ _("Post a Job") }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import frappe
|
|||||||
def get_context(context):
|
def get_context(context):
|
||||||
context.jobs = frappe.get_all("Job Opportunity",
|
context.jobs = frappe.get_all("Job Opportunity",
|
||||||
{
|
{
|
||||||
"status": "Approved",
|
"status": "Open",
|
||||||
"job_opportunity_status": "Open"
|
"disabled": False
|
||||||
},
|
},
|
||||||
[
|
[
|
||||||
"job_title", "location", "type", "company_name",
|
"job_title", "location", "type", "company_name",
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
{% extends "templates/base.html" %}
|
{% extends "templates/base.html" %}
|
||||||
{% from "www/hackathons/macros/card.html" import null_card %}
|
|
||||||
{% block title %}{{ _(job.job_title) }}{% endblock %}
|
{% block title %}{{ _(job.job_title) }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@@ -7,31 +6,50 @@
|
|||||||
<div class="common-page-style">
|
<div class="common-page-style">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{ BreadCrumb(job) }}
|
{{ BreadCrumb(job) }}
|
||||||
<div class="common-card-style thread-card">
|
<div class="common-card-style job-detail-card">
|
||||||
<div class="d-flex">
|
{% set show_edit_link = True %}
|
||||||
<div class="avatar avatar-large" title="{{ job.company_name}}">
|
{% include "school/templates/job_card.html" %}
|
||||||
<span class="avatar-frame company-logo" style="background-image: url( {{ job.company_logo | urlencode }} );"></span>
|
<div class="p-4">
|
||||||
</div>
|
|
||||||
<div class="job-card-info">
|
|
||||||
<span class="d-flex mb-1">
|
|
||||||
<div class="course-card-pills">{{ _(job.type) }}</div>
|
|
||||||
<div class="course-card-pills">{{ job.location }}</div>
|
|
||||||
</span>
|
|
||||||
<div class="">
|
|
||||||
<div class="card-heading">{{ _(job.job_title) }}</div>
|
|
||||||
<a class="dark-links" href="{{ job.company_website }}">{{ job.company_name }}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="small">Posted On: {{ frappe.utils.format_date(job.creation, "medium") }}</div>
|
|
||||||
<a class="pull-right mt-3" href="/job-opportunity/{{ job.name }}">Edit</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mt-5">
|
|
||||||
<div>{{ _(job.description) }}</div>
|
<div>{{ _(job.description) }}</div>
|
||||||
<a class="button is-primary mt-5" href="{{ job.application_link }}">{{ _("Apply Now") }}</a>
|
<div class="d-flex justify-content-between mt-5">
|
||||||
|
<a class="button is-primary" href="{{ job.application_link }}">{{ _("Apply Now") }}</a>
|
||||||
|
<div class="button is-secondary" id="report">{{ _("Report this post") }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade report-modal" id="report-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||||
|
aria-hidden="true">
|
||||||
|
<div class="modal-dialog" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<div class="font-weight-bold">{{ _("Report this Post") }}</div>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form class="review-form" id="review-form">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="clearfix">
|
||||||
|
<label class="control-label reqd" style="padding-right: 0px;">{{ _("Reason for reporting") }}</label>
|
||||||
|
</div>
|
||||||
|
<div class="control-input-wrapper">
|
||||||
|
<div class="control-input">
|
||||||
|
<textarea type="text" autocomplete="off" class="input-with-feedback form-control report-field"
|
||||||
|
data-fieldtype="Text" data-fieldname="feedback_comments" placeholder="" style="height: 200px;"
|
||||||
|
spellcheck="false"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class="error-field muted-text"></p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<div class="button submit-review is-primary" data-job="{{ job.name }}" id="submit-report">
|
||||||
|
Report</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
27
school/www/jobs/job.js
Normal file
27
school/www/jobs/job.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
frappe.ready(() => {
|
||||||
|
$("#report").click((e) => {
|
||||||
|
open_report_dialog(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#submit-report").click((e) => {
|
||||||
|
report(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const open_report_dialog = (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
$("#report-modal").modal("show");
|
||||||
|
};
|
||||||
|
|
||||||
|
const report = (e) => {
|
||||||
|
frappe.call({
|
||||||
|
method: "school.job.doctype.job_opportunity.job_opportunity.report",
|
||||||
|
args: {
|
||||||
|
"job": $(e.currentTarget).data("job"),
|
||||||
|
"reason": $(".report-field").val()
|
||||||
|
},
|
||||||
|
callback: (data) => {
|
||||||
|
frappe.msgprint(__("Thanks for informing us about this post. Site admins will look into this and take an appropriate action soon."))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user