Skip to content
Snippets Groups Projects
Commit dfcc42a3 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '363-equipment-and-rooms' into 'master'

changed sidebar menu. #363 Vouchers has its own menu, kit requests is alone...

Closes #363

See merge request NCER-PD/scheduling-system!286
parents 5980f765 dc617692
No related branches found
No related tags found
1 merge request!286changed sidebar menu. #363 Vouchers has its own menu, kit requests is alone...
Pipeline #35004 failed
Showing
with 69 additions and 56 deletions
<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> <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"> <li class="active">
<a href="{% url 'web.views.appointment_types' %}">Appointment Types</a> <a href="{% url 'web.views.appointment_types' %}">Appointment Types</a>
</li> </li>
\ No newline at end of file
<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li>
{% if worker_type == 'HEALTH_PARTNER' %} {% if worker_type == 'HEALTH_PARTNER' %}
<li>Configuration</li> <li>Configuration</li>
<li class="active"><a href="{% url 'web.views.workers' %}">Workers</a></li>
{% elif worker_type == 'VOUCHER_PARTNER' %} {% 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 %} {% endif %}
<li class="active"><a href="{% url 'web.views.workers' %}">Workers</a></li>
\ No newline at end of file
<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> <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> <li class="active"><a href="{% url 'web.views.equipment' %}">Equipment definitions</a></li>
<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> <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> <li class="active"><a href="{% url 'web.views.equipment_and_rooms.flying_teams' %}">Flying teams</a></li>
<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> <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> <li class="active"><a href="{% url 'web.views.kit_requests' %}">Kit requests</a></li>
<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> <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> <li class="active"><a href="{% url 'web.views.equipment_and_rooms.rooms' %}">Rooms</a></li>
...@@ -34,33 +34,12 @@ ...@@ -34,33 +34,12 @@
</li> </li>
{% endif %} {% endif %}
{% if equipment_perms %} {% if "send_sample_mail_for_appointments" in permissions %}
<li data-desc="equipment_and_rooms" class="treeview"> <li data-desc="kit_requests">
<a href="{% url 'web.views.equipment_and_rooms' %}"> <a href="{% url 'web.views.kit_requests' %}">
<i class="fa fa-building-o"></i> <span>Equipment &amp; Rooms</span> <i class="fa fa-truck"></i>
<span class="pull-right-container"> <span>Kit requests</span>
<i class="fa fa-angle-left pull-right"></i>
</span>
</a> </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> </li>
{% endif %} {% endif %}
...@@ -92,13 +71,32 @@ ...@@ -92,13 +71,32 @@
</li> </li>
{% endif %} {% endif %}
{% if study.has_vouchers and "change_voucher" in permissions %} {% if voucher_should_shown %}
<li data-desc="vouchers"> <li data-desc="vouchers" class="treeview">
<a href="{% url 'web.views.vouchers' %}"> <a href="#">
<i class="fa fa-user-md"></i> <i class="fa fa-user-md"></i> <span>Vouchers</span>
<span>Vouchers</span> <span class="pull-right-container">
</a> <i class="fa fa-angle-left pull-right"></i>
</li> </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 %} {% endif %}
{% if conf_perms %} {% if conf_perms %}
...@@ -115,17 +113,16 @@ ...@@ -115,17 +113,16 @@
<li data-desc="settings"><a href="{% url 'web.views.configuration' %}">General</a></li> <li data-desc="settings"><a href="{% url 'web.views.configuration' %}">General</a></li>
{% endif %} {% endif %}
{% if "change_language" in permissions %} {% if "change_study" in permissions %}
<li data-desc="languages"><a href="{% url 'web.views.languages' %}">Languages</a></li> <li data-desc="study_conf"><a href="{% url 'web.views.edit_study' study_id %}">Study</a></li>
{% endif %} {% endif %}
{% if study.has_voucher_types and "change_vouchertype" in permissions %} {% if "change_configurationitem" in permissions or "change_study" in permissions %}
<li data-desc="voucher_types"><a href="{% url 'web.views.voucher_types' %}">Voucher types</a></li> <hr style="margin: 5px 20px 5px 10px; border-top-color: #6b6b6b">
{% endif %} {% endif %}
{% if study.has_vouchers and "change_worker" in permissions %} {% if "change_language" in permissions %}
<li data-desc="voucher_partner"><a href="{% url 'web.views.workers' 'VOUCHER_PARTNER' %}">Voucher <li data-desc="languages"><a href="{% url 'web.views.languages' %}">Languages</a></li>
partners</a></li>
{% endif %} {% endif %}
{% if "change_worker" in permissions %} {% if "change_worker" in permissions %}
...@@ -133,8 +130,19 @@ ...@@ -133,8 +130,19 @@
partners</a></li> partners</a></li>
{% endif %} {% endif %}
{% if "change_study" in permissions %} {% if equipment_perms and "change_appointmenttype" in permissions %}
<li data-desc="study_conf"><a href="{% url 'web.views.edit_study' study_id %}">Study</a></li> <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 %} {% endif %}
</ul> </ul>
</li> </li>
......
<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> <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> <li class="active"><a href="{% url 'web.views.voucher_types' %}">Voucher types</a></li>
\ No newline at end of file
<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> <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> <li class="active"><a href="{% url 'web.views.voucher_types' %}">Voucher types</a></li>
\ No newline at end of file
<li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> <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> <li>Vouchers</li>
\ No newline at end of file <li class="active"><a href="{% url 'web.views.vouchers' %}">Voucher List</a></li>
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}">
{% endblock styles %} {% 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_header %}Vouchers{% endblock page_header %}
{% block page_description %}{% endblock page_description %} {% block page_description %}{% endblock page_description %}
......
...@@ -68,6 +68,7 @@ def extend_context(params, request: HttpRequest): ...@@ -68,6 +68,7 @@ def extend_context(params, request: HttpRequest):
'permissions' : permissions, 'permissions' : permissions,
'conf_perms' : permissions & PermissionDecorator.codename_groups['configuration'], 'conf_perms' : permissions & PermissionDecorator.codename_groups['configuration'],
'equipment_perms' : permissions & PermissionDecorator.codename_groups['equipment'], '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, 'person': person,
'role': role, 'role': role,
'notifications': notifications, 'notifications': notifications,
......
...@@ -65,7 +65,7 @@ def get_kit_requests(user, start_date=None, end_date=None): ...@@ -65,7 +65,7 @@ def get_kit_requests(user, start_date=None, end_date=None):
return result 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): def get_kit_requests_data(request, start_date=None, end_date=None):
form = KitRequestForm() form = KitRequestForm()
if request.method == 'POST': if request.method == 'POST':
...@@ -82,7 +82,7 @@ def get_kit_requests_data(request, start_date=None, end_date=None): ...@@ -82,7 +82,7 @@ def get_kit_requests_data(request, start_date=None, end_date=None):
return params return params
@PermissionDecorator('send_sample_mail_for_appointments', 'equipment') @PermissionDecorator('send_sample_mail_for_appointments', 'kit')
def kit_requests(request): def kit_requests(request):
return wrap_response(request, 'equipment_and_rooms/kit_requests/kit_requests.html', get_kit_requests_data(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): ...@@ -216,7 +216,7 @@ def send_mail(data):
EmailSender().send_email(title, email_body, recipients, cc_recipients) 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): def kit_requests_send_mail(request, start_date, end_date=None):
data = get_kit_requests_data(request, start_date, end_date) data = get_kit_requests_data(request, start_date, end_date)
try: try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment