mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Added the ability for HR staff to message the end user
This commit is contained in:
@@ -28,17 +28,20 @@ AUDIT_EVENT_STATUSCHANGE = 0
|
||||
AUDIT_EVENT_NOTE = 1
|
||||
AUDIT_EVENT_REJECTION = 2
|
||||
AUDIT_EVENT_ACCEPTED = 3
|
||||
AUDIT_EVENT_MESSAGE = 4
|
||||
|
||||
AUDIT_EVENT_CHOICES = (
|
||||
(AUDIT_EVENT_STATUSCHANGE, 'Status Change'),
|
||||
(AUDIT_EVENT_NOTE, 'Note'),
|
||||
(AUDIT_EVENT_NOTE, 'Staff Note'),
|
||||
(AUDIT_EVENT_REJECTION, 'Rejection Reason'),
|
||||
(AUDIT_EVENT_ACCEPTED, 'Accepted'),
|
||||
(AUDIT_EVENT_MESSAGE, 'Message to User'),
|
||||
)
|
||||
|
||||
AUDIT_EVENT_LOOKUP = {
|
||||
AUDIT_EVENT_STATUSCHANGE: 'Status Change',
|
||||
AUDIT_EVENT_NOTE: 'Note',
|
||||
AUDIT_EVENT_NOTE: 'Staff Note',
|
||||
AUDIT_EVENT_REJECTION: 'Rejection Reason',
|
||||
AUDIT_EVENT_ACCEPTED: 'Accepted',
|
||||
AUDIT_EVENT_MESSAGE: 'Message to User',
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ urlpatterns = patterns('',
|
||||
(r'^application/(?P<applicationid>\d+)/$', views.view_application),
|
||||
(r'^application/(?P<applicationid>\d+)/update/(?P<status>\d+)/$', views.update_application),
|
||||
(r'^application/(?P<applicationid>\d+)/note/$', views.add_note),
|
||||
(r'^application/(?P<applicationid>\d+)/message/$', views.add_message),
|
||||
(r'^application/(?P<applicationid>\d+)/reject/$', views.reject_application),
|
||||
(r'^application/(?P<applicationid>\d+)/accept/$', views.accept_application),
|
||||
|
||||
|
||||
13
hr/views.py
13
hr/views.py
@@ -191,6 +191,19 @@ def add_note(request, applicationid):
|
||||
form = NoteForm()
|
||||
return render_to_response('hr/applications/add_note.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
def add_message(request, applicationid):
|
||||
if request.method == 'POST':
|
||||
obj = Audit(application=Application.objects.get(id=applicationid), user=request.user, event=AUDIT_EVENT_MESSAGE)
|
||||
form = NoteForm(request.POST, instance=obj)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
send_message(obj.application, 'message', note=obj.text)
|
||||
return HttpResponseRedirect(reverse('hr.views.view_application', args=[applicationid]))
|
||||
|
||||
form = NoteForm()
|
||||
return render_to_response('hr/applications/add_message.html', locals(), context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@login_required
|
||||
def reject_application(request, applicationid):
|
||||
if request.method == 'POST':
|
||||
|
||||
12
templates/hr/applications/add_message.html
Normal file
12
templates/hr/applications/add_message.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Send Message to Applicant{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form action="{% url hr.views.add_message applicationid %}" method="post">
|
||||
<table>
|
||||
{{ form.as_table }}
|
||||
</table>
|
||||
<input type="submit" value="Apply" />
|
||||
</form>
|
||||
{% endblock %}
|
||||
@@ -21,7 +21,8 @@
|
||||
<a href="{% url hr.views.update_application app.id 1 %}">Submit Application</a>,
|
||||
{% endif %}
|
||||
{% if hrstaff %}
|
||||
<a href="{% url hr.views.add_note app.id %}">Add Note</a>,
|
||||
<a href="{% url hr.views.add_note app.id %}">Add Note</a>,
|
||||
<a href="{% url hr.views.add_message app.id %}">Send Message to Applicant</a>,
|
||||
{% if app.status < 2 or app.status = 4 %}
|
||||
<a href="{% url hr.views.reject_application app.id %}">Reject Application</a>,
|
||||
<a href="{% url hr.views.accept_application app.id %}">Accept Application</a>,
|
||||
|
||||
13
templates/hr/emails/message.txt
Normal file
13
templates/hr/emails/message.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
Hi {{ app.character }},
|
||||
|
||||
A message was sent to you regarding your current application to {{ app.corporation }}:
|
||||
|
||||
{% if note %}
|
||||
{{ note }}
|
||||
{% endif %}
|
||||
|
||||
If you have any further questions regarding your application, please contact {{ app.corporation }} via the normal channels.
|
||||
|
||||
Regards,
|
||||
|
||||
{{ app.corporation }} HR Bot
|
||||
1
templates/hr/emails/message_subject.txt
Normal file
1
templates/hr/emails/message_subject.txt
Normal file
@@ -0,0 +1 @@
|
||||
A message regarding your application to {{ app.corporation }}.
|
||||
Reference in New Issue
Block a user