Skip to content
Snippets Groups Projects
Commit 3562104a authored by Valentin Groues's avatar Valentin Groues :eyes:
Browse files

add daily planning section

parent 82d0ba46
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -362,6 +362,7 @@ desired effect
{% block scripts %}
<!-- jQuery 2.2.3 -->
<script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script>
<script src="{% static 'AdminLTE/plugins/jQueryUI/jquery-ui.min.js' %}"></script>
<!-- Bootstrap 3.3.6 -->
<script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script>
<!-- AdminLTE Template Helpers (for example- left side bar) -->
......
......@@ -69,7 +69,8 @@
<script>
$(function () {
var table = $('#approaching_table').DataTable({
var approachingTable = $('#approaching_table');
var table = approachingTable.DataTable({
serverSide: true,
processing: true,
ordering: false,
......@@ -86,8 +87,8 @@
"data": "id",
"defaultContent": '<a href="#" type="button" class="btn btn-block btn-default">Edit</a>'
}]
})
$('#approaching_table tbody').on('click', 'a', function () {
});
approachingTable.find('tbody').on('click', 'a', function () {
var data = table.row($(this).parents('tr')).data();
var url = "{% url 'web.views.appointment_edit' 12345 %}".replace(/12345/, data.id.toString());
window.location.href = url;
......@@ -99,7 +100,7 @@
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek',
right: 'month,agendaWeek'
},
editable: false,
weekNumbers: true,
......
{% extends "_base.html" %}
{% load static %}
{% block styles %}
{{ block.super }}
<!-- DataTables -->
<link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}">
<!-- fullCalendar 2.2.5-->
<link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.css' %}">
<link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar_custom.print.css' %}"
media="print"
/>
<link rel="stylesheet" href="{% static 'fullcalendar-scheduler/scheduler.min.css' %}">
<link rel="stylesheet" href="{% static 'css/daily_planning.css' %}">
{% endblock styles %}
{% block ui_active_tab %}'daily_planning'{% endblock ui_active_tab %}
{% block page_header %}Daily Planning{% endblock page_header %}
{% block page_description %}{% endblock page_description %}
{% block title %}{{ block.super }} - Daily Planning{% endblock %}
{% block breadcrumb %}
{% include "appointments/breadcrumb.html" %}
{% endblock breadcrumb %}
{% block maincontent %}
<div class="row" id="subjects">
</div>
<div class="row">
<div class="col-md-12">
<div class="box box-primary">
<div class="box-body no-padding">
<div id="calendar"></div>
</div>
</div>
</div>
</div>
{% endblock maincontent %}
{% block scripts %}
{{ block.super }}
<script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script>
<script src="{% static 'fullcalendar-scheduler/lib/fullcalendar.min.js' %}"></script>
<script src="{% static 'fullcalendar-scheduler/scheduler.min.js' %}"></script>
<script>
var resources_url = '{% url 'web.api.workers' %}';
var events_url = '{% url 'web.api.events_persist' %}';
</script>
<script src="{% static 'js/daily_planning.js' %}"></script>
{% endblock scripts %}
{% block messages %}
{{ block.super }}
<div class="alert alert-success alert-dismissible collapse" id="dp-saved-alert">
<button type="button" class="close" data-hide="alert" aria-hidden="true">×</button>
<h4><i class="icon fa fa-check"></i> Saved</h4>
</div>
{% endblock %}
......@@ -16,6 +16,13 @@
</a>
</li>
<li data-desc="daily_planning">
<a href="{% url 'web.views.daily_planning' %}">
<i class="fa fa-clock-o"></i>
<span>Daily Planning</span>
</a>
</li>
<li data-desc="workers">
<a href="{% url 'web.views.doctors' %}">
<i class="fa fa-user-md"></i>
......
......@@ -7,6 +7,7 @@ from django.test import Client
from django.test import TestCase
from django.urls import reverse
from web.models import AppointmentTypeLink
from web.tests.functions import create_subject, create_worker, create_visit, create_appointment, \
create_appointment_type, create_get_suffix
from web.views.appointment import APPOINTMENT_LIST_GENERIC, APPOINTMENT_LIST_APPROACHING, APPOINTMENT_LIST_UNFINISHED
......@@ -36,8 +37,10 @@ class TestApi(TestCase):
create_appointment(visit)
appointment2 = create_appointment(visit, get_today_midnight_date())
appointment2.visit = None
appointment2.appointment_types.add(create_appointment_type())
appointment_type = create_appointment_type()
appointment2.save()
AppointmentTypeLink.objects.create(appointment=appointment2, appointment_type=appointment_type)
url = reverse('web.api.appointments', kwargs={'type': APPOINTMENT_LIST_GENERIC})
response = self.client.get(url)
......@@ -77,9 +80,10 @@ class TestApi(TestCase):
self.subject.save()
visit = create_visit(self.subject)
appointment = create_appointment(visit, get_today_midnight_date())
appointment.appointment_types.add(create_appointment_type())
appointment.save()
AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=create_appointment_type())
params = {
"start_date": (get_today_midnight_date() + datetime.timedelta(days=2)).strftime("%Y-%m-%d"),
"end_date": (get_today_midnight_date() + datetime.timedelta(days=3)).strftime("%Y-%m-%d"),
......
......@@ -3,7 +3,7 @@ import datetime
from django.test import TestCase
from web.models import Visit
from web.models import Visit, AppointmentTypeLink
from web.statistics import get_previous_year_and_month_for_date, StatisticsManager
from web.tests.functions import create_appointment, create_appointment_type
from web.views.notifications import get_today_midnight_date
......@@ -16,7 +16,7 @@ class TestStatistics(TestCase):
self.now = get_today_midnight_date()
self.appointment_type = create_appointment_type()
appointment = create_appointment(when=self.now)
appointment.appointment_types = [self.appointment_type]
AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=self.appointment_type)
self.visit_start = appointment.visit.datetime_begin
self.visit_end = appointment.visit.datetime_end
appointment.save()
......@@ -72,7 +72,8 @@ class TestStatistics(TestCase):
subject=self.subject,
is_finished=False)
second_appointment = create_appointment(second_visit, when=self.now)
second_appointment.appointment_types = [self.appointment_type]
AppointmentTypeLink.objects.create(appointment=second_appointment, appointment_type=self.appointment_type)
second_appointment.status = "Cancelled"
second_appointment.save()
self.statistics_manager = StatisticsManager()
......
......@@ -3,7 +3,7 @@ import datetime
from django.urls import reverse
from functions import create_appointment_type, create_appointment
from web.models import Item, Appointment
from web.models import Item, Appointment, AppointmentTypeLink
from web.views.notifications import get_today_midnight_date
from . import LoggedInTestCase
......@@ -22,8 +22,9 @@ class ViewFunctionsTests(LoggedInTestCase):
appointment = create_appointment()
appointment.datetime_when = get_today_midnight_date() + datetime.timedelta(days=2)
appointment.appointment_types.add(appointment_type)
appointment.save()
AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=appointment_type)
response = self.client.get(reverse('web.views.kit_requests'))
self.assertEqual(response.status_code, 200)
......@@ -39,9 +40,9 @@ class ViewFunctionsTests(LoggedInTestCase):
appointment = create_appointment()
appointment.datetime_when = get_today_midnight_date() + datetime.timedelta(days=2)
appointment.appointment_types.add(appointment_type)
appointment.status = Appointment.APPOINTMENT_STATUS_CANCELLED
appointment.save()
AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=appointment_type)
response = self.client.get(reverse('web.views.kit_requests'))
self.assertEqual(response.status_code, 200)
......@@ -57,8 +58,9 @@ class ViewFunctionsTests(LoggedInTestCase):
appointment = create_appointment()
appointment.datetime_when = get_today_midnight_date() + datetime.timedelta(days=2)
appointment.appointment_types.add(appointment_type)
appointment.save()
AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=appointment_type)
response = self.client.get(reverse('web.views.kit_requests'))
self.assertEqual(response.status_code, 200)
......
......@@ -5,7 +5,7 @@ from django.contrib.auth.models import AnonymousUser
from functions import create_appointment, create_location, create_worker, create_appointment_type
from functions import create_subject
from functions import create_visit
from web.models import Appointment, Location
from web.models import Appointment, Location, AppointmentTypeLink
from web.views.notifications import \
get_approaching_visits_for_mail_contact, \
get_approaching_visits_for_mail_contact_count, \
......@@ -79,7 +79,7 @@ class NotificationViewTests(LoggedInTestCase):
visit.save()
appointment = create_appointment(visit)
appointment.appointment_types.add(appointment_type)
AppointmentTypeLink.objects.create(appointment=appointment, appointment_type=appointment_type)
appointment.status = Appointment.APPOINTMENT_STATUS_FINISHED
appointment.save()
......
......@@ -16,6 +16,8 @@ Including another URLconf
from django.conf import settings
from django.conf.urls import include
from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from web import views
......@@ -111,6 +113,13 @@ urlpatterns = [
url(r'^mail_templates/(?P<mail_template_id>\d+)/generate/(?P<instance_id>\d+)$', views.mails.generate,
name="web.views.mail_template_generate"),
####################
# DAILY PLANNING #
####################
url(r'^daily_planning$', login_required(TemplateView.as_view(template_name='daily_planning.html')), name='web.views.daily_planning'),
####################
# LANGUAGES #
####################
......
......@@ -91,6 +91,7 @@ def appointment_edit(request, id):
return redirect('web.views.appointments')
else:
appointment_form = AppointmentEditForm(instance=the_appointment, user=request.user, prefix="appointment")
if the_appointment.visit is not None:
subject_form = SubjectEditForm(instance=the_appointment.visit.subject, prefix="subject")
......
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