diff options
author | Akshen | 2017-09-05 14:05:25 +0530 |
---|---|---|
committer | Akshen | 2017-09-05 14:05:25 +0530 |
commit | 47cdf0a98730ba006a24d4d710afdad04c861363 (patch) | |
tree | cc56921a1199fd57d4f612e3efa279a07d335405 /workshop_app/templates | |
parent | 86e0b947d7d8cf20cd354d6653b1c84c0e6d124f (diff) | |
download | workshop_booking-47cdf0a98730ba006a24d4d710afdad04c861363.tar.gz workshop_booking-47cdf0a98730ba006a24d4d710afdad04c861363.tar.bz2 workshop_booking-47cdf0a98730ba006a24d4d710afdad04c861363.zip |
Updates Workshop Stats
- Updates .gitignore
- Updates footer, sets it to fixed position
- Adds Workshop Stats
- Instructor can Download or View Workshop stats from the givin date range
- Instructor can view number of workshops per month in chart
- Writes test for Workshop Stats
Diffstat (limited to 'workshop_app/templates')
10 files changed, 260 insertions, 104 deletions
diff --git a/workshop_app/templates/workshop_app/base.html b/workshop_app/templates/workshop_app/base.html index 391fa9b..b2a5335 100644 --- a/workshop_app/templates/workshop_app/base.html +++ b/workshop_app/templates/workshop_app/base.html @@ -44,10 +44,10 @@ <h1>Base Template Content. Please override me</h1> {% endblock %} +</body> <footer class="footer"> <div class="container"> <p align="center">Developed by FOSSEE group, IIT Bombay</p> </div> </footer> -</body> </html>
\ No newline at end of file diff --git a/workshop_app/templates/workshop_app/edit_profile.html b/workshop_app/templates/workshop_app/edit_profile.html index 5e01430..70ad417 100644 --- a/workshop_app/templates/workshop_app/edit_profile.html +++ b/workshop_app/templates/workshop_app/edit_profile.html @@ -15,7 +15,7 @@ <li><a href="{{ URL_ROOT }}/create_workshop/">Create Workshop</a></li> <li><a href="{{ URL_ROOT }}/view_workshoptype_list/">Workshop List</a></li> <li><a href="{{ URL_ROOT }}/my_workshops/">My Workshops</a></li> - <li><a href="{{ URL_ROOT }}/scheduled_workshops/">Scheduled Workshops</a></li> + <li><a href="{{ URL_ROOT }}/workshop_stats/">Workshop Stats</a></li> </ul> {% else %} <div class="navbar-header"> diff --git a/workshop_app/templates/workshop_app/manage.html b/workshop_app/templates/workshop_app/manage.html index 9aac809..97f1604 100644 --- a/workshop_app/templates/workshop_app/manage.html +++ b/workshop_app/templates/workshop_app/manage.html @@ -10,7 +10,7 @@ <li ><a href="{{ URL_ROOT }}/create_workshop/">Create Workshop</a></li> <li ><a href="{{ URL_ROOT }}/view_workshoptype_list/"> Workshop List</a></li> <li ><a href="{{ URL_ROOT }}/my_workshops/">My Workshops</a></li> - <li><a href="{{ URL_ROOT }}/scheduled_workshops/">Scheduled Workshops</a></li> + <li><a href="{{ URL_ROOT }}/workshop_stats/">Workshop Stats</a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="{{ URL_ROOT }}/view_profile/"><span class="glyphicon glyphicon-user"></span> Profile </a></li> @@ -126,4 +126,4 @@ </div> {% endif %} -{% endblock %}
\ No newline at end of file +{% endblock %} diff --git a/workshop_app/templates/workshop_app/my_workshops.html b/workshop_app/templates/workshop_app/my_workshops.html index c36485e..740e28f 100644 --- a/workshop_app/templates/workshop_app/my_workshops.html +++ b/workshop_app/templates/workshop_app/my_workshops.html @@ -49,7 +49,7 @@ <li><a href="{{ URL_ROOT }}/create_workshop/">Create Workshop</a></li> <li><a href="{{ URL_ROOT }}/view_workshoptype_list/">Workshop List</a></li> <li class="active"><a href="{{ URL_ROOT }}/my_workshops/">My Workshops</a></li> - <li><a href="{{ URL_ROOT }}/scheduled_workshops/">Scheduled Workshops</a></li> + <li><a href="{{ URL_ROOT }}/workshop_stats/">Workshop Stats</a></li> </ul> {% else %} <div class="navbar-header"> @@ -61,7 +61,7 @@ <li><a href="{{ URL_ROOT }}/faq/">FAQ's</a></li> <li><a href="{{ URL_ROOT }}/benefits/">Benefits</a></li> <li><a href="{{ URL_ROOT }}/view_workshoptype_details/"> Workshop List</a></li> - <li><a href="{{ URL_ROOT }}/how_to_participate/">How to Participate</a></li> + <li><a href="{{ URL_ROOT }}/how_to_participate/">How to Participate</a></li> </ul> {% endif %} @@ -81,7 +81,7 @@ <!-- Pending View --> <div class="container"> - <h3 align="center"><strong><u>Pending</u></strong></h3> + <h3 align="center"><strong><u>My Requests</u></strong></h3> <table class="table table-striped"> <thead> <tr> @@ -122,7 +122,7 @@ <!-- Accepted View --> <div class="container"> - <h3 align="center"><strong><u>Accepted</u></strong></h3> + <h3 align="center"><strong><u>Workshops Accepted</u></strong></h3> <table class="table table-striped"> <thead> <tr> @@ -171,7 +171,7 @@ <!-- Proposed View --> <div class="container"> - <h3 align="center"><strong><u>Proposed</u></strong></h3> + <h3 align="center"><strong><u>Proposed Workshops</u></strong></h3> <table class="table table-striped"> <thead> <tr> @@ -211,7 +211,7 @@ <!-- Deleted/Rejected View --> <div class="container"> - <h3 align="center"><strong><u>Deleted/Rejected</u></strong></h3> + <h3 align="center"><strong><u>Workshops Deleted/Rejected</u></strong></h3> <table class="table table-striped"> <thead> <tr> @@ -295,4 +295,4 @@ {% endif %} {% endif %} -{% endblock %}
\ No newline at end of file +{% endblock %} diff --git a/workshop_app/templates/workshop_app/profile_updated.html b/workshop_app/templates/workshop_app/profile_updated.html index e0aa3ad..abeb3de 100644 --- a/workshop_app/templates/workshop_app/profile_updated.html +++ b/workshop_app/templates/workshop_app/profile_updated.html @@ -15,7 +15,7 @@ <li><a href="{{ URL_ROOT }}/create_workshop/">Create Workshop</a></li> <li><a href="{{ URL_ROOT }}/view_workshoptype_details/"> Workshop List</a></li> <li><a href="{{ URL_ROOT }}/my_workshops/">My Workshops</a></li> - <li><a href="{{ URL_ROOT }}/scheduled_workshops/">Scheduled Workshops</a></li> + <li><a href="{{ URL_ROOT }}/workshop_stats/">Workshop Stats</a></li> </ul> {% else %} <div class="navbar-header"> diff --git a/workshop_app/templates/workshop_app/propose_workshop.html b/workshop_app/templates/workshop_app/propose_workshop.html index ce90dc8..95a4008 100644 --- a/workshop_app/templates/workshop_app/propose_workshop.html +++ b/workshop_app/templates/workshop_app/propose_workshop.html @@ -22,7 +22,7 @@ changeMonth: true, changeYear: true, minDate: dateToday, - maxDate: upto + maxDate: upto, // You can put more options here. }); }); diff --git a/workshop_app/templates/workshop_app/scheduled_workshops.html b/workshop_app/templates/workshop_app/scheduled_workshops.html deleted file mode 100644 index a9aedd6..0000000 --- a/workshop_app/templates/workshop_app/scheduled_workshops.html +++ /dev/null @@ -1,89 +0,0 @@ -{% extends 'workshop_app/base.html' %} - -{% block header %} - <nav class="navbar navbar-default navbar-custom"> - <div class="container-fluid"> - <div class="navbar-header"> - <a class="navbar-brand" href="{{ URL_ROOT }}/manage/">Home</a> - </div> - <ul class="nav navbar-nav"> - <li ><a href="{{ URL_ROOT }}/create_workshop/">Create Workshop</a></li> - <li ><a href="{{ URL_ROOT }}/view_workshoptype_list/"> Workshop List</a></li> - <li ><a href="{{ URL_ROOT }}/my_workshops/">My Workshops</a></li> - <li><a href="{{ URL_ROOT }}/scheduled_workshops/">Scheduled Workshops</a></li> - </ul> - <ul class="nav navbar-nav navbar-right"> - <li><a href="{{ URL_ROOT }}/view_profile/"><span class="glyphicon glyphicon-user"></span> Profile </a></li> - <li><a href="{{ URL_ROOT }}/logout/"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li> - </ul> - </div> - </nav> -{% endblock %} - - -{% block content %} - - <div class="container"> - {% if scheduled_workshops %} - <h3>This Table Shows Scheduled Workshops which were Proposed By Coordinators</h3> - <br> - <table class="table table-hover"> - <thead> - <tr> - <th>Coordinator Name</th> - <th>Institute Name</th> - <th>Instructor Name</th> - <th>Workshop Name</th> - <th>Workshop Date</th> - </tr> - </thead> - {% csrf_token %} - {% for workshop in proposed_workshops %} - {% if workshop.status == 'ACCEPTED' %} - <tbody> - <tr> - <td>{{ workshop.proposed_workshop_coordinator.get_full_name | capfirst }}</td> - <td>{{ workshop.proposed_workshop_coordinator.profile.institute | capfirst }}</td> - <td>{{ workshop.proposed_workshop_instructor.get_full_name }}</td> - <td>{{ workshop.proposed_workshop_title.workshoptype_name }}</td> - <td>{{ workshop.proposed_workshop_date | date}}</td> - </tr> - </tbody> - {% endif %} - {% endfor %} - </table> - <h3>This Table Shows Scheduled Workshops based on Instructors Approval </h3> - <br> - <table class="table table-hover"> - <thead> - <tr> - <th>Coordinator Name</th> - <th>Institute Name</th> - <th>Instructor Name</th> - <th>Workshop Name</th> - <th>Workshop Date</th> - </tr> - </thead> - {% csrf_token %} - {% for workshop in requested_workshops %} - {% if workshop.status == 'ACCEPTED' %} - <tbody> - <tr> - <td>{{ workshop.requested_workshop_coordinator.get_full_name | capfirst }}</td> - <td>{{ workshop.requested_workshop_coordinator.profile.institute | capfirst }}</td> - <td>{{ workshop.requested_workshop_instructor.get_full_name }}</td> - <td>{{ workshop.requested_workshop_title.workshoptype_name }}</td> - <td>{{ workshop.requested_workshop_date | date}}</td> - </tr> - </tbody> - {% endif %} - {% endfor %} - </table> - - {% else %} - <div class="jumbotron"> - <h2>Permission to View Scheduled Workshops is set to False</h2> - </div> - {% endif %} - </div> -{% endblock %} diff --git a/workshop_app/templates/workshop_app/view_profile.html b/workshop_app/templates/workshop_app/view_profile.html index d960f45..91efdf1 100644 --- a/workshop_app/templates/workshop_app/view_profile.html +++ b/workshop_app/templates/workshop_app/view_profile.html @@ -15,7 +15,7 @@ <li><a href="{{ URL_ROOT }}/create_workshop/">Create Workshop</a></li> <li><a href="{{ URL_ROOT }}/view_workshoptype_list/">Workshop List</a></li> <li><a href="{{ URL_ROOT }}/my_workshops/">My Workshops</a></li> - <li><a href="{{ URL_ROOT }}/scheduled_workshops/">Scheduled Workshops</a></li> + <li><a href="{{ URL_ROOT }}/workshop_stats/">Workshop Stats</a></li> </ul> {% else %} <div class="navbar-header"> diff --git a/workshop_app/templates/workshop_app/view_workshoptype_list.html b/workshop_app/templates/workshop_app/view_workshoptype_list.html index 53d32ce..75cee32 100644 --- a/workshop_app/templates/workshop_app/view_workshoptype_list.html +++ b/workshop_app/templates/workshop_app/view_workshoptype_list.html @@ -15,7 +15,7 @@ <ul class="nav navbar-nav"> {% if request.user.profile.position == 'instructor'%} <li><a href="{{ URL_ROOT }}/create_workshop/">Create Workshop</a></li> - <li><a href="{{ URL_ROOT }}/scheduled_workshops/">Scheduled Workshops</a></li> + <li><a href="{{ URL_ROOT }}/workshop_stats/">Workshop Stats</a></li> {% else %} <li><a href="{{ URL_ROOT }}/book/">Book</a></li> <li><a href="{{ URL_ROOT }}/propose_workshop/">Propose a Workshop</a></li> diff --git a/workshop_app/templates/workshop_app/workshop_stats.html b/workshop_app/templates/workshop_app/workshop_stats.html new file mode 100644 index 0000000..464c625 --- /dev/null +++ b/workshop_app/templates/workshop_app/workshop_stats.html @@ -0,0 +1,245 @@ +{% extends 'workshop_app/base.html' %} + +{% block header %} + <nav class="navbar navbar-default navbar-custom"> + <div class="container-fluid"> + <div class="navbar-header"> + <a class="navbar-brand" href="{{ URL_ROOT }}/manage/">Home</a> + </div> + <ul class="nav navbar-nav"> + <li ><a href="{{ URL_ROOT }}/create_workshop/">Create Workshop</a></li> + <li ><a href="{{ URL_ROOT }}/view_workshoptype_list/"> Workshop List</a></li> + <li ><a href="{{ URL_ROOT }}/my_workshops/">My Workshops</a></li> + <li class="active"><a href="{{ URL_ROOT }}/workshop_stats/" >Workshop Stats</a></li> + </ul> + <ul class="nav navbar-nav navbar-right"> + <li><a href="{{ URL_ROOT }}/view_profile/"><span class="glyphicon glyphicon-user"></span> Profile </a></li> + <li><a href="{{ URL_ROOT }}/logout/"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li> + </ul> + </div> + </nav> +{% endblock %} + +{% block extra %} + <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> + <script src="https://code.jquery.com/jquery-1.12.4.js"></script> + <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> + <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> + + <!-- For Charts --> + + <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.bundle.min.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script> + +<script> + var dateToday = new Date(); + var upto = new Date(); + + dateToday.setDate(dateToday.getDate() - 1); + upto.setFullYear(dateToday.getFullYear() + 1); + + $( function() { + from = $( "#from" ) + .datepicker({ + defaultDate: "+1w", + changeMonth: true, + changeYear: true, + showButtonPanel: true, + maxDate: dateToday, + dateFormat: "yy-mm-dd" + }) + .on( "change", function() { + to.datepicker( "option", "minDate", getDate( this ) ); + }), + to = $( "#to" ).datepicker({ + defaultDate: "+1w", + changeMonth: true, + changeYear: true, + showButtonPanel: true, + minDate: dateToday, + maxDate: upto, + dateFormat: "yy-mm-dd" + }) + .on( "change", function() { + from.datepicker( "option", "maxDate", getDate( this ) ); + }); + + function getDate( element ) { + var date; + try { + date = $.datepicker.parseDate( dateFormat, element.value ); + } catch( error ) { + date = null; + } + + return date; + } + } ); + + </script> + +{% endblock %} + +{% block content %} + + <div class="container"> + {% if show_workshop_stats %} + <div align="right"> + <form method="POST" > + {% csrf_token %} + <div class="form-group"> + <label for="from">From</label> + <input type="text" id="from" name="from"> + <label for="to">to</label> + <input type="text" id="to" name="to"> + <button class="btn btn-warning" type="submit" name="Download" value="Download">Download</button> + <button class="btn btn-info" type="submit" name="View" value="View">View</button> + </div> + </form> + {% if messages %} + + <ul class="messages"> + {% for message in messages %} + <div class="alert alert-{{ message.tags }}"> + <li {% if message.tags %} class="{{ message.tags }}"{% endif %}> {{ message }} + </li> + </div> + {% endfor %} + </ul> + {% endif %} + </div> + <br> + <table class="table table-hover"> + <thead> + <tr> + <th>Coordinator Name</th> + <th>Institute Name</th> + <th>Instructor Name</th> + <th>Workshop Name</th> + <th>Workshop Date</th> + <th>Requested/Proposed By</th> + </tr> + </thead> + {% csrf_token %} + {% for workshop in upcoming_workshops %} + {% if workshop.proposed_workshop_date %} + <tbody> + <tr> + <td>{{ workshop.proposed_workshop_coordinator.get_full_name | capfirst }}</td> + <td>{{ workshop.proposed_workshop_coordinator.profile.institute | capfirst }}</td> + <td>{{ workshop.proposed_workshop_instructor.get_full_name }}</td> + <td>{{ workshop.proposed_workshop_title.workshoptype_name }}</td> + <td>{{ workshop.proposed_workshop_date | date}}</td> + <td>Coordinator</td> + </tr> + </tbody> + {% else %} + <tbody> + <tr> + <td>{{ workshop.requested_workshop_coordinator.get_full_name | capfirst }}</td> + <td>{{ workshop.requested_workshop_coordinator.profile.institute | capfirst }}</td> + <td>{{ workshop.requested_workshop_instructor.get_full_name }}</td> + <td>{{ workshop.requested_workshop_title.workshoptype_name }}</td> + <td>{{ workshop.requested_workshop_date | date}}</td> + <td>Instructor</td> + </tr> + </tbody> + {% endif %} + {% endfor %} + </table> + + <!-- Page Navigation --> + <div class="container"> + <div class="Page-Nav" align="center"> + <nav aria-label="Page navigation"> + <ul class="pagination pagination-sm"> + <li class="page-item"> + {% if upcoming_workshops.has_previous %} + <a class="page-link" tabindex="-1" + href="?page={{ upcoming_workshops.previous_page_number }}">Previous</a> + {% endif %} + </li> + <li class="page-item"> + <span class="current"> + Page {{ upcoming_workshops.number }} of {{ upcoming_workshops.paginator.num_pages }} + </span> + </li> + <li class="page-item"> + {% if upcoming_workshops.has_next %} + <a class="page-link" href="?page={{ upcoming_workshops.next_page_number }}">Next + </a> + {% endif %} + </li> + </ul> + </nav> + </div> + </div> + {% else %} + <div class="jumbotron"> + <h2>Permission to View Upcoming Workshops is set to false, please set it to true in settings.py</h2> + </div> + {% endif %} + </div> +<br> + <div class="row"> + <br> + <div class="col-md-12 "> + <br> + <canvas id="myChart" width="300px" height="40px"></canvas> + <script> + var ctx = document.getElementById("myChart").getContext('2d'); + var myChart = new Chart(ctx, { + type: 'bar', + data: { + labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', ' December'], + datasets: [{ + label: 'Number of workshops per Month for '+ dateToday.getFullYear(), + data: {{ workshop_count }}, + backgroundColor: [ + 'rgba(255, 99, 132, 0.2)', + 'rgba(54, 162, 235, 0.2)', + 'rgba(255, 206, 86, 0.2)', + 'rgba(75, 192, 192, 0.2)', + 'rgba(153, 102, 255, 0.2)', + 'rgba(242, 38, 19, 0.2)', + 'rgba(25, 91, 13, 0.2)', + 'rgba(54, 12, 235, 0.2)', + 'rgba(150, 40, 27, 0.2)', + 'rgba(66, 114, 155, 0.2)', + 'rgba(219, 10, 91, 0.2)', + 'rgba(191, 191, 191, 0.2)' + ], + borderColor: [ + 'rgba(255, 99, 132, 1)', + 'rgba(54, 162, 235, 1)', + 'rgba(255, 206, 86, 1)', + 'rgba(75, 192, 192, 1)', + 'rgba(153, 102, 255, 1)', + 'rgba(242, 38, 19, 1)', + 'rgba(25, 91, 13, 1)', + 'rgba(54, 12, 235, 1)', + 'rgba(150, 40, 27 ,1)', + 'rgba(66, 114, 155, 1)', + 'rgba(219, 10, 91, 1)', + 'rgba(191, 191, 191, 1)' + ], + borderWidth: 1 + }] + }, + options: { + responsive: true, + scales: { + yAxes: [{ + ticks: { + beginAtZero:true + } + }] + } + } + }); + </script> + </div> + + </div> +<br> +{% endblock %} |