diff --git a/jobs/views.py b/jobs/views.py
index c03081e..8e32909 100644
--- a/jobs/views.py
+++ b/jobs/views.py
@@ -57,6 +57,7 @@ class SingleJobView(SuccessMessageMixin, UpdateView):
context = super(SingleJobView, self).get_context_data(**kwargs)
context['categories'] = Category.objects.all()
context['employee_applied'] = Job.objects.get(pk=self.kwargs['pk']).employee.all().filter(id=self.request.user.id)
+ context['in_my_list'] = Job.objects.get(pk=self.kwargs['pk']).wish_list.all().filter(user_id=self.request.user.id)
try:
context['applied_employees'] = Job.objects.get(pk=self.kwargs['pk'], employer_id=self.request.user.id).employee.all()
context['employer_id'] = Job.objects.get(pk=self.kwargs['pk']).employer_id
diff --git a/static/js/addorremove.js b/static/js/addorremove.js
new file mode 100644
index 0000000..49d7bde
--- /dev/null
+++ b/static/js/addorremove.js
@@ -0,0 +1,56 @@
+function addorremove(id) {
+ if (id){
+ var wishlist = $('#jobwl' + id).data('wl');
+ if(wishlist == 0) {
+ $.ajax({
+ url: "/users/add-wishlist/" + id,
+ method: "GET",
+ success: function () {
+ $('#jobwl' + id).removeClass('btn-primary').addClass('btn-danger')
+ const Toast = Swal.mixin({
+ toast: true,
+ position: 'top',
+ showConfirmButton: true,
+ timer: 3000,
+ timerProgressBar: true,
+ didOpen: (toast) => {
+ toast.addEventListener('mouseenter', Swal.stopTimer)
+ toast.addEventListener('mouseleave', Swal.resumeTimer)
+ }
+ })
+
+ Toast.fire({
+ icon: 'success',
+ title: 'Added'
+ })
+ $('#jobwl' + id).data('wl', 1);
+ }
+ });
+ }else{
+ $.ajax({
+ url:"/users/remove-from-wishlist/" + id,
+ method:"GET",
+ success:function () {
+ $('#jobwl' + id).removeClass('btn-danger').addClass('btn-primary')
+ const Toast = Swal.mixin({
+ toast: true,
+ position: 'top',
+ showConfirmButton: true,
+ timer: 3000,
+ timerProgressBar: true,
+ didOpen: (toast) => {
+ toast.addEventListener('mouseenter', Swal.stopTimer)
+ toast.addEventListener('mouseleave', Swal.resumeTimer)
+ }
+ })
+
+ Toast.fire({
+ icon: 'error',
+ title: 'Removed'
+ })
+ $('#jobwl' + id).data('wl', 0);
+ }
+ });
+ }
+ }
+ }
\ No newline at end of file
diff --git a/static/js/addorremovenotauth.js b/static/js/addorremovenotauth.js
new file mode 100644
index 0000000..abac3d4
--- /dev/null
+++ b/static/js/addorremovenotauth.js
@@ -0,0 +1,24 @@
+function addorremove(id) {
+ if (id){
+ $.ajax({
+ success:function () {
+ const Toast = Swal.mixin({
+ toast: true,
+ position: 'top',
+ showConfirmButton: true,
+ timer: 3000,
+ timerProgressBar: true,
+ didOpen: (toast) => {
+ toast.addEventListener('mouseenter', Swal.stopTimer)
+ toast.addEventListener('mouseleave', Swal.resumeTimer)
+ }
+ })
+
+ Toast.fire({
+ icon: 'error',
+ title: 'You are not an employee!'
+ })
+ }
+ });
+ }
+ }
\ No newline at end of file
diff --git a/templates/base.html b/templates/base.html
index 76f19b8..da31f61 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -202,13 +202,12 @@
+
{% if user.is_authenticated and user.is_employee %}
{% else %}
-
+
{% endif %}
-
-