diff --git a/smash/web/templates/appointment_types/breadcrumb.html b/smash/web/templates/appointment_types/breadcrumb.html index 2ab1c8ec997ca0ccf01b576afb751c3a92981c95..eb8c7038b50385c4c08addd1b8dddd42650d156f 100644 --- a/smash/web/templates/appointment_types/breadcrumb.html +++ b/smash/web/templates/appointment_types/breadcrumb.html @@ -1,5 +1,5 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> -<li><a href="{% url 'web.views.equipment_and_rooms' %}">Equipment and rooms</a></li> +<li><a>Configuration</a></li> <li class="active"> <a href="{% url 'web.views.appointment_types' %}">Appointment Types</a> </li> \ No newline at end of file diff --git a/smash/web/templates/doctors/breadcrumb.html b/smash/web/templates/doctors/breadcrumb.html index 391f87d887db27dadfd5b2a7f390967d920769fd..fe408c6186211a692de71c25182adf64d934558d 100644 --- a/smash/web/templates/doctors/breadcrumb.html +++ b/smash/web/templates/doctors/breadcrumb.html @@ -1,7 +1,10 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> {% if worker_type == 'HEALTH_PARTNER' %} <li>Configuration</li> +<li class="active"><a href="{% url 'web.views.workers' %}">Workers</a></li> {% elif worker_type == 'VOUCHER_PARTNER' %} -<li>Configuration</li> +<li>Voucher</li> +<li class="active"><a href="{% url 'web.views.workers' %}">Voucher Partners</a></li> +{% else %} +<li class="active"><a href="{% url 'web.views.workers' %}">Workers</a></li> {% endif %} -<li class="active"><a href="{% url 'web.views.workers' %}">Workers</a></li> \ No newline at end of file diff --git a/smash/web/templates/equipment_and_rooms/equipment/breadcrumb.html b/smash/web/templates/equipment_and_rooms/equipment/breadcrumb.html index 7205568ff1353fbfe2d409cbca64aabf9489aa31..71c23fe2524bd6503c1a05120dd4254078c6969f 100644 --- a/smash/web/templates/equipment_and_rooms/equipment/breadcrumb.html +++ b/smash/web/templates/equipment_and_rooms/equipment/breadcrumb.html @@ -1,3 +1,3 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> -<li><a href="{% url 'web.views.equipment_and_rooms' %}">Equipment and rooms</a></li> +<li><a>Configuration</a></li> <li class="active"><a href="{% url 'web.views.equipment' %}">Equipment definitions</a></li> diff --git a/smash/web/templates/equipment_and_rooms/flying_teams/breadcrumb.html b/smash/web/templates/equipment_and_rooms/flying_teams/breadcrumb.html index 1259da09b4464c8cc63a417b77d527b05c3505f5..6743d1356ea15c4cc298d61c2ae5c1cfa14e2f2c 100644 --- a/smash/web/templates/equipment_and_rooms/flying_teams/breadcrumb.html +++ b/smash/web/templates/equipment_and_rooms/flying_teams/breadcrumb.html @@ -1,3 +1,3 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> -<li><a href="{% url 'web.views.equipment_and_rooms' %}">Equipment and rooms</a></li> +<li><a>Configuration</a></li> <li class="active"><a href="{% url 'web.views.equipment_and_rooms.flying_teams' %}">Flying teams</a></li> diff --git a/smash/web/templates/equipment_and_rooms/kit_requests/breadcrumb.html b/smash/web/templates/equipment_and_rooms/kit_requests/breadcrumb.html index b2e3801aaee04939f8c6b2ff00a28d2731a518b2..23c6107eab26f4caa0a31245f5f7d93b814429e6 100644 --- a/smash/web/templates/equipment_and_rooms/kit_requests/breadcrumb.html +++ b/smash/web/templates/equipment_and_rooms/kit_requests/breadcrumb.html @@ -1,3 +1,2 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> -<li><a href="{% url 'web.views.equipment_and_rooms' %}">Equipment and rooms</a></li> <li class="active"><a href="{% url 'web.views.kit_requests' %}">Kit requests</a></li> diff --git a/smash/web/templates/equipment_and_rooms/rooms/breadcrumb.html b/smash/web/templates/equipment_and_rooms/rooms/breadcrumb.html index b2ecb34d76b1b2c14a78762297c46cbf855cf5cd..8c39a0ac490af8bd2bc7c360e21c84259aefe342 100644 --- a/smash/web/templates/equipment_and_rooms/rooms/breadcrumb.html +++ b/smash/web/templates/equipment_and_rooms/rooms/breadcrumb.html @@ -1,3 +1,3 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> -<li><a href="{% url 'web.views.equipment_and_rooms' %}">Equipment and rooms</a></li> +<li><a>Configuration</a></li> <li class="active"><a href="{% url 'web.views.equipment_and_rooms.rooms' %}">Rooms</a></li> diff --git a/smash/web/templates/sidebar.html b/smash/web/templates/sidebar.html index bea2f85b80f6a78b75564abe3becd7a04f0a7427..1ca1ba464789c55b5d8eaafc299d28346ebabe78 100644 --- a/smash/web/templates/sidebar.html +++ b/smash/web/templates/sidebar.html @@ -34,33 +34,12 @@ </li> {% endif %} - {% if equipment_perms %} - <li data-desc="equipment_and_rooms" class="treeview"> - <a href="{% url 'web.views.equipment_and_rooms' %}"> - <i class="fa fa-building-o"></i> <span>Equipment & Rooms</span> - <span class="pull-right-container"> - <i class="fa fa-angle-left pull-right"></i> - </span> + {% if "send_sample_mail_for_appointments" in permissions %} + <li data-desc="kit_requests"> + <a href="{% url 'web.views.kit_requests' %}"> + <i class="fa fa-truck"></i> + <span>Kit requests</span> </a> - <ul class="treeview-menu"> - {% if "change_item" in permissions %} - <li data-desc="equipment_items"><a href="{% url 'web.views.equipment' %}">Equipment items</a></li> - {% endif %} - {% if "change_appointmenttype" in permissions %} - <li data-desc="appointment_types"><a href="{% url 'web.views.appointment_types' %}">Appointment - Types</a></li> - {% endif %} - {% if "change_flyingteam" in permissions %} - <li data-desc="flying_teams"><a href="{% url 'web.views.equipment_and_rooms.flying_teams' %}">Flying - teams</a></li> - {% endif %} - {% if "send_sample_mail_for_appointments" in permissions %} - <li data-desc="kit_requests"><a href="{% url 'web.views.kit_requests' %}">Kit requests</a></li> - {% endif %} - {% if "change_room" in permissions %} - <li data-desc="rooms"><a href="{% url 'web.views.equipment_and_rooms.rooms' %}">Rooms</a></li> - {% endif %} - </ul> </li> {% endif %} @@ -92,13 +71,32 @@ </li> {% endif %} - {% if study.has_vouchers and "change_voucher" in permissions %} - <li data-desc="vouchers"> - <a href="{% url 'web.views.vouchers' %}"> - <i class="fa fa-user-md"></i> - <span>Vouchers</span> - </a> - </li> + {% if voucher_should_shown %} + <li data-desc="vouchers" class="treeview"> + <a href="#"> + <i class="fa fa-user-md"></i> <span>Vouchers</span> + <span class="pull-right-container"> + <i class="fa fa-angle-left pull-right"></i> + </span> + </a> + <ul class="treeview-menu"> + {% if study.has_vouchers and "change_voucher" in permissions %} + <li data-desc="vouchers"> + <a href="{% url 'web.views.vouchers' %}"> + Voucher List + </a> + </li> + {% endif %} + {% if study.has_voucher_types and "change_vouchertype" in permissions %} + <li data-desc="voucher_types"><a href="{% url 'web.views.voucher_types' %}">Voucher types</a></li> + {% endif %} + + {% if study.has_vouchers and "change_worker" in permissions %} + <li data-desc="voucher_partner"><a href="{% url 'web.views.workers' 'VOUCHER_PARTNER' %}">Voucher + partners</a></li> + {% endif %} + </ul> + </li> {% endif %} {% if conf_perms %} @@ -115,17 +113,16 @@ <li data-desc="settings"><a href="{% url 'web.views.configuration' %}">General</a></li> {% endif %} - {% if "change_language" in permissions %} - <li data-desc="languages"><a href="{% url 'web.views.languages' %}">Languages</a></li> + {% if "change_study" in permissions %} + <li data-desc="study_conf"><a href="{% url 'web.views.edit_study' study_id %}">Study</a></li> {% endif %} - - {% if study.has_voucher_types and "change_vouchertype" in permissions %} - <li data-desc="voucher_types"><a href="{% url 'web.views.voucher_types' %}">Voucher types</a></li> + + {% if "change_configurationitem" in permissions or "change_study" in permissions %} + <hr style="margin: 5px 20px 5px 10px; border-top-color: #6b6b6b"> {% endif %} - {% if study.has_vouchers and "change_worker" in permissions %} - <li data-desc="voucher_partner"><a href="{% url 'web.views.workers' 'VOUCHER_PARTNER' %}">Voucher - partners</a></li> + {% if "change_language" in permissions %} + <li data-desc="languages"><a href="{% url 'web.views.languages' %}">Languages</a></li> {% endif %} {% if "change_worker" in permissions %} @@ -133,8 +130,19 @@ partners</a></li> {% endif %} - {% if "change_study" in permissions %} - <li data-desc="study_conf"><a href="{% url 'web.views.edit_study' study_id %}">Study</a></li> + {% if equipment_perms and "change_appointmenttype" in permissions %} + <li data-desc="appointment_types"><a href="{% url 'web.views.appointment_types' %}">Appointment + Types</a></li> + {% endif %} + {% if equipment_perms and "change_item" in permissions %} + <li data-desc="equipment_items"><a href="{% url 'web.views.equipment' %}">Equipment items</a></li> + {% endif %} + {% if equipment_perms and "change_flyingteam" in permissions %} + <li data-desc="flying_teams"><a href="{% url 'web.views.equipment_and_rooms.flying_teams' %}">Flying + teams</a></li> + {% endif %} + {% if equipment_perms and "change_room" in permissions %} + <li data-desc="rooms"><a href="{% url 'web.views.equipment_and_rooms.rooms' %}">Rooms</a></li> {% endif %} </ul> </li> diff --git a/smash/web/templates/voucher_type_prices/breadcrumb.html b/smash/web/templates/voucher_type_prices/breadcrumb.html index 844971e607ceace28009bea2b53bf6ccd423ba0d..d6d7bd90b46b4fd477cc1c61d992c27c276c063e 100644 --- a/smash/web/templates/voucher_type_prices/breadcrumb.html +++ b/smash/web/templates/voucher_type_prices/breadcrumb.html @@ -1,2 +1,3 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> +<li>Vouchers</li> <li class="active"><a href="{% url 'web.views.voucher_types' %}">Voucher types</a></li> \ No newline at end of file diff --git a/smash/web/templates/voucher_types/breadcrumb.html b/smash/web/templates/voucher_types/breadcrumb.html index d3fe1508ae40cd59514f2c828129472bb89bd6b1..d6d7bd90b46b4fd477cc1c61d992c27c276c063e 100644 --- a/smash/web/templates/voucher_types/breadcrumb.html +++ b/smash/web/templates/voucher_types/breadcrumb.html @@ -1,3 +1,3 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> -<li>Configuration</li> +<li>Vouchers</li> <li class="active"><a href="{% url 'web.views.voucher_types' %}">Voucher types</a></li> \ No newline at end of file diff --git a/smash/web/templates/vouchers/breadcrumb.html b/smash/web/templates/vouchers/breadcrumb.html index f71acc808f35010d4240224a41f00db70a830f0d..b0865891cadf7550a759e3ab3602f8b60ee4f48e 100644 --- a/smash/web/templates/vouchers/breadcrumb.html +++ b/smash/web/templates/vouchers/breadcrumb.html @@ -1,2 +1,3 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> -<li class="active"><a href="{% url 'web.views.vouchers' %}">Vouchers</a></li> \ No newline at end of file +<li>Vouchers</li> +<li class="active"><a href="{% url 'web.views.vouchers' %}">Voucher List</a></li> \ No newline at end of file diff --git a/smash/web/templates/vouchers/list.html b/smash/web/templates/vouchers/list.html index 99a39340aec7ed9bd833dd733ee3b5bac9659a89..f4d47ef8ddf7fd08af4388284cd473a24af23e93 100644 --- a/smash/web/templates/vouchers/list.html +++ b/smash/web/templates/vouchers/list.html @@ -7,7 +7,7 @@ <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} -{% block ui_active_tab %}'configuration'{% endblock ui_active_tab %} +{% block ui_active_tab %}'vouchers'{% endblock ui_active_tab %} {% block page_header %}Vouchers{% endblock page_header %} {% block page_description %}{% endblock page_description %} diff --git a/smash/web/views/__init__.py b/smash/web/views/__init__.py index 0684e2c6859df4c159621890a5be48f3aad703f6..dbde0f7765aa7fa72a2f76fa7b5bb52f4153b29d 100644 --- a/smash/web/views/__init__.py +++ b/smash/web/views/__init__.py @@ -68,6 +68,7 @@ def extend_context(params, request: HttpRequest): 'permissions' : permissions, 'conf_perms' : permissions & PermissionDecorator.codename_groups['configuration'], 'equipment_perms' : permissions & PermissionDecorator.codename_groups['equipment'], + 'voucher_should_shown': study.has_vouchers and bool({'change_voucher', 'change_vouchertype', 'change_worker'} | permissions), #at least one permission must be present and study should have vouchers 'person': person, 'role': role, 'notifications': notifications, diff --git a/smash/web/views/kit.py b/smash/web/views/kit.py index 472a39477a3a76c9ab0558a0405fb1d3ba171d67..3a3fb57ef33e76fab957936e381cc934c825f5ad 100644 --- a/smash/web/views/kit.py +++ b/smash/web/views/kit.py @@ -65,7 +65,7 @@ def get_kit_requests(user, start_date=None, end_date=None): return result -@PermissionDecorator('send_sample_mail_for_appointments', 'equipment') +@PermissionDecorator('send_sample_mail_for_appointments', 'kit') def get_kit_requests_data(request, start_date=None, end_date=None): form = KitRequestForm() if request.method == 'POST': @@ -82,7 +82,7 @@ def get_kit_requests_data(request, start_date=None, end_date=None): return params -@PermissionDecorator('send_sample_mail_for_appointments', 'equipment') +@PermissionDecorator('send_sample_mail_for_appointments', 'kit') def kit_requests(request): return wrap_response(request, 'equipment_and_rooms/kit_requests/kit_requests.html', get_kit_requests_data(request)) @@ -216,7 +216,7 @@ def send_mail(data): EmailSender().send_email(title, email_body, recipients, cc_recipients) -@PermissionDecorator('send_sample_mail_for_appointments', 'equipment') +@PermissionDecorator('send_sample_mail_for_appointments', 'kit') def kit_requests_send_mail(request, start_date, end_date=None): data = get_kit_requests_data(request, start_date, end_date) try: