23# added messages
This commit is contained in:
parent
c3c8d97d51
commit
193eb7c8af
@ -56,11 +56,11 @@
|
||||
{{ user.first_name }}
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="#">My Jobs</a>
|
||||
<a class="dropdown-item" href="">You Have {{ user.count_unread_messages }} message(s)</a>
|
||||
<a class="dropdown-item" href="">My Wish List</a>
|
||||
<a class="dropdown-item" href="{% url 'users:update_profile' pk=user.get_profile_id %}">Update Profile</a>
|
||||
<a class="dropdown-item" href="">Change Password</a>
|
||||
<a class="dropdown-item" href="#">My jobs</a>
|
||||
<a class="dropdown-item" href="">You have {{ user.count_unread_messages }} message(s)</a>
|
||||
<a class="dropdown-item" href="">My wish list</a>
|
||||
<a class="dropdown-item" href="{% url 'users:update_profile' pk=user.get_profile_id %}">Update profile</a>
|
||||
<a class="dropdown-item" href="">Change password</a>
|
||||
<a class="dropdown-item" href="{% url 'users:logout' %}">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
@ -71,12 +71,12 @@
|
||||
{{ user.first_name }}
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="{% url 'jobs:create_job' %}">Add Job</a>
|
||||
<a class="dropdown-item" href="{% url 'users:employer_jobs' %}">My Jobs</a>
|
||||
<a class="dropdown-item" href="{% url 'jobs:create_job' %}">Add job</a>
|
||||
<a class="dropdown-item" href="{% url 'users:employer_jobs' %}">My jobs</a>
|
||||
{% if user.get_profile_id %}
|
||||
<a class="dropdown-item" href="{% url 'users:update_profile' pk=user.get_profile_id %}">Update Profile</a>
|
||||
<a class="dropdown-item" href="{% url 'users:update_profile' pk=user.get_profile_id %}">Update profile</a>
|
||||
{% endif %}
|
||||
<a class="dropdown-item" href="">Change Password</a>
|
||||
<a class="dropdown-item" href="">Change password</a>
|
||||
<a class="dropdown-item" href="{% url 'users:logout' %}">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<div class="container">
|
||||
<div class="row no-gutters slider-text js-fullheight align-items-end justify-content-start" data-scrollax-parent="true">
|
||||
<div class="col-md-8 ftco-animate text-center text-md-left mb-5" data-scrollax=" properties: { translateY: '70%' }">
|
||||
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span class="mr-3"><a href="blog.html">Blog <i class="ion-ios-arrow-forward"></i></a></span> <span>Single</span></p>
|
||||
<p class="breadcrumbs" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }"><span class="mr-3"><a href="index.html">Home <i class="ion-ios-arrow-forward"></i></a></span> <span>Detail</span></p>
|
||||
<h1 class="mb-3 bread" data-scrollax="properties: { translateY: '30%', opacity: 1.6 }">Job detail</h1>
|
||||
</div>
|
||||
</div>
|
||||
@ -43,7 +43,7 @@
|
||||
Applied candidates
|
||||
</button>
|
||||
{% for employee in applied_employees %}
|
||||
<a href="{% url 'users:employee_profile' pk=employee.pk %}" class="list-group-item list-group-item-action">{{ employee.first_name }} {{ employee.last_name }}</a>
|
||||
<a href="{% url 'users:employee_profile' employee_id=employee.pk job_id=job.id %}" class="list-group-item list-group-item-action">{{ employee.first_name }} {{ employee.last_name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
|
@ -26,6 +26,7 @@
|
||||
<hr>
|
||||
<h3>Send an invitation to employee</h3>
|
||||
<form action="" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="row form-group">
|
||||
<div class="col-md-12">
|
||||
<label class="font-weight-bold" for="fullname">Date</label>
|
||||
|
@ -55,6 +55,9 @@ class Account(AbstractBaseUser, PermissionsMixin):
|
||||
def get_profile_id(self):
|
||||
return self.profile.id
|
||||
|
||||
def count_unread_messages(self):
|
||||
return self.invites.filter(unread=True).count()
|
||||
|
||||
|
||||
class Profile(models.Model):
|
||||
user = models.OneToOneField(Account, on_delete=models.CASCADE, related_name="profile")
|
||||
|
@ -7,6 +7,6 @@ urlpatterns = [
|
||||
path('login/', UserLoginView.as_view(), name='login'),
|
||||
path('logout/', UserLogoutView.as_view(), name='logout'),
|
||||
path('update-profile/<int:pk>/', UserUpdateView.as_view(), name='update_profile'),
|
||||
path('employee-profile/<int:pk>/', EmployeeProfileView.as_view(), name='employee_profile'),
|
||||
path('employee-profile/<int:employee_id>/<int:job_id>/', EmployeeProfileView.as_view(), name='employee_profile'),
|
||||
path('employer-jobs/', EmployerPostedJobsView.as_view(), name='employer_jobs'),
|
||||
]
|
||||
|
@ -67,11 +67,22 @@ class EmployeeProfileView(CreateView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(EmployeeProfileView, self).get_context_data(**kwargs)
|
||||
context['account'] = Account.objects.get(pk=self.kwargs['pk'])
|
||||
context['profile'] = Profile.objects.get(user_id=self.kwargs['pk'])
|
||||
context['account'] = Account.objects.get(pk=self.kwargs['employee_id'])
|
||||
context['profile'] = Profile.objects.get(user_id=self.kwargs['employee_id'])
|
||||
context['job'] = Job.objects.get(id=self.kwargs['job_id'])
|
||||
context['categories'] = Category.objects.all()
|
||||
return context
|
||||
|
||||
def form_valid(self, form):
|
||||
instance = form.save(commit=False)
|
||||
instance.user = Account.objects.get(pk=self.kwargs['employee_id'])
|
||||
instance.job = Job.objects.get(pk=self.kwargs['job_id'])
|
||||
instance.save()
|
||||
return super(EmployeeProfileView, self).form_valid(form)
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse('users:employer_jobs')
|
||||
|
||||
|
||||
@method_decorator(login_required(login_url='/users/login'), name='dispatch')
|
||||
class EmployerPostedJobsView(ListView):
|
||||
|
Loading…
Reference in New Issue
Block a user