diff --git a/smash/web/templates/doctors/availdex.html b/smash/web/templates/doctors/availdex.html index 932ac30c63a20014d2006c3cd6f6788a0b532d71..d012f87f4351efed633ce879c232ac4b57b041ed 100644 --- a/smash/web/templates/doctors/availdex.html +++ b/smash/web/templates/doctors/availdex.html @@ -18,10 +18,27 @@ {% block maincontent %} <div class="box-body"> + <div class="box box-danger box-solid"> + <div class="box-header with-border"> + <h3 class="box-title">To be implemented</h3> + + <div class="box-tools pull-right"> + <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> + </div> + <!-- /.box-tools --> + </div> + <!-- /.box-header --> + <div class="box-body"> + Currently only an overview of doctor's availibility is presented. + Changes to the schedules can be made only by the administrator in administrator's panel. + </div> + <!-- /.box-body --> + </div> + <h3>Monday</h3> {% if avmon %} - <table id = "tabmon" class="table table-bordered table-striped"> + <table id="tabmon" class="table table-bordered table-striped"> <thead> <tr> <th>No.</th> @@ -36,7 +53,7 @@ <td> {{forloop.counter}} </td> <td> {{record.availFro}} </td> <td> {{record.availTil}} </td> - <td><a href="{% url 'web.views.availdelete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> + <td><a href="{% url 'web.views.availdelete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> </tr> {% endfor %} </tbody> @@ -55,7 +72,7 @@ <h3>Tuesday</h3> {% if avtue %} - <table id = "tabtue" class="table table-bordered table-striped"> + <table id="tabtue" class="table table-bordered table-striped"> <thead> <tr> <th>No.</th> @@ -70,7 +87,7 @@ <td> {{forloop.counter}} </td> <td> {{record.availFro}} </td> <td> {{record.availTil}} </td> - <td><a href="{% url 'web.views.availdelete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> + <td><a href="{% url 'web.views.availdelete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> </tr> {% endfor %} </tbody> @@ -89,7 +106,7 @@ <h3>Wednesday</h3> {% if avwed %} - <table id = "tabwed" class="table table-bordered table-striped"> + <table id="tabwed" class="table table-bordered table-striped"> <thead> <tr> <th>No.</th> @@ -104,7 +121,7 @@ <td> {{forloop.counter}} </td> <td> {{record.availFro}} </td> <td> {{record.availTil}} </td> - <td><a href="{% url 'web.views.availdelete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> + <td><a href="{% url 'web.views.availdelete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> </tr> {% endfor %} </tbody> @@ -123,7 +140,7 @@ <h3>Thursday</h3> {% if avthu %} - <table id = "tabmon" class="table table-bordered table-striped"> + <table id="tabmon" class="table table-bordered table-striped"> <thead> <tr> <th>No.</th> @@ -138,7 +155,7 @@ <td> {{forloop.counter}} </td> <td> {{record.availFro}} </td> <td> {{record.availTil}} </td> - <td><a href="{% url 'web.views.availdelete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> + <td><a href="{% url 'web.views.availdelete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> </tr> {% endfor %} </tbody> @@ -157,7 +174,7 @@ <h3>Friday</h3> {% if avfri %} - <table id = "tabmon" class="table table-bordered table-striped"> + <table id="tabmon" class="table table-bordered table-striped"> <thead> <tr> <th>No.</th> @@ -172,7 +189,7 @@ <td> {{forloop.counter}} </td> <td> {{record.availFro}} </td> <td> {{record.availTil}} </td> - <td><a href="{% url 'web.views.availdelete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> + <td><a href="{% url 'web.views.availdelete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> </tr> {% endfor %} </tbody> @@ -191,7 +208,7 @@ <h3>Saturday</h3> {% if avsat %} - <table id = "tabmon" class="table table-bordered table-striped"> + <table id="tabmon" class="table table-bordered table-striped"> <thead> <tr> <th>No.</th> @@ -206,7 +223,7 @@ <td> {{forloop.counter}} </td> <td> {{record.availFro}} </td> <td> {{record.availTil}} </td> - <td><a href="{% url 'web.views.availdelete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> + <td><a href="{% url 'web.views.availdelete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> </tr> {% endfor %} </tbody> diff --git a/smash/web/urls.py b/smash/web/urls.py index 2c48580019f0e721e2a042a60f739df01cefcaa5..a8455ab8717d5d0539ae97d9d752c796c1f86dfa 100644 --- a/smash/web/urls.py +++ b/smash/web/urls.py @@ -18,18 +18,18 @@ from web import views urlpatterns = [ url(r'assignments$', views.assignments, name='web.views.assignments'), - url(r'assignments/details/(?P<ids>\d+)$', views.assignmentdetails, name='web.views.assignmentdetails'), + url(r'assignments/details/(?P<id>\d+)$', views.assignmentdetails, name='web.views.assignmentdetails'), url(r'subjects$', views.subjects, name='web.views.subjects'), url(r'subjects/add$', views.subjectadd, name='web.views.subjectadd'), - url(r'subjects/details/(?P<ids>\d+)$', views.subjectdet, name='web.views.subjectdet'), - url(r'subjects/edit/(?P<ids>\d+)$', views.subjectedit, name='web.views.subjectedit'), - url(r'subjects/delete/(?P<ids>\d+)$', views.subjectdelete, name='web.views.subjectdelete'), + url(r'subjects/details/(?P<id>\d+)$', views.subjectdet, name='web.views.subjectdet'), + url(r'subjects/edit/(?P<id>\d+)$', views.subjectedit, name='web.views.subjectedit'), + url(r'subjects/delete/(?P<id>\d+)$', views.subjectdelete, name='web.views.subjectdelete'), url(r'doctors$', views.doctors, name='web.views.doctors'), url(r'doctors/add$', views.doctoradd, name='web.views.doctoradd'), - url(r'doctors/details/(?P<ids>\d+)$', views.doctordetails, name='web.views.doctordetails'), - url(r'doctors/edit/(?P<ids>\d+)$', views.doctoredit, name='web.views.doctoredit'), - url(r'doctors/avaibility/(?P<ids>\d+)$', views.doctoravail, name='web.views.doctoravail'), - url(r'doctors/availdelete/(?P<ids>\d+)$', views.availdelete, name='web.views.availdelete'), + url(r'doctors/details/(?P<id>\d+)$', views.doctordetails, name='web.views.doctordetails'), + url(r'doctors/edit/(?P<id>\d+)$', views.doctoredit, name='web.views.doctoredit'), + url(r'doctors/avaibility/(?P<id>\d+)$', views.doctoravail, name='web.views.doctoravail'), + url(r'doctors/availdelete/(?P<doctor_id>\d+)/(?P<availibility_id>\d+)$', views.availdelete, name='web.views.availdelete'), url(r'equipment_and_rooms$', views.equipment_and_rooms, name='web.views.equipment_and_rooms'), url(r'equipment_and_rooms/eqdef$', views.equipment_def, name='web.views.equipment_def'), url(r'mail_templates$', views.mail_templates, name='web.views.mail_templates'), diff --git a/smash/web/views.py b/smash/web/views.py index 51054775a1681c68e3ad46c10e0de4cbb3016d8f..8249c76a6e6e774f1078707c13d23c5edb869bdf 100644 --- a/smash/web/views.py +++ b/smash/web/views.py @@ -77,29 +77,29 @@ def subjectadd(request): return wrap_response(request, 'subjects/add.html', {'form': form}) -def subjectdet(request, ids): - form = SubjectDetailForm(instance=Subject.objects.get(id=ids)) +def subjectdet(request, id): + form = SubjectDetailForm(instance=Subject.objects.get(id=id)) return wrap_response(request, 'subjects/details.html', {'form': form}) -def subjectedit(request, ids): +def subjectedit(request, id): if request.method == 'POST': - form = SubjectEditForm(request.POST, request.FILES, instance=Subject.objects.get(id=ids)) + form = SubjectEditForm(request.POST, request.FILES, instance=Subject.objects.get(id=id)) if form.is_valid(): form.save() return redirect(subjects) else: - form = SubjectEditForm(instance=Subject.objects.get(id=ids)) + form = SubjectEditForm(instance=Subject.objects.get(id=id)) return wrap_response(request, 'subjects/edit.html', {'form': form}) -def subjectdelete(request, ids): +def subjectdelete(request, id): if request.method == 'POST': - Subject.objects.get(id=ids).delete() + Subject.objects.get(id=id).delete() return redirect(subjects) else: - form = SubjectEditForm(instance=Subject.objects.get(id=ids)) + form = SubjectEditForm(instance=Subject.objects.get(id=id)) return wrap_response(request, 'subjects/delete.html', {'form': form}) @@ -125,25 +125,25 @@ def doctoradd(request): -def doctoredit(request, ids): +def doctoredit(request, id): if request.method == 'POST': - form = WorkerEditForm(request.POST, request.FILES, instance=Worker.objects.get(id=ids)) + form = WorkerEditForm(request.POST, request.FILES, instance=Worker.objects.get(id=id)) if form.is_valid(): form.save() return redirect(doctors) else: - form = WorkerEditForm(instance=Worker.objects.get(id=ids)) + form = WorkerEditForm(instance=Worker.objects.get(id=id)) return wrap_response(request, 'doctors/edit.html', {'form': form}) -def doctordetails(request, ids): - form = WorkerDetailForm(instance=Worker.objects.get(id=ids)) +def doctordetails(request, id): + form = WorkerDetailForm(instance=Worker.objects.get(id=id)) return wrap_response(request, 'doctors/details.html', {'form': form}) -def doctoravail(request, ids): - avall = Avaibility.objects.filter(person = ids) +def doctoravail(request, id): + avall = Avaibility.objects.filter(person=id) avmon = avall.filter(dayNo=1) avtue = avall.filter(dayNo=2) @@ -159,14 +159,17 @@ def doctoravail(request, ids): 'avthu': avthu, 'avfri': avfri, 'avsat': avsat, - 'ids': ids + 'id': id } return wrap_response(request, "doctors/availdex.html", context) -def availdelete(request, id): - return redirect(doctors) +def availdelete(request, doctor_id, availibility_id): + availibility = Avaibility.objects.filter(id=availibility_id) + if len(availibility) > 0: + availibility.delete() + return redirect(doctoravail, id=doctor_id) def equipment_def(request): @@ -196,6 +199,6 @@ def assignments(request): return wrap_response(request, "assignments/index.html",context) -def assignmentdetails(request, ids): - form = AppointmentDetailForm(instance=Appointment.objects.get(id=ids)) +def assignmentdetails(request, id): + form = AppointmentDetailForm(instance=Appointment.objects.get(id=id)) return wrap_response(request, 'assignments/details.html', {'form': form})