Commit ab7d1441 authored by Tudor Văran's avatar Tudor Văran

Merge branch 'tudor-add-job-fix' into 'master'

Tudor add job fix See merge request Cronologium/proiectcolectiv-931!49
parents 44d94597 f0cb9de3
......@@ -128,7 +128,7 @@ def check_edit_fields(request):
def edit_profile_validate_password(request):
password = request.POST['password']
password = request.POST['new_password']
error_key = 'edit-pass-error'
if request.POST['new_password'] == '':
return {error_key: 'Please enter a password'}
......
......@@ -139,16 +139,16 @@ class AddJobForm(forms.Form):
self.fields['start_date'] = forms.DateField(required=True,
widget=forms.DateInput(
attrs={'class': 'inputfield',
'placeholder': 'yyyy-mm-dd',
attrs={'class': 'inputfield datepicker',
'placeholder': 'dd/mm/yyyy',
'style': 'position: absolute; left: 410px;', }),
label="Start")
self.fields['end_date'] = forms.DateField(required=True,
widget=forms.DateInput(
attrs={'class': 'inputfield',
'placeholder': 'yyyy-mm-dd',
attrs={'class': 'inputfield datepicker',
'placeholder': 'dd/mm/yyyy',
'style': 'position: absolute; left: 410px;', }),
label="End")
......@@ -260,19 +260,19 @@ class EditJobForm(forms.Form):
self.fields['start_date'] = forms.DateField(required=True,
widget=forms.DateInput(
attrs={'class': 'inputfield',
'placeholder': 'yyyy-mm-dd',
attrs={'class': 'inputfield datepicker',
'placeholder': 'dd/mm/yyyy',
'style': 'position: absolute; left: 410px;', }),
initial=job.start_date,
initial='/'.join(str(job.end_date).split('-')[::-1]),
label="Start")
self.fields['end_date'] = forms.DateField(required=True,
widget=forms.DateInput(
attrs={'class': 'inputfield',
'placeholder': 'yyyy-mm-dd',
attrs={'class': 'inputfield datepicker',
'placeholder': 'dd/mm/yyyy',
'style': 'position: absolute; left: 410px;', }),
initial=job.end_date,
initial='/'.join(str(job.end_date).split('-')[::-1]),
label="End")
self.fields['number_of_hours'] = forms.CharField(required=True,
......
......@@ -70,7 +70,7 @@ def validate_start_date(request):
if 'start_date' in request.POST and request.POST['start_date'] == '':
return {'add-start-error': 'Please enter start date'}
try:
start_date = datetime.datetime.strptime(request.POST['start_date'], '%Y-%m-%d')
start_date = datetime.datetime.strptime(request.POST['start_date'], '%d/%m/%Y')
print(start_date)
except ValueError:
return {'add-start-error': 'Please enter a valid date'}
......@@ -83,12 +83,12 @@ def validate_end_date(request):
if 'end_date' in request.POST and request.POST['end_date'] == '':
return {'add-end-error': 'Please enter end date'}
try:
end_date = datetime.datetime.strptime(request.POST['end_date'], '%Y-%m-%d')
end_date = datetime.datetime.strptime(request.POST['end_date'], '%d/%m/%Y')
print('end',end_date)
except ValueError:
return {'add-end-error': 'Please enter a valid date'}
try:
start_date = datetime.datetime.strptime(request.POST['start_date'], '%Y-%m-%d')
start_date = datetime.datetime.strptime(request.POST['start_date'], '%d/%m/%Y')
print('s',start_date)
except ValueError:
return {'add-start-error': 'Please enter a valid date'}
......@@ -309,8 +309,12 @@ def edit_job_ajax(request):
job.description = request.POST.get('description')
job.category=category
job.start_date = request.POST['start_date']
job.end_date = request.POST['end_date']
start = request.POST['start_date']
d, m, y = start.split('/')
job.start_date = datetime.date(year=int(y), month=int(m), day=int(d))
end = request.POST['end_date']
d, m, y = end.split('/')
job.end_date = datetime.date(year=int(y), month=int(m), day=int(d))
job.number_of_hours = request.POST['number_of_hours']
job.per_time = request.POST['per_time']
job.cost_of_services = request.POST['cost_of_services']
......
......@@ -78,4 +78,12 @@ $(document).ready(function () {
});
});
$(".datepicker").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "2017:2030",
dateFormat: "dd/mm/yy"
});
});
\ No newline at end of file
......@@ -84,4 +84,12 @@ $(document).ready(function () {
});
});
$(".datepicker").datepicker({
changeMonth: true,
changeYear: true,
yearRange: "2017:2030",
dateFormat: "dd/mm/yy"
});
});
\ No newline at end of file
......@@ -37,7 +37,6 @@ $(document).ready(function () {
$('#voluntaryCB').change(visibilityCostFields);
function displayInterval() {
if ($('#searchByInterval').is(":checked"))
$("#searchByIntervalForm").show();
......
......@@ -3,33 +3,30 @@
z-index: 100;
width: 98%;
}
table {
.data-table {
border-collapse: collapse;
width: 100%;
width: 99%;
}
th, td, table {
.data-th, .data-td, .data-table {
border: 1px solid;
}
th, td {
.data-th, .data-td {
height: 30px;
text-align: center;
vertical-align: middle;
font-family: 'Poiret One', cursive;
font-weight: bold;
}
td {
.data-td {
background-color: white;
opacity: 0.9;
}
th {
.data-th {
color: white;
border-color: black;
background-color: #fba100;
font-size: 1.2em;
}
body {
margin-right: 0;
}
a.noStyleLink {
text-decoration: none;
color: black;
......
......@@ -2,6 +2,8 @@
<link rel="stylesheet" type='text/css' href="{% static 'style/job_add.css' %}"/>
{% load static %}
<link rel="stylesheet" type='text/css' href="{% static 'style/flash-service.css' %}"/>
{% load static %}
<link rel="stylesheet" type='text/css' href="{% static 'jquery-ui-1.12.1/jquery-ui.min.css' %}"/>
{% load static %}
<script type="text/javascript" src="{% static 'script/jquery-3.2.1.min.js' %}"></script>
......@@ -11,6 +13,10 @@
<script type="text/javascript" src="{% static 'script/flash-service.js' %}"></script>
{% load static %}
<script type="text/javascript" src="{% static 'script/menu.js' %}"></script>
{%load static %}
<script type="text/javascript" src="{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}"></script>
<title>Add Job</title>
......
......@@ -52,18 +52,18 @@
{% if user.is_authenticated %}
{% if job.user.id == request.user.id %}
{% if job.applicants.all|length %}
<table>
<table class = "data-table">
<thead>
<tr>
<th>Applicant</th>
<th>Date</th>
<th>Select</th>
<tr class="data-tr">
<th class="data-th">Applicant</th>
<th class="data-th">Date</th>
<th class="data-th">Select</th>
</tr>
</thead>
<tbody>
{% for applicant in job.application_set.all %}
<tr>
<td>
<tr class="data-tr">
<td class="data-td">
<a href="/profile/{{applicant.user.user.username}}">
{% if applicant.user.user.first_name|length or applicant.user.user.last_name|length %}
{{applicant.user.user.first_name}} {{applicant.user.user.last_name}}
......@@ -72,8 +72,8 @@
{% endif %}
</a>
</td>
<td>{{applicant.apply_date}}</td>
<td>
<td class="data-td">{{applicant.apply_date}}</td>
<td class="data-td">
{% if job.user_chosen %}
{% if job.user_chosen.id == applicant.user.id %}
<form action="/job/{{job.id}}/deselect" method="POST">
......
......@@ -2,6 +2,8 @@
<link rel="stylesheet" type='text/css' href="{% static 'style/job_edit.css' %}"/>
{% load static %}
<link rel="stylesheet" type='text/css' href="{% static 'style/flash-service.css' %}"/>
{% load static %}
<link rel="stylesheet" type='text/css' href="{% static 'jquery-ui-1.12.1/jquery-ui.min.css' %}"/>
{% load static %}
<script type="text/javascript" src="{% static 'script/jquery-3.2.1.min.js' %}"></script>
......@@ -11,6 +13,8 @@
<script type="text/javascript" src="{% static 'script/flash-service.js' %}"></script>
{% load static %}
<script type="text/javascript" src="{% static 'script/menu.js' %}"></script>
{%load static %}
<script type="text/javascript" src="{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}"></script>
<title>Edit Job</title>
......
......@@ -25,16 +25,15 @@
<div id="category_search">
{{ category_form.category }}
</div>
<div id="serachByHours">
<div id="searchHours">
<input type="checkbox" name="searchByHours" id="searchByHours"/>Search By hours<br>
<div id="serachByHoursForm">
<b>Minimun nr. hours: </b>{{searchByHoursForm.min_hours}}<br>
<div id="searchByHoursForm">
<b>Minimum nr. hours: </b>{{searchByHoursForm.min_hours}}<br>
<b>Maximum nr. hours: </b>{{searchByHoursForm.max_hours}}<br>
<b>Per: </b>{{searchByHoursForm.per_time}}<br>
</div>
</div>
<div id="searchInterval">
<input type="checkbox" name="searchByInterval" id="searchByInterval"/>Search by interval<br>
<div id="searchByIntervalForm">
......@@ -60,24 +59,24 @@
</div>
<div id="rightContent">
<a class="jobs-button jobs-button-centered" href="/job_add">Add job</a><br>
<table>
<table class="data-table">
<thead>
<tr>
<th> Name</th>
<th> Publish date</th>
<th> Category</th>
<th> Location</th>
<th> Posted by</th>
<tr class="data-tr">
<th class="data-th"> Name</th>
<th class="data-th"> Publish date</th>
<th class="data-th"> Category</th>
<th class="data-th"> Location</th>
<th class="data-th"> Posted by</th>
</tr>
</thead>
<tbody>
{% for j in jobs %}
<tr>
<td> <a class="noStyleLink" href="/job/{{j.id}}">{{j.name}}</a></td>
<td> {{j.publish_date}}</td>
<td> {{j.category}}</td>
<td> {{j.location}}</td>
<td> <a class="noStyleLink" href="/profile/{{j.user.username}}">{{j.user.username}}</a></td>
<tr class="data-tr">
<td class="data-td"> <a class="noStyleLink" href="/job/{{j.id}}">{{j.name}}</a></td>
<td class="data-td"> {{j.publish_date}}</td>
<td class="data-td"> {{j.category}}</td>
<td class="data-td"> {{j.location}}</td>
<td class="data-td"> <a class="noStyleLink" href="/profile/{{j.user.username}}">{{j.user.username}}</a></td>
</tr>
{% endfor %}
</tbody>
......
......@@ -11,30 +11,30 @@
<!-- Content goes down here -->
<body>
<div id="content">
<table>
<table class="data-table">
<thead>
<tr>
<th> Name</th>
<th> Publish date</th>
<th> Category</th>
<th> Location</th>
<th> Edit </th>
<th> Delete </th>
<tr class="data-tr">
<th class="data-th"> Name</th>
<th class="data-th"> Publish date</th>
<th class="data-th"> Category</th>
<th class="data-th"> Location</th>
<th class="data-th"> Edit </th>
<th class="data-th"> Delete </th>
</tr>
</thead>
<tbody>
{% for j in jobs %}
<tr>
<td> <a class="noStyleLink" href="/job/{{j.id}}">{{j.name}}</a></td>
<td> {{j.publish_date}}</td>
<td> {{j.category}}</td>
<td> {{j.location}}</td>
<td>
<tr class="data-tr">
<td class="data-td"> <a class="noStyleLink" href="/job/{{j.id}}">{{j.name}}</a></td>
<td class="data-td"> {{j.publish_date}}</td>
<td class="data-td"> {{j.category}}</td>
<td class="data-td"> {{j.location}}</td>
<td class="data-td">
<form action="/job/{{j.id}}/edit" method="get">
<input type="submit" id="edit_job_button" value="Edit">
</form>
</td>
<td>
<td class="data-td">
<form action="/job/{{j.id}}/delete" method="get">
<input type="submit" id="delete_job_button" value="Delete">
</form>
......
......@@ -12,26 +12,26 @@
<!-- Content goes down here -->
<body>
<div style="width: 70%; margin-left: 15%;">
<table class="notificationsTable">
<table class="data-table notificationsTable">
<thead>
<tr>
<th> Job</th>
<th> Message</th>
<th> Seen </th>
<tr class="data-tr">
<th class="data-th"> Job</th>
<th class="data-th"> Message</th>
<th class="data-th"> Seen </th>
</tr>
</thead>
<tbody>
{% for notification in notifications %}
<tr >
<td style="width: 10%"> <a class="noStyleLink" href="/handle_notification/{{notification.id}}">{{notification.job.name}}</a></td>
<td style="width: 70%"> {{notification.notification_text}} </td>
<tr class="data-tr">
<td class="data-td" style="width: 10%"> <a class="noStyleLink" href="/handle_notification/{{notification.id}}">{{notification.job.name}}</a></td>
<td class="data-td" style="width: 70%"> {{notification.notification_text}} </td>
{% if notification.is_read %}
<td style="width: 10%">
<td class="data-td" style="width: 10%">
<input type="checkbox" checked disabled>
</td>
{% else %}
<td style="width: 10%">
<td class="data-td" style="width: 10%">
<input type="checkbox" class="seen-checkbox" value="{{notification.id}}">
</td>
{% endif %}
......
......@@ -10,27 +10,27 @@
<!-- Content goes down here -->
<body>
<div id="content">
<table class="seekersTable">
<table class="data-table">
<thead>
<tr>
<th> Reviewer</th>
<th> User reviewed</th>
<th> Related job</th>
<th> Category </th>
<th> Date & time</th>
<th> Rating </th>
<th class="data-th"> Reviewer</th>
<th class="data-th"> User reviewed</th>
<th class="data-th"> Related job</th>
<th class="data-th"> Category </th>
<th class="data-th"> Date & time</th>
<th class="data-th"> Rating </th>
</tr>
</thead>
<tbody>
{% for r in reviews %}
<tr >
<td> <a href="/profile/{{r.user_reviewing}}">{{r.user_reviewing.username}}</a></td>
<td> {% if r.employer_review %} Employer {% else %} Applicant {% endif %} <a href="/profile/{{r.user_reviewing}}">{{r.user_reviewed.username}}</a></td>
<td> {{ r.job.name }} </td>
<td> {{ r.job.category.name }} </td>
<td> {{ r.timestamp}}</td>
<td> {{ r.stars }} stars </td>
<tr class="data-tr">
<td class="data-td"> <a href="/profile/{{r.user_reviewing}}">{{r.user_reviewing.username}}</a></td>
<td class="data-td"> {% if r.employer_review %} Employer {% else %} Applicant {% endif %} <a href="/profile/{{r.user_reviewing}}">{{r.user_reviewed.username}}</a></td>
<td class="data-td"> {{ r.job.name }} </td>
<td class="data-td"> {{ r.job.category.name }} </td>
<td class="data-td"> {{ r.timestamp}}</td>
<td class="data-td"> {{ r.stars }} stars </td>
</tr>
{% endfor %}
</tbody>
......
......@@ -10,38 +10,38 @@
<!-- Content goes down here -->
<body>
<div id="content">
<table class="seekersTable">
<table class="data-table">
<thead>
<tr>
<th> Username</th>
<th> First Name</th>
<th> Last Name</th>
<th> Email </th>
<th> Interests </th>
<th> Rating </th>
<tr class="data-tr">
<th class="data-th"> Username</th>
<th class="data-th"> First Name</th>
<th class="data-th"> Last Name</th>
<th class="data-th"> Email </th>
<th class="data-th"> Interests </th>
<th class="data-th"> Rating </th>
</tr>
</thead>
<tbody>
{% for s in seekers %}
<tr >
<td> <a href="/profile/{{s.user.username}}">{{s.user.username}}</a></td>
<td > {{s.user.first_name}}</td>
<td > {{s.user.last_name}}</td>
<tr class="data-tr">
<td class="data-td"> <a href="/profile/{{s.user.username}}">{{s.user.username}}</a></td>
<td class="data-td"> {{s.user.first_name}}</td>
<td class="data-td"> {{s.user.last_name}}</td>
{%if s.hide_email_for_strangers == True and s.user != request.user %}
<td > No email available</td>
<td class="data-td"> No email available</td>
{%else%}
<td > {{s.user.email}}</td>
<td class="data-td"> {{s.user.email}}</td>
{%endif%}
<td>
<td class="data-td">
<select>
{% for i in s.interests.all %}
<option >{{i.name}}</option>
{%endfor%}
</select>
</td>
<td>
<td class="data-td">
{% if s.average_applicant_rating %}
<a href="/profile/{{s.user.username}}/reviews"> {{s.average_applicant_rating}} </a>
{% else %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment