diff --git a/smash/web/templates/doctors/add.html b/smash/web/templates/doctors/add.html index 45259a6242701e7754fcf98eea71b6609fa3da19..88be6696b6e91e93bd4bdb96d480ac386e9e9019 100644 --- a/smash/web/templates/doctors/add.html +++ b/smash/web/templates/doctors/add.html @@ -8,11 +8,8 @@ {% endblock styles %} {% block ui_active_tab %}'workers'{% endblock ui_active_tab %} -{% block page_header %}New worker{% endblock page_header %} {% block page_description %}{% endblock page_description %} -{% block title %}{{ block.super }} - Add new worker{% endblock %} - {% block breadcrumb %} {% include "doctors/breadcrumb.html" %} {% endblock breadcrumb %} @@ -22,7 +19,7 @@ {% block content %} <div class="box box-info"> <div class="box-header with-border"> - <a href="{% url 'web.views.workers' %}" class="btn btn-block btn-default">Go back (without changes)</a> + <a href="{% block list-url %}{% endblock %}" class="btn btn-block btn-default">Go back (without changes)</a> </div> <form method="post" action="" class="form-horizontal"> @@ -52,7 +49,8 @@ <div class="box-footer"> <div class="col-sm-6"> - <button type="submit" class="btn btn-block btn-success">Add</button> + <button type="submit" class="btn btn-block btn-success">{% block save-button %} + Add{% endblock %}</button> </div> <div class="col-sm-6"> <a href="{% url 'web.views.workers' %}" class="btn btn-block btn-default">Cancel</a> diff --git a/smash/web/templates/doctors/breadcrumb.html b/smash/web/templates/doctors/breadcrumb.html index 6d111dd545adc0d422fe4dfae996671af3c8f657..549b2357d5ee10f1a13a761f2cd3548d54c8bc29 100644 --- a/smash/web/templates/doctors/breadcrumb.html +++ b/smash/web/templates/doctors/breadcrumb.html @@ -1,2 +1,2 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> -<li class="active"><a href="{% url 'web.views.workers' %}">Workers</a></li> \ No newline at end of file +<li class="active"><a href="{% url 'web.views.workers' worker_type %}">Workers</a></li> \ No newline at end of file diff --git a/smash/web/templates/doctors/edit.html b/smash/web/templates/doctors/edit.html index 148cda2c28482fd8327a800c334d58728abf9cb6..0cec140da7cc8be3611b371522c56ca36be31e1f 100644 --- a/smash/web/templates/doctors/edit.html +++ b/smash/web/templates/doctors/edit.html @@ -9,11 +9,8 @@ {% endblock styles %} {% block ui_active_tab %}'workers'{% endblock ui_active_tab %} -{% block page_header %}Edit worker{% endblock page_header %} {% block page_description %}{% endblock page_description %} -{% block title %} - Edit worker information{% endblock %} - {% block breadcrumb %} {% include "doctors/breadcrumb.html" %} {% endblock breadcrumb %} @@ -23,8 +20,8 @@ {% block content %} <div class="box box-info"> <div class="box-header with-border"> - <a href="{% url 'web.views.workers' %}" class="btn btn-block btn-default" onclick="history.back()">Go - back (without changes)</a> + <a href="{% url 'web.views.workers' worker_type %}" class="btn btn-block btn-default" + onclick="history.back()">Go back (without changes)</a> </div> <form method="post" action="" class="form-horizontal"> @@ -63,92 +60,95 @@ </div> - <div class="box-header with-border"> - <h3 class="box-title">Availability</h3> - </div> - <div class="box-body"> - <table id="table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>Day</th> - <th>From</th> - <th>Until</th> - <th>Modify</th> - <th>Remove</th> - </tr> - </thead> - <tbody> - {% for availability in availabilities %} + + {% if worker_type == 'STAFF' %} + <div class="box-header with-border"> + <h3 class="box-title">Availability</h3> + </div> + <div class="box-body"> + <table id="table" class="table table-bordered table-striped"> + <thead> <tr> - <td> - {% for weekday in weekdays %} - {% if availability.day_number == weekday.0 %} - {{ weekday.1 }} - {% endif %} - {% endfor %} - </td> - <td>{{ availability.available_from }}</td> - <td>{{ availability.available_till }}</td> - <td> - <a href="{% url 'web.views.worker_availability_edit' availability.id %}" type="button" - class="btn btn-block btn-default">Edit</a> - </td> - <td> - <a href="{% url 'web.views.worker_availability_delete' availability.id %}" type="button" - class="btn btn-block btn-default">Delete</a> - </td> + <th>Day</th> + <th>From</th> + <th>Until</th> + <th>Modify</th> + <th>Remove</th> </tr> - {% endfor %} + </thead> + <tbody> + {% for availability in availabilities %} + <tr> + <td> + {% for weekday in weekdays %} + {% if availability.day_number == weekday.0 %} + {{ weekday.1 }} + {% endif %} + {% endfor %} + </td> + <td>{{ availability.available_from }}</td> + <td>{{ availability.available_till }}</td> + <td> + <a href="{% url 'web.views.worker_availability_edit' availability.id %}" type="button" + class="btn btn-block btn-default">Edit</a> + </td> + <td> + <a href="{% url 'web.views.worker_availability_delete' availability.id %}" type="button" + class="btn btn-block btn-default">Delete</a> + </td> + </tr> + {% endfor %} - </tbody> - </table> + </tbody> + </table> - <div class="box-footer"> - <div class="col-sm-6"> - <a href="{% url 'web.views.worker_availability_add' doctor_id %}" type="button" - class="btn btn-block btn-success">Add availability</a> - </div> - </div><!-- /.box-footer --> + <div class="box-footer"> + <div class="col-sm-6"> + <a href="{% url 'web.views.worker_availability_add' doctor_id %}" type="button" + class="btn btn-block btn-success">Add availability</a> + </div> + </div><!-- /.box-footer --> - </div> + </div> - <div class="box-header with-border"> - <h3 class="box-title">Holidays</h3> - </div> - <div class="box-body"> - <table id="table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>From</th> - <th>Until</th> - <th>Info</th> - <th>Remove</th> - </tr> - </thead> - <tbody> - {% for holiday in holidays %} + <div class="box-header with-border"> + <h3 class="box-title">Holidays</h3> + </div> + <div class="box-body"> + <table id="table" class="table table-bordered table-striped"> + <thead> <tr> - <td>{{ holiday.datetime_start }}</td> - <td>{{ holiday.datetime_end }}</td> - <td>{{ holiday.info }}</td> - <td> - <a href="{% url 'web.views.worker_holiday_delete' holiday.id %}" type="button" - class="btn btn-block btn-default">Delete</a> - </td> + <th>From</th> + <th>Until</th> + <th>Info</th> + <th>Remove</th> </tr> - {% endfor %} + </thead> + <tbody> + {% for holiday in holidays %} + <tr> + <td>{{ holiday.datetime_start }}</td> + <td>{{ holiday.datetime_end }}</td> + <td>{{ holiday.info }}</td> + <td> + <a href="{% url 'web.views.worker_holiday_delete' holiday.id %}" type="button" + class="btn btn-block btn-default">Delete</a> + </td> + </tr> + {% endfor %} - </tbody> - </table> + </tbody> + </table> - <div class="box-footer"> - <div class="col-sm-6"> - <a href="{% url 'web.views.worker_holiday_add' doctor_id %}" type="button" - class="btn btn-block btn-success">Add holiday</a> - </div> - </div><!-- /.box-footer --> + <div class="box-footer"> + <div class="col-sm-6"> + <a href="{% url 'web.views.worker_holiday_add' doctor_id %}" type="button" + class="btn btn-block btn-success">Add holiday</a> + </div> + </div><!-- /.box-footer --> - </div> + </div> + {% endif %} {% endblock %} diff --git a/smash/web/templates/doctors/index.html b/smash/web/templates/doctors/index.html index 67741a4b3b3fbf193e98e6c77c5a44db981ba3f9..ceff757997e1aac4645582c49bc277ed6c05d098 100644 --- a/smash/web/templates/doctors/index.html +++ b/smash/web/templates/doctors/index.html @@ -8,8 +8,6 @@ {% endblock styles %} {% block ui_active_tab %}'workers'{% endblock ui_active_tab %} -{% block page_header %}Workers{% endblock page_header %} -{% block page_description %}information{% endblock page_description %} {% block breadcrumb %} {% include "doctors/breadcrumb.html" %} @@ -20,62 +18,66 @@ <div> <a href="{% url 'web.views.worker_add' worker_type %}" class="btn btn-app"> <i class="fa fa-plus"></i> - Add new worker</a> + Add new + {% if worker_type == 'STAFF' %} + worker + {% elif worker_type == 'HEALTH_PARTNER' %} + health partner + {% elif worker_type == 'VOUCHER_PARTNER' %} + voucher partner + {% endif %} + </a> </div> <div class="box-body"> - {% if doctors_list %} - <table id="table" class="table table-bordered table-striped"> - <thead> + <table id="table" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>First name</th> + <th>Last name</th> + <th>Languages</th> + <th>Unit</th> + <th>Details</th> + <th>On leave</th> + <th>Disabled</th> + </tr> + </thead> + <tbody> + {% for worker in doctors_list %} <tr> - <th>No.</th> - <th>First name</th> - <th>Last name</th> - <th>Languages</th> - <th>Unit</th> - <th>Details</th> - <th>On leave</th> - <th>Disabled</th> + <td>{{ forloop.counter }}</td> + <td>{{ worker.first_name }}</td> + <td>{{ worker.last_name }}</td> + <td> + {% autoescape off %} + {% for language in worker.languages.all %} + {{ language.image_img }} + {% endfor %} + {% endautoescape %} + </td> + <td>{{ worker.unit }}</td> + <td><a href="{% url 'web.views.worker_edit' worker.id %}" type="button" + class="btn btn-block btn-default">Details</a></td> + <td> + {% if worker.is_on_leave %} + <button type="button" class="btn btn-block btn-danger">YES</button> + {% else %} + <button type="button" class="btn btn-block btn-success">NO</button> + {% endif %} + </td> + <td> + {% if worker.is_active %} + <a href="{% url 'web.views.worker_disable' worker.id %}" class="btn btn-block btn-warning">DISABLE</a> + {% else %} + YES + {% endif %} + </td> </tr> - </thead> - <tbody> - {% for worker in doctors_list %} - <tr> - <td>{{ forloop.counter }}</td> - <td>{{ worker.first_name }}</td> - <td>{{ worker.last_name }}</td> - <td> - {% autoescape off %} - {% for language in worker.languages.all %} - {{ language.image_img }} - {% endfor %} - {% endautoescape %} - </td> - <td>{{ worker.unit }}</td> - <td><a href="{% url 'web.views.worker_edit' worker.id %}" type="button" - class="btn btn-block btn-default">Details</a></td> - <td> - {% if worker.is_on_leave %} - <button type="button" class="btn btn-block btn-danger">YES</button> - {% else %} - <button type="button" class="btn btn-block btn-success">NO</button> - {% endif %} - </td> - <td> - {% if worker.is_active %} - <a href="{% url 'web.views.worker_disable' worker.id %}" class="btn btn-block btn-warning">DISABLE</a> - {% else %} - YES - {% endif %} - </td> - </tr> - {% endfor %} + {% endfor %} - </tbody> - </table> - {% else %} - <p>No subjects found.</p> - {% endif %} + </tbody> + </table> </div> {% endblock maincontent %} diff --git a/smash/web/templates/sidebar.html b/smash/web/templates/sidebar.html index 235006d25e2c473796090189adc1e11426fcbf59..82a59e6aa4a8acfab2bc5cb6d9bd86af12ce506e 100644 --- a/smash/web/templates/sidebar.html +++ b/smash/web/templates/sidebar.html @@ -82,6 +82,8 @@ <li><a href="{% url 'web.views.configuration' %}">General</a></li> <li><a href="{% url 'web.views.languages' %}">Languages</a></li> <li><a href="{% url 'web.views.voucher_types' %}">Voucher types</a></li> + <li><a href="{% url 'web.views.workers' 'VOUCHER_PARTNER' %}">Voucher partners</a></li> + <li><a href="{% url 'web.views.workers' 'HEALTH_PARTNER' %}">Health partners</a></li> </ul> </li> diff --git a/smash/web/views/worker.py b/smash/web/views/worker.py index 12914af5ca91250b897ce1824437b780d213aa95..6fab2239ac33adb9e702c0c9586e49c2e17b7631 100644 --- a/smash/web/views/worker.py +++ b/smash/web/views/worker.py @@ -30,20 +30,21 @@ def worker_add(request, worker_type): form = WorkerForm(request.POST, request.FILES, worker_type=worker_type) if form.is_valid(): form.save() - return redirect('web.views.workers') + return redirect('web.views.workers', worker_type=worker_type) else: form = WorkerForm(worker_type=worker_type) - return wrap_response(request, 'doctors/add.html', {'form': form}) + return wrap_response(request, 'doctors/add.html', {'form': form, "worker_type": worker_type}) def worker_edit(request, worker_id): worker = get_object_or_404(Worker, id=worker_id) + worker_type = worker_type_by_worker(worker) if request.method == 'POST': - form = WorkerForm(request.POST, request.FILES, instance=worker, worker_type=worker_type_by_worker(worker)) + form = WorkerForm(request.POST, request.FILES, instance=worker, worker_type=worker_type) if form.is_valid(): form.save() - return redirect('web.views.workers') + return redirect('web.views.workers', worker_type=worker_type) else: form = WorkerForm(instance=worker) availabilities = Availability.objects.filter(person=worker_id).order_by('day_number', 'available_from') @@ -54,7 +55,8 @@ def worker_edit(request, worker_id): 'availabilities': availabilities, 'holidays': holidays, 'doctor_id': worker_id, - 'weekdays': WEEKDAY_CHOICES + 'weekdays': WEEKDAY_CHOICES, + "worker_type": worker_type }) @@ -125,8 +127,8 @@ def worker_holiday_add(request, doctor_id): return redirect(worker_edit, doctor_id=doctor_id) else: form = HolidayAddForm(initial={'person': doctor}) - return wrap_response(request, 'doctors/add_holiday.html', - { - 'form': form, - 'doctor_id': doctor_id - }) + return wrap_response(request, 'doctors/add_holiday.html', + { + 'form': form, + 'doctor_id': doctor_id + })