diff --git a/smash/web/static/js/daily_planning.js b/smash/web/static/js/daily_planning.js index 462ab764188851019eacd48960ce8a031d2bc11a..9ae40d26537594521ff1412d448d72862255ad31 100644 --- a/smash/web/static/js/daily_planning.js +++ b/smash/web/static/js/daily_planning.js @@ -381,7 +381,11 @@ $(document).ready(function () { data: { start_date: view.start.format('YYYY-MM-DD'), } - }).then(function(resources){callback(resources)}); + }).then(function(resources){ + var checked_roles = $('.role_list_item > input:checked').map( (i,e) => e.value).toArray(); + resources = resources.filter(resource => checked_roles.includes(resource.role)); + callback(resources) + }); }, 0); }, events: [], diff --git a/smash/web/templates/daily_planning.html b/smash/web/templates/daily_planning.html index c02b5d7d6e7e9262b53a20f90b1eb9c4d4a261d9..c28fb0192e2eaf4f53d787b3ba30d111ec7b6c8b 100644 --- a/smash/web/templates/daily_planning.html +++ b/smash/web/templates/daily_planning.html @@ -13,6 +13,20 @@ /> <link rel="stylesheet" href="{% static 'fullcalendar-scheduler/scheduler.min.css' %}"> <link rel="stylesheet" href="{% static 'css/daily_planning.css' %}"> + <style type="text/css"> + .role_label{ + padding-left: 5px; + } + #role_list{ + columns: 3; + webkit-columns: 2; + -moz-columns: 2; + } + .role_list_item{ + list-style: none; + list-style-type:none; + } + </style> {% include "includes/datepicker.css.html" %} {% endblock styles %} @@ -38,6 +52,13 @@ </div> </div> </div> + <ul id="role_list"> + {% for role in worker_study_roles %} + <li class="role_list_item"> + <input type="checkbox" name="{{role.0}}" value="{{role.0}}" id="{{role.0}}" onclick="clicked_role_list_item(this);" checked><label class="role_label" for="{{role.0}}">{{role.1}}</label> + </li> + {% endfor %} + </ul> {% endblock maincontent %} {% block scripts %} @@ -48,6 +69,11 @@ <script> var resources_url = '{% url 'web.api.workers.daily_planning' %}'; var events_url = '{% url 'web.api.events_persist' %}'; + function clicked_role_list_item(item){ + //var checked = $(item).prop('checked'); + $('#calendar').fullCalendar('refetchResources'); + } + </script> {% include "includes/datepicker.js.html" %} <script src="{% static 'js/daily_planning.js' %}"></script>