diff options
-rw-r--r-- | static/recurrence/js/recurrence-widget.js | 2 | ||||
-rw-r--r-- | workshop_app/templates/workshop_app/manage.html | 14 | ||||
-rw-r--r-- | workshop_app/templates/workshop_app/my_workshops.html | 118 | ||||
-rw-r--r-- | workshop_app/views.py | 60 |
4 files changed, 150 insertions, 44 deletions
diff --git a/static/recurrence/js/recurrence-widget.js b/static/recurrence/js/recurrence-widget.js index f63e3b7..caceae6 100644 --- a/static/recurrence/js/recurrence-widget.js +++ b/static/recurrence/js/recurrence-widget.js @@ -1788,7 +1788,7 @@ recurrence.display.labels = { 'repeat_until': gettext('Repeat until'), 'exclude_occurrences': gettext('Exclude these occurences'), 'exclude_date': gettext('Exclude this date'), - 'add_rule': gettext('Add rule'), + 'add_rule': gettext('Add recurrence'), 'add_date': gettext('Add date'), 'remove': gettext('Remove'), 'calendar': gettext('Calendar') diff --git a/workshop_app/templates/workshop_app/manage.html b/workshop_app/templates/workshop_app/manage.html index 235f985..302f715 100644 --- a/workshop_app/templates/workshop_app/manage.html +++ b/workshop_app/templates/workshop_app/manage.html @@ -23,8 +23,18 @@ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> - + <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script> + //ToolTip PopUp function onhover + $(document).ready(function(){ + $('[data-toggle="popover"]').popover({ + placement : 'top', + trigger : 'hover' + }); + }); + function sendData(d){ var URL = "{{ URL_ROOT }}/my_workshops/" console.log(d); @@ -68,7 +78,7 @@ <td>{{ w.user }}</td> <td>{{ w.workshop }}</td> <td>{{ w.date | date}}</td> - <td><button data-toggle="tooltip" data-placement="top" title="Tooltip on top" class="btn btn-danger btn-sm" id="delete-btn" onClick="sendData('{{ w.user}},{{w.date | safe}},{{ w.workshop.id }},DELETED')" > Delete Event </button></td> + <td><button class="btn btn-danger btn-sm" id="delete-btn" onClick="sendData('{{ w.user}},{{w.date | safe}},{{ w.workshop.id }},DELETED')" data-toggle="popover" title="Please Note" data-content="Once Deleted you cannot revoke this action." > Delete Event </button></td> </tr> </tbody> {% endfor %} diff --git a/workshop_app/templates/workshop_app/my_workshops.html b/workshop_app/templates/workshop_app/my_workshops.html index ced8758..672f9f9 100644 --- a/workshop_app/templates/workshop_app/my_workshops.html +++ b/workshop_app/templates/workshop_app/my_workshops.html @@ -8,8 +8,17 @@ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css"> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> - + <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script> + //ToolTip popup function onhover + $(document).ready(function(){ + $('[data-toggle="popover"]').popover({ + placement : 'top', + trigger : 'hover' + }); + }); + function sendData(d){ var URL = "{{ URL_ROOT }}/my_workshops/" console.log(d); @@ -61,8 +70,11 @@ {% if workshop_occurences %} <h3 align="center">The status of your workshops </h3> <br> + + <!-- Pending View --> <div class="container"> - <table class="table table-hover"> + <h3 align="center"><strong><u>Pending</u></strong></h3> + <table class="table table-striped"> <thead> <tr> {% if request.user.profile.position == 'instructor' %} @@ -79,23 +91,95 @@ {% for workshop in workshop_occurences %} <tbody> <tr> - {% if request.user.profile.position == 'instructor' %} - <td>{{ workshop.requested_workshop_coordinator }}</td> - {% else %} - <td>{{ workshop.requested_workshop_instructor }}</td> - {% endif %} - <td>{{ workshop.requested_workshop_title }}</td> - <td>{{ workshop.requested_workshop_date }}</td> {% if workshop.status == 'Pending' %} - <td><span class = "label label-warning">{{ workshop.status }}</span></td> - {% elif workshop.status == 'ACCEPTED' %} - <td><span class = "label label-success">{{ workshop.status }}</span></td> - {% else %} - <td><span class = "label label-danger">{{ workshop.status }}</span></td> + {% if request.user.profile.position == 'instructor' %} + <td>{{ workshop.requested_workshop_coordinator }}</td> + {% else %} + <td>{{ workshop.requested_workshop_instructor }}</td> + {% endif %} + <td>{{ workshop.requested_workshop_title }}</td> + <td>{{ workshop.requested_workshop_date }}</td> + <td><span class = "label label-warning">{{ workshop.status }}</span></td> + {% endif %} + {% if request.user.profile.position == 'instructor' and workshop.status == 'Pending' %} + <td><button class="btn btn-primary btn-sm" id="book-btn" onClick="sendData('{{workshop.requested_workshop_coordinator}},{{workshop.requested_workshop_date| safe}},{{ workshop.requested_workshop_title_id }},ACCEPTED')" data-toggle="popover" title="Please Note" data-content="Once Accepted you can't Reject, you have to personally contact the Coordinator if the workshop is to be cancelled"> Accept</button></td> + <td><button class="btn btn-danger btn-sm" id="book-btn" onClick="sendData('{{workshop.requested_workshop_coordinator}},{{workshop.requested_workshop_date| safe}},{{ workshop.requested_workshop_title_id }},REJECTED')" data-toggle="popover" title="Please Note" data-content="Once Rejected you cannot revoke this action."> Reject </button></td> + {% endif %} + </tr> + </tbody> + + {% endfor %} + </table> + </div> + + <!-- Accepted View --> + <div class="container"> + <h3 align="center"><strong><u>Accepted</u></strong></h3> + <table class="table table-striped"> + <thead> + <tr> + {% if request.user.profile.position == 'instructor' %} + <th>Coordinator Name</th> + {% else %} + <th>Instructor Name</th> + {% endif %} + <th>Course Name</th> + <th>Course Day</th> + <th>Status</th> + </tr> + </thead> + {% csrf_token %} + {% for workshop in workshop_occurences %} + <tbody> + <tr> + {% if workshop.status == 'ACCEPTED' %} + {% if request.user.profile.position == 'instructor' %} + <td>{{ workshop.requested_workshop_coordinator }}</td> + {% else %} + <td>{{ workshop.requested_workshop_instructor }}</td> + {% endif %} + <td>{{ workshop.requested_workshop_title }}</td> + <td>{{ workshop.requested_workshop_date }}</td> + <td><span class = "label label-success">{{ workshop.status }}</span></td> {% endif %} - {% if request.user.profile.position == 'instructor' and workshop.status != 'DELETED' %} - <td><button class="btn btn-primary btn-sm" id="book-btn" onClick="sendData('{{workshop.requested_workshop_coordinator}},{{workshop.requested_workshop_date| safe}},{{ workshop.requested_workshop_title_id }},ACCEPTED')" > Accept</button></td> - <td><button class="btn btn-danger btn-sm" id="book-btn" onClick="sendData('{{workshop.requested_workshop_coordinator}},{{workshop.requested_workshop_date| safe}},{{ workshop.requested_workshop_title_id }},REJECTED')" > Reject </button></td> + </tr> + </tbody> + + {% endfor %} + + </table> + </div> + +<!-- Deleted/Rejected View --> +<div class="container"> + <h3 align="center"><strong><u>Deleted/Rejected</u></strong></h3> + <table class="table table-striped"> + <thead> + <tr> + {% if request.user.profile.position == 'instructor' %} + <th>Coordinator Name</th> + {% else %} + <th>Instructor Name</th> + {% endif %} + <th>Course Name</th> + <th>Course Day</th> + <th>Status</th> + </tr> + </thead> + {% csrf_token %} + {% for workshop in workshop_occurences %} + <tbody> + <tr> + {% if workshop.status == 'DELETED' or workshop.status == 'REJECTED' %} + {% if request.user.profile.position == 'instructor' %} + <td>{{ workshop.requested_workshop_coordinator }}</td> + {% else %} + <td>{{ workshop.requested_workshop_instructor }}</td> + {% endif %} + <td>{{ workshop.requested_workshop_title }}</td> + <td>{{ workshop.requested_workshop_date }}</td> + + <td><span class = "label label-danger">{{ workshop.status }}</span></td> {% endif %} </tr> </tbody> diff --git a/workshop_app/views.py b/workshop_app/views.py index f028ed5..526e865 100644 --- a/workshop_app/views.py +++ b/workshop_app/views.py @@ -133,17 +133,29 @@ def book(request): #Gives you the objects of BookedWorkshop bookedworkshop = BookedWorkshop.objects.all() - for j in bookedworkshop: + for b in bookedworkshop: ''' - j.booked_workshop.requested_workshop_date returns object from + b.booked_workshop.requested_workshop_date returns object from requestedworkshop table ''' - a = j.booked_workshop.requested_workshop_date.strftime("%d-%m-%Y") - b = j.booked_workshop.requested_workshop_title - for i in workshop_occurence_list: - if i[0] == a and i[2] == b: - workshop_occurence_list.remove(i) - del a, b + x = b.booked_workshop.requested_workshop_date.strftime("%d-%m-%Y") + y = b.booked_workshop.requested_workshop_title + for a in workshop_occurence_list: + if a[0] == x and a[2] == y: + workshop_occurence_list.remove(a) + del x, y + + #Gives you the objects of RequestedWorkshop for that particular coordinator + rW_obj = RequestedWorkshop.objects.filter( + requested_workshop_coordinator=request.user + ) + for r in rW_obj: + x = r.requested_workshop_date.strftime("%d-%m-%Y") + for a in workshop_occurence_list: + if a[0] == x: + workshop_occurence_list.remove(a) + del x + #Show upto 12 Workshops per page paginator = Paginator(workshop_occurence_list, 12) @@ -215,22 +227,22 @@ def book_workshop(request): rW_obj.requested_workshop_title = workshop.workshop_title rW_obj.save() - # Mail to instructor - send_email(request, call_on='Booking', - user_position='instructor', - workshop_date=workshop_date, - workshop_title=workshop.workshop_title.course_name, - user_name=str(request.user), - other_email=workshop.workshop_instructor.email - ) - - #Mail to coordinator - send_email(request, call_on='Booking', - workshop_date=workshop_date, - workshop_title=workshop.workshop_title.course_name, - user_name=workshop.workshop_instructor.username) - - return HttpResponse("Thank You, Please check your email for further information.") + # Mail to instructor + send_email(request, call_on='Booking', + user_position='instructor', + workshop_date=workshop_date, + workshop_title=workshop.workshop_title.course_name, + user_name=str(request.user), + other_email=workshop.workshop_instructor.email + ) + + #Mail to coordinator + send_email(request, call_on='Booking', + workshop_date=workshop_date, + workshop_title=workshop.workshop_title.course_name, + user_name=workshop.workshop_instructor.username) + + return HttpResponse("Thank You, Please check your email for further information.") else: return HttpResponse("Some Error Occurred.") |