diff --git a/.gitignore b/.gitignore index 7cd94db8e4e3b989be1fb2f7f32a11f949533709..4996b376b436862040d84b8cd8b7aa059d67db9f 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ appointment-import/testFiles/~* appointment-import/tmp.sql .idea *.iml +out diff --git a/local_settings_ci.py b/local_settings_ci.py index f5c39156decf4d67ba99ed9a1ac00ec5f13cbb1f..246ab9c0f9d46c0f09643b1651c7c8a11305a13b 100644 --- a/local_settings_ci.py +++ b/local_settings_ci.py @@ -10,21 +10,21 @@ WSGI_APPLICATION = 'smash.wsgi.application' # https://docs.djangoproject.com/en/1.10/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.postgresql_psycopg2', - 'NAME': 'smash', # Insert your database's name - 'USER': 'runner', # Insert your database's user - 'PASSWORD': 'password', # Insert your user's password - 'HOST': 'postgres', - 'PORT': '', - 'TEST': { - 'NAME': 'dbtest', - }, # '' === default one # Empty string is OK + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'smash', # Insert your database's name + 'USER': 'runner', # Insert your database's user + 'PASSWORD': 'password', # Insert your user's password + 'HOST': 'postgres', + 'PORT': '', + 'TEST': { + 'NAME': 'dbtest', + }, # '' === default one # Empty string is OK - # If to use sqlite - # 'ENGINE': 'django.db.backends.sqlite3', - # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), - } + # If to use sqlite + # 'ENGINE': 'django.db.backends.sqlite3', + # 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } } STATIC_ROOT = '/tmp/static' # Warning! `/tmp` directory can be flushed in any moment; use a persistent one; e.g. ~/tmp/static diff --git a/smash/web/admin.py b/smash/web/admin.py index a23a9b196ec0e20424eee10bfd2cc3210a588c43..6f5e40c96a085f56ae91ef72deccd9b90f15140e 100644 --- a/smash/web/admin.py +++ b/smash/web/admin.py @@ -1,10 +1,11 @@ from django.contrib import admin -from models import * +from models import Subject, Item, Room, AppointmentType, Language, Location, Worker, FlyingTeam, Avaibility, Holiday, \ + Visit, Appointment class LanguageAdmin(admin.ModelAdmin): - list_display = ('name','image_img') + list_display = ('name', 'image_img') # Register your models here. diff --git a/smash/web/api_urls.py b/smash/web/api_urls.py index f607052acc2eb332339cbdbcff5909822274f772..d783526c2062dcda87e8478f187e8597495e74ab 100644 --- a/smash/web/api_urls.py +++ b/smash/web/api_urls.py @@ -14,6 +14,7 @@ Including another URLconf 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url + from web import api_views urlpatterns = [ diff --git a/smash/web/api_views.py b/smash/web/api_views.py index d4234e9e8eb8f5807e7fcd5f9280cb528772a5ec..c6c37379a2d8a7dbed632f3d7b0a7145d97fed5b 100644 --- a/smash/web/api_views.py +++ b/smash/web/api_views.py @@ -1,15 +1,14 @@ -from .models import * -from .forms import * - from django.contrib.auth.decorators import login_required from django.http import JsonResponse +from models import Subject, Worker, AppointmentType + @login_required def cities(request): X = Subject.objects.filter(city__isnull=False).values_list('city').distinct() return JsonResponse({ - "cities" : [x[0] for x in X] + "cities": [x[0] for x in X] }) @@ -17,7 +16,7 @@ def cities(request): def countries(request): X = Subject.objects.filter(country__isnull=False).values_list('country').distinct() return JsonResponse({ - "countries" : [x[0] for x in X] + "countries": [x[0] for x in X] }) @@ -25,7 +24,7 @@ def countries(request): def referrals(request): X = Subject.objects.filter(referral__isnull=False).values_list('referral').distinct() return JsonResponse({ - "referrals" : [x[0] for x in X] + "referrals": [x[0] for x in X] }) @@ -33,7 +32,7 @@ def referrals(request): def specializations(request): X = Worker.objects.filter(specialization__isnull=False).values_list('specialization').distinct() return JsonResponse({ - "specializations" : [x[0] for x in X] + "specializations": [x[0] for x in X] }) @@ -41,9 +40,10 @@ def specializations(request): def units(request): X = Worker.objects.filter(unit__isnull=False).values_list('unit').distinct() return JsonResponse({ - "units" : [x[0] for x in X] + "units": [x[0] for x in X] }) + @login_required def appointment_types(request): appointments = AppointmentType.objects.filter().all() @@ -56,5 +56,5 @@ def appointment_types(request): "can_be_parallelized": appointment.can_be_parallelized, }) return JsonResponse({ - "appointment_types" : result + "appointment_types": result }) diff --git a/smash/web/auth.py b/smash/web/auth.py index f6b1e168fefd2f78eb76d7f67b403f2d58963e1a..87e77838f1d9b84d28a661f1a0006adbefa9dc8b 100644 --- a/smash/web/auth.py +++ b/smash/web/auth.py @@ -2,16 +2,16 @@ from django.contrib.auth import authenticate, login, logout def do_login(request): - user = authenticate(username=request.POST.get('username', 'none'), - password=request.POST.get('password', 'none')) - if user is not None: - login(request, user) - return True, "ok" - return False, "login_failed" + user = authenticate(username=request.POST.get('username', 'none'), + password=request.POST.get('password', 'none')) + if user is not None: + login(request, user) + return True, "ok" + return False, "login_failed" def do_logout(request): - if request.user.is_authenticated: - logout(request) - return True, "logout" - return False, "logout_failed" \ No newline at end of file + if request.user.is_authenticated: + logout(request) + return True, "logout" + return False, "logout_failed" diff --git a/smash/web/forms.py b/smash/web/forms.py index c5499f0e5afa216284e0d651d4f52bd7b9b17c60..514d9ac9f2a080c3908e756236e404a9b591e5eb 100644 --- a/smash/web/forms.py +++ b/smash/web/forms.py @@ -1,44 +1,47 @@ +from datetime import datetime + from django import forms from django.forms import ModelForm, Form -from .models import * -from datetime import datetime + +from models import Subject, Worker, Appointment, Visit """ Possible redundancy, but if need arises, contents of forms can be easily customized """ CURRENT_YEAR = datetime.now().year -YEAR_CHOICES=tuple(range(CURRENT_YEAR,CURRENT_YEAR - 120, -1)) -FUTURE_YEAR_CHOICES=tuple(range(CURRENT_YEAR,CURRENT_YEAR + 5, 1)) +YEAR_CHOICES = tuple(range(CURRENT_YEAR, CURRENT_YEAR - 120, -1)) +FUTURE_YEAR_CHOICES = tuple(range(CURRENT_YEAR, CURRENT_YEAR + 5, 1)) DATEPICKER_DATE_ATTRS = { - 'class':'datepicker', - 'data-date-format':'yyyy-mm-dd', + 'class': 'datepicker', + 'data-date-format': 'yyyy-mm-dd', 'data-date-orientation': 'bottom' } DATETIMEPICKER_DATE_ATTRS = { - 'class':'datetimepicker', - 'data-date-format':'Y-MM-DD HH:mm', + 'class': 'datetimepicker', + 'data-date-format': 'Y-MM-DD HH:mm', } + def validate_subject_nd_number(self): subject = self.cleaned_data - if subject['nd_number']!="": + if subject['nd_number'] != "": subjects_from_db = Subject.objects.filter(nd_number=subject['nd_number']) - if (len(subjects_from_db)>0): - if subjects_from_db[0].screening_number!= subject.get('screening_number',''): + if subjects_from_db: + if subjects_from_db[0].screening_number != subject.get('screening_number', ''): self.add_error('nd_number', "ND number already in use") class SubjectAddForm(ModelForm): date_born = forms.DateField(label="Date of birth", - widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), - required=False - ) + widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), + required=False + ) datetime_contact_reminder = forms.DateField(label="Contact on", - widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), - required=False - ) + widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), + required=False + ) class Meta: model = Subject @@ -47,13 +50,14 @@ class SubjectAddForm(ModelForm): def clean(self): subject = self.cleaned_data - subjects_from_db = Subject.objects.filter(screening_number=subject.get('screening_number','')) + subjects_from_db = Subject.objects.filter(screening_number=subject.get('screening_number', '')) - if len(subjects_from_db)>0: + if len(subjects_from_db) > 0: self.add_error('screening_number', "Screening number already in use") validate_subject_nd_number(self) + class SubjectDetailForm(ModelForm): class Meta: model = Subject @@ -61,15 +65,14 @@ class SubjectDetailForm(ModelForm): class SubjectEditForm(ModelForm): - datetime_contact_reminder = forms.DateField(label="Contact on", - widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), - required=False - ) + widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), + required=False + ) date_born = forms.DateField(label="Date of birth", - widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), - required=False - ) + widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), + required=False + ) def __init__(self, *args, **kwargs): super(SubjectEditForm, self).__init__(*args, **kwargs) @@ -116,8 +119,9 @@ class AppointmentDetailForm(ModelForm): fields = '__all__' datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)', - widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS) - ) + widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS) + ) + class AppointmentEditForm(ModelForm): class Meta: @@ -125,22 +129,22 @@ class AppointmentEditForm(ModelForm): fields = '__all__' datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)', - widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS) - ) + widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS) + ) def __init__(self, *args, **kwargs): user = kwargs.pop('user', None) - if user==None: + if user is None: raise TypeError("User not defined") self.user = Worker.get_by_user(user) - if self.user==None: + if self.user is None: raise TypeError("Worker not defined for: " + user.username) - super(ModelForm, self).__init__(*args,**kwargs) + super(ModelForm, self).__init__(*args, **kwargs) def clean_location(self): location = self.cleaned_data['location'] - if self.user.locations.filter(id = location.id).count()==0: + if self.user.locations.filter(id=location.id).count() == 0: self.add_error('location', "You cannot create appointment for this location") else: return location @@ -152,22 +156,22 @@ class AppointmentAddForm(ModelForm): exclude = ['status'] datetime_when = forms.DateTimeField(label='Appointment on (YYYY-MM-DD HH:MM)', - widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS) - ) + widget=forms.DateTimeInput(DATETIMEPICKER_DATE_ATTRS) + ) def __init__(self, *args, **kwargs): user = kwargs.pop('user', None) - if user==None: + if user is None: raise TypeError("User not defined") self.user = Worker.get_by_user(user) - if self.user==None: + if self.user is None: raise TypeError("Worker not defined for: " + user.username) - super(ModelForm, self).__init__(*args,**kwargs) + super(ModelForm, self).__init__(*args, **kwargs) def clean_location(self): location = self.cleaned_data['location'] - if self.user.locations.filter(id = location.id).count()==0: + if self.user.locations.filter(id=location.id).count() == 0: self.add_error('location', "You cannot create appointment for this location") else: return location @@ -175,11 +179,11 @@ class AppointmentAddForm(ModelForm): class VisitDetailForm(ModelForm): datetime_begin = forms.DateField(label="Visit begins on", - widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d") - ) + widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d") + ) datetime_end = forms.DateField(label="Visit ends on", - widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d") - ) + widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d") + ) post_mail_sent = forms.RadioSelect() @@ -187,30 +191,33 @@ class VisitDetailForm(ModelForm): model = Visit exclude = ['is_finished'] + class VisitAddForm(ModelForm): - subject = forms.ModelChoiceField(queryset=Subject.objects.order_by('last_name','first_name')) + subject = forms.ModelChoiceField(queryset=Subject.objects.order_by('last_name', 'first_name')) datetime_begin = forms.DateField(label="Visit begins on", - widget=forms.TextInput(attrs=DATEPICKER_DATE_ATTRS) - ) + widget=forms.TextInput(attrs=DATEPICKER_DATE_ATTRS) + ) datetime_end = forms.DateField(label="Visit ends on", - widget=forms.TextInput(attrs=DATEPICKER_DATE_ATTRS) - ) + widget=forms.TextInput(attrs=DATEPICKER_DATE_ATTRS) + ) + class Meta: model = Visit exclude = ['is_finished'] def clean(self): - if (self.cleaned_data['datetime_begin']>=self.cleaned_data['datetime_end']): + if self.cleaned_data['datetime_begin'] >= self.cleaned_data['datetime_end']: self.add_error('datetime_begin', "Start date must be before end date") self.add_error('datetime_end', "Start date must be before end date") + class KitRequestForm(Form): start_date = forms.DateField(label="From date", - widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), - required=False - ) + widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), + required=False + ) end_date = forms.DateField(label="End date", - widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), - required=False - ) + widget=forms.DateInput(DATEPICKER_DATE_ATTRS, "%Y-%m-%d"), + required=False + ) diff --git a/smash/web/models.py b/smash/web/models.py index 83dc148eacfcddd156eaa7bf88608411f0c11f5b..03f784fc8399a99ea3c8f92339eff5cbf43bdafe 100644 --- a/smash/web/models.py +++ b/smash/web/models.py @@ -1,27 +1,29 @@ from __future__ import unicode_literals -from django.db import models -from django.utils import timezone -from django.contrib.auth.models import User, AnonymousUser import datetime -from datetime import timedelta +from django.contrib.auth.models import User +from django.db import models + def get_current_year(): return datetime.datetime.now().year + BOOL_CHOICES = ((True, 'Yes'), (False, 'No')) -class Location (models.Model): + +class Location(models.Model): name = models.CharField(max_length=20) def __str__(self): - return "%s" % (self.name) + return "%s" % self.name def __unicode__(self): - return "%s" % (self.name) + return "%s" % self.name + -class Language (models.Model): +class Language(models.Model): name = models.CharField(max_length=20) image = models.ImageField() @@ -37,30 +39,30 @@ class Language (models.Model): image_img.short_description = 'Flag icon' image_img.allow_tags = True + class Subject(models.Model): SEX_CHOICES_MALE = 'M' SEX_CHOICES_FEMALE = 'F' SEX_CHOICES = ( - (SEX_CHOICES_MALE,'Male'), - (SEX_CHOICES_FEMALE,'Female'), + (SEX_CHOICES_MALE, 'Male'), + (SEX_CHOICES_FEMALE, 'Female'), ) SUBJECT_TYPE_CHOICES_CONTROL = 'C' SUBJECT_TYPE_CHOICES = ( - (SUBJECT_TYPE_CHOICES_CONTROL,'CONTROL'), - ('P','PATIENT'), + (SUBJECT_TYPE_CHOICES_CONTROL, 'CONTROL'), + ('P', 'PATIENT'), ) - def finish_all_visits(self): - visits = Visit.objects.filter(subject = self, is_finished = False) + visits = Visit.objects.filter(subject=self, is_finished=False) for visit in visits: visit.is_finished = True visit.save() def finish_all_appointments(self): - appointments = Appointment.objects.filter(visit__subject = self, status = Appointment.APPOINTMENT_STATUS_SCHEDULED) + appointments = Appointment.objects.filter(visit__subject=self, status=Appointment.APPOINTMENT_STATUS_SCHEDULED) for appointment in appointments: appointment.status = Appointment.APPOINTMENT_STATUS_CANCELLED appointment.save() @@ -80,135 +82,135 @@ class Subject(models.Model): self.finish_all_appointments() sex = models.CharField(max_length=1, - choices=SEX_CHOICES, - verbose_name='Sex' - ) - postponed = models.BooleanField(choices=BOOL_CHOICES, - verbose_name='Postponed', - default=False - ) + choices=SEX_CHOICES, + verbose_name='Sex' + ) + postponed = models.BooleanField(choices=BOOL_CHOICES, + verbose_name='Postponed', + default=False + ) datetime_contact_reminder = models.DateField( null=True, - blank=True, + blank=True, verbose_name='Contact on', ) type = models.CharField(max_length=1, - choices=SUBJECT_TYPE_CHOICES, - verbose_name='Type' - ) + choices=SUBJECT_TYPE_CHOICES, + verbose_name='Type' + ) dead = models.BooleanField( verbose_name='Dead', - default= False, + default=False, editable=False ) resigned = models.BooleanField( verbose_name='Resigned', - default= False, + default=False, editable=False ) default_location = models.ForeignKey(Location, - verbose_name='Default appointment location', - ) + verbose_name='Default appointment location', + ) first_name = models.CharField(max_length=50, - verbose_name='First name' - ) + verbose_name='First name' + ) last_name = models.CharField(max_length=50, - verbose_name='Last name' - ) + verbose_name='Last name' + ) languages = models.ManyToManyField(Language, - blank=True, - verbose_name='Known languages' - ) + blank=True, + verbose_name='Known languages' + ) default_written_communication_language = models.ForeignKey(Language, - null=True, - blank=True, - related_name="%(class)s_written_comunication", - verbose_name='Default language for document generation' - ) + null=True, + blank=True, + related_name="%(class)s_written_comunication", + verbose_name='Default language for document generation' + ) phone_number = models.CharField(max_length=20, - null=True, - blank=True, - verbose_name='Phone number' - ) + null=True, + blank=True, + verbose_name='Phone number' + ) phone_number_2 = models.CharField(max_length=20, - null=True, - blank=True, - verbose_name='Phone number 2' - ) + null=True, + blank=True, + verbose_name='Phone number 2' + ) phone_number_3 = models.CharField(max_length=20, - null=True, - blank=True, - verbose_name='Phone number 3' - ) + null=True, + blank=True, + verbose_name='Phone number 3' + ) email = models.EmailField( null=True, - blank=True, + blank=True, verbose_name='E-mail' ) date_born = models.DateField( null=True, - blank=True, + blank=True, verbose_name='Date of birth (YYYY-MM-DD)' ) address = models.CharField(max_length=255, - blank=True, - verbose_name='Address' - ) + blank=True, + verbose_name='Address' + ) postal_code = models.CharField(max_length=7, - blank=True, - verbose_name='Postal code' - ) + blank=True, + verbose_name='Postal code' + ) city = models.CharField(max_length=50, - blank=True, - verbose_name='City' - ) + blank=True, + verbose_name='City' + ) country = models.CharField(max_length=50, - verbose_name='Country' - ) + verbose_name='Country' + ) screening_number = models.CharField(max_length=50, - unique=True, - verbose_name='Screening number' - ) + unique=True, + verbose_name='Screening number' + ) nd_number = models.CharField(max_length=6, - blank=True, - verbose_name='ND number' - ) + blank=True, + verbose_name='ND number' + ) mpower_id = models.CharField(max_length=20, - blank=True, - verbose_name='MPower ID' - ) + blank=True, + verbose_name='MPower ID' + ) comments = models.TextField(max_length=2000, - blank=True, - verbose_name='Comments' - ) + blank=True, + verbose_name='Comments' + ) date_added = models.DateField(verbose_name='Added on', - auto_now=True - ) + auto_now=True + ) referral = models.CharField(max_length=128, - null=True, - blank=True, - verbose_name='Referred by' - ) + null=True, + blank=True, + verbose_name='Referred by' + ) diagnosis = models.CharField(max_length=128, - null=True, - blank=True, - verbose_name='Diagnosis' - ) + null=True, + blank=True, + verbose_name='Diagnosis' + ) year_of_diagnosis = models.IntegerField( default=0, null=True, - blank=True, + blank=True, verbose_name='Year of diagnosis (YYYY)' ) def latest_visit(self): visits = self.visit_set.all() - if len(visits)==0: + if len(visits) == 0: return None - result = visits[0]; + result = visits[0] for visit in visits: - if (visit.datetime_begin > result.datetime_begin): + if visit.datetime_begin > result.datetime_begin: result = visit return result @@ -219,8 +221,7 @@ class Subject(models.Model): return "%s %s" % (self.first_name, self.last_name) - -class Item (models.Model): +class Item(models.Model): is_fixed = models.BooleanField( default=False, verbose_name='Is the item fixed?' @@ -232,8 +233,8 @@ class Item (models.Model): ) name = models.CharField(max_length=255, - verbose_name='Name' - ) + verbose_name='Name' + ) def __str__(self): return self.name @@ -242,20 +243,20 @@ class Item (models.Model): return self.name -class Room (models.Model): +class Room(models.Model): equipment = models.ManyToManyField(Item, - verbose_name='On-site equipment', - blank=True - ) + verbose_name='On-site equipment', + blank=True + ) owner = models.CharField(max_length=50, - verbose_name='Owner' - ) + verbose_name='Owner' + ) address = models.CharField(max_length=255, - verbose_name='Address' - ) + verbose_name='Address' + ) city = models.CharField(max_length=50, - verbose_name='City' - ) + verbose_name='City' + ) room_number = models.IntegerField( verbose_name='Room number' ) @@ -273,22 +274,20 @@ class Room (models.Model): return "%d %s %s" % (self.room_number, self.address, self.city) -class AppointmentType (models.Model): - - +class AppointmentType(models.Model): DEFAULT_COLOR = '#cfc600' DEFAULT_FONT_COLOR = '#00000' required_equipment = models.ManyToManyField(Item, - verbose_name='Required equipment', - blank = True - ) + verbose_name='Required equipment', + blank=True + ) code = models.CharField(max_length=20, - verbose_name='Appointment code' - ) + verbose_name='Appointment code' + ) description = models.CharField(max_length=2000, - verbose_name='Appointment description' - ) + verbose_name='Appointment description' + ) default_duration = models.IntegerField( verbose_name='Default duration (in minutes)' ) @@ -297,13 +296,13 @@ class AppointmentType (models.Model): default=1 ) calendar_color = models.CharField(max_length=2000, - verbose_name='Calendar color', - default=DEFAULT_COLOR - ) + verbose_name='Calendar color', + default=DEFAULT_COLOR + ) calendar_font_color = models.CharField(max_length=2000, - verbose_name='Calendar color', - default=DEFAULT_FONT_COLOR - ) + verbose_name='Calendar color', + default=DEFAULT_FONT_COLOR + ) rest_time = models.IntegerField( verbose_name='Suggested rest time', default=0 @@ -319,9 +318,9 @@ class AppointmentType (models.Model): ('ANY', 'Any') ) required_worker = models.CharField(max_length=20, choices=REQ_ROLE_CHOICES, - verbose_name='Type of worker required for appointment', - default='ANY' - ) + verbose_name='Type of worker required for appointment', + default='ANY' + ) def __str__(self): return self.code @@ -330,31 +329,31 @@ class AppointmentType (models.Model): return self.code -class Worker (models.Model): +class Worker(models.Model): languages = models.ManyToManyField(Language, - verbose_name='Known languages' - ) + verbose_name='Known languages' + ) locations = models.ManyToManyField(Location, - verbose_name='Locations' - ) + verbose_name='Locations' + ) appointments = models.ManyToManyField('Appointment', blank=True, - verbose_name='Appointments' - ) + verbose_name='Appointments' + ) user = models.OneToOneField(User, blank=True, null=True, - verbose_name='Username' - ) + verbose_name='Username' + ) first_name = models.CharField(max_length=50, - verbose_name='First name' - ) + verbose_name='First name' + ) last_name = models.CharField(max_length=50, - verbose_name='Last name' - ) + verbose_name='Last name' + ) phone_number = models.CharField(max_length=20, - verbose_name='Phone number' - ) + verbose_name='Phone number' + ) unit = models.CharField(max_length=50, - verbose_name='Unit' - ) + verbose_name='Unit' + ) email = models.EmailField( verbose_name='E-mail' ) @@ -367,11 +366,11 @@ class Worker (models.Model): (ROLE_CHOICES_SECRETARY, 'Secretary') ) role = models.CharField(max_length=20, choices=ROLE_CHOICES, - verbose_name='Role' - ) + verbose_name='Role' + ) specialization = models.CharField(max_length=20, - verbose_name='Specialization' - ) + verbose_name='Specialization' + ) def is_on_leave(self): if len(self.holiday_set.filter(datetime_end__gt=datetime.datetime.now(), @@ -379,35 +378,34 @@ class Worker (models.Model): return True return False - @staticmethod def get_by_user(the_user): if isinstance(the_user, User): workers = Worker.objects.filter(user=the_user) - if len(workers)>0: + if len(workers) > 0: return workers[0] else: return None - elif isinstance(user, Worker): - return user - elif user!=None: - raise TypeError("Unknown class type: "+user.__class__.__name__) + elif isinstance(the_user, Worker): + return the_user + elif the_user is not None: + raise TypeError("Unknown class type: " + the_user.__class__.__name__) else: return None @staticmethod def get_details(the_user): - if the_user.is_authenticated == False: - return ('Guest', 'Test account') + if not the_user.is_authenticated: + return 'Guest', 'Test account' person = Worker.objects.filter(user=the_user) if len(person) == 0: - return (the_user.get_full_name(), '<No worker information>') + return the_user.get_full_name(), '<No worker information>' else: # For get_*_display, see: # https://docs.djangoproject.com/en/1.10/topics/db/models/#field-options - return (str(person[0]), person[0].get_role_display()) + return str(person[0]), person[0].get_role_display() def __str__(self): return "%s %s" % (self.first_name, self.last_name) @@ -438,24 +436,19 @@ class FlyingTeam(models.Model): # # def __unicode__(self): # return "%s %s %s" % (self.doctor.last_name, self.nurse.last_name, self.psychologist.last_name) - - - place = models.CharField(max_length=255, - verbose_name='Place', - ) + place = models.CharField(max_length=255, verbose_name='Place') def __str__(self): - return "%s" % (self.place) + return "%s" % self.place def __unicode__(self): - return "%s" % (self.place) - + return "%s" % self.place class Avaibility(models.Model): person = models.ForeignKey(Worker, on_delete=models.CASCADE, - verbose_name='Worker' - ) + verbose_name='Worker' + ) day_number = models.IntegerField( verbose_name='Day of the week' ) @@ -479,8 +472,8 @@ class Avaibility(models.Model): class Holiday(models.Model): person = models.ForeignKey(Worker, on_delete=models.CASCADE, - verbose_name='Worker' - ) + verbose_name='Worker' + ) datetime_start = models.DateTimeField( verbose_name='On leave since' ) @@ -494,29 +487,30 @@ class Holiday(models.Model): def __unicode__(self): return "%s %s" % (self.person.first_name, self.person.last_name) + class Visit(models.Model): subject = models.ForeignKey(Subject, on_delete=models.CASCADE, - verbose_name='Subject' - ) + verbose_name='Subject' + ) datetime_begin = models.DateTimeField( verbose_name='Visit starts at' ) datetime_end = models.DateTimeField( verbose_name='Visit ends at' - ) # Deadline before which all appointments need to be scheduled + ) # Deadline before which all appointments need to be scheduled is_finished = models.BooleanField( verbose_name='Has ended', default=False ) - post_mail_sent = models.BooleanField(choices=BOOL_CHOICES, - verbose_name='Post mail sent', - default=False - ) + post_mail_sent = models.BooleanField(choices=BOOL_CHOICES, + verbose_name='Post mail sent', + default=False + ) appointment_types = models.ManyToManyField(AppointmentType, - verbose_name='Requested appointments', - blank=True, - ) + verbose_name='Requested appointments', + blank=True, + ) def __unicode__(self): return "%s %s" % (self.subject.first_name, self.subject.last_name) @@ -525,31 +519,32 @@ class Visit(models.Model): return "%s %s" % (self.subject.first_name, self.subject.last_name) def follow_up_title(self): - count = Visit.objects.filter(subject=self.subject, datetime_begin__lt =self.datetime_begin).count() + count = Visit.objects.filter(subject=self.subject, datetime_begin__lt=self.datetime_begin).count() return "Visit " + str(count + 1) def mark_as_finished(self): self.is_finished = True self.save() - if (not self.subject.dead) and (not self.subject.resigned): + if (not self.subject.dead) and (not self.subject.resigned): visit_started = self.datetime_begin time_to_next_visit = datetime.timedelta(days=365) - if self.subject.type== Subject.SUBJECT_TYPE_CHOICES_CONTROL: - time_to_next_visit = datetime.timedelta(days=365*3+366) + if self.subject.type == Subject.SUBJECT_TYPE_CHOICES_CONTROL: + time_to_next_visit = datetime.timedelta(days=365 * 3 + 366) Visit.objects.create( - subject = self.subject, - datetime_begin = visit_started+time_to_next_visit, - datetime_end = visit_started+time_to_next_visit+datetime.timedelta(days=93) - ) + subject=self.subject, + datetime_begin=visit_started + time_to_next_visit, + datetime_end=visit_started + time_to_next_visit + datetime.timedelta(days=93) + ) + class Appointment(models.Model): - APPOINTMENT_STATUS_SCHEDULED = 'SCHEDULED'; - APPOINTMENT_STATUS_FINISHED = 'FINISHED'; - APPOINTMENT_STATUS_CANCELLED = 'CANCELLED'; - APPOINTMENT_STATUS_NO_SHOW = 'NO_SHOW'; + APPOINTMENT_STATUS_SCHEDULED = 'SCHEDULED' + APPOINTMENT_STATUS_FINISHED = 'FINISHED' + APPOINTMENT_STATUS_CANCELLED = 'CANCELLED' + APPOINTMENT_STATUS_NO_SHOW = 'NO_SHOW' APPOINTMENT_STATUS_CHOICES = ( (APPOINTMENT_STATUS_SCHEDULED, 'Scheduled'), (APPOINTMENT_STATUS_FINISHED, 'Finished'), @@ -558,46 +553,46 @@ class Appointment(models.Model): ) flying_team = models.ForeignKey(FlyingTeam, - verbose_name='Flying team (if applicable)', - null=True, blank=True - ) + verbose_name='Flying team (if applicable)', + null=True, blank=True + ) worker_assigned = models.ForeignKey(Worker, - verbose_name='Worker conducting the assessment (if applicable)', - null=True, blank=True - ) + verbose_name='Worker conducting the assessment (if applicable)', + null=True, blank=True + ) appointment_types = models.ManyToManyField(AppointmentType, - verbose_name='Appointment types', - blank=True - ) + verbose_name='Appointment types', + blank=True + ) room = models.ForeignKey(Room, - verbose_name='Room ID', - null=True, - blank=True - ) + verbose_name='Room ID', + null=True, + blank=True + ) location = models.ForeignKey(Location, - verbose_name='Location', - ) + verbose_name='Location', + ) visit = models.ForeignKey(Visit, - verbose_name='Visit ID' - ) + verbose_name='Visit ID' + ) comment = models.TextField(max_length=1024, - verbose_name='Comment', - null=True, - blank=True - ) + verbose_name='Comment', + null=True, + blank=True + ) datetime_when = models.DateTimeField( verbose_name='Appointment on', null=True, blank=True ) length = models.IntegerField( verbose_name='Appointment length (in minutes)' - )#Potentially redundant; but can be used to manually adjust appointment's length + ) # Potentially redundant; but can be used to manually adjust appointment's length status = models.CharField(max_length=20, choices=APPOINTMENT_STATUS_CHOICES, - verbose_name='Status', - editable=False, - default=APPOINTMENT_STATUS_SCHEDULED - ) + verbose_name='Status', + editable=False, + default=APPOINTMENT_STATUS_SCHEDULED + ) def mark_as_finished(self): self.status = Appointment.APPOINTMENT_STATUS_FINISHED @@ -615,14 +610,14 @@ class Appointment(models.Model): if self.datetime_when is None: return None else: - return self.datetime_when + timedelta(minutes=max(self.length, 15)) + return self.datetime_when + datetime.timedelta(minutes=max(self.length, 15)) def color(self): result = AppointmentType.DEFAULT_COLOR priority = 1000000 for type in self.appointment_types.all(): - if type.calendar_color_priority<priority: - priority=type.calendar_color_priority + if type.calendar_color_priority < priority: + priority = type.calendar_color_priority result = type.calendar_color return result @@ -630,16 +625,16 @@ class Appointment(models.Model): result = AppointmentType.DEFAULT_FONT_COLOR priority = 1000000 for type in self.appointment_types.all(): - if type.calendar_color_priority<priority: - priority=type.calendar_color_priority + if type.calendar_color_priority < priority: + priority = type.calendar_color_priority result = type.calendar_font_color return result def title(self): - if self.visit.subject.screening_number=="---": + if self.visit.subject.screening_number == "---": return self.comment.replace("\n", ";").replace("\r", ";") else: title = self.visit.subject.first_name + " " + self.visit.subject.last_name + " type: " - for type in self.appointment_types.all(): - title += type.code+", " + for appointment_type in self.appointment_types.all(): + title += appointment_type.code + ", " return title diff --git a/smash/web/templates/_base.html b/smash/web/templates/_base.html index b248cd1137f02b98c10fb5cba26a1c88206e4425..685769f28a16609d7ec2f345e91e5ecc64703178 100644 --- a/smash/web/templates/_base.html +++ b/smash/web/templates/_base.html @@ -1,38 +1,39 @@ {% load static %}<!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <title>{% block title %}Scheduling system{% endblock title %}</title> - <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <title>{% block title %}Scheduling system{% endblock title %}</title> + <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> - {% block styles %} - <!-- Bootstrap 3.3.6 --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> + {% block styles %} + <!-- Bootstrap 3.3.6 --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> - <!-- Font Awesome --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> + <!-- Font Awesome --> + <link rel="stylesheet" + href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> - <!-- Ionicons --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> + <!-- Ionicons --> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> - <!-- Theme style --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> + <!-- Theme style --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> - <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> - <style> - .flag-icon { - height: 20px; - } - </style> + <style> + .flag-icon { + height: 20px; + } + </style> - <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> + <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> - {% endblock styles %} + {% endblock styles %} </head> <!-- BODY TAG OPTIONS: @@ -57,43 +58,44 @@ desired effect <body class="hold-transition skin-green sidebar-mini"> <div class="wrapper"> - <header class="main-header"> - - <!-- Logo --> - <a href="{% url 'web.views.index' %}" class="logo"> - <!-- mini logo for sidebar mini 50x50 pixels --> - <span class="logo-mini"><i class="fa fa-calendar-check-o fa-2x"></i></span> - <!-- logo for regular state and mobile devices --> - <span class="logo-lg"><b>Smart</b>Scheduling <small>alpha</small></span> - </a> - - <!-- Header Navbar --> - <nav class="navbar navbar-static-top" role="navigation"> - <!-- Sidebar toggle button--> - <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> - <span class="sr-only">Toggle navigation</span> - </a> - - <!-- Navbar Right Menu --> - <div class="navbar-custom-menu"> - <ul class="nav navbar-nav"> - <!-- Messages: style can be found in dropdown.less--> - <li class="dropdown messages-menu" style="display: none"> - <!-- Menu toggle button --> - <a href="#" class="dropdown-toggle" data-toggle="dropdown"> - <i class="fa fa-envelope-o"></i> - <span class="label label-success"> + <header class="main-header"> + + <!-- Logo --> + <a href="{% url 'web.views.index' %}" class="logo"> + <!-- mini logo for sidebar mini 50x50 pixels --> + <span class="logo-mini"><i class="fa fa-calendar-check-o fa-2x"></i></span> + <!-- logo for regular state and mobile devices --> + <span class="logo-lg"><b>Smart</b>Scheduling <small>alpha</small></span> + </a> + + <!-- Header Navbar --> + <nav class="navbar navbar-static-top" role="navigation"> + <!-- Sidebar toggle button--> + <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"> + <span class="sr-only">Toggle navigation</span> + </a> + + <!-- Navbar Right Menu --> + <div class="navbar-custom-menu"> + <ul class="nav navbar-nav"> + <!-- Messages: style can be found in dropdown.less--> + <li class="dropdown messages-menu" style="display: none"> + <!-- Menu toggle button --> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + <i class="fa fa-envelope-o"></i> + <span class="label label-success"> 0 </span> - </a> - <ul class="dropdown-menu"> - <li class="header"> - You have 0 letters to send<hr /> - (Not implemented yet) - </li> - <li> - </li> - {% comment "TODO: Implement letter notification" %} + </a> + <ul class="dropdown-menu"> + <li class="header"> + You have 0 letters to send + <hr/> + (Not implemented yet) + </li> + <li> + </li> + {% comment "TODO: Implement letter notification" %} <li> <!-- inner menu: contains the messages --> <ul class="menu"> @@ -117,62 +119,62 @@ desired effect <!-- /.menu --> </li> {% endcomment %} - <li class="footer"><a href="#">See All</a></li> - </ul> - </li> - <!-- /.messages-menu --> - - <!-- Notifications Menu --> - {% if notifications.0 > 0 %} - <li class="dropdown notifications-menu" > - <!-- Menu toggle button --> - <a href="#" class="dropdown-toggle" data-toggle="dropdown"> - <i class="fa fa-bell-o"></i> - <span class="label label-warning"> {{notifications.0}}</span> - </a> - <ul class="dropdown-menu"> - <li class="header"> You have {{notifications.0}} notification(s): </li> - <li> - <!-- Inner Menu: contains the notifications --> - <ul class="menu"> - {% for notification in notifications.1 %} - {% if notification.count > 0 %} - <li><!-- start notification --> - <a href="{% url notification.type %}"> - <i class="fa {{notification.style}}"></i> {{ notification.title }}: {{ notification.count }} - </a> - </li> + <li class="footer"><a href="#">See All</a></li> + </ul> + </li> + <!-- /.messages-menu --> + + <!-- Notifications Menu --> + {% if notifications.0 > 0 %} + <li class="dropdown notifications-menu"> + <!-- Menu toggle button --> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + <i class="fa fa-bell-o"></i> + <span class="label label-warning"> {{ notifications.0 }}</span> + </a> + <ul class="dropdown-menu"> + <li class="header"> You have {{ notifications.0 }} notification(s):</li> + <li> + <!-- Inner Menu: contains the notifications --> + <ul class="menu"> + {% for notification in notifications.1 %} + {% if notification.count > 0 %} + <li><!-- start notification --> + <a href="{% url notification.type %}"> + <i class="fa {{ notification.style }}"></i> {{ notification.title }}: {{ notification.count }} + </a> + </li> + {% endif %} + {% endfor %} + <!-- end notification --> + </ul> + </li> + </ul> + </li> {% endif %} - {% endfor %} - <!-- end notification --> - </ul> - </li> - </ul> - </li> - {% endif %} - <!-- User Account Menu --> - <li class="dropdown user user-menu"> - <!-- Menu Toggle Button --> - <a href="#" class="dropdown-toggle" data-toggle="dropdown"> - {% comment "TODO: Add photo/avatar/initials" %} + <!-- User Account Menu --> + <li class="dropdown user user-menu"> + <!-- Menu Toggle Button --> + <a href="#" class="dropdown-toggle" data-toggle="dropdown"> + {% comment "TODO: Add photo/avatar/initials" %} <!-- The user image in the navbar--> <img src="dist/img/user2-160x160.jpg" class="user-image" alt="User Image"> {% endcomment %} - <span>{{ person }}</span> - <i class="fa fa-gears"></i> - </a> - <ul class="dropdown-menu"> - <li class="user-header"> - <i class="fa fa-user-circle-o fa-5x white" style="color: rgba(255,255,255,0.8)"></i> - {% comment "TODO: Add user's photo %} + <span>{{ person }}</span> + <i class="fa fa-gears"></i> + </a> + <ul class="dropdown-menu"> + <li class="user-header"> + <i class="fa fa-user-circle-o fa-5x white" style="color: rgba(255,255,255,0.8)"></i> + {% comment "TODO: Add user's photo %} <img src="dist/img/user2-160x160.jpg" class="img-circle" alt="User Image"> {% endcomment %} - <p> - {{ person }} - <small>{{ role }}</small> - </p> - </li> - {% comment "Uncomment if needed %} + <p> + {{ person }} + <small>{{ role }}</small> + </p> + </li> + {% comment "Uncomment if needed %} <!-- Menu Body --> <li class="user-body"> <div class="row"> @@ -188,35 +190,36 @@ desired effect </div> <!-- /.row --> {% endcomment %} - </li> - <!-- Menu Footer--> - <li class="user-footer"> - <!--<div class="pull-left"> - <a href="#" class="btn btn-default btn-flat"><i class="fa fa-user"></i> Profile</a> - </div>--> - <div class="pull-right"> - <a href="{% url 'web.views.logout' %}" class="btn btn-default btn-flat"><i class="fa fa-sign-out"></i> Sign out</a> - </div> - </li> - </ul> - </li> - {% comment "Uncomment if needed" %} + </li> + <!-- Menu Footer--> + <li class="user-footer"> + <!--<div class="pull-left"> + <a href="#" class="btn btn-default btn-flat"><i class="fa fa-user"></i> Profile</a> + </div>--> + <div class="pull-right"> + <a href="{% url 'web.views.logout' %}" class="btn btn-default btn-flat"><i + class="fa fa-sign-out"></i> Sign out</a> + </div> + </li> + </ul> + </li> + {% comment "Uncomment if needed" %} <!-- Control Sidebar Toggle Button --> <li> <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a> </li> {% endcomment %} - </ul> - </div> - </nav> - </header> - <!-- Left side column. contains the logo and sidebar --> - <aside class="main-sidebar"> + </ul> + </div> + </nav> + </header> + <!-- Left side column. contains the logo and sidebar --> + <aside class="main-sidebar"> - <!-- sidebar: style can be found in sidebar.less --> - <section class="sidebar"> + <!-- sidebar: style can be found in sidebar.less --> + <section class="sidebar"> - {% comment "Uncomment if needed" %} + {% comment "Uncomment if needed" %} <!-- Sidebar user panel (optional) --> <div class="user-panel"> <div class="pull-left image"> @@ -233,7 +236,7 @@ desired effect </div> {% endcomment %} - {% comment "Uncomment if necessary' %} + {% comment "Uncomment if necessary' %} <!-- search form (Optional) --> <form action="#" method="get" class="sidebar-form"> <div class="input-group"> @@ -247,60 +250,60 @@ desired effect <!-- /.search form --> {% endcomment %} - <!-- Sidebar Menu --> - <ul class="sidebar-menu"> - <li class="header">Pages</li> - - <li data-desc="subjects"> - <a href="{% url 'web.views.subjects' %}"> - <i class="fa fa-users"></i> - <span>Subjects</span> - </a> - </li> - - <li data-desc="visits"> - <a href="{% url 'web.views.visits' %}"> - <i class="fa fa-id-card-o"></i> - <span>Visits</span> - </a> - </li> - - <li data-desc="appointments"> - <a href="{% url 'web.views.appointments' %}"> - <i class="fa fa-calendar"></i> - <span>Appointments</span> - </a> - </li> - - <li data-desc="workers"> - <a href="{% url 'web.views.doctors' %}"> - <i class="fa fa-user-md"></i> - <span>Workers</span> - </a> - </li> - - <li data-desc="equipment_and_rooms"> - <a href="{% url 'web.views.equipment_and_rooms' %}"> - <i class="fa fa-building-o"></i> - <span>Equipment&rooms</span> - </a> - </li> - - <li data-desc="mail_templates"> - <a href="{% url 'web.views.mail_templates' %}"> - <i class="fa fa-envelope-o"></i> - <span>Mail templates</span> - </a> - </li> - - <li data-desc="export"> - <a href="{% url 'web.views.export' %}"> - <i class="fa fa-file-excel-o"></i> - <span>Export</span> - </a> - </li> - - {% comment "Multi-level" %} + <!-- Sidebar Menu --> + <ul class="sidebar-menu"> + <li class="header">Pages</li> + + <li data-desc="subjects"> + <a href="{% url 'web.views.subjects' %}"> + <i class="fa fa-users"></i> + <span>Subjects</span> + </a> + </li> + + <li data-desc="visits"> + <a href="{% url 'web.views.visits' %}"> + <i class="fa fa-id-card-o"></i> + <span>Visits</span> + </a> + </li> + + <li data-desc="appointments"> + <a href="{% url 'web.views.appointments' %}"> + <i class="fa fa-calendar"></i> + <span>Appointments</span> + </a> + </li> + + <li data-desc="workers"> + <a href="{% url 'web.views.doctors' %}"> + <i class="fa fa-user-md"></i> + <span>Workers</span> + </a> + </li> + + <li data-desc="equipment_and_rooms"> + <a href="{% url 'web.views.equipment_and_rooms' %}"> + <i class="fa fa-building-o"></i> + <span>Equipment&rooms</span> + </a> + </li> + + <li data-desc="mail_templates"> + <a href="{% url 'web.views.mail_templates' %}"> + <i class="fa fa-envelope-o"></i> + <span>Mail templates</span> + </a> + </li> + + <li data-desc="export"> + <a href="{% url 'web.views.export' %}"> + <i class="fa fa-file-excel-o"></i> + <span>Export</span> + </a> + </li> + + {% comment "Multi-level" %} <li class="treeview"> <a href="#"><i class="fa fa-link"></i> <span>Multilevel</span> <span class="pull-right-container"> @@ -313,55 +316,55 @@ desired effect </ul> </li> {% endcomment %} - </ul> - <!-- /.sidebar-menu --> - </section> - <!-- /.sidebar --> - </aside> - - <!-- Content Wrapper. Contains page content --> - <div class="content-wrapper"> - <!-- Content Header (Page header) --> - <section class="content-header"> - <h1> - {% block page_header %}{% endblock page_header %} - <small>{% block page_description %}{% endblock page_description %}</small> - </h1> - - <ol class="breadcrumb"> - {% block breadcrumb %} - <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li> - <li class="active">Index</li> - {% endblock breadcrumb %} - </ol> - </section> - - - <!-- Main content --> - <section class="content"> - {% block maincontent %} - {% endblock maincontent %} - </section> - <!-- /.content --> - </div> - <!-- /.content-wrapper --> - - <!-- Main Footer --> - <footer class="main-footer"> - {% block footer %} - <!-- To the right --> - <div class="pull-right hidden-xs"> - Version: <strong>preview 0.3.1</strong> (20 Mar 2017) - </div> - - <!-- Default to the left --> - 2017, Parkinson Research Clinic <!--(eg. <small> + </ul> + <!-- /.sidebar-menu --> + </section> + <!-- /.sidebar --> + </aside> + + <!-- Content Wrapper. Contains page content --> + <div class="content-wrapper"> + <!-- Content Header (Page header) --> + <section class="content-header"> + <h1> + {% block page_header %}{% endblock page_header %} + <small>{% block page_description %}{% endblock page_description %}</small> + </h1> + + <ol class="breadcrumb"> + {% block breadcrumb %} + <li><a href="#"><i class="fa fa-dashboard"></i> Dashboard</a></li> + <li class="active">Index</li> + {% endblock breadcrumb %} + </ol> + </section> + + + <!-- Main content --> + <section class="content"> + {% block maincontent %} + {% endblock maincontent %} + </section> + <!-- /.content --> + </div> + <!-- /.content-wrapper --> + + <!-- Main Footer --> + <footer class="main-footer"> + {% block footer %} + <!-- To the right --> + <div class="pull-right hidden-xs"> + Version: <strong>preview 0.3.1</strong> (20 Mar 2017) + </div> + + <!-- Default to the left --> + 2017, Parkinson Research Clinic <!--(eg. <small> <strong>Copyright © 2016 <a href="#">Company</a>.</strong> All rights reserved. </small>)--> - {% endblock footer %} - </footer> + {% endblock footer %} + </footer> - {% comment "Uncomment if sidebar is needed" %} + {% comment "Uncomment if sidebar is needed" %} <!-- Control Sidebar --> <aside class="control-sidebar control-sidebar-dark"> <!-- Create the tabs --> @@ -444,30 +447,30 @@ desired effect <!-- ./wrapper --> - {% block scripts %} - <!-- jQuery 2.2.3 --> - <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> - <!-- Bootstrap 3.3.6 --> - <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> - <!-- AdminLTE Template Helpers (for example- left side bar) --> - <script src="{% static 'AdminLTE/js/app.min.js' %}"></script> +{% block scripts %} + <!-- jQuery 2.2.3 --> + <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> + <!-- Bootstrap 3.3.6 --> + <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> + <!-- AdminLTE Template Helpers (for example- left side bar) --> + <script src="{% static 'AdminLTE/js/app.min.js' %}"></script> - <script> - var activate = function(page_to_activate) { - var $e = $(".sidebar-menu > li[data-desc='" + page_to_activate + "']"); - $e.addClass("active"); - }; + <script> + var activate = function (page_to_activate) { + var $e = $(".sidebar-menu > li[data-desc='" + page_to_activate + "']"); + $e.addClass("active"); + }; - activate({% block ui_active_tab %}{% endblock ui_active_tab %}); + activate({% block ui_active_tab %}{% endblock ui_active_tab %}); - </script> + </script> - {% comment "TODO: Check, and add if works %} + {% comment "TODO: Check, and add if works %} <!-- Optionally, you can add Slimscroll and FastClick plugins. Both of these plugins are recommended to enhance the user experience. Slimscroll is required when using the fixed layout. --> {% endcomment %} - {% endblock scripts %} +{% endblock scripts %} </body> </html> diff --git a/smash/web/templates/appointments/add.html b/smash/web/templates/appointments/add.html index 5b1bcef0884cf18657badba9c33d1ea6e5e61408..07b201acf2ac1faa2db151a7fe48ed68e269298d 100644 --- a/smash/web/templates/appointments/add.html +++ b/smash/web/templates/appointments/add.html @@ -3,15 +3,15 @@ {% load filters %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ 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.print.css' %}" media="print"> + <!-- fullCalendar 2.2.5--> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.print.css' %}" media="print"> - {% include "includes/datetimepicker.css.html" %} + {% include "includes/datetimepicker.css.html" %} {% endblock styles %} {% block ui_active_tab %}'appointments'{% endblock ui_active_tab %} @@ -21,141 +21,140 @@ {% block title %}{{ block.super }} - Add new appoitnment{% endblock %} {% block breadcrumb %} -{% include "appointments/breadcrumb.html" %} + {% include "appointments/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default">Cancel</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default">Cancel</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Adding an appointment</h3> </div>{% endcomment %} - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} - <div class="box-body"> - <div class="col-sm-6"> - {% for field in form %} - <div class="form-group {% if field.errors %}has-error{% endif %}"> - <label class="col-sm-4 control-label"> - {{ field.label }} - </label> + <div class="box-body"> + <div class="col-sm-6"> + {% for field in form %} + <div class="form-group {% if field.errors %}has-error{% endif %}"> + <label class="col-sm-4 control-label"> + {{ field.label }} + </label> - <div class="col-sm-8"> - {{ field|add_class:'form-control' }} - </div> + <div class="col-sm-8"> + {{ field|add_class:'form-control' }} + </div> - {% if field.errors %} - <span class="help-block"> + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - </div> - <div class="col-md-6"> - <div class="box box-primary"> - <div class="box-body no-padding"> - <div id="calendar"></div> - </div> - </div> - </div> - </div><!-- /.box-body --> + {% endif %} + </div> + {% endfor %} + </div> + <div class="col-md-6"> + <div class="box box-primary"> + <div class="box-body no-padding"> + <div id="calendar"></div> + </div> + </div> + </div> + </div><!-- /.box-body --> + <div class="box-footer"> + <div class="col-sm-6"> + <button type="submit" class="btn btn-block btn-success">Add</button> + </div> + <div class="col-sm-6"> + <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default">Cancel</a> + </div> + </div><!-- /.box-footer --> + </form> - <div class="box-footer"> - <div class="col-sm-6"> - <button type="submit" class="btn btn-block btn-success">Add</button> - </div> - <div class="col-sm-6"> - <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default">Cancel</a> - </div> - </div><!-- /.box-footer --> - </form> + </div> -</div> - -{% endblock %} + {% endblock %} {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.js' %}"></script> - <script src="{% static 'js/appointment.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek' - }, - editable: false, - dayClick: function(date, jsEvent, view) { - var dateString = date.format(); - if (dateString.indexOf("T")>=0) { - dateString=dateString.replace("T"," "); - } else { - dateString=dateString+" 09:00"; - } - document.getElementById("id_datetime_when").value = dateString; - - }, - eventClick: function(calEvent, jsEvent, view) { - - var dateString = calEvent.start.format(); - if (dateString.indexOf("T")>0) { - dateString=dateString.replace("T"," "); - } else { - dateString=dateString+" 09:00"; - } - if (dateString.indexOf("+")>=0) { - dateString= dateString.substring(0,dateString.indexOf("+")); - } - document.getElementById("id_datetime_when").value = dateString; - - }, - events: [ - {% for appointment in full_appointment_list %} - { - title: '{{ appointment.title }}', - start: '{{ appointment.datetime_when | date:"c" }}', - end: '{{ appointment.datetime_until | date:"c" }}', - color: '{{ appointment.color }}', - subject_id: '{{ appointment.visit.subject.id }}', - id: '{{ appointment.id }}' - }, - {% endfor %} - ], - }); - - }); - - appointment_type_begaviour($("[name='appointment_types']"), $("[name='length']"), "{% url 'web.api.appointment_types' %}"); - </script> - - {% include "includes/datetimepicker.js.html" %} + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.js' %}"></script> + <script src="{% static 'js/appointment.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + + $('#calendar').fullCalendar({ + header: { + left: 'prev,next today', + center: 'title', + right: 'month,agendaWeek' + }, + editable: false, + dayClick: function (date, jsEvent, view) { + var dateString = date.format(); + if (dateString.indexOf("T") >= 0) { + dateString = dateString.replace("T", " "); + } else { + dateString = dateString + " 09:00"; + } + document.getElementById("id_datetime_when").value = dateString; + + }, + eventClick: function (calEvent, jsEvent, view) { + + var dateString = calEvent.start.format(); + if (dateString.indexOf("T") > 0) { + dateString = dateString.replace("T", " "); + } else { + dateString = dateString + " 09:00"; + } + if (dateString.indexOf("+") >= 0) { + dateString = dateString.substring(0, dateString.indexOf("+")); + } + document.getElementById("id_datetime_when").value = dateString; + + }, + events: [ + {% for appointment in full_appointment_list %} + { + title: '{{ appointment.title }}', + start: '{{ appointment.datetime_when | date:"c" }}', + end: '{{ appointment.datetime_until | date:"c" }}', + color: '{{ appointment.color }}', + subject_id: '{{ appointment.visit.subject.id }}', + id: '{{ appointment.id }}' + }, + {% endfor %} + ], + }); + + }); + + appointment_type_begaviour($("[name='appointment_types']"), $("[name='length']"), "{% url 'web.api.appointment_types' %}"); + </script> + + {% include "includes/datetimepicker.js.html" %} {% endblock scripts %} diff --git a/smash/web/templates/appointments/breadcrumb.html b/smash/web/templates/appointments/breadcrumb.html index 888712c0475077b95e76af8fb36c4006d997c13b..b498c40ebda5d69879ca558b797b19d9b6ba09b3 100644 --- a/smash/web/templates/appointments/breadcrumb.html +++ b/smash/web/templates/appointments/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.appointments' %}">Appointments</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 class="active"><a href="{% url 'web.views.appointments' %}">Appointments</a></li> \ No newline at end of file diff --git a/smash/web/templates/appointments/details.html b/smash/web/templates/appointments/details.html index 28d1ef3b47aef5e3fef916b7836a4d9187ae7e36..278f5bb5ccf9ef50c71914ad7ac1580f32f238bc 100644 --- a/smash/web/templates/appointments/details.html +++ b/smash/web/templates/appointments/details.html @@ -3,11 +3,11 @@ {% load filters %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> - {% include "includes/datetimepicker.css.html" %} + {% include "includes/datetimepicker.css.html" %} {% endblock styles %} {% block ui_active_tab %}'appointments'{% endblock ui_active_tab %} @@ -17,50 +17,52 @@ {% block title %} - Details of appointment{% endblock %} {% block breadcrumb %} -<!--{% include "appointments/breadcrumb.html" %}--> + <!--{% include "appointments/breadcrumb.html" %}--> {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default" onclick="history.back()">Go back</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default" onclick="history.back()">Go + back</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Details of worker</h3> </div>{% endcomment %} - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} - <div class="box-body"> - {% for field in form %} - <div class="form-group"> - <label class="col-sm-3 control-label"> - {{ field.label }} - </label> + <div class="box-body"> + {% for field in form %} + <div class="form-group"> + <label class="col-sm-3 control-label"> + {{ field.label }} + </label> - <div class="col-sm-9"> - {{ field|add_class:'form-control' }} - </div> + <div class="col-sm-9"> + {{ field|add_class:'form-control' }} + </div> - {% if field.help_text %} - <span class="help-block"> + {% if field.help_text %} + <span class="help-block"> {{ field.help_text }} </span> - {% endif %} - </div> - {% endfor %} - </div><!-- /.box-body --> + {% endif %} + </div> + {% endfor %} + </div><!-- /.box-body --> - <div class="box-footer"> - <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default" onclick="history.back()">Go back</a> - </div><!-- /.box-footer --> - </form> -</div> -{% endblock %} + <div class="box-footer"> + <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default" + onclick="history.back()">Go back</a> + </div><!-- /.box-footer --> + </form> + </div> + {% endblock %} @@ -68,22 +70,22 @@ {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> - - {% include "includes/datetimepicker.js.html" %} + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> + + {% include "includes/datetimepicker.js.html" %} {% endblock scripts %} diff --git a/smash/web/templates/appointments/edit.html b/smash/web/templates/appointments/edit.html index 8663014d7112a134ad02e617b655c0733fb68862..93ff194ab063c0799e0391d39e336babcbcb557d 100644 --- a/smash/web/templates/appointments/edit.html +++ b/smash/web/templates/appointments/edit.html @@ -3,11 +3,11 @@ {% load filters %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> - {% include "includes/datetimepicker.css.html" %} + {% include "includes/datetimepicker.css.html" %} {% endblock styles %} {% block ui_active_tab %}'appointments'{% endblock ui_active_tab %} @@ -17,98 +17,105 @@ {% block title %} - Edit appointment information{% endblock %} {% block breadcrumb %} -{% include "appointments/breadcrumb.html" %} + {% include "appointments/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default" onclick="history.back()">Go back (without changes)</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default" onclick="history.back()">Go + back (without changes)</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Details of appointment</h3> </div>{% endcomment %} - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} - <div class="box-body"> - {% for field in form %} - <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> - <label for="{# TODO #}" class="col-sm-4 control-label"> - {{ field.label }} - </label> + <div class="box-body"> + {% for field in form %} + <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> + <label for="{# TODO #}" class="col-sm-4 control-label"> + {{ field.label }} + </label> - <div class="col-sm-8"> - {{ field|add_class:'form-control' }} - </div> + <div class="col-sm-8"> + {{ field|add_class:'form-control' }} + </div> - {% if field.errors %} - <span class="help-block"> + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - <div class="col-md-6 form-group"> - <label for="{# TODO #}" class="col-sm-4 control-label"> - Status: - </label> - <div class="btn-group-vertical col-sm-8"> - <label class="btn btn-primary">{{ appointment.status }}</label> - <a href="{% url 'web.views.appointment_mark' id 'finished' %}" class="btn btn-warning btn-block">Mark as finished</a> - <a href="{% url 'web.views.appointment_mark' id 'cancelled' %}" class="btn btn-warning btn-block">Mark as cancelled</a> - <a href="{% url 'web.views.appointment_mark' id 'no_show' %}" class="btn btn-warning btn-block">Mark as no show</a> - </div> - </div> - </div><!-- /.box-body --> - - <div class="box-footer"> - <div class="col-sm-6"> - <button type="submit" class="btn btn-block btn-success">Save</button> - </div> - <div class="col-sm-6"> - <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default" onclick="history.back()">Cancel</a> - </div> - </div><!-- /.box-footer --> - - <div class="box-header with-border"> - <h3 class="box-title">Subject's details</h3> - </div> - - <form class="form-horizontal"> - <div class="box-body"> - {% for field in subject_form %} - <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> - <label for="{# TODO #}" class="col-sm-4 control-label"> - {{ field.label }} - </label> - - <div class="col-sm-8"> - {{ field|disable|add_class:'form-control' }} - </div> - - {% if field.errors %} - <span class="help-block"> + {% endif %} + </div> + {% endfor %} + <div class="col-md-6 form-group"> + <label for="{# TODO #}" class="col-sm-4 control-label"> + Status: + </label> + <div class="btn-group-vertical col-sm-8"> + <label class="btn btn-primary">{{ appointment.status }}</label> + <a href="{% url 'web.views.appointment_mark' id 'finished' %}" + class="btn btn-warning btn-block">Mark as finished</a> + <a href="{% url 'web.views.appointment_mark' id 'cancelled' %}" + class="btn btn-warning btn-block">Mark as cancelled</a> + <a href="{% url 'web.views.appointment_mark' id 'no_show' %}" + class="btn btn-warning btn-block">Mark as no show</a> + </div> + </div> + </div><!-- /.box-body --> + + <div class="box-footer"> + <div class="col-sm-6"> + <button type="submit" class="btn btn-block btn-success">Save</button> + </div> + <div class="col-sm-6"> + <a href="{% url 'web.views.appointments' %}" class="btn btn-block btn-default" + onclick="history.back()">Cancel</a> + </div> + </div><!-- /.box-footer --> + + <div class="box-header with-border"> + <h3 class="box-title">Subject's details</h3> + </div> + + <form class="form-horizontal"> + <div class="box-body"> + {% for field in subject_form %} + <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> + <label for="{# TODO #}" class="col-sm-4 control-label"> + {{ field.label }} + </label> + + <div class="col-sm-8"> + {{ field|disable|add_class:'form-control' }} + </div> + + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - </div><!-- /.box-body --> + {% endif %} + </div> + {% endfor %} + </div><!-- /.box-body --> - <div class="box-footer"> - <a href="{% url 'web.views.subject_edit' appointment.visit.subject.id %}" type="button" class="btn btn-block btn-default">Edit subject</a> - <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Back</a> - </div><!-- /.box-footer --> - </form> + <div class="box-footer"> + <a href="{% url 'web.views.subject_edit' appointment.visit.subject.id %}" type="button" + class="btn btn-block btn-default">Edit subject</a> + <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" + onclick="history.back()">Back</a> + </div><!-- /.box-footer --> + </form> - </form> -</div> -{% endblock %} + </form> + </div> + {% endblock %} @@ -116,24 +123,24 @@ {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script src="{% static 'js/appointment.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - appointment_type_begaviour($("[name='appointment_types']"), $("[name='length']"), "{% url 'web.api.appointment_types' %}"); - </script> - - {% include "includes/datetimepicker.js.html" %} + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script src="{% static 'js/appointment.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + appointment_type_begaviour($("[name='appointment_types']"), $("[name='length']"), "{% url 'web.api.appointment_types' %}"); + </script> + + {% include "includes/datetimepicker.js.html" %} {% endblock scripts %} diff --git a/smash/web/templates/appointments/index.html b/smash/web/templates/appointments/index.html index 32897aeadf746587ad0387a02aa207d89e557d2c..8fef6073fa2bcc8dc84688618f365c2658429e45 100644 --- a/smash/web/templates/appointments/index.html +++ b/smash/web/templates/appointments/index.html @@ -2,13 +2,13 @@ {% load static %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ 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.print.css' %}" media="print"> + <!-- fullCalendar 2.2.5--> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.print.css' %}" media="print"> {% endblock styles %} {% block ui_active_tab %}'appointments'{% endblock ui_active_tab %} @@ -18,149 +18,153 @@ {% block title %}{{ block.super }} - Appointments{% endblock %} {% block breadcrumb %} -{% include "appointments/breadcrumb.html" %} + {% include "appointments/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -<div class="row"> - <div class="col-md-5"> - <h3>Planning</h3> - - {% if planning_list %} - <table id="planning_table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>Subject name</th> - <th>Subject's details</th> - <th>Suggested date</th> - <th>Plan/Modify</th> - </tr> - </thead> - <tbody> - {% for planned in planning_list %} - <tr> - <td>{{ planned.visit.subject.first_name }} {{ planned.visit.subject.last_name }}</td> - <td> - <a href="{% url 'web.views.subject_edit' planned.visit.subject.id %}" type="button" class="btn btn-block btn-default">Subject's details</a> - </td> - <td> - {{ planned.datetime_when }} - </td> - <td> - <a href="{% url 'web.views.appointment_edit_datetime' planned.id %}" type="button" class="btn btn-block btn-default">Plan/Modify</a> - </td> - </tr> - {% endfor %} - </tbody> - </table> - - {% else %} - <p>No visits to plan in close future.</p> - {% endif %} - - <hr /> - - <h3>Approaching</h3> - - {% if approaching_list %} - <table id="approaching_table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>Subject</th> - <th>Visit</th> - <th>Type</th> - <th>Date</th> - <th>Details</th> - </tr> - </thead> - <tbody> - - {% for approach in approaching_list %} - <tr> - {% if approach.visit.subject.screening_number == "---" %} - <td> - </td> - <td> - </td> - {% else %} - <td> - {{ approach.visit.subject.first_name }} {{ approach.visit.subject.last_name }} ({{ approach.visit.subject.nd_number }}) - </td> - <td> - {{ approach.visit.follow_up_title }} - </td> - {% endif %} - <td> - {% for type in approach.appointment_types.all %} - {{ type.code }}, - {% endfor %} - </td> - <td>{{ approach.datetime_when | date:"Y-m-d H:i" }}</td> - <td> - <a href="{% url 'web.views.appointment_edit' approach.id %}" type="button" class="btn btn-block btn-default">Details</a> - </td> - </tr> - {% endfor %} - </tbody> - </table> - - {% else %} - <p>No visits approaching in close future.</p> - {% endif %} - </div> - - <div class="col-md-7"> - <div class="box box-primary"> - <div class="box-body no-padding"> - <div id="calendar"></div> - </div> - </div> - </div> -</div> + <div class="row"> + <div class="col-md-5"> + <h3>Planning</h3> + + {% if planning_list %} + <table id="planning_table" class="table table-bordered table-striped"> + <thead> + <tr> + <th>Subject name</th> + <th>Subject's details</th> + <th>Suggested date</th> + <th>Plan/Modify</th> + </tr> + </thead> + <tbody> + {% for planned in planning_list %} + <tr> + <td>{{ planned.visit.subject.first_name }} {{ planned.visit.subject.last_name }}</td> + <td> + <a href="{% url 'web.views.subject_edit' planned.visit.subject.id %}" type="button" + class="btn btn-block btn-default">Subject's details</a> + </td> + <td> + {{ planned.datetime_when }} + </td> + <td> + <a href="{% url 'web.views.appointment_edit_datetime' planned.id %}" type="button" + class="btn btn-block btn-default">Plan/Modify</a> + </td> + </tr> + {% endfor %} + </tbody> + </table> + + {% else %} + <p>No visits to plan in close future.</p> + {% endif %} + + <hr/> + + <h3>Approaching</h3> + + {% if approaching_list %} + <table id="approaching_table" class="table table-bordered table-striped"> + <thead> + <tr> + <th>Subject</th> + <th>Visit</th> + <th>Type</th> + <th>Date</th> + <th>Details</th> + </tr> + </thead> + <tbody> + + {% for approach in approaching_list %} + <tr> + {% if approach.visit.subject.screening_number == "---" %} + <td> + </td> + <td> + </td> + {% else %} + <td> + {{ approach.visit.subject.first_name }} {{ approach.visit.subject.last_name }} + ({{ approach.visit.subject.nd_number }}) + </td> + <td> + {{ approach.visit.follow_up_title }} + </td> + {% endif %} + <td> + {% for type in approach.appointment_types.all %} + {{ type.code }}, + {% endfor %} + </td> + <td>{{ approach.datetime_when | date:"Y-m-d H:i" }}</td> + <td> + <a href="{% url 'web.views.appointment_edit' approach.id %}" type="button" + class="btn btn-block btn-default">Details</a> + </td> + </tr> + {% endfor %} + </tbody> + </table> + + {% else %} + <p>No visits approaching in close future.</p> + {% endif %} + </div> + + <div class="col-md-7"> + <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/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.js' %}"></script> - - <script> - $(function () { - $('#planning_table, #approaching_table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "order": [[ 3, "asc"]], - "info": true, - "autoWidth": false - }); - - $('#calendar').fullCalendar({ - header: { - left: 'prev,next today', - center: 'title', - right: 'month,agendaWeek', - }, - editable: false, - weekNumbers: true, - events: [ - {% for appointment in full_list %} - { - title: '{{ appointment.title }}', - start: '{{ appointment.datetime_when | date:"c" }}', - end: '{{ appointment.datetime_until | date:"c" }}', - color: '{{ appointment.color }}', - subject_id: '{{ appointment.visit.subject.id }}', - id: '{{ appointment.id }}', - url: '{% url 'web.views.appointment_edit' appointment.id %}', - }, - {% endfor %} - ], - }); - }); - </script> + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.js' %}"></script> + + <script> + $(function () { + $('#planning_table, #approaching_table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "order": [[3, "asc"]], + "info": true, + "autoWidth": false + }); + + $('#calendar').fullCalendar({ + header: { + left: 'prev,next today', + center: 'title', + right: 'month,agendaWeek', + }, + editable: false, + weekNumbers: true, + events: [ + {% for appointment in full_list %} + { + title: '{{ appointment.title }}', + start: '{{ appointment.datetime_when | date:"c" }}', + end: '{{ appointment.datetime_until | date:"c" }}', + color: '{{ appointment.color }}', + subject_id: '{{ appointment.visit.subject.id }}', + id: '{{ appointment.id }}', + url: '{% url 'web.views.appointment_edit' appointment.id %}', + }, + {% endfor %} + ], + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/appointments/list.html b/smash/web/templates/appointments/list.html index 1c7393d3a5c5307af237f5caf01b8c0e909aea65..19ccaa1f2ca20de2bb8d46e83de62cf0065917de 100644 --- a/smash/web/templates/appointments/list.html +++ b/smash/web/templates/appointments/list.html @@ -2,13 +2,13 @@ {% load static %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ 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.print.css' %}" media="print"> + <!-- fullCalendar 2.2.5--> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.print.css' %}" media="print"> {% endblock styles %} {% block ui_active_tab %}'appointments'{% endblock ui_active_tab %} @@ -18,53 +18,55 @@ {% block title %}{{ block.super }} - Appointments{% endblock %} {% block breadcrumb %} -{% include "appointments/breadcrumb.html" %} + {% include "appointments/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -<div class="row"> - <div class="col-md-16"> - <table id="approaching_table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>Subject</th> - <th>Visit</th> - <th>Type</th> - <th>Date</th> - <th>Details</th> - </tr> - </thead> - <tbody> + <div class="row"> + <div class="col-md-16"> + <table id="approaching_table" class="table table-bordered table-striped"> + <thead> + <tr> + <th>Subject</th> + <th>Visit</th> + <th>Type</th> + <th>Date</th> + <th>Details</th> + </tr> + </thead> + <tbody> - {% for approach in appointment_list %} - <tr> - {% if approach.visit.subject.screening_number == "---" %} - <td> - </td> - <td> - </td> - {% else %} - <td> - {{ approach.visit.subject.first_name }} {{ approach.visit.subject.last_name }} ({{ approach.visit.subject.nd_number }}) - </td> - <td> - {{ approach.visit.follow_up_title }} - </td> - {% endif %} - <td> - {% for type in approach.appointment_types.all %} - {{ type.code }}, - {% endfor %} - </td> - <td>{{ approach.datetime_when | date:"Y-m-d H:i" }}</td> - <td> - <a href="{% url 'web.views.appointment_edit' approach.id %}" type="button" class="btn btn-block btn-default">Details</a> - </td> - </tr> - {% endfor %} - </tbody> - </table> + {% for approach in appointment_list %} + <tr> + {% if approach.visit.subject.screening_number == "---" %} + <td> + </td> + <td> + </td> + {% else %} + <td> + {{ approach.visit.subject.first_name }} {{ approach.visit.subject.last_name }} + ({{ approach.visit.subject.nd_number }}) + </td> + <td> + {{ approach.visit.follow_up_title }} + </td> + {% endif %} + <td> + {% for type in approach.appointment_types.all %} + {{ type.code }}, + {% endfor %} + </td> + <td>{{ approach.datetime_when | date:"Y-m-d H:i" }}</td> + <td> + <a href="{% url 'web.views.appointment_edit' approach.id %}" type="button" + class="btn btn-block btn-default">Details</a> + </td> + </tr> + {% endfor %} + </tbody> + </table> - </div> -</div> + </div> + </div> {% endblock maincontent %} diff --git a/smash/web/templates/doctors/add.html b/smash/web/templates/doctors/add.html index 07b4ff4b8dad351150281de94ac531409f4dddf3..e70a0b8064a6daa80de09dd812fe18bb26cc1228 100644 --- a/smash/web/templates/doctors/add.html +++ b/smash/web/templates/doctors/add.html @@ -3,8 +3,8 @@ {% load filters %} {% block styles %} -{{ block.super }} -<link rel="stylesheet" href="{% static 'AdminLTE/plugins/awesomplete/awesomplete.css' %}" /> + {{ block.super }} + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/awesomplete/awesomplete.css' %}"/> {% endblock styles %} {% block ui_active_tab %}'workers'{% endblock ui_active_tab %} @@ -14,57 +14,57 @@ {% block title %}{{ block.super }} - Add new worker{% endblock %} {% block breadcrumb %} -{% include "doctors/breadcrumb.html" %} + {% include "doctors/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default">Go back (without changes)</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default">Go back (without changes)</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Add new worker</h3> </div>{% endcomment %} - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} - <div class="box-body"> - <div class="col-sm-6"> - {% for field in form %} - <div class="form-group {% if field.errors %}has-error{% endif %}"> - <label for="{# TODO #}" class="col-sm-4 control-label"> - {{ field.label }} - </label> + <div class="box-body"> + <div class="col-sm-6"> + {% for field in form %} + <div class="form-group {% if field.errors %}has-error{% endif %}"> + <label for="{# TODO #}" class="col-sm-4 control-label"> + {{ field.label }} + </label> - <div class="col-sm-8"> - {{ field|add_class:'form-control' }} - </div> + <div class="col-sm-8"> + {{ field|add_class:'form-control' }} + </div> - {% if field.errors %} - <span class="help-block"> + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - </div> - </div><!-- /.box-body --> + {% endif %} + </div> + {% endfor %} + </div> + </div><!-- /.box-body --> - <div class="box-footer"> - <div class="col-sm-6"> - <button type="submit" class="btn btn-block btn-success">Add</button> - </div> - <div class="col-sm-6"> - <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default">Cancel</a> - </div> - </div><!-- /.box-footer --> - </form> -</div> -{% endblock %} + <div class="box-footer"> + <div class="col-sm-6"> + <button type="submit" class="btn btn-block btn-success">Add</button> + </div> + <div class="col-sm-6"> + <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default">Cancel</a> + </div> + </div><!-- /.box-footer --> + </form> + </div> + {% endblock %} @@ -72,17 +72,17 @@ {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/awesomplete/awesomplete.min.js' %}"></script> - <script> - // If ever to debug and thinking why it doesn't work => look if theres 'null' in data from API - $.get("{% url 'web.api.specializations' %}", function(data) { - new Awesomplete(document.querySelector("#id_specialization")).list = data.specializations; - }); - $.get("{% url 'web.api.units' %}", function(data) { - new Awesomplete(document.querySelector("#id_unit")).list = data.units; - }); - </script> + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/awesomplete/awesomplete.min.js' %}"></script> + <script> + // If ever to debug and thinking why it doesn't work => look if theres 'null' in data from API + $.get("{% url 'web.api.specializations' %}", function (data) { + new Awesomplete(document.querySelector("#id_specialization")).list = data.specializations; + }); + $.get("{% url 'web.api.units' %}", function (data) { + new Awesomplete(document.querySelector("#id_unit")).list = data.units; + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/doctors/availability_delete.html b/smash/web/templates/doctors/availability_delete.html index accf25c0406706178d41ba8401b18ee9bf982f4a..06163f25086be9245d7d420fa404fdc634d54990 100644 --- a/smash/web/templates/doctors/availability_delete.html +++ b/smash/web/templates/doctors/availability_delete.html @@ -2,9 +2,9 @@ {% load static %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} {% block ui_active_tab %}'workers'{% endblock ui_active_tab %} @@ -12,235 +12,241 @@ {% block page_description %}avaibility{% endblock page_description %} {% block breadcrumb %} -{% include "doctors/breadcrumb.html" %} + {% include "doctors/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -<div class="box-body"> - - <h3>Monday</h3> - {% if avmon %} - <table id = "tabmon" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <th>Remove</th> - </tr> - </thead> - <tbody> - {% for record in avmon %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - - {% else %} - <p>No avaibilities on Monday.</p> - {% endif %} - - <div> - <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - <h3>Tuesday</h3> - {% if avtue %} - <table id = "tabtue" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <td> Remove </td> - </tr> - </thead> - <tbody> - {% for record in avtue %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - - {% else %} - <p>No avaibilities on Tuesday.</p> - {% endif %} - - <div> - <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - <h3>Wednesday</h3> - {% if avwed %} - <table id = "tabwed" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <td> Remove </td> - </tr> - </thead> - <tbody> - {% for record in avwed %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - - {% else %} - <p>No avaibilities on Wednesday.</p> - {% endif %} - - <div> - <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - <h3>Thursday</h3> - {% if avthu %} - <table id = "tabmon" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <td> Remove </td> - </tr> - </thead> - <tbody> - {% for record in avthu %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - - {% else %} - <p>No avaibilities on Thursday.</p> - {% endif %} - - <div> - <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - <h3>Friday</h3> - {% if avfri %} - <table id = "tabmon" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <td> Remove </td> - </tr> - </thead> - <tbody> - {% for record in avfri %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - - {% else %} - <p>No avaibilities on Friday.</p> - {% endif %} - - <div> - <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - <h3>Saturday</h3> - {% if avsat %} - <table id = "tabmon" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <th>Remove</th> - </tr> - </thead> - <tbody> - {% for record in avsat %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - - {% else %} - <p>No avaibilities on Saturday.</p> - {% endif %} - - <div> - <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - -</div> + <div class="box-body"> + + <h3>Monday</h3> + {% if avmon %} + <table id="tabmon" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <th>Remove</th> + </tr> + </thead> + <tbody> + {% for record in avmon %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + + {% else %} + <p>No avaibilities on Monday.</p> + {% endif %} + + <div> + <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + <h3>Tuesday</h3> + {% if avtue %} + <table id="tabtue" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <td> Remove</td> + </tr> + </thead> + <tbody> + {% for record in avtue %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + + {% else %} + <p>No avaibilities on Tuesday.</p> + {% endif %} + + <div> + <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + <h3>Wednesday</h3> + {% if avwed %} + <table id="tabwed" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <td> Remove</td> + </tr> + </thead> + <tbody> + {% for record in avwed %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + + {% else %} + <p>No avaibilities on Wednesday.</p> + {% endif %} + + <div> + <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + <h3>Thursday</h3> + {% if avthu %} + <table id="tabmon" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <td> Remove</td> + </tr> + </thead> + <tbody> + {% for record in avthu %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + + {% else %} + <p>No avaibilities on Thursday.</p> + {% endif %} + + <div> + <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + <h3>Friday</h3> + {% if avfri %} + <table id="tabmon" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <td> Remove</td> + </tr> + </thead> + <tbody> + {% for record in avfri %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + + {% else %} + <p>No avaibilities on Friday.</p> + {% endif %} + + <div> + <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + <h3>Saturday</h3> + {% if avsat %} + <table id="tabmon" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <th>Remove</th> + </tr> + </thead> + <tbody> + {% for record in avsat %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + + {% else %} + <p>No avaibilities on Saturday.</p> + {% endif %} + + <div> + <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + </div> {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": false, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": false, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/doctors/availability_index.html b/smash/web/templates/doctors/availability_index.html index 30264f0750a964c7fa27e95f33b7f70b269c7291..770b20a8c6ab6c006cc119b7cbfc8ab63637a5fa 100644 --- a/smash/web/templates/doctors/availability_index.html +++ b/smash/web/templates/doctors/availability_index.html @@ -2,9 +2,9 @@ {% load static %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} {% block ui_active_tab %}'workers'{% endblock ui_active_tab %} @@ -12,309 +12,317 @@ {% block page_description %}avaibility{% endblock page_description %} {% block breadcrumb %} -{% include "doctors/breadcrumb.html" %} + {% include "doctors/breadcrumb.html" %} {% endblock breadcrumb %} {% 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 center"> - <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> + <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 center"> + <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> + + <div> + <h3>Monday</h3> + + <div class="new-availability"> + <a href="#" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + {% if avmon %} + <table id="tabmon" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <th>Remove</th> + </tr> + </thead> + <tbody> + {% for record in avmon %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + {% else %} + <p>No avaibilities on Monday.</p> + {% endif %} + </div> + + <hr/> + + <div> + <h3>Tuesday</h3> + + <div class="new-availability"> + <a href="#" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + {% if avtue %} + <table id="tabtue" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <td> Remove</td> + </tr> + </thead> + <tbody> + {% for record in avtue %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + {% else %} + <p>No avaibilities on Tuesday.</p> + {% endif %} + </div> + + <hr/> + + <div> + <h3>Wednesday</h3> + + <div class="new-availability"> + <a href="#" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + {% if avwed %} + <table id="tabwed" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <td> Remove</td> + </tr> + </thead> + <tbody> + {% for record in avwed %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + {% else %} + <p>No avaibilities on Wednesday.</p> + {% endif %} + </div> + + <hr/> + + <div> + <h3>Thursday</h3> + + <div class="new-availability"> + <a href="#" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + {% if avthu %} + <table id="tabmon" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <td> Remove</td> + </tr> + </thead> + <tbody> + {% for record in avthu %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + {% else %} + <p>No avaibilities on Thursday.</p> + {% endif %} + </div> + + <hr/> + + <div> + <h3>Friday</h3> + + <div class="new-availability"> + <a href="#" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + {% if avfri %} + <table id="tabmon" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <td> Remove</td> + </tr> + </thead> + <tbody> + {% for record in avfri %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + {% else %} + <p>No avaibilities on Friday.</p> + {% endif %} + </div> + + <hr/> + + <div> + <h3>Saturday</h3> + + <div class="new-availability"> + <a href="#" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + {% if avsat %} + <table id="tabmon" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <th>Remove</th> + </tr> + </thead> + <tbody> + {% for record in avsat %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + {% else %} + <p>No avaibilities on Saturday.</p> + {% endif %} + </div> + + <div> + <h3>Sunday</h3> + + <div class="new-availability"> + <a href="#" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new avaibility</a> + </div> + + {% if avsun %} + <table id="tabmon" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>From</th> + <th>Until</th> + <th>Remove</th> + </tr> + </thead> + <tbody> + {% for record in avsun %} + <tr> + <td> {{ forloop.counter }} </td> + <td> {{ record.available_from }} </td> + <td> {{ record.available_till }} </td> + <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" + class="btn btn-block btn-default">Delete</a></td> + </tr> + {% endfor %} + </tbody> + </table> + + {% else %} + <p>No avaibilities on Sunday.</p> + {% endif %} + </div> - <div> - <h3>Monday</h3> - - <div class="new-availability"> - <a href="#" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> </div> - - {% if avmon %} - <table id="tabmon" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <th>Remove</th> - </tr> - </thead> - <tbody> - {% for record in avmon %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - {% else %} - <p>No avaibilities on Monday.</p> - {% endif %} - </div> - - <hr /> - - <div> - <h3>Tuesday</h3> - - <div class="new-availability"> - <a href="#" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - {% if avtue %} - <table id="tabtue" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <td> Remove </td> - </tr> - </thead> - <tbody> - {% for record in avtue %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - {% else %} - <p>No avaibilities on Tuesday.</p> - {% endif %} - </div> - - <hr /> - - <div> - <h3>Wednesday</h3> - - <div class="new-availability"> - <a href="#" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - {% if avwed %} - <table id="tabwed" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <td> Remove </td> - </tr> - </thead> - <tbody> - {% for record in avwed %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - {% else %} - <p>No avaibilities on Wednesday.</p> - {% endif %} - </div> - - <hr /> - - <div> - <h3>Thursday</h3> - - <div class="new-availability"> - <a href="#" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - {% if avthu %} - <table id="tabmon" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <td> Remove </td> - </tr> - </thead> - <tbody> - {% for record in avthu %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - {% else %} - <p>No avaibilities on Thursday.</p> - {% endif %} - </div> - - <hr /> - - <div> - <h3>Friday</h3> - - <div class="new-availability"> - <a href="#" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - {% if avfri %} - <table id="tabmon" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <td> Remove </td> - </tr> - </thead> - <tbody> - {% for record in avfri %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - {% else %} - <p>No avaibilities on Friday.</p> - {% endif %} - </div> - - <hr /> - - <div> - <h3>Saturday</h3> - - <div class="new-availability"> - <a href="#" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - {% if avsat %} - <table id="tabmon" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <th>Remove</th> - </tr> - </thead> - <tbody> - {% for record in avsat %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - {% else %} - <p>No avaibilities on Saturday.</p> - {% endif %} - </div> - - <div> - <h3>Sunday</h3> - - <div class="new-availability"> - <a href="#" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new avaibility</a> - </div> - - {% if avsun %} - <table id="tabmon" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>From</th> - <th>Until</th> - <th>Remove</th> - </tr> - </thead> - <tbody> - {% for record in avsun %} - <tr> - <td> {{forloop.counter}} </td> - <td> {{record.available_from}} </td> - <td> {{record.available_till}} </td> - <td><a href="{% url 'web.views.doctor_availability_delete' id record.id %}" type="button" class="btn btn-block btn-default">Delete</a></td> - </tr> - {% endfor %} - </tbody> - </table> - - {% else %} - <p>No avaibilities on Sunday.</p> - {% endif %} - </div> - -</div> {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": false, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": false, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/doctors/breadcrumb.html b/smash/web/templates/doctors/breadcrumb.html index 09a3e7625def202e840310097a6368a4384005c4..76b5b72095b33b9a7c470f19bb7568d72b7df9b4 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.doctors' %}">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 class="active"><a href="{% url 'web.views.doctors' %}">Workers</a></li> \ No newline at end of file diff --git a/smash/web/templates/doctors/details.html b/smash/web/templates/doctors/details.html index 78317e31e1175bc1314948716644947f18c5cccf..d9cb19ac5116130cad6ce47e68c376c7c17e8ee3 100644 --- a/smash/web/templates/doctors/details.html +++ b/smash/web/templates/doctors/details.html @@ -3,9 +3,9 @@ {% load filters %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} {% block ui_active_tab %}'workers'{% endblock ui_active_tab %} @@ -15,50 +15,52 @@ {% block title %} - Details of worker{% endblock %} {% block breadcrumb %} -{% include "doctors/breadcrumb.html" %} + {% include "doctors/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default" onclick="history.back()">Go back</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default" onclick="history.back()">Go + back</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Details of worker</h3> </div>{% endcomment %} - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} - <div class="box-body"> - {% for field in form %} - <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> - <label for="{# TODO #}" class="col-sm-4 control-label"> - {{ field.label }} - </label> + <div class="box-body"> + {% for field in form %} + <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> + <label for="{# TODO #}" class="col-sm-4 control-label"> + {{ field.label }} + </label> - <div class="col-sm-8"> - {{ field|disable|add_class:'form-control' }} - </div> + <div class="col-sm-8"> + {{ field|disable|add_class:'form-control' }} + </div> - {% if field.errors %} - <span class="help-block"> + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - </div><!-- /.box-body --> + {% endif %} + </div> + {% endfor %} + </div><!-- /.box-body --> - <div class="box-footer"> - <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default" onclick="history.back()">Go back</a> - </div><!-- /.box-footer --> - </form> -</div> -{% endblock %} + <div class="box-footer"> + <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default" onclick="history.back()">Go + back</a> + </div><!-- /.box-footer --> + </form> + </div> + {% endblock %} @@ -66,20 +68,20 @@ {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/doctors/edit.html b/smash/web/templates/doctors/edit.html index 9cbb1d98582ad6f1bc94f39aa762aab2aa47491c..c22db7cc4ad26bcc9889eb2b67261597f9eddf5f 100644 --- a/smash/web/templates/doctors/edit.html +++ b/smash/web/templates/doctors/edit.html @@ -3,9 +3,9 @@ {% load filters %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} {% block ui_active_tab %}'workers'{% endblock ui_active_tab %} @@ -15,55 +15,57 @@ {% block title %} - Edit worker information{% endblock %} {% block breadcrumb %} -{% include "doctors/breadcrumb.html" %} + {% include "doctors/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default" onclick="history.back()">Go back (without changes)</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default" onclick="history.back()">Go + back (without changes)</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Details of worker</h3> </div>{% endcomment %} - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} - <div class="box-body"> - {% for field in form %} - <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> - <label for="{# TODO #}" class="col-sm-4 control-label"> - {{ field.label }} - </label> + <div class="box-body"> + {% for field in form %} + <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> + <label for="{# TODO #}" class="col-sm-4 control-label"> + {{ field.label }} + </label> - <div class="col-sm-8"> - {{ field|add_class:'form-control' }} - </div> + <div class="col-sm-8"> + {{ field|add_class:'form-control' }} + </div> - {% if field.errors %} - <span class="help-block"> + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - </div><!-- /.box-body --> + {% endif %} + </div> + {% endfor %} + </div><!-- /.box-body --> - <div class="box-footer"> - <div class="col-sm-6"> - <button type="submit" class="btn btn-block btn-success">Save</button> - </div> - <div class="col-sm-6"> - <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default" onclick="history.back()">Cancel</a> - </div> - </div><!-- /.box-footer --> - </form> -</div> -{% endblock %} + <div class="box-footer"> + <div class="col-sm-6"> + <button type="submit" class="btn btn-block btn-success">Save</button> + </div> + <div class="col-sm-6"> + <a href="{% url 'web.views.doctors' %}" class="btn btn-block btn-default" + onclick="history.back()">Cancel</a> + </div> + </div><!-- /.box-footer --> + </form> + </div> + {% endblock %} @@ -71,20 +73,20 @@ {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/doctors/index.html b/smash/web/templates/doctors/index.html index 9e166e58e737a6c9dac2884949099b95e3ae337f..c8fc622133ffea7159da87900ea08e590b00c6ed 100644 --- a/smash/web/templates/doctors/index.html +++ b/smash/web/templates/doctors/index.html @@ -2,9 +2,9 @@ {% load static %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} {% block ui_active_tab %}'workers'{% endblock ui_active_tab %} @@ -12,81 +12,86 @@ {% block page_description %}information{% endblock page_description %} {% block breadcrumb %} -{% include "doctors/breadcrumb.html" %} + {% include "doctors/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -<div> - <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new worker</a> -</div> + <div> + <a href="{% url 'web.views.doctor_add' %}" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new worker</a> + </div> -<div class="box-body"> - {% if doctors_list %} - <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>Edit</th> - <th>Availibility details</th> - <th>On leave</th> - </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.doctor_details' worker.id %}" type="button" class="btn btn-block btn-default">Details</a></td> - <td><a href="{% url 'web.views.doctor_edit' worker.id %}" type="button" class="btn btn-block btn-default">Edit</a></td> - <td><a href="{% url 'web.views.doctor_availability' worker.id %}" type="button" class="btn btn-block btn-default">Modify availability</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> - </tr> - {% endfor %} + <div class="box-body"> + {% if doctors_list %} + <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>Edit</th> + <th>Availibility details</th> + <th>On leave</th> + </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.doctor_details' worker.id %}" type="button" + class="btn btn-block btn-default">Details</a></td> + <td><a href="{% url 'web.views.doctor_edit' worker.id %}" type="button" + class="btn btn-block btn-default">Edit</a></td> + <td><a href="{% url 'web.views.doctor_availability' worker.id %}" type="button" + class="btn btn-block btn-default">Modify availability</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> + </tr> + {% endfor %} - </tbody> - </table> - {% else %} - <p>No subjects found.</p> - {% endif %} -</div> + </tbody> + </table> + {% else %} + <p>No subjects found.</p> + {% endif %} + </div> {% endblock maincontent %} {% block scripts %} - {{ block.super }} + {{ block.super }} - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/eqdef/breadcrumb.html b/smash/web/templates/eqdef/breadcrumb.html index cb09d06459637be8314f7a7d29c94ebda1eaec39..888621e6be83367fffadf57ad5f5d6fb7130e823 100644 --- a/smash/web/templates/eqdef/breadcrumb.html +++ b/smash/web/templates/eqdef/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.equipment_def' %}">Equipment definitions</a></li> \ No newline at end of file +<li class="active"><a href="{% url 'web.views.equipment_def' %}">Equipment definitions</a></li> \ No newline at end of file diff --git a/smash/web/templates/eqdef/index.html b/smash/web/templates/eqdef/index.html index d99df097d9a83bbc0bfad7310936b19a9c6ad04a..fbc0dc6e64592cb1a761246edc9c248d46beb7fa 100644 --- a/smash/web/templates/eqdef/index.html +++ b/smash/web/templates/eqdef/index.html @@ -2,9 +2,9 @@ {% load static %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} {% block ui_active_tab %}'eqdef'{% endblock ui_active_tab %} @@ -12,67 +12,73 @@ {% block page_description %}{% endblock page_description %} {% block breadcrumb %} -{% include "eqdef/breadcrumb.html" %} + {% include "eqdef/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -<div> - <a class="btn btn-app"> - <i class="fa fa-plus"></i> Add new equipment type - </a> -</div> + <div> + <a class="btn btn-app"> + <i class="fa fa-plus"></i> Add new equipment type + </a> + </div> -<div class="box-body"> - {% if equipment_list %} - <table id="table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>Name</th> - <th>Is fixed?</th> - <th>Edit</th> - <th>Delete</th> - </tr> - </thead> - <tbody> - {% for equip in equipment_list %} - <tr> - <td>{{ forloop.counter }}</td> - <td>{{ equip.name }}</td> - <td> - {% if equip.isFixed %}<button type="button" class="btn btn-block btn-danger">YES</button> - {% else %}<button type="button" class="btn btn-block btn-success">NO</button> + <div class="box-body"> + {% if equipment_list %} + <table id="table" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>Name</th> + <th>Is fixed?</th> + <th>Edit</th> + <th>Delete</th> + </tr> + </thead> + <tbody> + {% for equip in equipment_list %} + <tr> + <td>{{ forloop.counter }}</td> + <td>{{ equip.name }}</td> + <td> + {% if equip.isFixed %} + <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> + <button type="button" class="btn btn-block btn-default">Edit</button> + </td> + <td> + <button type="button" class="btn btn-block btn-default">Delete</button> + </td> + </tr> + {% endfor %} + </tbody> + </table> + {% else %} + <p>No equipment found.</p> {% endif %} - </td> - <td><button type="button" class="btn btn-block btn-default">Edit</button></td> - <td><button type="button" class="btn btn-block btn-default">Delete</button></td> - </tr> - {% endfor %} - </tbody> - </table> - {% else %} - <p>No equipment found.</p> - {% endif %} -</div> + </div> {% endblock maincontent %} {% block scripts %} - {{ block.super }} + {{ block.super }} - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/equipment_and_rooms/breadcrumb.html b/smash/web/templates/equipment_and_rooms/breadcrumb.html index 2d6f4c7757f189fa4a441f63ff435b1870cf4f1a..247a5d7aa00fd940ae0eec668b31ea3042b78b9a 100644 --- a/smash/web/templates/equipment_and_rooms/breadcrumb.html +++ b/smash/web/templates/equipment_and_rooms/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.equipment_and_rooms' %}">Equipment and rooms</a></li> \ No newline at end of file +<li class="active"><a href="{% url 'web.views.equipment_and_rooms' %}">Equipment and rooms</a></li> \ No newline at end of file diff --git a/smash/web/templates/equipment_and_rooms/index.html b/smash/web/templates/equipment_and_rooms/index.html index 95d68215f8a6193d98efb7ef6bf61095c662c7fb..d9ba8764cd81623bdf3a057e8d9ce708ca61dabc 100644 --- a/smash/web/templates/equipment_and_rooms/index.html +++ b/smash/web/templates/equipment_and_rooms/index.html @@ -6,11 +6,11 @@ {% endblock page_description %} {% block breadcrumb %} -{% include "equipment_and_rooms/breadcrumb.html" %} + {% include "equipment_and_rooms/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% comment %} + {% comment %} <div class="box box-danger box-solid"> <div class="box-header with-border"> <h3 class="box-title">Not yet implemented</h3> @@ -30,8 +30,8 @@ {% endcomment %} -<div class="row"> - {% comment %} + <div class="row"> + {% comment %} <div class="col-md-3"> <div class="bg-red-active small-box"> @@ -78,22 +78,22 @@ </div> {% endcomment %} - <div class="col-md-3"> - <div class="bg-yellow-active small-box"> - <div class="inner"> - <h4>Kit requests</h4> - - <p> </p> - </div> - <div class="icon"> - <i class="ion ion-compose"></i> - </div> - <a href="{% url 'web.views.kit_requests' %}" class="small-box-footer"> - See <i class="fa fa-arrow-circle-right"></i> - </a> - </div> - - {% comment %} + <div class="col-md-3"> + <div class="bg-yellow-active small-box"> + <div class="inner"> + <h4>Kit requests</h4> + + <p> </p> + </div> + <div class="icon"> + <i class="ion ion-compose"></i> + </div> + <a href="{% url 'web.views.kit_requests' %}" class="small-box-footer"> + See <i class="fa fa-arrow-circle-right"></i> + </a> + </div> + + {% comment %} <div class="bg-yellow small-box"> <div class="inner"> <h4>Equipment in rooms</h4> @@ -108,9 +108,9 @@ </a> </div> {% endcomment %} - </div> + </div> - {% comment %} + {% comment %} <div class="col-md-3"> <div class="bg-green-active small-box"> <div class="inner"> @@ -156,5 +156,5 @@ </div> {% endcomment %} -</div> + </div> {% endblock maincontent %} diff --git a/smash/web/templates/equipment_and_rooms/kit_requests.html b/smash/web/templates/equipment_and_rooms/kit_requests.html index b9881bd23f51782703c9782bd84cf63f094082e3..23d9ab9b3245fc72dbcadf1bde9d0fe1c5fee86e 100644 --- a/smash/web/templates/equipment_and_rooms/kit_requests.html +++ b/smash/web/templates/equipment_and_rooms/kit_requests.html @@ -2,102 +2,105 @@ {% block ui_active_tab %}'equipment_and_rooms'{% endblock ui_active_tab %} {% block page_header %} - Kits required between {{ start_date | date:"Y-m-d" }} and {% if end_date %} {{ end_date | date:"Y-m-d" }} {% else %} end of time {% endif %} + Kits required between {{ start_date | date:"Y-m-d" }} and {% if end_date %} {{ end_date | date:"Y-m-d" }} +{% else %} end of time {% endif %} {% endblock page_header %} {% block page_description %} {% endblock page_description %} {% block styles %} -{{ block.super }} - {% include "includes/datepicker.css.html" %} + {{ block.super }} + {% include "includes/datepicker.css.html" %} {% endblock styles %} {% block breadcrumb %} -{% include "equipment_and_rooms/breadcrumb.html" %} + {% include "equipment_and_rooms/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} - - <div class="box-body"> - <div class="col-sm-6"> - {% for field in form %} - <div class="form-group {% if field.errors %}has-error{% endif %}"> - <label class="col-sm-4 control-label"> - {{ field.label }} - </label> - - <div class="col-sm-8"> - {{ field }} - </div> - - {% if field.errors %} - <span class="help-block"> + {% block content %} + <div class="box box-info"> + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} + + <div class="box-body"> + <div class="col-sm-6"> + {% for field in form %} + <div class="form-group {% if field.errors %}has-error{% endif %}"> + <label class="col-sm-4 control-label"> + {{ field.label }} + </label> + + <div class="col-sm-8"> + {{ field }} + </div> + + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - </div> - </div> - - <div class="box-footer"> - <div class="col-sm-6"> - <button type="submit" class="btn btn-block btn-success">Search</button> - </div> - </div><!-- /.box-footer --> - - </form> - - <div class="box col-md-12"> - <table id="visit_table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>Date</th> - <th>Kits</th> - </tr> - </thead> - <tbody> - {% for appointment in appointments %} - <tr> - <td>{{ appointment.datetime_when | date:"Y-m-d H:i"}} </td> - <td> - {% for type in appointment.appointment_types.all %} - {% for item in type.required_equipment.all %} - {% if item.disposable %} - {{ item.name }}, - {% endif %} - {% endfor %} - {% endfor %} - </td> - </tr> - {% endfor %} - </tbody> - </table> - - <div class="box-footer"> - <div class="col-sm-12"> - {% if end_date == None %} - <a href="{% url 'web.views.kit_requests_send_mail' start_date|date:"Y-m-d" %}" class="btn btn-block btn-default">Show email content</a> - {% else %} - <a href="{% url 'web.views.kit_requests_send_mail' start_date|date:"Y-m-d" end_date|date:"Y-m-d" %}" class="btn btn-block btn-default">Show email content</a> - {% endif %} - </div> - </div><!-- /.box-footer --> - - </div> - - -</div> -{% endblock %} + {% endif %} + </div> + {% endfor %} + </div> + </div> + + <div class="box-footer"> + <div class="col-sm-6"> + <button type="submit" class="btn btn-block btn-success">Search</button> + </div> + </div><!-- /.box-footer --> + + </form> + + <div class="box col-md-12"> + <table id="visit_table" class="table table-bordered table-striped"> + <thead> + <tr> + <th>Date</th> + <th>Kits</th> + </tr> + </thead> + <tbody> + {% for appointment in appointments %} + <tr> + <td>{{ appointment.datetime_when | date:"Y-m-d H:i" }} </td> + <td> + {% for type in appointment.appointment_types.all %} + {% for item in type.required_equipment.all %} + {% if item.disposable %} + {{ item.name }}, + {% endif %} + {% endfor %} + {% endfor %} + </td> + </tr> + {% endfor %} + </tbody> + </table> + + <div class="box-footer"> + <div class="col-sm-12"> + {% if end_date == None %} + <a href="{% url 'web.views.kit_requests_send_mail' start_date|date:"Y-m-d" %}" + class="btn btn-block btn-default">Show email content</a> + {% else %} + <a href="{% url 'web.views.kit_requests_send_mail' start_date|date:"Y-m-d" end_date|date:"Y-m-d" %}" + class="btn btn-block btn-default">Show email content</a> + {% endif %} + </div> + </div><!-- /.box-footer --> + + </div> + + + </div> + {% endblock %} {% endblock maincontent %} {% block scripts %} - {{ block.super }} + {{ block.super }} - {% include "includes/datepicker.js.html" %} + {% include "includes/datepicker.js.html" %} {% endblock scripts %} diff --git a/smash/web/templates/equipment_and_rooms/kit_requests_send_mail.html b/smash/web/templates/equipment_and_rooms/kit_requests_send_mail.html index 1c89a616bcb4c2e997d28b80d126e91908109cec..201d1871b46817dfeb895b16b7d58c9379ebf090 100644 --- a/smash/web/templates/equipment_and_rooms/kit_requests_send_mail.html +++ b/smash/web/templates/equipment_and_rooms/kit_requests_send_mail.html @@ -1,26 +1,26 @@ <h1>Kits required between {{ start_date }} and {% if end_date %} {{ end_date }} {% else %} end of time {% endif %}</h1> <table> - <thead> + <thead> <tr> - <th>Date</th> - <th>Kits</th> + <th>Date</th> + <th>Kits</th> </tr> - </thead> - <tbody> + </thead> + <tbody> {% for appointment in appointments %} - <tr> - <td>{{ appointment.datetime_when | date:"Y-m-d H:i"}} </td> - <td> - {% for type in appointment.appointment_types.all %} - {% for item in type.required_equipment.all %} - {% if item.disposable %} - {{ item.name }}, - {% endif %} - {% endfor %} - {% endfor %} - </td> - </tr> + <tr> + <td>{{ appointment.datetime_when | date:"Y-m-d H:i" }} </td> + <td> + {% for type in appointment.appointment_types.all %} + {% for item in type.required_equipment.all %} + {% if item.disposable %} + {{ item.name }}, + {% endif %} + {% endfor %} + {% endfor %} + </td> + </tr> {% endfor %} - </tbody> + </tbody> </table> diff --git a/smash/web/templates/errors/400.html b/smash/web/templates/errors/400.html index 497c2c5a6ae44c1d9b72591b28360c259e201f2e..bbf296de2123737278047e2a4aaca10102d59353 100644 --- a/smash/web/templates/errors/400.html +++ b/smash/web/templates/errors/400.html @@ -1,81 +1,83 @@ {% load static %}<!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <title>Scheduling System | Error page</title> - <!-- Tell the browser to be responsive to screen width --> - <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> - {% block styles %} - <!-- Bootstrap 3.3.6 --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <title>Scheduling System | Error page</title> + <!-- Tell the browser to be responsive to screen width --> + <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> + {% block styles %} + <!-- Bootstrap 3.3.6 --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> - <!-- Font Awesome --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> + <!-- Font Awesome --> + <link rel="stylesheet" + href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> - <!-- Ionicons --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> + <!-- Ionicons --> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> - <!-- Theme style --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> + <!-- Theme style --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> - <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> - <!-- iCheck --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> + <!-- iCheck --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> - <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> + <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> - <style> - .login-logo-h5 { - margin-top: -10px; - } - .login-page-bg { - background: url('{% static 'background.jpg' %}'); - } - </style> - {% endblock styles %} + <style> + .login-logo-h5 { + margin-top: -10px; + } + + .login-page-bg { + background: url('{% static 'background.jpg' %}'); + } + </style> + {% endblock styles %} </head> <body class="hold-transition login-page login-page-bg"> <div class="login-box"> - <div class="login-box-body"> - <div class="login-logo"> - <b>SMA</b>SCH - <h5 class="login-logo-h5">(Smart Scheduling)</h5> - </div> - <!-- /.login-logo --> + <div class="login-box-body"> + <div class="login-logo"> + <b>SMA</b>SCH + <h5 class="login-logo-h5">(Smart Scheduling)</h5> + </div> + <!-- /.login-logo --> - <div class="callout callout-danger"> - <h4>Sorry, there were some problems handling your request</h4> + <div class="callout callout-danger"> + <h4>Sorry, there were some problems handling your request</h4> - <p>Bad request.</p> - </div> - </div> - <!-- /.login-box-body --> + <p>Bad request.</p> + </div> + </div> + <!-- /.login-box-body --> </div> <!-- /.login-box --> {% block scripts %} - <!-- jQuery 2.2.3 --> - <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> - <!-- Bootstrap 3.3.6 --> - <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> + <!-- jQuery 2.2.3 --> + <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> + <!-- Bootstrap 3.3.6 --> + <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> - <!-- iCheck --> - <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> - <script> - $(document).ready(function () { - $('input').iCheck({ - checkboxClass: 'icheckbox_square-blue', - radioClass: 'iradio_square-blue', - increaseArea: '20%' // optional - }); - }); - </script> + <!-- iCheck --> + <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> + <script> + $(document).ready(function () { + $('input').iCheck({ + checkboxClass: 'icheckbox_square-blue', + radioClass: 'iradio_square-blue', + increaseArea: '20%' // optional + }); + }); + </script> {% endblock scripts %} </body> </html> diff --git a/smash/web/templates/errors/403.html b/smash/web/templates/errors/403.html index 19b79af2c42b803bc1dfe556bb8f48f8e6bede16..e84426636c53f935887c89a67101430390b775df 100644 --- a/smash/web/templates/errors/403.html +++ b/smash/web/templates/errors/403.html @@ -1,81 +1,83 @@ {% load static %}<!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <title>Scheduling System | Error page</title> - <!-- Tell the browser to be responsive to screen width --> - <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> - {% block styles %} - <!-- Bootstrap 3.3.6 --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <title>Scheduling System | Error page</title> + <!-- Tell the browser to be responsive to screen width --> + <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> + {% block styles %} + <!-- Bootstrap 3.3.6 --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> - <!-- Font Awesome --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> + <!-- Font Awesome --> + <link rel="stylesheet" + href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> - <!-- Ionicons --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> + <!-- Ionicons --> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> - <!-- Theme style --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> + <!-- Theme style --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> - <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> - <!-- iCheck --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> + <!-- iCheck --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> - <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> + <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> - <style> - .login-logo-h5 { - margin-top: -10px; - } - .login-page-bg { - background: url('{% static 'background.jpg' %}'); - } - </style> - {% endblock styles %} + <style> + .login-logo-h5 { + margin-top: -10px; + } + + .login-page-bg { + background: url('{% static 'background.jpg' %}'); + } + </style> + {% endblock styles %} </head> <body class="hold-transition login-page login-page-bg"> <div class="login-box"> - <div class="login-box-body"> - <div class="login-logo"> - <b>SMA</b>SCH - <h5 class="login-logo-h5">(Smart Scheduling)</h5> - </div> - <!-- /.login-logo --> + <div class="login-box-body"> + <div class="login-logo"> + <b>SMA</b>SCH + <h5 class="login-logo-h5">(Smart Scheduling)</h5> + </div> + <!-- /.login-logo --> - <div class="callout callout-danger"> - <h4>Sorry, there were some problems handling your request</h4> + <div class="callout callout-danger"> + <h4>Sorry, there were some problems handling your request</h4> - <p>Permission denied.</p> - </div> - </div> - <!-- /.login-box-body --> + <p>Permission denied.</p> + </div> + </div> + <!-- /.login-box-body --> </div> <!-- /.login-box --> {% block scripts %} - <!-- jQuery 2.2.3 --> - <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> - <!-- Bootstrap 3.3.6 --> - <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> + <!-- jQuery 2.2.3 --> + <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> + <!-- Bootstrap 3.3.6 --> + <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> - <!-- iCheck --> - <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> - <script> - $(document).ready(function () { - $('input').iCheck({ - checkboxClass: 'icheckbox_square-blue', - radioClass: 'iradio_square-blue', - increaseArea: '20%' // optional - }); - }); - </script> + <!-- iCheck --> + <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> + <script> + $(document).ready(function () { + $('input').iCheck({ + checkboxClass: 'icheckbox_square-blue', + radioClass: 'iradio_square-blue', + increaseArea: '20%' // optional + }); + }); + </script> {% endblock scripts %} </body> </html> diff --git a/smash/web/templates/errors/404.html b/smash/web/templates/errors/404.html index b1bafd57720ddcc5e335c6c808c8a4cf6f4d6feb..568379cef1e331ed08fc17ae272b2dd17ec8dbac 100644 --- a/smash/web/templates/errors/404.html +++ b/smash/web/templates/errors/404.html @@ -1,81 +1,83 @@ {% load static %}<!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <title>Scheduling System | Error page</title> - <!-- Tell the browser to be responsive to screen width --> - <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> - {% block styles %} - <!-- Bootstrap 3.3.6 --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <title>Scheduling System | Error page</title> + <!-- Tell the browser to be responsive to screen width --> + <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> + {% block styles %} + <!-- Bootstrap 3.3.6 --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> - <!-- Font Awesome --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> + <!-- Font Awesome --> + <link rel="stylesheet" + href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> - <!-- Ionicons --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> + <!-- Ionicons --> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> - <!-- Theme style --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> + <!-- Theme style --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> - <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> - <!-- iCheck --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> + <!-- iCheck --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> - <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> + <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> - <style> - .login-logo-h5 { - margin-top: -10px; - } - .login-page-bg { - background: url('{% static 'background.jpg' %}'); - } - </style> - {% endblock styles %} + <style> + .login-logo-h5 { + margin-top: -10px; + } + + .login-page-bg { + background: url('{% static 'background.jpg' %}'); + } + </style> + {% endblock styles %} </head> <body class="hold-transition login-page login-page-bg"> <div class="login-box"> - <div class="login-box-body"> - <div class="login-logo"> - <b>SMA</b>SCH - <h5 class="login-logo-h5">(Smart Scheduling)</h5> - </div> - <!-- /.login-logo --> + <div class="login-box-body"> + <div class="login-logo"> + <b>SMA</b>SCH + <h5 class="login-logo-h5">(Smart Scheduling)</h5> + </div> + <!-- /.login-logo --> - <div class="callout callout-danger"> - <h4>Sorry, there were some problems handling your request</h4> + <div class="callout callout-danger"> + <h4>Sorry, there were some problems handling your request</h4> - <p>The requested page does not exist.</p> - </div> - </div> - <!-- /.login-box-body --> + <p>The requested page does not exist.</p> + </div> + </div> + <!-- /.login-box-body --> </div> <!-- /.login-box --> {% block scripts %} - <!-- jQuery 2.2.3 --> - <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> - <!-- Bootstrap 3.3.6 --> - <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> + <!-- jQuery 2.2.3 --> + <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> + <!-- Bootstrap 3.3.6 --> + <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> - <!-- iCheck --> - <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> - <script> - $(document).ready(function () { - $('input').iCheck({ - checkboxClass: 'icheckbox_square-blue', - radioClass: 'iradio_square-blue', - increaseArea: '20%' // optional - }); - }); - </script> + <!-- iCheck --> + <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> + <script> + $(document).ready(function () { + $('input').iCheck({ + checkboxClass: 'icheckbox_square-blue', + radioClass: 'iradio_square-blue', + increaseArea: '20%' // optional + }); + }); + </script> {% endblock scripts %} </body> </html> diff --git a/smash/web/templates/errors/500.html b/smash/web/templates/errors/500.html index 68cd9213621848b7ff1bb327c6e0547644a39749..4262c587d8910a2b383e90f0517f5b72dc7b624a 100644 --- a/smash/web/templates/errors/500.html +++ b/smash/web/templates/errors/500.html @@ -1,81 +1,83 @@ {% load static %}<!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <title>Scheduling System | Error page</title> - <!-- Tell the browser to be responsive to screen width --> - <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> - {% block styles %} - <!-- Bootstrap 3.3.6 --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <title>Scheduling System | Error page</title> + <!-- Tell the browser to be responsive to screen width --> + <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> + {% block styles %} + <!-- Bootstrap 3.3.6 --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> - <!-- Font Awesome --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> + <!-- Font Awesome --> + <link rel="stylesheet" + href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> - <!-- Ionicons --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> + <!-- Ionicons --> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> - <!-- Theme style --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> + <!-- Theme style --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> - <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> - <!-- iCheck --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> + <!-- iCheck --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> - <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> + <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> - <style> - .login-logo-h5 { - margin-top: -10px; - } - .login-page-bg { - background: url('{% static 'background.jpg' %}'); - } - </style> - {% endblock styles %} + <style> + .login-logo-h5 { + margin-top: -10px; + } + + .login-page-bg { + background: url('{% static 'background.jpg' %}'); + } + </style> + {% endblock styles %} </head> <body class="hold-transition login-page login-page-bg"> <div class="login-box"> - <div class="login-box-body"> - <div class="login-logo"> - <b>SMA</b>SCH - <h5 class="login-logo-h5">(Smart Scheduling)</h5> - </div> - <!-- /.login-logo --> + <div class="login-box-body"> + <div class="login-logo"> + <b>SMA</b>SCH + <h5 class="login-logo-h5">(Smart Scheduling)</h5> + </div> + <!-- /.login-logo --> - <div class="callout callout-danger"> - <h4>Sorry, there were some problems handling your request</h4> + <div class="callout callout-danger"> + <h4>Sorry, there were some problems handling your request</h4> - <p>Internet server error.</p> - </div> - </div> - <!-- /.login-box-body --> + <p>Internet server error.</p> + </div> + </div> + <!-- /.login-box-body --> </div> <!-- /.login-box --> {% block scripts %} - <!-- jQuery 2.2.3 --> - <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> - <!-- Bootstrap 3.3.6 --> - <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> + <!-- jQuery 2.2.3 --> + <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> + <!-- Bootstrap 3.3.6 --> + <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> - <!-- iCheck --> - <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> - <script> - $(document).ready(function () { - $('input').iCheck({ - checkboxClass: 'icheckbox_square-blue', - radioClass: 'iradio_square-blue', - increaseArea: '20%' // optional - }); - }); - </script> + <!-- iCheck --> + <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> + <script> + $(document).ready(function () { + $('input').iCheck({ + checkboxClass: 'icheckbox_square-blue', + radioClass: 'iradio_square-blue', + increaseArea: '20%' // optional + }); + }); + </script> {% endblock scripts %} </body> </html> diff --git a/smash/web/templates/export/breadcrumb.html b/smash/web/templates/export/breadcrumb.html index 38d433b854ad90bc3070e001f23bdaed3827a8cb..625adf276fed5fa81fd64bf60e6cf78ac74ddd82 100644 --- a/smash/web/templates/export/breadcrumb.html +++ b/smash/web/templates/export/breadcrumb.html @@ -1,4 +1,4 @@ - <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> - <li class="active"> - <a href="{% url 'web.views.subjects' %}">Export</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.subjects' %}">Export</a> +</li> diff --git a/smash/web/templates/export/index.html b/smash/web/templates/export/index.html index 0fe811b04f426f927905f4a716f2936f5c27f859..b1813ec7f47d6d675a61a633580272169aa20250 100644 --- a/smash/web/templates/export/index.html +++ b/smash/web/templates/export/index.html @@ -2,7 +2,7 @@ {% load static %} {% block styles %} -{{ block.super }} + {{ block.super }} {% endblock styles %} {% block ui_active_tab %}'export'{% endblock ui_active_tab %} @@ -12,23 +12,23 @@ {% block title %}{{ block.super }} - Export to csv{% endblock %} {% block breadcrumb %} -{% include "export/breadcrumb.html" %} + {% include "export/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -<div> - <a href="{% url 'web.views.export_to_csv2' 'subjects' %}" class="btn btn-app"> - <i class="fa fa-download"></i> - Subjects - </a> - <br/> - <a href="{% url 'web.views.export_to_csv2' 'appointments' %}" class="btn btn-app"> - <i class="fa fa-download"></i> - Appointments - </a> -</div> + <div> + <a href="{% url 'web.views.export_to_csv2' 'subjects' %}" class="btn btn-app"> + <i class="fa fa-download"></i> + Subjects + </a> + <br/> + <a href="{% url 'web.views.export_to_csv2' 'appointments' %}" class="btn btn-app"> + <i class="fa fa-download"></i> + Appointments + </a> + </div> -<div class="box-body"> -</div> + <div class="box-body"> + </div> {% endblock maincontent %} diff --git a/smash/web/templates/includes/datepicker.js.html b/smash/web/templates/includes/datepicker.js.html index d1ac29a0e8874ab8d44cb1f6a6c04775d371fd8a..6d563d81b167bb70076d59e56056871fda36f86e 100644 --- a/smash/web/templates/includes/datepicker.js.html +++ b/smash/web/templates/includes/datepicker.js.html @@ -1,7 +1,7 @@ {% load static %} <script src="{% static 'AdminLTE/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js' %}"></script> <script> - $(document).ready(function () { - $(".datepicker").datepicker(); - }); + $(document).ready(function () { + $(".datepicker").datepicker(); + }); </script> diff --git a/smash/web/templates/includes/datetimepicker.css.html b/smash/web/templates/includes/datetimepicker.css.html index 0a34152592cab55fc1fe7aca8354135337e71d32..f50eed79fce989c7e9c936fb16ed93b115a955be 100644 --- a/smash/web/templates/includes/datetimepicker.css.html +++ b/smash/web/templates/includes/datetimepicker.css.html @@ -1,3 +1,4 @@ {% load static %} <!-- Bootstrap datepicker --> -<link rel="stylesheet" href="{% static 'AdminLTE/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css' %}"> +<link rel="stylesheet" + href="{% static 'AdminLTE/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css' %}"> diff --git a/smash/web/templates/includes/datetimepicker.js.html b/smash/web/templates/includes/datetimepicker.js.html index f6b5f8a785b10e6ad5eb6fc96eebc2d56801b168..08e746bc36186b312e1fafafa932be1e5ed8fff8 100644 --- a/smash/web/templates/includes/datetimepicker.js.html +++ b/smash/web/templates/includes/datetimepicker.js.html @@ -2,9 +2,9 @@ <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script> <script src="{% static 'AdminLTE/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js' %}"></script> <script> - $(document).ready(function () { - $(".datetimepicker").datetimepicker({ - 'sideBySide': true + $(document).ready(function () { + $(".datetimepicker").datetimepicker({ + 'sideBySide': true + }); }); - }); </script> diff --git a/smash/web/templates/includes/tablesorter.tfoot.html b/smash/web/templates/includes/tablesorter.tfoot.html index b5b5536af2b6a4ecf9c852fc849fd0fb8cae96f7..3864f5c4a6d012e2cd6706b174442bb21ea866d4 100644 --- a/smash/web/templates/includes/tablesorter.tfoot.html +++ b/smash/web/templates/includes/tablesorter.tfoot.html @@ -1,22 +1,26 @@ <tfoot> <tr> - <th colspan="8" class="ts-pager form-inline"> - <div class="btn-group btn-group-sm" role="group"> - <button type="button" class="btn btn-default first"><span class="glyphicon glyphicon-step-backward"></span></button> - <button type="button" class="btn btn-default prev"><span class="glyphicon glyphicon-backward"></span></button> - </div> - <span class="pagedisplay"></span> - <div class="btn-group btn-group-sm" role="group"> - <button type="button" class="btn btn-default next"><span class="glyphicon glyphicon-forward"></span></button> - <button type="button" class="btn btn-default last"><span class="glyphicon glyphicon-step-forward"></span></button> - </div> - <select class="form-control input-sm pagesize" title="Select page size"> - <option selected="selected" value="10">10</option> - <option value="20">20</option> - <option value="30">30</option> - <option value="all">All Rows</option> - </select> - <select class="form-control input-sm pagenum" title="Select page number"></select> - </th> + <th colspan="8" class="ts-pager form-inline"> + <div class="btn-group btn-group-sm" role="group"> + <button type="button" class="btn btn-default first"><span class="glyphicon glyphicon-step-backward"></span> + </button> + <button type="button" class="btn btn-default prev"><span class="glyphicon glyphicon-backward"></span> + </button> + </div> + <span class="pagedisplay"></span> + <div class="btn-group btn-group-sm" role="group"> + <button type="button" class="btn btn-default next"><span class="glyphicon glyphicon-forward"></span> + </button> + <button type="button" class="btn btn-default last"><span class="glyphicon glyphicon-step-forward"></span> + </button> + </div> + <select class="form-control input-sm pagesize" title="Select page size"> + <option selected="selected" value="10">10</option> + <option value="20">20</option> + <option value="30">30</option> + <option value="all">All Rows</option> + </select> + <select class="form-control input-sm pagenum" title="Select page number"></select> + </th> </tr> </tfoot> diff --git a/smash/web/templates/login.html b/smash/web/templates/login.html index 86b7238f0d148e5aa3ec9416c1a945840e9f0a5c..e02c5705f25549909a6de2ea5a2968915cdec322 100644 --- a/smash/web/templates/login.html +++ b/smash/web/templates/login.html @@ -1,135 +1,137 @@ {% load static %}<!DOCTYPE html> <html> <head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <title>Scheduling System | Log in</title> - <!-- Tell the browser to be responsive to screen width --> - <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> - {% block styles %} - <!-- Bootstrap 3.3.6 --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <title>Scheduling System | Log in</title> + <!-- Tell the browser to be responsive to screen width --> + <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> + {% block styles %} + <!-- Bootstrap 3.3.6 --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/bootstrap.min.css' %}"> - <!-- Font Awesome --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> + <!-- Font Awesome --> + <link rel="stylesheet" + href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> - <!-- Ionicons --> - <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> + <!-- Ionicons --> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css"> - <!-- Theme style --> - <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> + <!-- Theme style --> + <link rel="stylesheet" href="{% static 'AdminLTE/css/AdminLTE.min.css' %}"> - <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/css/skins/skin-green.min.css' %}"> - <!-- iCheck --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> + <!-- iCheck --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/iCheck/square/blue.css' %}"> - <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> - <!--[if lt IE 9]> + <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> - <style> - .login-logo-h5 { - margin-top: -10px; - } - .login-page-bg { - background: url('{% static 'background.jpg' %}'); - } - </style> - {% endblock styles %} + <style> + .login-logo-h5 { + margin-top: -10px; + } + + .login-page-bg { + background: url('{% static 'background.jpg' %}'); + } + </style> + {% endblock styles %} </head> <body class="hold-transition login-page login-page-bg"> <div class="login-box"> - <div class="login-box-body"> - <div class="login-logo"> - <b>SMA</b>SCH - <h5 class="login-logo-h5">(Smart Scheduling)</h5> - </div> - <!-- /.login-logo --> - - {% if state == "logout" %} - <div class="callout callout-info"> - <h4>Success!</h4> - - <p>You have logged out of the Scheduling System</p> - </div> - {% elif state == "logout_failed" %} - <div class="callout callout-danger"> - <h4>Error!</h4> - - <p>You cannot log out, if you are not logged in!</p> - </div> - {% elif state == "login_failed" %} - <div class="callout callout-danger"> - <h4>Error!</h4> - - <p>Username does not exist, or the password is incorrect!</p> - </div> - {% else %} - <hr /> - {% endif %} - - <p class="login-box-msg">Please sign in</p> - - <form action="{% url 'web.views.login' %}" method="post"> - {% csrf_token %} - {% if next %} - <input type="hidden" name="next" value="{{ next }}" /> - {% endif %} - - <div class="form-group has-feedback"> - <input type="text" name="username" class="form-control" placeholder="Login"> - <span class="glyphicon glyphicon-envelope form-control-feedback"></span> - </div> - <div class="form-group has-feedback"> - <input type="password" name="password" class="form-control" placeholder="Password"> - <span class="glyphicon glyphicon-lock form-control-feedback"></span> - </div> - <div class="row"> - <div class="col-xs-8"> - <div class="checkbox icheck"> - <label> - <input type="checkbox"> Remember Me - </label> - </div> - </div> - <!-- /.col --> - <div class="col-xs-4"> - <button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button> + <div class="login-box-body"> + <div class="login-logo"> + <b>SMA</b>SCH + <h5 class="login-logo-h5">(Smart Scheduling)</h5> </div> - <!-- /.col --> - </div> - </form> - - <hr /> - - <a href="#">I forgot my password</a><br> - <a href="#">I have an issue with account</a> - - </div> - <!-- /.login-box-body --> + <!-- /.login-logo --> + + {% if state == "logout" %} + <div class="callout callout-info"> + <h4>Success!</h4> + + <p>You have logged out of the Scheduling System</p> + </div> + {% elif state == "logout_failed" %} + <div class="callout callout-danger"> + <h4>Error!</h4> + + <p>You cannot log out, if you are not logged in!</p> + </div> + {% elif state == "login_failed" %} + <div class="callout callout-danger"> + <h4>Error!</h4> + + <p>Username does not exist, or the password is incorrect!</p> + </div> + {% else %} + <hr/> + {% endif %} + + <p class="login-box-msg">Please sign in</p> + + <form action="{% url 'web.views.login' %}" method="post"> + {% csrf_token %} + {% if next %} + <input type="hidden" name="next" value="{{ next }}"/> + {% endif %} + + <div class="form-group has-feedback"> + <input type="text" name="username" class="form-control" placeholder="Login"> + <span class="glyphicon glyphicon-envelope form-control-feedback"></span> + </div> + <div class="form-group has-feedback"> + <input type="password" name="password" class="form-control" placeholder="Password"> + <span class="glyphicon glyphicon-lock form-control-feedback"></span> + </div> + <div class="row"> + <div class="col-xs-8"> + <div class="checkbox icheck"> + <label> + <input type="checkbox"> Remember Me + </label> + </div> + </div> + <!-- /.col --> + <div class="col-xs-4"> + <button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button> + </div> + <!-- /.col --> + </div> + </form> + + <hr/> + + <a href="#">I forgot my password</a><br> + <a href="#">I have an issue with account</a> + + </div> + <!-- /.login-box-body --> </div> <!-- /.login-box --> {% block scripts %} - <!-- jQuery 2.2.3 --> - <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> - <!-- Bootstrap 3.3.6 --> - <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> - - <!-- iCheck --> - <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> - <script> - $(document).ready(function () { - $('input').iCheck({ - checkboxClass: 'icheckbox_square-blue', - radioClass: 'iradio_square-blue', - increaseArea: '20%' // optional - }); - }); - </script> + <!-- jQuery 2.2.3 --> + <script src="{% static 'AdminLTE/plugins/jQuery/jquery-2.2.3.min.js' %}"></script> + <!-- Bootstrap 3.3.6 --> + <script src="{% static 'AdminLTE/js/bootstrap.min.js' %}"></script> + + <!-- iCheck --> + <script src="{% static 'AdminLTE/plugins/iCheck/icheck.min.js' %}"></script> + <script> + $(document).ready(function () { + $('input').iCheck({ + checkboxClass: 'icheckbox_square-blue', + radioClass: 'iradio_square-blue', + increaseArea: '20%' // optional + }); + }); + </script> {% endblock scripts %} </body> </html> diff --git a/smash/web/templates/mail_templates/breadcrumb.html b/smash/web/templates/mail_templates/breadcrumb.html index c3d68d74bf3f04e400175919e7f00718891587c7..52f9e30cd3af8f803a13a9574d73a1c7ea922335 100644 --- a/smash/web/templates/mail_templates/breadcrumb.html +++ b/smash/web/templates/mail_templates/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.mail_templates' %}">Mail templates</a></li> \ No newline at end of file +<li class="active"><a href="{% url 'web.views.mail_templates' %}">Mail templates</a></li> \ No newline at end of file diff --git a/smash/web/templates/mail_templates/index.html b/smash/web/templates/mail_templates/index.html index 45ef610eebb5c61329acc6e5c46ca4f6c2e9d1d5..137ade1b2b90f7773f205a2a6d81981db5212e75 100644 --- a/smash/web/templates/mail_templates/index.html +++ b/smash/web/templates/mail_templates/index.html @@ -2,9 +2,9 @@ {% load static %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} {% block ui_active_tab %}'mail_templates'{% endblock ui_active_tab %} @@ -12,99 +12,123 @@ {% block page_description %}{% endblock page_description %} {% block breadcrumb %} -{% include "mail_templates/breadcrumb.html" %} + {% include "mail_templates/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -<div class="box box-danger box-solid"> - <div class="box-header with-border"> - <h3 class="box-title">Not yet implemented</h3> + <div class="box box-danger box-solid"> + <div class="box-header with-border"> + <h3 class="box-title">Not yet 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 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"> + This is only a static page to show, how the system would look like. + A comprehensive system for template editing and generation has to be developed. + </div> + <!-- /.box-body --> </div> - <!-- /.box-tools --> - </div> - <!-- /.box-header --> - <div class="box-body"> - This is only a static page to show, how the system would look like. - A comprehensive system for template editing and generation has to be developed. - </div> - <!-- /.box-body --> -</div> -<div> - <a class="btn btn-app"> - <i class="fa fa-plus"></i> Add new letter - </a> -</div> + <div> + <a class="btn btn-app"> + <i class="fa fa-plus"></i> Add new letter + </a> + </div> -<div class="box-body"> - <table id="table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>Destination</th> - <th>Language</th> - <th>Title</th> - <th>Details</th> - <th>Edit</th> - <th>Delete</th> - <th>Generate</th> - </tr> - </thead> - <tbody> - <tr> - <td>1</td> - <td>Patients</td> - <td>english</td> - <td>"Thank you" letter</td> - <td><button type="button" class="btn btn-block btn-default">Details</button></td> - <td><button type="button" class="btn btn-block btn-warning">Edit</button></td> - <td><button type="button" class="btn btn-block btn-danger">Delete</button></td> - <td><button type="button" class="btn btn-block btn-default">Generate</button></td> - </tr> - <tr> - <td>2</td> - <td>Patients</td> - <td>english</td> - <td>"Dankescreiben" letter</td> - <td><button type="button" class="btn btn-block btn-default">Details</button></td> - <td><button type="button" class="btn btn-block btn-warning">Edit</button></td> - <td><button type="button" class="btn btn-block btn-danger">Delete</button></td> - <td><button type="button" class="btn btn-block btn-default">Generate</button></td> - </tr> - <tr> - <td>3</td> - <td>Doctors</td> - <td>english</td> - <td>"New Scheduling system"</td> - <td><button type="button" class="btn btn-block btn-default">Details</button></td> - <td><button type="button" class="btn btn-block btn-warning">Edit</button></td> - <td><button type="button" class="btn btn-block btn-danger">Delete</button></td> - <td><button type="button" class="btn btn-block btn-default">Generate</button></td> - </tr> - </tbody> - </table> -</div> + <div class="box-body"> + <table id="table" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>Destination</th> + <th>Language</th> + <th>Title</th> + <th>Details</th> + <th>Edit</th> + <th>Delete</th> + <th>Generate</th> + </tr> + </thead> + <tbody> + <tr> + <td>1</td> + <td>Patients</td> + <td>english</td> + <td>"Thank you" letter</td> + <td> + <button type="button" class="btn btn-block btn-default">Details</button> + </td> + <td> + <button type="button" class="btn btn-block btn-warning">Edit</button> + </td> + <td> + <button type="button" class="btn btn-block btn-danger">Delete</button> + </td> + <td> + <button type="button" class="btn btn-block btn-default">Generate</button> + </td> + </tr> + <tr> + <td>2</td> + <td>Patients</td> + <td>english</td> + <td>"Dankescreiben" letter</td> + <td> + <button type="button" class="btn btn-block btn-default">Details</button> + </td> + <td> + <button type="button" class="btn btn-block btn-warning">Edit</button> + </td> + <td> + <button type="button" class="btn btn-block btn-danger">Delete</button> + </td> + <td> + <button type="button" class="btn btn-block btn-default">Generate</button> + </td> + </tr> + <tr> + <td>3</td> + <td>Doctors</td> + <td>english</td> + <td>"New Scheduling system"</td> + <td> + <button type="button" class="btn btn-block btn-default">Details</button> + </td> + <td> + <button type="button" class="btn btn-block btn-warning">Edit</button> + </td> + <td> + <button type="button" class="btn btn-block btn-danger">Delete</button> + </td> + <td> + <button type="button" class="btn btn-block btn-default">Generate</button> + </td> + </tr> + </tbody> + </table> + </div> {% endblock maincontent %} {% block scripts %} - {{ block.super }} + {{ block.super }} - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/subjects/add.html b/smash/web/templates/subjects/add.html index 575fe70a8c92c5f704c1975109774f41929f5e8c..3ce7d1c7526e08a9cfd214936639aa41792484d2 100644 --- a/smash/web/templates/subjects/add.html +++ b/smash/web/templates/subjects/add.html @@ -3,10 +3,10 @@ {% load filters %} {% block styles %} -{{ block.super }} - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/awesomplete/awesomplete.css' %}" /> + {{ block.super }} + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/awesomplete/awesomplete.css' %}"/> - {% include "includes/datepicker.css.html" %} + {% include "includes/datepicker.css.html" %} {% endblock styles %} {% block ui_active_tab %}'subjects'{% endblock ui_active_tab %} @@ -16,81 +16,81 @@ {% block title %}{{ block.super }} - Add new subject{% endblock %} {% block breadcrumb %} -{% include "subjects/breadcrumb.html" %} + {% include "subjects/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default">Cancel</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default">Cancel</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Details of subject</h3> </div>{% endcomment %} - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} - <div class="box-body"> - <div class="col-sm-6"> - {% for field in form %} - <div class="form-group {% if field.errors %}has-error{% endif %}"> - <label class="col-sm-4 control-label"> - {{ field.label }} - </label> + <div class="box-body"> + <div class="col-sm-6"> + {% for field in form %} + <div class="form-group {% if field.errors %}has-error{% endif %}"> + <label class="col-sm-4 control-label"> + {{ field.label }} + </label> - <div class="col-sm-8"> - {{ field|add_class:'form-control' }} - </div> + <div class="col-sm-8"> + {{ field|add_class:'form-control' }} + </div> - {% if field.errors %} - <span class="help-block"> + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - </div> - </div><!-- /.box-body --> - - <div class="box-footer"> - <div class="col-sm-6"> - <button type="submit" class="btn btn-block btn-success">Add</button> - </div> - <div class="col-sm-6"> - <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default">Cancel</a> - </div> - </div><!-- /.box-footer --> - </form> -</div> - -{% endblock %} + {% endif %} + </div> + {% endfor %} + </div> + </div><!-- /.box-body --> + + <div class="box-footer"> + <div class="col-sm-6"> + <button type="submit" class="btn btn-block btn-success">Add</button> + </div> + <div class="col-sm-6"> + <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default">Cancel</a> + </div> + </div><!-- /.box-footer --> + </form> + </div> + + {% endblock %} {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/awesomplete/awesomplete.min.js' %}"></script> - <script> - $(document).ready(function() { - // If ever to debug and thinking why it doesn't work => look if theres 'null' in data from API - $.get("{% url 'web.api.cities' %}", function(data) { - new Awesomplete(document.querySelector("#id_city")).list = data.cities; - }); - $.get("{% url 'web.api.countries' %}", function(data) { - new Awesomplete(document.querySelector("#id_country")).list = data.countries; - }); - $.get("{% url 'web.api.referrals' %}", function(data) { - new Awesomplete(document.querySelector("#id_referral")).list = data.referrals; - }); - }); - - </script> - - {% include "includes/datepicker.js.html" %} + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/awesomplete/awesomplete.min.js' %}"></script> + <script> + $(document).ready(function () { + // If ever to debug and thinking why it doesn't work => look if theres 'null' in data from API + $.get("{% url 'web.api.cities' %}", function (data) { + new Awesomplete(document.querySelector("#id_city")).list = data.cities; + }); + $.get("{% url 'web.api.countries' %}", function (data) { + new Awesomplete(document.querySelector("#id_country")).list = data.countries; + }); + $.get("{% url 'web.api.referrals' %}", function (data) { + new Awesomplete(document.querySelector("#id_referral")).list = data.referrals; + }); + }); + + </script> + + {% include "includes/datepicker.js.html" %} {% endblock scripts %} diff --git a/smash/web/templates/subjects/breadcrumb.html b/smash/web/templates/subjects/breadcrumb.html index 1cdad6d9df58f76294a622f5269b001f40d9822c..9e000082f77e03bc56923c7cde28e006bfb8f131 100644 --- a/smash/web/templates/subjects/breadcrumb.html +++ b/smash/web/templates/subjects/breadcrumb.html @@ -1,4 +1,4 @@ - <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> - <li class="active"> - <a href="{% url 'web.views.subjects' %}">Subjects</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 class="active"> + <a href="{% url 'web.views.subjects' %}">Subjects</a> +</li> \ No newline at end of file diff --git a/smash/web/templates/subjects/delete.html b/smash/web/templates/subjects/delete.html index b890cca348bf2e3aad1b2ae8c0820fa824061bdd..372dce816701f74a8fc01ef7078452ed61004f20 100644 --- a/smash/web/templates/subjects/delete.html +++ b/smash/web/templates/subjects/delete.html @@ -3,9 +3,9 @@ {% load filters %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} {% block ui_active_tab %}'subjects'{% endblock ui_active_tab %} @@ -15,56 +15,58 @@ {% block title %}{{ block.super }} - Delete subject information{% endblock %} {% block breadcrumb %} -{% include "subjects/breadcrumb.html" %} + {% include "subjects/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Go back (without changes)</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Go + back (without changes)</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Details of subject</h3> </div>{% endcomment %} - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} - <div class="box-body"> - {% for field in form %} - <div class="col-md-6 form-group"> - <label class="col-sm-4 control-label"> - {{ field.label }} - </label> + <div class="box-body"> + {% for field in form %} + <div class="col-md-6 form-group"> + <label class="col-sm-4 control-label"> + {{ field.label }} + </label> - <div class="col-sm-8"> - {{ field|disable|add_class:'form-control' }} - </div> + <div class="col-sm-8"> + {{ field|disable|add_class:'form-control' }} + </div> - {% if field.help_text %} - <span class="help-block"> + {% if field.help_text %} + <span class="help-block"> {{ field.help_text }} </span> - {% endif %} - </div> - {% endfor %} - </div><!-- /.box-body --> + {% endif %} + </div> + {% endfor %} + </div><!-- /.box-body --> - <div class="box-footer"> - <div class="col-sm-6"> - <button type="submit" class="btn btn-block btn-danger">Delete</button> - </div> - <div class="col-sm-6"> - <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Cancel</a> - </div> - </div><!-- /.box-footer --> - </form> -</div> -{% endblock %} + <div class="box-footer"> + <div class="col-sm-6"> + <button type="submit" class="btn btn-block btn-danger">Delete</button> + </div> + <div class="col-sm-6"> + <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" + onclick="history.back()">Cancel</a> + </div> + </div><!-- /.box-footer --> + </form> + </div> + {% endblock %} @@ -72,20 +74,20 @@ {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/subjects/details.html b/smash/web/templates/subjects/details.html index d3429c02d958a98369984e2315ddb76dc3c8f137..4187da02173f53056f75e39e8942148cd506cc71 100644 --- a/smash/web/templates/subjects/details.html +++ b/smash/web/templates/subjects/details.html @@ -3,9 +3,9 @@ {% load filters %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} {% block ui_active_tab %}'subjects'{% endblock ui_active_tab %} @@ -15,53 +15,55 @@ {% block title %}{{ block.super }} - Details of subject {% endblock %} {% block breadcrumb %} -{% include "subjects/breadcrumb.html" %} + {% include "subjects/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Back</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" + onclick="history.back()">Back</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Details of subject</h3> </div>{% endcomment %} - <form class="form-horizontal"> - <div class="box-body"> - {% for field in form %} - <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> - <label for="{# TODO #}" class="col-sm-4 control-label"> - {{ field.label }} - </label> + <form class="form-horizontal"> + <div class="box-body"> + {% for field in form %} + <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> + <label for="{# TODO #}" class="col-sm-4 control-label"> + {{ field.label }} + </label> - <div class="col-sm-8"> - {{ field|disable|add_class:'form-control' }} - </div> + <div class="col-sm-8"> + {{ field|disable|add_class:'form-control' }} + </div> - {% if field.errors %} - <span class="help-block"> + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - </div><!-- /.box-body --> + {% endif %} + </div> + {% endfor %} + </div><!-- /.box-body --> - <a href="{% url 'web.views.subject_visit_details' sid %}" type = "button" class="btn btn-block btn-default">Subject's visits</a> + <a href="{% url 'web.views.subject_visit_details' sid %}" type="button" + class="btn btn-block btn-default">Subject's visits</a> - <div class="box-footer"> - <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Back</a> - </div><!-- /.box-footer --> - </form> -</div> + <div class="box-footer"> + <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Back</a> + </div><!-- /.box-footer --> + </form> + </div> -</form> -{% endblock %} + </form> + {% endblock %} @@ -69,20 +71,20 @@ {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/subjects/edit.html b/smash/web/templates/subjects/edit.html index 124a4d539a080cf7f95e06660da5c89299d438a8..946d63f87abeb9e0e95f7c4c01814cf5e899e99e 100644 --- a/smash/web/templates/subjects/edit.html +++ b/smash/web/templates/subjects/edit.html @@ -3,11 +3,11 @@ {% load filters %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> - {% include "includes/datepicker.css.html" %} + {% include "includes/datepicker.css.html" %} {% endblock styles %} {% block ui_active_tab %}'subjects'{% endblock ui_active_tab %} @@ -17,98 +17,103 @@ {% block title %}{{ block.super }} - Edit subject information{% endblock %} {% block breadcrumb %} -{% include "subjects/breadcrumb.html" %} + {% include "subjects/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Go back (without changes)</a> - <a href="{% url 'web.views.subject_visit_details' subject.id %}" type = "button" class="btn btn-block btn-default">Subject's visits</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Go + back (without changes)</a> + <a href="{% url 'web.views.subject_visit_details' subject.id %}" type="button" + class="btn btn-block btn-default">Subject's visits</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Details of subject</h3> </div>{% endcomment %} - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} - <div class="box-body"> - <div class="col-md-12"> - {% for field in form %} - <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> - <label for="{# TODO #}" class="col-sm-4 control-label"> - {{ field.label }} - </label> + <div class="box-body"> + <div class="col-md-12"> + {% for field in form %} + <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> + <label for="{# TODO #}" class="col-sm-4 control-label"> + {{ field.label }} + </label> - <div class="col-sm-8"> - {{ field|add_class:'form-control' }} - </div> + <div class="col-sm-8"> + {{ field|add_class:'form-control' }} + </div> - {% if field.errors %} - <span class="help-block"> + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - - <div class="col-md-6"> - {% if not subject.resigned %} - <a href="{% url 'web.views.subject_mark' subject.id 'rejected' %}" class="btn btn-warning btn-block">Mark as rejected</a> - {% else %} - <label for="{# TODO #}" class="col-sm-4 control-label">REJECTED</label> - <div class="col-sm-8">{{subject.resigned}}</div> - {% endif %} + {% endif %} + </div> + {% endfor %} + + <div class="col-md-6"> + {% if not subject.resigned %} + <a href="{% url 'web.views.subject_mark' subject.id 'rejected' %}" + class="btn btn-warning btn-block">Mark as rejected</a> + {% else %} + <label for="{# TODO #}" class="col-sm-4 control-label">REJECTED</label> + <div class="col-sm-8">{{ subject.resigned }}</div> + {% endif %} + </div> + <div class="col-md-6"> + {% if not subject.dead %} + <a href="{% url 'web.views.subject_mark' subject.id 'dead' %}" + class="btn btn-danger btn-block">Mark as dead</a><br/> + {% else %} + <label for="{# TODO #}" class="col-sm-4 control-label">DEAD</label> + <div class="col-sm-8">{{ subject.dead }}</div> + {% endif %} + </div> + </div> + + </div><!-- /.box-body --> + + <div class="box-footer"> + <div class="col-sm-6"> + <button type="submit" class="btn btn-block btn-success">Save</button> + </div> + <div class="col-sm-6"> + <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" + onclick="history.back()">Cancel</a> + </div> + </div><!-- /.box-footer --> + </form> </div> - <div class="col-md-6"> - {% if not subject.dead %} - <a href="{% url 'web.views.subject_mark' subject.id 'dead' %}" class="btn btn-danger btn-block">Mark as dead</a><br /> - {% else %} - <label for="{# TODO #}" class="col-sm-4 control-label">DEAD</label> - <div class="col-sm-8">{{subject.dead}}</div> - {% endif %} - </div> - </div> - - </div><!-- /.box-body --> - - <div class="box-footer"> - <div class="col-sm-6"> - <button type="submit" class="btn btn-block btn-success">Save</button> - </div> - <div class="col-sm-6"> - <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Cancel</a> - </div> - </div><!-- /.box-footer --> - </form> -</div> -{% endblock %} + {% endblock %} {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script> - $(function () { - $('#table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> - - {% include "includes/datepicker.js.html" %} + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script> + $(function () { + $('#table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> + + {% include "includes/datepicker.js.html" %} {% endblock scripts %} diff --git a/smash/web/templates/subjects/index.html b/smash/web/templates/subjects/index.html index 252bef06d8ac685754cb5855010e46cc25a05d64..f46c7b189dd0e673481e033ae7f031b66937ae95 100644 --- a/smash/web/templates/subjects/index.html +++ b/smash/web/templates/subjects/index.html @@ -2,8 +2,8 @@ {% load static %} {% block styles %} -{{ block.super }} - {% include "includes/tablesorter.css.html" %} + {{ block.super }} + {% include "includes/tablesorter.css.html" %} {% endblock styles %} {% block ui_active_tab %}'subjects'{% endblock ui_active_tab %} @@ -13,92 +13,93 @@ {% block title %}{{ block.super }} - Subjects{% endblock %} {% block breadcrumb %} -{% include "subjects/breadcrumb.html" %} + {% include "subjects/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -<div> - <a href="{% url 'web.views.subject_add' %}" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new subject - </a> -</div> + <div> + <a href="{% url 'web.views.subject_add' %}" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new subject + </a> + </div> -<div class="box-body"> - {% if subjects_list %} - <table id="table" class="table table-bordered table-striped tablesorter"> - <thead> - <tr> - <th>ND</th> - <th>Screening</th> - <th>First name</th> - <th>Last name</th> - <th class="filter-select filter-exact" data-placeholder="Select location">Default location</th> - <th>Dead</th> - <th>Resigned</th> - <th>Postponed</th> - <th>Edit</th> - </tr> - </thead> + <div class="box-body"> + {% if subjects_list %} + <table id="table" class="table table-bordered table-striped tablesorter"> + <thead> + <tr> + <th>ND</th> + <th>Screening</th> + <th>First name</th> + <th>Last name</th> + <th class="filter-select filter-exact" data-placeholder="Select location">Default location</th> + <th>Dead</th> + <th>Resigned</th> + <th>Postponed</th> + <th>Edit</th> + </tr> + </thead> - {% include "includes/tablesorter.tfoot.html" %} + {% include "includes/tablesorter.tfoot.html" %} - <tbody> - {% for subject in subjects_list %} - <tr> - <td>{{ subject.nd_number }}</td> - <td>{{ subject.screening_number }}</td> - <td>{{ subject.first_name }}</td> - <td>{{ subject.last_name }}</td> - <td>{{ subject.default_location }}</td> - <td>{% if subject.dead %} YES {% else %} NO {% endif %} </td> - <td>{% if subject.resigned %} YES {% else %} NO {% endif %} </td> - <td>{% if subject.postponed %} YES {% else %} NO {% endif %} </td> - <td><a href="{% url 'web.views.subject_edit' subject.id %}" type="button" class="btn btn-block btn-default">Edit</a></td> - </tr> - {% endfor %} + <tbody> + {% for subject in subjects_list %} + <tr> + <td>{{ subject.nd_number }}</td> + <td>{{ subject.screening_number }}</td> + <td>{{ subject.first_name }}</td> + <td>{{ subject.last_name }}</td> + <td>{{ subject.default_location }}</td> + <td>{% if subject.dead %} YES {% else %} NO {% endif %} </td> + <td>{% if subject.resigned %} YES {% else %} NO {% endif %} </td> + <td>{% if subject.postponed %} YES {% else %} NO {% endif %} </td> + <td><a href="{% url 'web.views.subject_edit' subject.id %}" type="button" + class="btn btn-block btn-default">Edit</a></td> + </tr> + {% endfor %} - </tbody> - </table> - {% else %} - <p>No subjects found.</p> - {% endif %} -</div> + </tbody> + </table> + {% else %} + <p>No subjects found.</p> + {% endif %} + </div> {% endblock maincontent %} {% block scripts %} - {{ block.super }} + {{ block.super }} - {% include "includes/tablesorter.js.html" %} + {% include "includes/tablesorter.js.html" %} - <script> - $(function () { - $('#table').tablesorter({ - theme : "bootstrap", - widthFixed: true, - headerTemplate : '{content} {icon}', - widgets : [ "uitheme", "filter", "columns", "zebra" ], - widgetOptions : { - zebra : ["even", "odd"], - columns: [ "primary", "secondary", "tertiary" ], - filter_reset : ".reset", - filter_cssFilter: "form-control", - }, - headers: { - 0: { sorter: true}, - } - }).tablesorterPager({ - container: $(".ts-pager"), - cssGoto : ".pagenum", - // remove rows from the table to speed up the sort of large tables. - // setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled. - removeRows: false, - // output string - default is '{page}/{totalPages}'; - // possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} - output: '{startRow} - {endRow} / {filteredRows} ({totalRows})' - }); - }); - </script> + <script> + $(function () { + $('#table').tablesorter({ + theme: "bootstrap", + widthFixed: true, + headerTemplate: '{content} {icon}', + widgets: ["uitheme", "filter", "columns", "zebra"], + widgetOptions: { + zebra: ["even", "odd"], + columns: ["primary", "secondary", "tertiary"], + filter_reset: ".reset", + filter_cssFilter: "form-control", + }, + headers: { + 0: {sorter: true}, + } + }).tablesorterPager({ + container: $(".ts-pager"), + cssGoto: ".pagenum", + // remove rows from the table to speed up the sort of large tables. + // setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled. + removeRows: false, + // output string - default is '{page}/{totalPages}'; + // possible variables: {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows} + output: '{startRow} - {endRow} / {filteredRows} ({totalRows})' + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templates/subjects/visitdetails.html b/smash/web/templates/subjects/visitdetails.html index 02933fd2130c2d74e2f8953bc92b5beca2078ea7..70b4beb38d3983fb6870878f7de99b712330b3d7 100644 --- a/smash/web/templates/subjects/visitdetails.html +++ b/smash/web/templates/subjects/visitdetails.html @@ -3,9 +3,9 @@ {% load filters %} {% block styles %} -{{ block.super }} -<!-- DataTables --> -<link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> {% endblock styles %} {% block ui_active_tab %}'subjects'{% endblock ui_active_tab %} @@ -15,119 +15,125 @@ {% block title %}{{ block.super }} - List of subject's visits {% endblock %} {% block breadcrumb %} -{% include "subjects/breadcrumb.html" %} + {% include "subjects/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default" onclick="history.back()">Back</a> - <a href="{% url 'web.views.visit_add' id %}" type = "button" class="btn btn-block btn-default">Add visit</a> - </div> - - <div class="box-body"> - <form class="form-horizontal"> - {% for element in display %} - <div class="box box-widget widget-user-2"> - <div class="widget-user-header bg-green"> - <h3 class="widget-user-username">{{ element.4 }}</h3> - <h5 class="widget-user-desc"> - {% if element.2 %}(Finished) - {% else %}(Not finished) - {% endif %} - <a href="{% url 'web.views.visit_details' element.3 %}"><font color="#D3D3D3">Details >>></font></a> - </h5> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default" + onclick="history.back()">Back</a> + <a href="{% url 'web.views.visit_add' id %}" type="button" class="btn btn-block btn-default">Add + visit</a> </div> - <div class="box-footer"> - {% for field in element.0 %} - <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> - <label class="col-sm-4 control-label">{{ field.label }}</label> - - <div class="col-sm-8"> - {{ field|add_class:'form-control' }} - </div> - - {% if field.errors %}<span class="help-block">{{ field.errors }}</span>{% endif %} - </div> - {% endfor %} - </div> - </div> - - <div class="box box-widget widget-user-2"> - <div class="widget-user-header bg-default"> - <h3 class="widget-user-username">Visit's appointments</h3> - <!--<h5 class="widget-user-desc"> - </h5>--> - </div> - <div class="box-footer"> - {% if element.1 %} - <table id="table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>Type</th> - <th>Date</th> - <th>Time</th> - <th>Length [min]</th> - <th>Responsible</th> - <th>Plan/Modify</th> - </tr> - </thead> - <tbody> - {% for app in element.1 %} - <tr> - <td>{{ forloop.counter }}</td> - <td style="background-color:{{app.color}} !important"> - <font COLOR="{{app.font_color}}"> - {% for type in app.appointment_types.all %} - {{ type.code }}, - {% endfor %} - </font> - </td> - <td>{{ app.datetime_when | date:"d-M-Y" }}</td> - <td>{{ app.datetime_when | time:"H:i" }}</td> - <td>{{ app.length }}</td> - <td> - {% if app.flying_team %} Flying team - {% else %} {{ app.worker_assigned.first_name }} {{app.worker_assigned.last_name}} - {% endif %} - </td> - <td> - {% ifequal app.status "SCHEDULED" %} - <a href="{% url 'web.views.appointment_edit' app.id %}" type="button" class="btn btn-block btn-default">Edit</a> - {% else %} - {{ app.status }} - {% endifequal %} - </td> - </tr> - {% endfor %} - - </tbody> - </table> - {% else %} - No appointments found. - {% endif %} - </div> - </div> - - {% endfor %} - </form> - - </div><!-- /.box-body --> - -</div> -{% endblock %} + <div class="box-body"> + <form class="form-horizontal"> + {% for element in display %} + <div class="box box-widget widget-user-2"> + <div class="widget-user-header bg-green"> + <h3 class="widget-user-username">{{ element.4 }}</h3> + <h5 class="widget-user-desc"> + {% if element.2 %}(Finished) + {% else %}(Not finished) + {% endif %} + <a href="{% url 'web.views.visit_details' element.3 %}"><font color="#D3D3D3">Details + >>></font></a> + </h5> + </div> + <div class="box-footer"> + {% for field in element.0 %} + <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> + <label class="col-sm-4 control-label">{{ field.label }}</label> + + <div class="col-sm-8"> + {{ field|add_class:'form-control' }} + </div> + + {% if field.errors %} + <span class="help-block">{{ field.errors }}</span>{% endif %} + </div> + {% endfor %} + </div> + </div> + + <div class="box box-widget widget-user-2"> + <div class="widget-user-header bg-default"> + <h3 class="widget-user-username">Visit's appointments</h3> + <!--<h5 class="widget-user-desc"> + </h5>--> + </div> + <div class="box-footer"> + {% if element.1 %} + <table id="table" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>Type</th> + <th>Date</th> + <th>Time</th> + <th>Length [min]</th> + <th>Responsible</th> + <th>Plan/Modify</th> + </tr> + </thead> + <tbody> + {% for app in element.1 %} + <tr> + <td>{{ forloop.counter }}</td> + <td style="background-color:{{ app.color }} !important"> + <font COLOR="{{ app.font_color }}"> + {% for type in app.appointment_types.all %} + {{ type.code }}, + {% endfor %} + </font> + </td> + <td>{{ app.datetime_when | date:"d-M-Y" }}</td> + <td>{{ app.datetime_when | time:"H:i" }}</td> + <td>{{ app.length }}</td> + <td> + {% if app.flying_team %} Flying team + {% else %} {{ app.worker_assigned.first_name }} + {{ app.worker_assigned.last_name }} + {% endif %} + </td> + <td> + {% ifequal app.status "SCHEDULED" %} + <a href="{% url 'web.views.appointment_edit' app.id %}" + type="button" class="btn btn-block btn-default">Edit</a> + {% else %} + {{ app.status }} + {% endifequal %} + </td> + </tr> + {% endfor %} + + </tbody> + </table> + {% else %} + No appointments found. + {% endif %} + </div> + </div> + + {% endfor %} + </form> + + </div><!-- /.box-body --> + + </div> + + {% endblock %} {% endblock maincontent %} {% block scripts %} -{{ block.super }} + {{ block.super }} -<script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> -<script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> {% endblock scripts %} diff --git a/smash/web/templates/visits/add.html b/smash/web/templates/visits/add.html index 09f0dbd09454fa550905b5142eede26eb7379769..d82401432851415ef92cede1b3853e323e5d14f7 100644 --- a/smash/web/templates/visits/add.html +++ b/smash/web/templates/visits/add.html @@ -3,8 +3,8 @@ {% load filters %} {% block styles %} -{{ block.super }} - {% include "includes/datepicker.css.html" %} + {{ block.super }} + {% include "includes/datepicker.css.html" %} {% endblock styles %} {% block ui_active_tab %}'visits'{% endblock ui_active_tab %} @@ -14,64 +14,64 @@ {% block title %}{{ block.super }} - Add new visit{% endblock %} {% block breadcrumb %} -{% include "visits/breadcrumb.html" %} + {% include "visits/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default">Cancel</a> - </div> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default">Cancel</a> + </div> - {% comment %} <div class="box-header with-border"> + {% comment %} <div class="box-header with-border"> <h3 class="box-title">Details of a visit</h3> </div>{% endcomment %} - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} - <div class="box-body"> - <div class="col-sm-6"> - {% for field in form %} - <div class="form-group {% if field.errors %}has-error{% endif %}"> - <label class="col-sm-4 control-label"> - {{ field.label }} - </label> + <div class="box-body"> + <div class="col-sm-6"> + {% for field in form %} + <div class="form-group {% if field.errors %}has-error{% endif %}"> + <label class="col-sm-4 control-label"> + {{ field.label }} + </label> - <div class="col-sm-8"> - {{ field|add_class:'form-control' }} - </div> + <div class="col-sm-8"> + {{ field|add_class:'form-control' }} + </div> - {% if field.errors %} - <span class="help-block"> + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - </div> - </div><!-- /.box-body --> - - <div class="box-footer"> - <div class="col-sm-6"> - <button type="submit" class="btn btn-block btn-success">Add</button> - </div> - <div class="col-sm-6"> - <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default">Cancel</a> - </div> - </div><!-- /.box-footer --> - </form> -</div> - -{% endblock %} + {% endif %} + </div> + {% endfor %} + </div> + </div><!-- /.box-body --> + + <div class="box-footer"> + <div class="col-sm-6"> + <button type="submit" class="btn btn-block btn-success">Add</button> + </div> + <div class="col-sm-6"> + <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default">Cancel</a> + </div> + </div><!-- /.box-footer --> + </form> + </div> + + {% endblock %} {% endblock maincontent %} {% block scripts %} - {{ block.super }} + {{ block.super }} - {% include "includes/datepicker.js.html" %} + {% include "includes/datepicker.js.html" %} {% endblock scripts %} diff --git a/smash/web/templates/visits/breadcrumb.html b/smash/web/templates/visits/breadcrumb.html index 327ee8492755b58841d81394c1685f9a65faa2e3..91d6d4baab620dbf5ad6c6ccb63a6ff77a440b5d 100644 --- a/smash/web/templates/visits/breadcrumb.html +++ b/smash/web/templates/visits/breadcrumb.html @@ -1,4 +1,4 @@ <li><a href="{% url 'web.views.appointments' %}"><i class="fa fa-dashboard"></i> Dashboard</a></li> <li class="active"> - <a href="{% url 'web.views.visits' %}">Visits</a> + <a href="{% url 'web.views.visits' %}">Visits</a> </li> diff --git a/smash/web/templates/visits/details.html b/smash/web/templates/visits/details.html index 66b9f979b2fbc000f06d30fedb70b8f9ba281539..5f4454951c9d2ec4ac1a017463343a83f37aa181 100644 --- a/smash/web/templates/visits/details.html +++ b/smash/web/templates/visits/details.html @@ -3,11 +3,11 @@ {% load filters %} {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ block.super }} + <!-- DataTables --> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> - {% include "includes/datepicker.css.html" %} + {% include "includes/datepicker.css.html" %} {% endblock styles %} {% block ui_active_tab %}'visits'{% endblock ui_active_tab %} @@ -17,178 +17,186 @@ {% block title %}{{ block.super }} - Details of visit ({{ visit.follow_up_title }}) {% endblock %} {% block breadcrumb %} -{% include "subjects/breadcrumb.html" %} + {% include "subjects/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -{% block content %} -<div class="box box-info"> - <div class="box-header with-border"> - <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default" onclick="history.back()">Back</a> - <a href="{% url 'web.views.subject_visit_details' visit.subject.id %}" type = "button" class="btn btn-block btn-default">Subject's visits</a> - </div> - - <div class="box-header with-border"> - <h3 class="box-title">Details of visit - - </h3> - </div> - - <form method="post" action="" class="form-horizontal"> - {% csrf_token %} - <div class="box-body"> - {% for field in vform %} - <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> - <label for="{# TODO #}" class="col-sm-4 control-label"> - {{ field.label }} - </label> - - <div class="col-sm-8"> - {{ field|add_class:'form-control' }} - </div> - - {% if field.errors %} - <span class="help-block"> + {% block content %} + <div class="box box-info"> + <div class="box-header with-border"> + <a href="{% url 'web.views.visits' %}" class="btn btn-block btn-default" + onclick="history.back()">Back</a> + <a href="{% url 'web.views.subject_visit_details' visit.subject.id %}" type="button" + class="btn btn-block btn-default">Subject's visits</a> + </div> + + <div class="box-header with-border"> + <h3 class="box-title">Details of visit + + </h3> + </div> + + <form method="post" action="" class="form-horizontal"> + {% csrf_token %} + <div class="box-body"> + {% for field in vform %} + <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> + <label for="{# TODO #}" class="col-sm-4 control-label"> + {{ field.label }} + </label> + + <div class="col-sm-8"> + {{ field|add_class:'form-control' }} + </div> + + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - - <div class="col-md-6 form-group"> - <label class="col-sm-4 control-label"> - Visit finished - </label> - <div class="col-sm-8"> - {% if visFinished %}<div class="btn btn-block">YES</div> - {% else %}<div class="btn btn-block"> - {% if canFinish %} - <a href="{% url 'web.views.visit_mark' vid 'finished' %}" class="btn btn-warning btn-block">Mark as finished</a> + {% endif %} + </div> + {% endfor %} + + <div class="col-md-6 form-group"> + <label class="col-sm-4 control-label"> + Visit finished + </label> + <div class="col-sm-8"> + {% if visFinished %} + <div class="btn btn-block">YES</div> + {% else %} + <div class="btn btn-block"> + {% if canFinish %} + <a href="{% url 'web.views.visit_mark' vid 'finished' %}" + class="btn btn-warning btn-block">Mark as finished</a> + {% else %} + Waiting for appointments to finish. + {% endif %} + </div> + {% endif %} + </div> + </div> + </div><!-- /.box-body --> + <div class="box-footer"> + <div class="col-sm-12"> + <button type="submit" class="btn btn-block btn-success">Save</button> + </div> + </div><!-- /.box-footer --> + </form> + + + <div class="box-header with-border"> + <h3 class="box-title">Visit's appointments</h3> + </div> + + <div> + <a href="{% url 'web.views.appointment_add' vid %}" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new appointment + </a> + </div> + + + {% if loApp %} + <table id="table" class="table table-bordered table-striped"> + <thead> + <tr> + <th>No.</th> + <th>Type</th> + <th>Date</th> + <th>Time</th> + <th>Length [min]</th> + <th>Responsible</th> + <th>Plan/Modify</th> + </tr> + </thead> + <tbody> + {% for app in loApp %} + <tr> + <td>{{ forloop.counter }}</td> + <td style="background-color:{{ app.color }} !important"> + <font COLOR="{{ app.font_color }}"> + {% for type in app.appointment_types.all %} + {{ type.code }}, + {% endfor %} + </font> + </td> + <td>{{ app.datetime_when | date:"d-M-Y" }}</td> + <td>{{ app.datetime_when | time:"H:i" }}</td> + <td>{{ app.length }}</td> + <td> + {% if app.flying_team %}{{ app.worker_assigned.first_name }} + {{ app.worker_assigned.last_name }} + {% else %} {{ app.flying_team }} + {% endif %} + </td> + <td> + {% ifequal app.status "SCHEDULED" %} + <a href="{% url 'web.views.appointment_edit' app.id %}" type="button" + class="btn btn-block btn-default">Edit</a> + {% else %} + {{ app.status }} + {% endifequal %} + </td> + </tr> + {% endfor %} + + </tbody> + </table> {% else %} - Waiting for appointments to finish. + <p>No appointments found.</p> {% endif %} + + + <div class="box-header with-border"> + <h3 class="box-title">Subject's details</h3> </div> - {% endif %} - </div> - </div> - </div><!-- /.box-body --> - <div class="box-footer"> - <div class="col-sm-12"> - <button type="submit" class="btn btn-block btn-success">Save</button> - </div> - </div><!-- /.box-footer --> - </form> - - -<div class="box-header with-border"> - <h3 class="box-title">Visit's appointments</h3> -</div> - -<div> - <a href="{% url 'web.views.appointment_add' vid %}" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new appointment - </a> -</div> - - -{% if loApp %} -<table id="table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>No.</th> - <th>Type</th> - <th>Date</th> - <th>Time</th> - <th>Length [min]</th> - <th>Responsible</th> - <th>Plan/Modify</th> - </tr> - </thead> -<tbody> - {% for app in loApp %} - <tr> - <td>{{ forloop.counter }}</td> - <td style="background-color:{{app.color}} !important"> - <font COLOR="{{app.font_color}}"> - {% for type in app.appointment_types.all %} - {{ type.code }}, - {% endfor %} - </font> - </td> - <td>{{ app.datetime_when | date:"d-M-Y" }}</td> - <td>{{ app.datetime_when | time:"H:i" }}</td> - <td>{{ app.length }}</td> - <td> - {% if app.flying_team %}{{ app.worker_assigned.first_name }} {{app.worker_assigned.last_name}} - {% else %} {{ app.flying_team }} - {% endif %} - </td> - <td> - {% ifequal app.status "SCHEDULED" %} - <a href="{% url 'web.views.appointment_edit' app.id %}" type="button" class="btn btn-block btn-default">Edit</a> - {% else %} - {{ app.status }} - {% endifequal %} - </td> - </tr> - {% endfor %} - -</tbody> -</table> -{% else %} - <p>No appointments found.</p> -{% endif %} - - -<div class="box-header with-border"> - <h3 class="box-title">Subject's details</h3> -</div> - -<form class="form-horizontal"> - <div class="box-body"> - {% for field in sform %} - <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> - <label for="{# TODO #}" class="col-sm-4 control-label"> - {{ field.label }} - </label> - - <div class="col-sm-8"> - {{ field|disable|add_class:'form-control' }} - </div> - {% if field.errors %} - <span class="help-block"> + <form class="form-horizontal"> + <div class="box-body"> + {% for field in sform %} + <div class="col-md-6 form-group {% if field.errors %}has-error{% endif %}"> + <label for="{# TODO #}" class="col-sm-4 control-label"> + {{ field.label }} + </label> + + <div class="col-sm-8"> + {{ field|disable|add_class:'form-control' }} + </div> + + {% if field.errors %} + <span class="help-block"> {{ field.errors }} </span> - {% endif %} - </div> - {% endfor %} - </div><!-- /.box-body --> - - <div class="box-footer"> - <td><a href="{% url 'web.views.subject_edit' visit.subject.id %}" type="button" class="btn btn-block btn-default">Edit subject</a></td> - <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Back</a> - </div><!-- /.box-footer --> -</form> -</div> + {% endif %} + </div> + {% endfor %} + </div><!-- /.box-body --> + + <div class="box-footer"> + <td><a href="{% url 'web.views.subject_edit' visit.subject.id %}" type="button" + class="btn btn-block btn-default">Edit subject</a></td> + <a href="{% url 'web.views.subjects' %}" class="btn btn-block btn-default" onclick="history.back()">Back</a> + </div><!-- /.box-footer --> + </form> + </div> -</form> -{% endblock %} + </form> + {% endblock %} -</div> + </div> {% endblock maincontent %} {% block scripts %} - {{ block.super }} + {{ block.super }} - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - {% include "includes/datepicker.js.html" %} + {% include "includes/datepicker.js.html" %} {% endblock scripts %} diff --git a/smash/web/templates/visits/index.html b/smash/web/templates/visits/index.html index 65a47aea2b1bbf053fc0e350164edff192c9ce72..6d82fe9098392bd9c903d3442379326a71c25378 100644 --- a/smash/web/templates/visits/index.html +++ b/smash/web/templates/visits/index.html @@ -3,13 +3,13 @@ {% block styles %} -{{ block.super }} - <!-- DataTables --> - <link rel="stylesheet" href="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.css' %}"> + {{ 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.print.css' %}" media="print"> + <!-- fullCalendar 2.2.5--> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.css' %}"> + <link rel="stylesheet" href="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.print.css' %}" media="print"> {% endblock styles %} {% block ui_active_tab %}'visits'{% endblock ui_active_tab %} @@ -19,84 +19,87 @@ {% block title %}{{ block.super }} - Visits{% endblock %} {% block breadcrumb %} -{% include "visits/breadcrumb.html" %} + {% include "visits/breadcrumb.html" %} {% endblock breadcrumb %} {% block maincontent %} -<div> - <a href="{% url 'web.views.visit_add' %}" class="btn btn-app"> - <i class="fa fa-plus"></i> - Add new visit - </a> -</div> - -<div> - <div> - {% if visit_list %} - <table id="visit_table" class="table table-bordered table-striped"> - <thead> - <tr> - <th>Subject name</th> - <th>Full information</th> - <th>Visit begins</th> - <th>Visit ends</th> - <th>Finished?</th> - </tr> - </thead> - <tbody> - {% for visit in visit_list %} - <tr> - <td>{{ visit.subject.first_name }} {{ visit.subject.last_name }}</td> - <td> - <a href="{% url 'web.views.visit_details' visit.id %}" type="button" class="btn btn-block btn-default">Details</a> - </td> - <td> - {{ visit.datetime_begin }} - </td> - <td> - {{ visit.datetime_end }} - </td> - <td> - {% if visit.is_finished %}<button type="button" class="btn btn-block btn-success">YES</button> - {% else %}<button type="button" class="btn btn-block btn-danger">NO</button> - {% endif %} - </td> - - </tr> - {% endfor %} - </tbody> - </table> - - {% else %} - <p>No visits to display.</p> - {% endif %} - - <hr /> - - </div> - -</div> + <div> + <a href="{% url 'web.views.visit_add' %}" class="btn btn-app"> + <i class="fa fa-plus"></i> + Add new visit + </a> + </div> + + <div> + <div> + {% if visit_list %} + <table id="visit_table" class="table table-bordered table-striped"> + <thead> + <tr> + <th>Subject name</th> + <th>Full information</th> + <th>Visit begins</th> + <th>Visit ends</th> + <th>Finished?</th> + </tr> + </thead> + <tbody> + {% for visit in visit_list %} + <tr> + <td>{{ visit.subject.first_name }} {{ visit.subject.last_name }}</td> + <td> + <a href="{% url 'web.views.visit_details' visit.id %}" type="button" + class="btn btn-block btn-default">Details</a> + </td> + <td> + {{ visit.datetime_begin }} + </td> + <td> + {{ visit.datetime_end }} + </td> + <td> + {% if visit.is_finished %} + <button type="button" class="btn btn-block btn-success">YES</button> + {% else %} + <button type="button" class="btn btn-block btn-danger">NO</button> + {% endif %} + </td> + + </tr> + {% endfor %} + </tbody> + </table> + + {% else %} + <p>No visits to display.</p> + {% endif %} + + <hr/> + + </div> + + </div> {% endblock maincontent %} {% block scripts %} - {{ block.super }} - - <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script> - <script src="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.js' %}"></script> - - <script> - $(function () { - $('#planning_table, #approaching_table').DataTable({ - "paging": true, - "lengthChange": false, - "searching": true, - "ordering": true, - "info": true, - "autoWidth": false - }); - }); - </script> + {{ block.super }} + + <script src="{% static 'AdminLTE/plugins/datatables/jquery.dataTables.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/moment.js/moment.min.js' %}"></script> + <script src="{% static 'AdminLTE/plugins/fullcalendar/fullcalendar.min.js' %}"></script> + + <script> + $(function () { + $('#planning_table, #approaching_table').DataTable({ + "paging": true, + "lengthChange": false, + "searching": true, + "ordering": true, + "info": true, + "autoWidth": false + }); + }); + </script> {% endblock scripts %} diff --git a/smash/web/templatetags/filters.py b/smash/web/templatetags/filters.py index 43418083c4a9317287a291425eb5abec7286aedd..2df497f0ddaaefa14b4fcc94294fdee4913176b1 100644 --- a/smash/web/templatetags/filters.py +++ b/smash/web/templatetags/filters.py @@ -3,6 +3,7 @@ from django import template register = template.Library() + @register.filter(name='add_class') def add_class(value, arg): # Get all the field's initial css-classes @@ -15,7 +16,8 @@ def add_class(value, arg): # Return the widget with freshly crafted classes return value.as_widget(attrs={'class': css_classes}) + @register.filter(name='disable') def disable(value): - value.field.widget.attrs['disabled']='disabled' + value.field.widget.attrs['disabled'] = 'disabled' return value diff --git a/smash/web/tests/functions.py b/smash/web/tests/functions.py index afd97ec1caf489279d723c94752eb242e29e3278..e5b5f0e43d30486f76c00fad1bbf31832bac1d88 100644 --- a/smash/web/tests/functions.py +++ b/smash/web/tests/functions.py @@ -1,31 +1,38 @@ -from datetime import timedelta +import datetime + +from django.contrib.auth.models import User + +from web.models import Location, AppointmentType, Subject, Worker, Visit, Appointment +from web.views import get_today_midnight_date -from web.models import * -from web.views import * def create_location(name="test"): return Location.objects.create(name=name) + def get_test_location(): - locations = Location.objects.filter(name = "test"); - if len(locations)>0: + locations = Location.objects.filter(name="test") + if len(locations) > 0: return locations[0] else: - return create_location() + return create_location() + def create_appointment_type(): return AppointmentType.objects.create( - code= "C", + code="C", default_duration="10", description="test", ) + def create_subject(): return Subject.objects.create( first_name="Piotr", last_name="Gawron", - default_location = get_test_location(), - sex= Subject.SEX_CHOICES_MALE) + default_location=get_test_location(), + sex=Subject.SEX_CHOICES_MALE) + def create_user(): user = User.objects.create_user( @@ -37,26 +44,28 @@ def create_user(): return user -def create_worker(user = None): +def create_worker(user=None): return Worker.objects.create( first_name='piotr', last_name="gawron", email='jacob@bla', - user = user, - ) - -def create_visit(subject = None): - if subject == None: - subject= create_subject() - return Visit.objects.create(datetime_begin=get_today_midnight_date()+datetime.timedelta(days=-31), - datetime_end=get_today_midnight_date()+datetime.timedelta(days=31), - subject =subject, - is_finished = False) - -def create_appointment(visit= None): - if visit == None: + user=user, + ) + + +def create_visit(subject=None): + if subject is None: + subject = create_subject() + return Visit.objects.create(datetime_begin=get_today_midnight_date() + datetime.timedelta(days=-31), + datetime_end=get_today_midnight_date() + datetime.timedelta(days=31), + subject=subject, + is_finished=False) + + +def create_appointment(visit=None): + if visit is None: visit = create_visit() return Appointment.objects.create( - visit = visit, - length = 30, - location = get_test_location()) + visit=visit, + length=30, + location=get_test_location()) diff --git a/smash/web/tests/test_AppointmentAddForm.py b/smash/web/tests/test_AppointmentAddForm.py index 2dfc3e7d154ffa4cf78f0086bc5fc1ba3bd86c38..7861e12f9bb24e72c016e4e3a8101e9492cfdbb6 100644 --- a/smash/web/tests/test_AppointmentAddForm.py +++ b/smash/web/tests/test_AppointmentAddForm.py @@ -1,8 +1,10 @@ from django.test import TestCase + +from functions import create_user, create_visit, create_location +from functions import get_test_location from web.forms import AppointmentAddForm -from web.models import Subject +from web.models import Worker -from web.tests.functions import * class AppointmentAddFormTests(TestCase): def setUp(self): @@ -16,11 +18,11 @@ class AppointmentAddFormTests(TestCase): self.visit = create_visit() self.sample_data = {'first_name': 'name', - 'length': '50', - 'visit' : self.visit.id, - 'location' : location.id, - 'datetime_when' : "2020-01-01", - } + 'length': '50', + 'visit': self.visit.id, + 'location': location.id, + 'datetime_when': "2020-01-01", + } def test_validation(self): form = AppointmentAddForm(user=self.user, data=self.sample_data) diff --git a/smash/web/tests/test_AppointmentEditForm.py b/smash/web/tests/test_AppointmentEditForm.py index e1ef88cc72a02279e1e6793e24ef12f79589bfcf..23e816d981853a7a4c70f894c2f44f71bc38e7d2 100644 --- a/smash/web/tests/test_AppointmentEditForm.py +++ b/smash/web/tests/test_AppointmentEditForm.py @@ -1,8 +1,10 @@ from django.test import TestCase + +from functions import get_test_location, create_user, create_visit, create_location +from web.forms import AppointmentAddForm from web.forms import AppointmentEditForm -from web.models import Subject +from web.models import Worker -from web.tests.functions import * class AppointmentEditFormTests(TestCase): def setUp(self): @@ -16,16 +18,15 @@ class AppointmentEditFormTests(TestCase): self.visit = create_visit() self.sample_data = {'first_name': 'name', - 'length': '50', - 'visit' : self.visit.id, - 'location' : location.id, - 'datetime_when' : "2020-01-01", - } + 'length': '50', + 'visit': self.visit.id, + 'location': location.id, + 'datetime_when': "2020-01-01", + } add_form = AppointmentAddForm(user=self.user, data=self.sample_data) self.appointment = add_form.save() - def test_validation(self): form = AppointmentEditForm(user=self.user, data=self.sample_data) self.assertTrue(form.is_valid()) diff --git a/smash/web/tests/test_SubjectAddForm.py b/smash/web/tests/test_SubjectAddForm.py index 4e78578c3a93d9f901802242cfaae538c2fee014..c0af1e319da6431fc861173f4ddbfc7444d540ca 100644 --- a/smash/web/tests/test_SubjectAddForm.py +++ b/smash/web/tests/test_SubjectAddForm.py @@ -1,20 +1,22 @@ from django.test import TestCase + +from functions import get_test_location from web.forms import SubjectAddForm from web.models import Subject -from web.tests.functions import * class SubjectAddFormTests(TestCase): def setUp(self): location = get_test_location() self.sample_data = {'first_name': 'name', - 'last_name': 'name', - 'sex' : Subject.SEX_CHOICES_MALE, - 'type' : Subject.SUBJECT_TYPE_CHOICES_CONTROL, - 'default_location' : location.id, - 'screening_number' : "123", - 'country' : 'Luxembourg' - } + 'last_name': 'name', + 'sex': Subject.SEX_CHOICES_MALE, + 'type': Subject.SUBJECT_TYPE_CHOICES_CONTROL, + 'default_location': location.id, + 'screening_number': "123", + 'country': 'Luxembourg' + } + def test_validation(self): form = SubjectAddForm(data=self.sample_data) form.is_valid() diff --git a/smash/web/tests/test_SubjectEditForm.py b/smash/web/tests/test_SubjectEditForm.py index 340d2f4cd6832fbe43af3c5e2296c52a76253289..7baf1732c696d75c0899e34c95f27e97b526736b 100644 --- a/smash/web/tests/test_SubjectEditForm.py +++ b/smash/web/tests/test_SubjectEditForm.py @@ -1,22 +1,23 @@ from django.test import TestCase + +from functions import get_test_location from web.forms import SubjectAddForm from web.forms import SubjectEditForm from web.models import Subject -from web.tests.functions import * class SubjectEditFormTests(TestCase): def setUp(self): location = get_test_location() self.sample_data = {'first_name': 'name', - 'last_name': 'name', - 'sex' : Subject.SEX_CHOICES_MALE, - 'type' : Subject.SUBJECT_TYPE_CHOICES_CONTROL, - 'default_location' : location.id, - 'country' : 'Luxembourg', - 'screening_number' : '123', - 'nd_number' : 'nd_123' - } + 'last_name': 'name', + 'sex': Subject.SEX_CHOICES_MALE, + 'type': Subject.SUBJECT_TYPE_CHOICES_CONTROL, + 'default_location': location.id, + 'country': 'Luxembourg', + 'screening_number': '123', + 'nd_number': 'nd_123' + } def tearDown(self): Subject.objects.all().delete() diff --git a/smash/web/tests/test_VisitAddForm.py b/smash/web/tests/test_VisitAddForm.py index 2916e650bf12f88886fbcf157afc94d493751264..6eea4e9ff337af69e7b2943e1566e6ace697e71b 100644 --- a/smash/web/tests/test_VisitAddForm.py +++ b/smash/web/tests/test_VisitAddForm.py @@ -1,27 +1,28 @@ +from __future__ import print_function + from django.test import TestCase -from web.forms import SubjectAddForm + +from functions import create_subject +from functions import get_test_location from web.forms import VisitAddForm -from web.models import Subject -from web.models import Visit -from web.tests.functions import * class SubjectAddFormTests(TestCase): def setUp(self): - location = get_test_location() + get_test_location() self.subject = create_subject() self.sample_data = {'datetime_begin': "2017-01-01", - 'datetime_end': "2017-02-02", - 'subject' : self.subject.id, - 'appointment_types' : '' + 'datetime_end': "2017-02-02", + 'subject': self.subject.id, + 'appointment_types': '' - } + } def test_validation(self): form = VisitAddForm(data=self.sample_data) is_valid = form.is_valid() - print form.errors + print(form.errors) self.assertTrue(is_valid) def test_invalid_validation(self): diff --git a/smash/web/tests/test_model_subject.py b/smash/web/tests/test_model_subject.py index 4d9f479794896160bc3596ab91180facace87337..ce31aab861b51678adf6b78fe8b39846d06f7c1d 100644 --- a/smash/web/tests/test_model_subject.py +++ b/smash/web/tests/test_model_subject.py @@ -1,15 +1,12 @@ -from django.contrib.auth.models import User -from django.test import TestCase, RequestFactory -from django.urls import reverse +from django.test import TestCase -from web.views import * +from functions import create_subject, create_appointment +from functions import create_visit +from web.models import Appointment +from web.models import Visit -from web.models import * - -from web.tests.functions import * class SubjectModelTests(TestCase): - def test_mark_as_dead(self): subject = create_subject() visit = create_visit(subject) @@ -17,10 +14,10 @@ class SubjectModelTests(TestCase): subject.mark_as_dead() appointment_status = Appointment.objects.filter(id=appointment.id)[0].status - visit_finsihed = Visit.objects.filter(id=visit.id)[0].is_finished + visit_finished = Visit.objects.filter(id=visit.id)[0].is_finished self.assertTrue(subject.dead) - self.assertTrue(visit_finsihed) + self.assertTrue(visit_finished) self.assertEquals(Appointment.APPOINTMENT_STATUS_CANCELLED, appointment_status) def test_mark_as_rejected(self): diff --git a/smash/web/tests/test_model_visit.py b/smash/web/tests/test_model_visit.py index 670d27346c764aa7deb37ce407c77baa7fe03806..2a54bcb98df71668457065eefac420c2f0095071 100644 --- a/smash/web/tests/test_model_visit.py +++ b/smash/web/tests/test_model_visit.py @@ -1,15 +1,11 @@ -from django.contrib.auth.models import User -from django.test import TestCase, RequestFactory -from django.urls import reverse +from django.test import TestCase -from web.views import * +from functions import create_subject +from functions import create_visit +from web.models import Visit -from web.models import * - -from web.tests.functions import * class VisitModelTests(TestCase): - def test_mark_as_finished(self): subject = create_subject() visit = create_visit(subject) @@ -22,7 +18,7 @@ class VisitModelTests(TestCase): def test_mark_as_finished_2(self): subject = create_subject() visit = create_visit(subject) - subject.dead=True + subject.dead = True subject.save() visit.mark_as_finished() @@ -33,7 +29,7 @@ class VisitModelTests(TestCase): def test_mark_as_finished_3(self): subject = create_subject() visit = create_visit(subject) - subject.resigned=True + subject.resigned = True subject.save() visit.mark_as_finished() diff --git a/smash/web/tests/test_view_appointments.py b/smash/web/tests/test_view_appointments.py index e65829a7fd9c9429d9d9ff4407adf8b3bfad868a..22cd13d366fd6a4185c3e0e5ff871ccd83690b96 100644 --- a/smash/web/tests/test_view_appointments.py +++ b/smash/web/tests/test_view_appointments.py @@ -2,8 +2,10 @@ from django.contrib.auth.models import User from django.test import TestCase, RequestFactory from django.urls import reverse -from web.views import * -from web.tests.functions import * +from functions import create_subject, create_visit, create_appointment +from web.models import Appointment +from web.views import appointments, appointment_mark + class AppointmentsViewTests(TestCase): def setUp(self): @@ -13,38 +15,38 @@ class AppointmentsViewTests(TestCase): username='piotr', email='jacob@bla', password='top_secret') def test_appointments_list_request(self): - request = self.factory.get(reverse('web.views.appointments')); + request = self.factory.get(reverse('web.views.appointments')) request.user = self.user - response = appointments(request); + response = appointments(request) self.assertEqual(response.status_code, 200) def test_mark_as_finished(self): - subject = create_subject(); + subject = create_subject() visit = create_visit(subject) appointment = create_appointment(visit) - request = self.factory.get(reverse('web.views.appointment_mark', args=[appointment.id, 'finished'])); + request = self.factory.get(reverse('web.views.appointment_mark', args=[appointment.id, 'finished'])) request.user = self.user - response = appointment_mark(request, appointment.id, 'finished'); + response = appointment_mark(request, appointment.id, 'finished') self.assertEqual(response.status_code, 302) def test_mark_as_cancelled(self): - subject = create_subject(); + subject = create_subject() visit = create_visit(subject) appointment = create_appointment(visit) - request = self.factory.get(reverse('web.views.appointment_mark', args=[appointment.id, 'cancelled'])); + request = self.factory.get(reverse('web.views.appointment_mark', args=[appointment.id, 'cancelled'])) request.user = self.user - response = appointment_mark(request, appointment.id, 'cancelled'); + response = appointment_mark(request, appointment.id, 'cancelled') self.assertEqual(response.status_code, 302) - update_appointment = Appointment.objects.filter(id= appointment.id)[0] + update_appointment = Appointment.objects.filter(id=appointment.id)[0] self.assertEqual(update_appointment.status, Appointment.APPOINTMENT_STATUS_CANCELLED) def test_mark_as_no_show(self): - subject = create_subject(); + subject = create_subject() visit = create_visit(subject) appointment = create_appointment(visit) - request = self.factory.get(reverse('web.views.appointment_mark', args=[appointment.id, 'no_show'])); + request = self.factory.get(reverse('web.views.appointment_mark', args=[appointment.id, 'no_show'])) request.user = self.user - response = appointment_mark(request, appointment.id, 'no_show'); + response = appointment_mark(request, appointment.id, 'no_show') self.assertEqual(response.status_code, 302) - update_appointment = Appointment.objects.filter(id= appointment.id)[0] + update_appointment = Appointment.objects.filter(id=appointment.id)[0] self.assertEqual(update_appointment.status, Appointment.APPOINTMENT_STATUS_NO_SHOW) diff --git a/smash/web/tests/test_view_functions.py b/smash/web/tests/test_view_functions.py index 7651e37a4ee5eabfb2e337ec8e05e60b6277a174..88410ae32ad55189bef40697c5d1dd6eec7c89ab 100644 --- a/smash/web/tests/test_view_functions.py +++ b/smash/web/tests/test_view_functions.py @@ -1,10 +1,9 @@ from django.test import TestCase -from web.forms import SubjectAddForm -from web.forms import VisitAddForm -from web.models import Subject -from web.models import Visit -from web.tests.functions import * +from functions import create_location, create_user, create_worker, get_test_location +from web.models import Location +from web.views import get_filter_locations + class ViewFunctionsTests(TestCase): def setUp(self): diff --git a/smash/web/tests/test_view_kit_request.py b/smash/web/tests/test_view_kit_request.py index 6b32ea7e142954bb750a77cf80c40af4fcc39042..d07bd8c6f5a34f4b7c03c7fd6d5726464b98fa78 100644 --- a/smash/web/tests/test_view_kit_request.py +++ b/smash/web/tests/test_view_kit_request.py @@ -1,9 +1,12 @@ +import datetime + from django.test import TestCase, RequestFactory from django.urls import reverse -from web.views import * +from functions import create_user, create_appointment_type, create_appointment, create_location +from web.models import Item, Appointment +from web.views import kit_requests, get_today_midnight_date -from web.tests.functions import * class ViewFunctionsTests(TestCase): def setUp(self): @@ -11,13 +14,13 @@ class ViewFunctionsTests(TestCase): self.user = create_user() def test_kit_requests(self): - request = self.factory.get(reverse('web.views.kit_requests')); + request = self.factory.get(reverse('web.views.kit_requests')) request.user = self.user - response = kit_requests(request); + response = kit_requests(request) self.assertEqual(response.status_code, 200) def test_kit_requests_2(self): - item_name = "Test item to be ordered" + item_name = "Test item to be ordered" item = Item.objects.create(disposable=True, name=item_name) appointment_type = create_appointment_type() appointment_type.required_equipment.add(item) @@ -28,15 +31,15 @@ class ViewFunctionsTests(TestCase): appointment.appointment_types.add(appointment_type) appointment.save() - request = self.factory.get(reverse('web.views.kit_requests')); + request = self.factory.get(reverse('web.views.kit_requests')) request.user = self.user - response = kit_requests(request); + response = kit_requests(request) self.assertEqual(response.status_code, 200) self.assertTrue(item_name in response.content) def test_kit_requests_4(self): - item_name = "Test item to be ordered" + item_name = "Test item to be ordered" item = Item.objects.create(disposable=True, name=item_name) appointment_type = create_appointment_type() appointment_type.required_equipment.add(item) @@ -48,15 +51,15 @@ class ViewFunctionsTests(TestCase): appointment.status = Appointment.APPOINTMENT_STATUS_CANCELLED appointment.save() - request = self.factory.get(reverse('web.views.kit_requests')); + request = self.factory.get(reverse('web.views.kit_requests')) request.user = self.user - response = kit_requests(request); + response = kit_requests(request) self.assertEqual(response.status_code, 200) self.assertFalse(item_name in response.content) def test_kit_requests_3(self): - item_name = "Test item to be ordered" + item_name = "Test item to be ordered" item = Item.objects.create(disposable=True, name=item_name) appointment_type = create_appointment_type() appointment_type.required_equipment.add(item) @@ -68,9 +71,9 @@ class ViewFunctionsTests(TestCase): appointment.location = create_location("other_loc") appointment.save() - request = self.factory.get(reverse('web.views.kit_requests')); + request = self.factory.get(reverse('web.views.kit_requests')) request.user = self.user - response = kit_requests(request); + response = kit_requests(request) self.assertEqual(response.status_code, 200) - self.assertFalse(not item_name in response.content) + self.assertTrue(item_name in response.content) diff --git a/smash/web/tests/test_view_notifications.py b/smash/web/tests/test_view_notifications.py index 9a2fb73aad6adf009be43399f0640e2fb77e9131..60095c78547145cc621cfd586fc0233db88a60b5 100644 --- a/smash/web/tests/test_view_notifications.py +++ b/smash/web/tests/test_view_notifications.py @@ -1,14 +1,16 @@ +import datetime + from django.contrib.auth.models import User from django.test import TestCase, RequestFactory -from django.urls import reverse - -from web.views import * -from web.models import * - -from web.tests.functions import * - -import datetime +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.views import get_exceeded_visit_notifications_count, get_approaching_visits_without_appointments_count, \ + get_today_midnight_date, get_subject_with_no_visit_notifications_count, get_unfinished_appointments_count, \ + get_approaching_visits_for_mail_contact_count, get_subjects_with_reminder_count, \ + get_visits_without_appointments_count class NotificationViewTests(TestCase): @@ -25,7 +27,7 @@ class NotificationViewTests(TestCase): visit = create_visit(subject) visit.datetime_end = "2011-01-01" visit.save() - appointment = create_appointment(visit) + create_appointment(visit) notification = get_exceeded_visit_notifications_count(self.user) self.assertEquals(original_notification.count + 1, notification.count) @@ -38,7 +40,7 @@ class NotificationViewTests(TestCase): visit.datetime_end = "2011-01-01" visit.is_finished = True visit.save() - appointment = create_appointment(visit) + create_appointment(visit) notification = get_exceeded_visit_notifications_count(self.user) self.assertEquals(original_notification.count, notification.count) @@ -46,7 +48,7 @@ class NotificationViewTests(TestCase): def test_get_visits_without_appointments_count(self): original_notification = get_visits_without_appointments_count(self.user) subject = create_subject() - visit = create_visit(subject) + create_visit(subject) notification = get_visits_without_appointments_count(self.user) self.assertEquals(original_notification.count + 1, notification.count) @@ -78,7 +80,7 @@ class NotificationViewTests(TestCase): original_notification = get_approaching_visits_without_appointments_count(self.user) subject = create_subject() visit = create_visit(subject) - visit.datetime_begin = get_today_midnight_date()+datetime.timedelta(days=2) + visit.datetime_begin = get_today_midnight_date() + datetime.timedelta(days=2) visit.save() notification = get_approaching_visits_without_appointments_count(self.user) @@ -88,9 +90,9 @@ class NotificationViewTests(TestCase): original_notification = get_approaching_visits_without_appointments_count(self.user) subject = create_subject() visit = create_visit(subject) - visit.datetime_begin = get_today_midnight_date()+datetime.timedelta(days=2) + visit.datetime_begin = get_today_midnight_date() + datetime.timedelta(days=2) visit.save() - appointment = create_appointment(visit) + create_appointment(visit) notification = get_approaching_visits_without_appointments_count(self.user) self.assertEquals(original_notification.count, notification.count) @@ -99,7 +101,7 @@ class NotificationViewTests(TestCase): original_notification = get_approaching_visits_without_appointments_count(self.user) subject = create_subject() visit = create_visit(subject) - visit.datetime_begin = get_today_midnight_date()+datetime.timedelta(days=2) + visit.datetime_begin = get_today_midnight_date() + datetime.timedelta(days=2) visit.save() appointment = create_appointment(visit) @@ -111,7 +113,7 @@ class NotificationViewTests(TestCase): def test_get_subject_with_no_visit_notifications_count(self): original_notification = get_subject_with_no_visit_notifications_count(self.user) - subject = create_subject() + create_subject() notification = get_subject_with_no_visit_notifications_count(self.user) self.assertEquals(original_notification.count + 1, notification.count) @@ -121,7 +123,7 @@ class NotificationViewTests(TestCase): subject = create_subject() visit = create_visit(subject) - visit.is_finished=True + visit.is_finished = True visit.save() notification = get_subject_with_no_visit_notifications_count(self.user) @@ -131,7 +133,7 @@ class NotificationViewTests(TestCase): original_notification = get_subject_with_no_visit_notifications_count(self.user) subject = create_subject() - visit = create_visit(subject) + create_visit(subject) notification = get_subject_with_no_visit_notifications_count(self.user) self.assertEquals(original_notification.count, notification.count) @@ -182,37 +184,36 @@ class NotificationViewTests(TestCase): create_location("l1") create_location("l2") original_notification = get_subject_with_no_visit_notifications_count(self.user) - subject = create_subject() + create_subject() notification = get_subject_with_no_visit_notifications_count(self.user) self.assertEquals(original_notification.count + 1, notification.count) def test_get_subject_with_no_visit_notifications_count_for_invalid_location(self): worker = create_worker() - worker.locations= [create_location("l2")] + worker.locations = [create_location("l2")] worker.save() original_notification = get_subject_with_no_visit_notifications_count(worker) subject = create_subject() - subject.default_location=create_location("l1") + subject.default_location = create_location("l1") subject.save() notification = get_subject_with_no_visit_notifications_count(worker) self.assertEquals(original_notification.count, notification.count) - worker.locations= Location.objects.filter(name="l1") + worker.locations = Location.objects.filter(name="l1") worker.save() notification = get_subject_with_no_visit_notifications_count(worker) - self.assertEquals(original_notification.count +1, notification.count) - + self.assertEquals(original_notification.count + 1, notification.count) def test_get_approaching_visits_for_mail_contact_count(self): original_notification = get_approaching_visits_for_mail_contact_count(self.user) subject = create_subject() visit = create_visit(subject) - visit.datetime_begin = get_today_midnight_date()+datetime.timedelta(days=100) + visit.datetime_begin = get_today_midnight_date() + datetime.timedelta(days=100) visit.save() notification = get_approaching_visits_for_mail_contact_count(self.user) @@ -222,9 +223,9 @@ class NotificationViewTests(TestCase): original_notification = get_approaching_visits_for_mail_contact_count(self.user) subject = create_subject() visit = create_visit(subject) - visit.datetime_begin = get_today_midnight_date()+datetime.timedelta(days=100) + visit.datetime_begin = get_today_midnight_date() + datetime.timedelta(days=100) visit.save() - appointment = create_appointment(visit) + create_appointment(visit) notification = get_approaching_visits_for_mail_contact_count(self.user) self.assertEquals(original_notification.count, notification.count) @@ -233,7 +234,7 @@ class NotificationViewTests(TestCase): original_notification = get_approaching_visits_for_mail_contact_count(self.user) subject = create_subject() visit = create_visit(subject) - visit.datetime_begin = get_today_midnight_date()+datetime.timedelta(days=100) + visit.datetime_begin = get_today_midnight_date() + datetime.timedelta(days=100) visit.save() appointment = create_appointment(visit) @@ -247,7 +248,7 @@ class NotificationViewTests(TestCase): original_notification = get_approaching_visits_for_mail_contact_count(self.user) subject = create_subject() visit = create_visit(subject) - visit.datetime_begin = get_today_midnight_date()+datetime.timedelta(days=100) + visit.datetime_begin = get_today_midnight_date() + datetime.timedelta(days=100) visit.post_mail_sent = True visit.save() @@ -258,7 +259,7 @@ class NotificationViewTests(TestCase): original_without_visit_notification = get_subject_with_no_visit_notifications_count(self.user) original_notification = get_subjects_with_reminder_count(self.user) subject = create_subject() - subject.datetime_contact_reminder = get_today_midnight_date()+datetime.timedelta(days=-1) + subject.datetime_contact_reminder = get_today_midnight_date() + datetime.timedelta(days=-1) subject.save() notification = get_subjects_with_reminder_count(self.user) @@ -271,7 +272,7 @@ class NotificationViewTests(TestCase): original_without_visit_notification = get_subject_with_no_visit_notifications_count(self.user) original_notification = get_subjects_with_reminder_count(self.user) subject = create_subject() - subject.datetime_contact_reminder = get_today_midnight_date()+datetime.timedelta(hours=23) + subject.datetime_contact_reminder = get_today_midnight_date() + datetime.timedelta(hours=23) subject.save() notification = get_subjects_with_reminder_count(self.user) @@ -284,7 +285,7 @@ class NotificationViewTests(TestCase): original_without_visit_notification = get_subject_with_no_visit_notifications_count(self.user) original_notification = get_subjects_with_reminder_count(self.user) subject = create_subject() - subject.datetime_contact_reminder = get_today_midnight_date()+datetime.timedelta(days=2) + subject.datetime_contact_reminder = get_today_midnight_date() + datetime.timedelta(days=2) subject.save() notification = get_subjects_with_reminder_count(self.user) diff --git a/smash/web/tests/test_view_visit.py b/smash/web/tests/test_view_visit.py index 8006943047ef7c88e86d492a1f732e9615957b20..da9d39fccd4ed4be075fd468ff2c4e3ff9f2a21c 100644 --- a/smash/web/tests/test_view_visit.py +++ b/smash/web/tests/test_view_visit.py @@ -2,11 +2,9 @@ from django.contrib.auth.models import User from django.test import TestCase, RequestFactory from django.urls import reverse -from web.views import * +from functions import create_subject, create_visit, create_appointment +from web.views import visit_details -from web.models import * - -from web.tests.functions import * class VisitViewTests(TestCase): def setUp(self): @@ -18,9 +16,9 @@ class VisitViewTests(TestCase): def test_visit_details_request(self): subject = create_subject() visit = create_visit(subject) - appointment = create_appointment(visit) + create_appointment(visit) - request = self.factory.get(reverse('web.views.visit_details', args=[visit.id])); + request = self.factory.get(reverse('web.views.visit_details', args=[visit.id])) request.user = self.user - response = visit_details(request, visit.id); + response = visit_details(request, visit.id) self.assertEqual(response.status_code, 200) diff --git a/smash/web/urls.py b/smash/web/urls.py index 46500c6bd3a953d157ae7a4eab6d64265a2f8061..4712179e99e4667e9911d93afa9e1d2df3c7ce49 100644 --- a/smash/web/urls.py +++ b/smash/web/urls.py @@ -13,28 +13,32 @@ Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ -from django.conf.urls import url +from django.conf import settings from django.conf.urls import include +from django.conf.urls import url from web import views -from django.conf import settings - urlpatterns = [ url(r'^appointments$', views.appointments, name='web.views.appointments'), url(r'^appointments/unfinished$', views.unfinished_appointments, name='web.views.unfinished_appointments'), url(r'^appointments/details/(?P<id>\d+)$', views.appointment_details, name='web.views.appointment_details'), url(r'^appointments/add/(?P<id>\d+)$', views.appointment_add, name='web.views.appointment_add'), url(r'^appointments/edit/(?P<id>\d+)$', views.appointment_edit, name='web.views.appointment_edit'), - url(r'^appointments/edit_datetime/(?P<id>\d+)$', views.appointment_edit_datetime, name='web.views.appointment_edit_datetime'), - url(r'^appointments/mark/(?P<id>\d+)/(?P<as_what>[A-z]+)$', views.appointment_mark, name='web.views.appointment_mark'), + url(r'^appointments/edit_datetime/(?P<id>\d+)$', views.appointment_edit_datetime, + name='web.views.appointment_edit_datetime'), + url(r'^appointments/mark/(?P<id>\d+)/(?P<as_what>[A-z]+)$', views.appointment_mark, + name='web.views.appointment_mark'), url(r'^visits$', views.visits, name='web.views.visits'), url(r'^visits/exceeded$', views.exceeded_visits, name='web.views.exceeded_visits'), url(r'^visits/unfinished$', views.unfinished_visits, name='web.views.unfinished_visits'), - url(r'^visits/approaching$', views.approaching_visits_without_appointments, name='web.views.approaching_visits_without_appointments'), - url(r'^visits/approaching_post_mail$', views.approaching_visits_for_mail_contact, name='web.views.approaching_visits_for_mail_contact'), - url(r'^visits/missing_appointments$', views.visits_with_missing_appointments, name='web.views.visits_with_missing_appointments'), + url(r'^visits/approaching$', views.approaching_visits_without_appointments, + name='web.views.approaching_visits_without_appointments'), + url(r'^visits/approaching_post_mail$', views.approaching_visits_for_mail_contact, + name='web.views.approaching_visits_for_mail_contact'), + url(r'^visits/missing_appointments$', views.visits_with_missing_appointments, + name='web.views.visits_with_missing_appointments'), url(r'^visits/details/(?P<id>\d+)$', views.visit_details, name='web.views.visit_details'), url(r'^visits/add$', views.visit_add, name='web.views.visit_add'), url(r'^visits/add/(?P<subject_id>\d+)$', views.visit_add, name='web.views.visit_add'), @@ -44,7 +48,8 @@ urlpatterns = [ url(r'^subjects/no_visit$', views.subject_no_visits, name='web.views.subject_no_visits'), url(r'^subjects/equire_contact$', views.subject_require_contact, name='web.views.subject_require_contact'), url(r'^subjects/add$', views.subject_add, name='web.views.subject_add'), - url(r'^subjects/subject_visit_details/(?P<id>\d+)$', views.subject_visit_details, name='web.views.subject_visit_details'), + url(r'^subjects/subject_visit_details/(?P<id>\d+)$', views.subject_visit_details, + name='web.views.subject_visit_details'), url(r'^subjects/edit/(?P<id>\d+)$', views.subject_edit, name='web.views.subject_edit'), url(r'^subjects/delete/(?P<id>\d+)$', views.subject_delete, name='web.views.subject_delete'), url(r'^subjects/mark/(?P<id>\d+)/(?P<as_what>[A-z]+)$', views.subject_mark, name='web.views.subject_mark'), @@ -54,14 +59,16 @@ urlpatterns = [ url(r'^doctors/details/(?P<doctor_id>\d+)$', views.doctor_details, name='web.views.doctor_details'), url(r'^doctors/edit/(?P<doctor_id>\d+)$', views.doctor_edit, name='web.views.doctor_edit'), url(r'^doctors/availability/(?P<doctor_id>\d+)$', views.doctor_availability, name='web.views.doctor_availability'), - url(r'^doctors/availability/(?P<doctor_id>\d+)/delete/(?P<availability_id>\d+)$', views.doctor_availability_delete, name='web.views.doctor_availability_delete'), + url(r'^doctors/availability/(?P<doctor_id>\d+)/delete/(?P<availability_id>\d+)$', views.doctor_availability_delete, + name='web.views.doctor_availability_delete'), 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'^equipment_and_rooms/kit_requests$', views.kit_requests, name='web.views.kit_requests'), - url(r'^equipment_and_rooms/kit_requests/(?P<start_date>[\w-]+)/$', views.kit_requests_send_mail, name='web.views.kit_requests_send_mail'), - url(r'^equipment_and_rooms/kit_requests/(?P<start_date>[\w-]+)/(?P<end_date>[\w-]+)/$', views.kit_requests_send_mail, name='web.views.kit_requests_send_mail'), - + url(r'^equipment_and_rooms/kit_requests/(?P<start_date>[\w-]+)/$', views.kit_requests_send_mail, + name='web.views.kit_requests_send_mail'), + url(r'^equipment_and_rooms/kit_requests/(?P<start_date>[\w-]+)/(?P<end_date>[\w-]+)/$', + views.kit_requests_send_mail, name='web.views.kit_requests_send_mail'), url(r'^mail_templates$', views.mail_templates, name='web.views.mail_templates'), @@ -71,11 +78,12 @@ urlpatterns = [ url(r'^login$', views.login, name='web.views.login'), url(r'^logout$', views.logout, name='web.views.logout'), - url(r'^$', views.index, name='web.views.index') + url(r'^$', views.index, name='web.views.index') ] if settings.DEBUG: import debug_toolbar + urlpatterns += [ url(r'^__debug__/', include(debug_toolbar.urls)), ] diff --git a/smash/web/views.py b/smash/web/views.py index 6734692cc107937e9b639a04808ee79bedf3f269..30ea696fdd5247fc3213c04cd9b3eeef6c38c021 100644 --- a/smash/web/views.py +++ b/smash/web/views.py @@ -1,27 +1,24 @@ from __future__ import unicode_literals -from django.contrib.auth.decorators import login_required -from django.shortcuts import redirect, render, get_object_or_404 -from django.http import HttpResponse -from django.template import loader -from django.views import generic -from .models import * -from .forms import * -from .auth import * # Own wrapper for django logging in/out -from django.forms import modelformset_factory -from django.shortcuts import render -from django.db.models import Q -import collections + +import csv import datetime -from django.db.models import Count + +from django.contrib.auth.decorators import login_required +from django.contrib.auth.models import User, AnonymousUser from django.db.models import Case +from django.db.models import Count from django.db.models import When +from django.forms import HiddenInput +from django.http import HttpResponse +from django.shortcuts import redirect, get_object_or_404 +from django.shortcuts import render from django.utils.dateparse import parse_datetime -import csv - +from auth import do_logout, do_login +from forms import SubjectDetailForm, WorkerEditForm, WorkerDetailForm, AppointmentDetailForm, AppointmentAddForm, \ + AppointmentEditForm, KitRequestForm, SubjectEditForm, SubjectAddForm, VisitAddForm, WorkerAddForm, VisitDetailForm +from models import Worker, Location, Visit, Subject, Appointment, Avaibility, Item, AppointmentType -# See https://docs.djangoproject.com/en/1.10/topics/http/views/#customizing-error-views -# They should work ONLY in production! (DEBUG=False) handler404 = 'web.views.e404_page_not_found' handler500 = 'web.views.e500_error' handler403 = 'web.views.e403_permission_denied' @@ -29,432 +26,465 @@ handler400 = 'web.views.e400_bad_request' def index(request): - if request.user.is_authenticated(): - return redirect(appointments) - return redirect(login) + if request.user.is_authenticated(): + return redirect(appointments) + return redirect(login) + +def e404_page_not_found(request, context=None): + return render(request, "errors/404.html", context, status=404) -def e404_page_not_found(request, context = None): - return render(request, "errors/404.html", context, status=404) -def e500_error(request, context = None): - return render(request, "errors/500.html", context, status=500) +def e500_error(request, context=None): + return render(request, "errors/500.html", context, status=500) -def e403_permission_denied(request, context = None): - return render(request, "errors/403.html", context, status=403) -def e400_bad_request(request, context = None): - return render(request, "errors/400.html", context, status=400) +def e403_permission_denied(request, context=None): + return render(request, "errors/403.html", context, status=403) + + +def e400_bad_request(request, context=None): + return render(request, "errors/400.html", context, status=400) def login(request): - context = { - 'state' : 'initial' - } - if request.GET and request.GET.get('error'): - context['state'] = request.GET.get('error') - - if request.method == "GET" and request.GET: - context['next'] = request.GET.get('next') - - if request.method == "POST" and request.POST: - state, message = do_login(request) - if state == True: - if request.POST.get('next'): - return redirect(request.POST.get('next')) - else: - return redirect(appointments) - else: - return redirect('/login?error=' + message) - return render(request, "login.html", context) + context = { + 'state': 'initial' + } + if request.GET and request.GET.get('error'): + context['state'] = request.GET.get('error') + + if request.method == "GET" and request.GET: + context['next'] = request.GET.get('next') + + if request.method == "POST" and request.POST: + state, message = do_login(request) + if state: + if request.POST.get('next'): + return redirect(request.POST.get('next')) + else: + return redirect(appointments) + else: + return redirect('/login?error=' + message) + return render(request, "login.html", context) + class NotificationCount(object): - title = "" - count = 0 - style = "" - type = '' + title = "" + count = 0 + style = "" + type = '' + + def __init__(self, title="Unknown", count=0, style="fa fa-users text-aqua", type='web.views.appointments'): + self.title = title + self.count = count + self.style = style + self.type = type - def __init__(self, title ="Unknown", count = 0, style = "fa fa-users text-aqua", type = 'web.views.appointments'): - self.title = title - self.count = count - self.style = style - self.type = type def get_filter_locations(user): - worker = None - - if isinstance(user, User): - workers = Worker.objects.filter(user=user) - if len(workers)>0: - worker = workers[0] - elif isinstance(user, Worker): - worker = user - elif isinstance(user, AnonymousUser): - # anonymous user shouldn't see anything - return Location.objects.filter(id=-1) - elif user!=None: - raise TypeError("Unknown class type: "+user.__class__.__name__) - - if worker==None or worker.locations.count() == 0: - return Location.objects.all() - else: - return worker.locations.all() + worker = None + + if isinstance(user, User): + workers = Worker.objects.filter(user=user) + if len(workers) > 0: + worker = workers[0] + elif isinstance(user, Worker): + worker = user + elif isinstance(user, AnonymousUser): + # anonymous user shouldn't see anything + return Location.objects.filter(id=-1) + elif user is not None: + raise TypeError("Unknown class type: " + user.__class__.__name__) + + if worker is None or worker.locations.count() == 0: + return Location.objects.all() + else: + return worker.locations.all() + def get_exceeded_visits(user): - return Visit.objects.filter(datetime_end__lt = get_today_midnight_date(), - is_finished = False, - subject__default_location__in = get_filter_locations(user) - ).order_by('datetime_begin') + return Visit.objects.filter(datetime_end__lt=get_today_midnight_date(), + is_finished=False, + subject__default_location__in=get_filter_locations(user) + ).order_by('datetime_begin') + def get_exceeded_visit_notifications_count(user): - notification = NotificationCount( - title = "exceeded visit time", - count = get_exceeded_visits(user).count(), - style = "fa fa-thermometer-4 text-red", - type = 'web.views.exceeded_visits') - return notification + notification = NotificationCount( + title="exceeded visit time", + count=get_exceeded_visits(user).count(), + style="fa fa-thermometer-4 text-red", + type='web.views.exceeded_visits') + return notification def get_subjects_with_no_visit(user): - result = Subject.objects.annotate(my_count=Count(Case(When(visit__is_finished=False, then=1)))).filter( - dead=False, - resigned=False, - my_count=0, - default_location__in = get_filter_locations(user), - postponed=False, - datetime_contact_reminder__isnull=True, - ) - return result + result = Subject.objects.annotate(my_count=Count(Case(When(visit__is_finished=False, then=1)))).filter( + dead=False, + resigned=False, + my_count=0, + default_location__in=get_filter_locations(user), + postponed=False, + datetime_contact_reminder__isnull=True, + ) + return result + def get_subjects_with_reminder(user): - tomorrow = get_today_midnight_date() + datetime.timedelta(days=1) + tomorrow = get_today_midnight_date() + datetime.timedelta(days=1) + + result = Subject.objects.filter( + dead=False, + resigned=False, + default_location__in=get_filter_locations(user), + datetime_contact_reminder__lt=tomorrow, + ) + return result - result = Subject.objects.filter( - dead=False, - resigned=False, - default_location__in = get_filter_locations(user), - datetime_contact_reminder__lt=tomorrow, - ) - return result def get_subjects_with_reminder_count(user): - notification = NotificationCount( - title = "subject required contact", - count = get_subjects_with_reminder(user).count(), - style = "fa fa-users text-aqua", - type = 'web.views.subject_require_contact') - return notification + notification = NotificationCount( + title="subject required contact", + count=get_subjects_with_reminder(user).count(), + style="fa fa-users text-aqua", + type='web.views.subject_require_contact') + return notification + def get_subject_with_no_visit_notifications_count(user): - notification = NotificationCount( - title = "subject without visit", - count = get_subjects_with_no_visit(user).count(), - style = "fa fa-users text-aqua", - type = 'web.views.subject_no_visits') - return notification + notification = NotificationCount( + title="subject without visit", + count=get_subjects_with_no_visit(user).count(), + style="fa fa-users text-aqua", + type='web.views.subject_no_visits') + return notification def get_visits_without_appointments_count(user): - notification = NotificationCount( - title = "unfinished visits ", - count = len(get_unfinished_visits(user)), - style = "fa fa-user-times text-yellow", - type = 'web.views.unfinished_visits') - return notification + notification = NotificationCount( + title="unfinished visits ", + count=len(get_unfinished_visits(user)), + style="fa fa-user-times text-yellow", + type='web.views.unfinished_visits') + return notification + def get_visits_with_missing_appointments_count(user): - notification = NotificationCount( - title = "visits with missing appointments", - count = len(get_active_visits_with_missing_appointments(user)), - style = "fa fa-user-times text-yellow", - type = 'web.views.visits_with_missing_appointments') - return notification + notification = NotificationCount( + title="visits with missing appointments", + count=len(get_active_visits_with_missing_appointments(user)), + style="fa fa-user-times text-yellow", + type='web.views.visits_with_missing_appointments') + return notification + def get_active_visits_without_appointments(user): - today = get_today_midnight_date() - return Visit.objects.annotate(my_count=Count(Case(When(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED, then=1)))).filter( - datetime_begin__lt = today, - datetime_end__gt = today, - is_finished = False, - subject__default_location__in = get_filter_locations(user), - my_count=0) + today = get_today_midnight_date() + return Visit.objects.annotate( + my_count=Count(Case(When(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED, then=1)))).filter( + datetime_begin__lt=today, + datetime_end__gt=today, + is_finished=False, + subject__default_location__in=get_filter_locations(user), + my_count=0) + def waiting_for_appointment(visit): - required_types = visit.appointment_types.all() - appointment_types = [] - for appointment in visit.appointment_set.all(): - for type in appointment.appointment_types.all(): - if (appointment.status in [Appointment.APPOINTMENT_STATUS_FINISHED,Appointment.APPOINTMENT_STATUS_SCHEDULED] ) and (not (type in appointment_types)): - appointment_types.append(type) - result = False - for type in required_types: - if not (type in appointment_types): - result = True - return result + required_types = visit.appointment_types.all() + appointment_types = [] + for appointment in visit.appointment_set.all(): + for type in appointment.appointment_types.all(): + if (appointment.status in [Appointment.APPOINTMENT_STATUS_FINISHED, + Appointment.APPOINTMENT_STATUS_SCHEDULED]) and (not (type in appointment_types)): + appointment_types.append(type) + result = False + for type in required_types: + if not (type in appointment_types): + result = True + return result + def get_unfinished_visits(user): - result = []; - for visit in get_active_visits_without_appointments(user): - if not waiting_for_appointment(visit): - result.append(visit) - return result + result = [] + for visit in get_active_visits_without_appointments(user): + if not waiting_for_appointment(visit): + result.append(visit) + return result + def get_active_visits_with_missing_appointments(user): - result = []; - for visit in get_active_visits_without_appointments(user): - if waiting_for_appointment(visit): - result.append(visit) - return result + result = [] + for visit in get_active_visits_without_appointments(user): + if waiting_for_appointment(visit): + result.append(visit) + return result + def get_approaching_visits_without_appointments_count(user): - notification = NotificationCount( - title = "approaching visits ", - count = get_approaching_visits_without_appointments(user).count(), - style = "fa fa-users text-aqua", - type = 'web.views.approaching_visits_without_appointments') - return notification + notification = NotificationCount( + title="approaching visits ", + count=get_approaching_visits_without_appointments(user).count(), + style="fa fa-users text-aqua", + type='web.views.approaching_visits_without_appointments') + return notification + def get_approaching_visits_for_mail_contact_count(user): - notification = NotificationCount( - title = "post mail for approaching visits", - count = get_approaching_visits_for_mail_contact(user).count(), - style = "fa fa-users text-aqua", - type = 'web.views.approaching_visits_for_mail_contact') - return notification + notification = NotificationCount( + title="post mail for approaching visits", + count=get_approaching_visits_for_mail_contact(user).count(), + style="fa fa-users text-aqua", + type='web.views.approaching_visits_for_mail_contact') + return notification + def get_approaching_visits_without_appointments(user): - today = get_today_midnight_date() - today_plus_two_months =today+datetime.timedelta(days=91) - return Visit.objects.annotate(my_count=Count(Case(When(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED, then=1)))).filter( - datetime_begin__gt = today, - datetime_begin__lt = today_plus_two_months, - is_finished = False, - subject__default_location__in = get_filter_locations(user), - my_count=0) + today = get_today_midnight_date() + today_plus_two_months = today + datetime.timedelta(days=91) + return Visit.objects.annotate( + my_count=Count(Case(When(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED, then=1)))).filter( + datetime_begin__gt=today, + datetime_begin__lt=today_plus_two_months, + is_finished=False, + subject__default_location__in=get_filter_locations(user), + my_count=0) + def get_approaching_visits_for_mail_contact(user): - today = get_today_midnight_date() - today_plus_three_months =today+datetime.timedelta(days=91) - today_plus_six_months =today+datetime.timedelta(days=183) - return Visit.objects.annotate(my_count=Count(Case(When(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED, then=1)))).filter( - datetime_begin__gt = today_plus_three_months, - datetime_begin__lt = today_plus_six_months, - is_finished = False, - post_mail_sent = False, - subject__default_location__in = get_filter_locations(user), - my_count=0) + today = get_today_midnight_date() + today_plus_three_months = today + datetime.timedelta(days=91) + today_plus_six_months = today + datetime.timedelta(days=183) + return Visit.objects.annotate( + my_count=Count(Case(When(appointment__status=Appointment.APPOINTMENT_STATUS_SCHEDULED, then=1)))).filter( + datetime_begin__gt=today_plus_three_months, + datetime_begin__lt=today_plus_six_months, + is_finished=False, + post_mail_sent=False, + subject__default_location__in=get_filter_locations(user), + my_count=0) + def get_unfinished_appointments_count(user): - return NotificationCount( - title = "unfinished appointments ", - count = get_unfinished_appointments(user).count(), - style = "fa fa-history text-yellow", - type = 'web.views.unfinished_appointments') + return NotificationCount( + title="unfinished appointments ", + count=get_unfinished_appointments(user).count(), + style="fa fa-history text-yellow", + type='web.views.unfinished_appointments') + def get_unfinished_appointments(user): - return Appointment.objects.filter( - datetime_when__lt = get_today_midnight_date(), - status = Appointment.APPOINTMENT_STATUS_SCHEDULED, - location__in = get_filter_locations(user), - ) + return Appointment.objects.filter( + datetime_when__lt=get_today_midnight_date(), + status=Appointment.APPOINTMENT_STATUS_SCHEDULED, + location__in=get_filter_locations(user), + ) + def get_notifications(the_user): - workers = Worker.objects.filter(user=the_user) - notifications = [] - count = 0; - if len(workers)>0: - person = workers[0] - if person.role == Worker.ROLE_CHOICES_SECRETARY: - notifications.append(get_exceeded_visit_notifications_count(person)) - notifications.append(get_visits_without_appointments_count(person)) - notifications.append(get_approaching_visits_without_appointments_count(person)) - notifications.append(get_unfinished_appointments_count(person)) - notifications.append(get_visits_with_missing_appointments_count(person)) - notifications.append(get_subject_with_no_visit_notifications_count(person)) - notifications.append(get_approaching_visits_for_mail_contact_count(person)) - notifications.append(get_subjects_with_reminder_count(person)) - - - for notification in notifications: - count += notification.count - return (count, notifications) + workers = Worker.objects.filter(user=the_user) + notifications = [] + count = 0 + if len(workers) > 0: + person = workers[0] + if person.role == Worker.ROLE_CHOICES_SECRETARY: + notifications.append(get_exceeded_visit_notifications_count(person)) + notifications.append(get_visits_without_appointments_count(person)) + notifications.append(get_approaching_visits_without_appointments_count(person)) + notifications.append(get_unfinished_appointments_count(person)) + notifications.append(get_visits_with_missing_appointments_count(person)) + notifications.append(get_subject_with_no_visit_notifications_count(person)) + notifications.append(get_approaching_visits_for_mail_contact_count(person)) + notifications.append(get_subjects_with_reminder_count(person)) + + for notification in notifications: + count += notification.count + return count, notifications + """ Saturates response with information about logged user """ + + @login_required def wrap_response(request, template, params): - person, role = Worker.get_details(request.user) + person, role = Worker.get_details(request.user) - notifications = get_notifications(request.user) + notifications = get_notifications(request.user) - final_params = params.copy() - final_params.update({ - 'person' : person, - 'role': role, - 'notifications': notifications - }) + final_params = params.copy() + final_params.update({ + 'person': person, + 'role': role, + 'notifications': notifications + }) - return render(request, template, final_params) + return render(request, template, final_params) def logout(request): - state, message = do_logout(request) - return redirect('/login?error=' + message) - + state, message = do_logout(request) + return redirect('/login?error=' + message) def visits(request): - visit_list = Visit.objects.order_by('-datetime_begin') - context = { - 'visit_list': visit_list - } + visit_list = Visit.objects.order_by('-datetime_begin') + context = { + 'visit_list': visit_list + } + + return wrap_response(request, 'visits/index.html', context) - return wrap_response(request, 'visits/index.html', context) def exceeded_visits(request): - context = { - 'visit_list': get_exceeded_visits(request.user) - } - return wrap_response(request, 'visits/index.html', context) + context = { + 'visit_list': get_exceeded_visits(request.user) + } + return wrap_response(request, 'visits/index.html', context) + def unfinished_visits(request): - context = { - 'visit_list': get_unfinished_visits(request.user) - } + context = { + 'visit_list': get_unfinished_visits(request.user) + } + + return wrap_response(request, 'visits/index.html', context) - return wrap_response(request, 'visits/index.html', context) def visits_with_missing_appointments(request): - context = { - 'visit_list': get_active_visits_with_missing_appointments(request.user) - } + context = { + 'visit_list': get_active_visits_with_missing_appointments(request.user) + } - return wrap_response(request, 'visits/index.html', context) + return wrap_response(request, 'visits/index.html', context) def approaching_visits_without_appointments(request): - context = { - 'visit_list': get_approaching_visits_without_appointments(request.user) - } - return wrap_response(request, 'visits/index.html', context) + context = { + 'visit_list': get_approaching_visits_without_appointments(request.user) + } + return wrap_response(request, 'visits/index.html', context) -def approaching_visits_for_mail_contact(request): - context = { - 'visit_list': get_approaching_visits_for_mail_contact(request.user) - } - return wrap_response(request, 'visits/index.html', context) +def approaching_visits_for_mail_contact(request): + context = { + 'visit_list': get_approaching_visits_for_mail_contact(request.user) + } + return wrap_response(request, 'visits/index.html', context) def visit_details(request, id): - displayedVisit = get_object_or_404(Visit, id=id) - if request.method == 'POST': - vform = VisitDetailForm(request.POST, request.FILES, instance=displayedVisit) - if vform.is_valid(): - vform.save() - else: - vform = VisitDetailForm(instance=displayedVisit) - - visFinished = displayedVisit.is_finished - vid = displayedVisit.id - displayedSubject = displayedVisit.subject - listOfAppointments = displayedVisit.appointment_set.all() - - canFinish=not waiting_for_appointment(displayedVisit) - - for appointment in listOfAppointments: - if appointment.status == Appointment.APPOINTMENT_STATUS_SCHEDULED: - canFinish=False; - - sform = SubjectDetailForm(instance=displayedSubject) - - return wrap_response(request, 'visits/details.html', { - 'vform': vform, - 'sform': sform, - 'loApp': listOfAppointments, - 'visFinished': visFinished, - 'canFinish': canFinish, - 'vid': vid, - 'visit': displayedVisit}) + displayed_visit = get_object_or_404(Visit, id=id) + if request.method == 'POST': + visit_form = VisitDetailForm(request.POST, request.FILES, instance=displayed_visit) + if visit_form.is_valid(): + visit_form.save() + else: + visit_form = VisitDetailForm(instance=displayed_visit) -def visit_mark(request, id, as_what): - visit = get_object_or_404(Visit, id=id) - if as_what == 'finished': - visit.mark_as_finished() + visit_finished = displayed_visit.is_finished + visit_id = displayed_visit.id + displayed_subject = displayed_visit.subject + list_of_appointments = displayed_visit.appointment_set.all() + + can_finish = not waiting_for_appointment(displayed_visit) - return redirect(visit_details, id=id) + for appointment in list_of_appointments: + if appointment.status == Appointment.APPOINTMENT_STATUS_SCHEDULED: + can_finish = False + subject_form = SubjectDetailForm(instance=displayed_subject) + return wrap_response(request, 'visits/details.html', { + 'vform': visit_form, + 'sform': subject_form, + 'loApp': list_of_appointments, + 'visFinished': visit_finished, + 'canFinish': can_finish, + 'vid': visit_id, + 'visit': displayed_visit}) -def visit_add(request, subject_id = -1): - if request.method == 'POST': - form = VisitAddForm(request.POST, request.FILES) - if form.is_valid(): - visit = form.save() - return redirect(visit_details, visit.id) - else: - subjects = Subject.objects.filter(id=subject_id) - subject = None - if len(subjects)>0: - subject = subjects[0] - form = VisitAddForm(initial={'subject':subject}) +def visit_mark(request, id, as_what): + visit = get_object_or_404(Visit, id=id) + if as_what == 'finished': + visit.mark_as_finished() + + return redirect(visit_details, id=id) + + +def visit_add(request, subject_id=-1): + if request.method == 'POST': + form = VisitAddForm(request.POST, request.FILES) + if form.is_valid(): + visit = form.save() + return redirect(visit_details, visit.id) + else: + subjects = Subject.objects.filter(id=subject_id) + subject = None + if len(subjects) > 0: + subject = subjects[0] + form = VisitAddForm(initial={'subject': subject}) - return wrap_response(request, 'visits/add.html', {'form': form}) + return wrap_response(request, 'visits/add.html', {'form': form}) def subjects(request): - subjects_list = Subject.objects.order_by('-last_name') - context = { - 'subjects_list': subjects_list - } + subjects_list = Subject.objects.order_by('-last_name') + context = { + 'subjects_list': subjects_list + } + + return wrap_response(request, 'subjects/index.html', context) - return wrap_response(request, 'subjects/index.html', context) def subject_add(request): - if request.method == 'POST': - form = SubjectAddForm(request.POST, request.FILES) - if form.is_valid(): - screening_number = form.cleaned_data['screening_number'] - if screening_number == '': - screening_number = get_new_screening_number() - form.save() - return redirect(subjects) - else: - form = SubjectAddForm() - - return wrap_response(request, 'subjects/add.html', {'form': form}) + if request.method == 'POST': + form = SubjectAddForm(request.POST, request.FILES) + if form.is_valid(): + screening_number = form.cleaned_data['screening_number'] + if screening_number == '': + screening_number = get_new_screening_number() # FIXME: method doesn't exist + form.save() + return redirect(subjects) + else: + form = SubjectAddForm() + + return wrap_response(request, 'subjects/add.html', {'form': form}) + def subject_no_visits(request): - subjects_list = get_subjects_with_no_visit(request.user).order_by('-last_name') - context = { - 'subjects_list': subjects_list - } + subjects_list = get_subjects_with_no_visit(request.user).order_by('-last_name') + context = { + 'subjects_list': subjects_list + } + + return wrap_response(request, 'subjects/index.html', context) - return wrap_response(request, 'subjects/index.html', context) def subject_require_contact(request): - subjects_list = get_subjects_with_reminder(request.user).order_by('-last_name') - context = { - 'subjects_list': subjects_list - } + subjects_list = get_subjects_with_reminder(request.user).order_by('-last_name') + context = { + 'subjects_list': subjects_list + } + + return wrap_response(request, 'subjects/index.html', context) - return wrap_response(request, 'subjects/index.html', context) def subject_edit(request, id): - the_subject = get_object_or_404(Subject, id=id) - if request.method == 'POST': - form = SubjectEditForm(request.POST, request.FILES, instance=the_subject) - if form.is_valid(): - form.save() - return redirect(subjects) - else: - form = SubjectEditForm(instance=the_subject) - return wrap_response(request, 'subjects/edit.html', { - 'form': form, - 'subject': the_subject - }) + the_subject = get_object_or_404(Subject, id=id) + if request.method == 'POST': + form = SubjectEditForm(request.POST, request.FILES, instance=the_subject) + if form.is_valid(): + form.save() + return redirect(subjects) + else: + form = SubjectEditForm(instance=the_subject) + return wrap_response(request, 'subjects/edit.html', { + 'form': form, + 'subject': the_subject + }) def subject_delete(request, id): @@ -468,360 +498,368 @@ def subject_delete(request, id): def subject_mark(request, id, as_what): - who = get_object_or_404(Subject, id=id) - if as_what == 'dead': - who.mark_as_dead() - elif as_what == 'rejected': - who.mark_as_rejected() - return redirect(subject_edit, id=id) + who = get_object_or_404(Subject, id=id) + if as_what == 'dead': + who.mark_as_dead() + elif as_what == 'rejected': + who.mark_as_rejected() + return redirect(subject_edit, id=id) + def appointment_mark(request, id, as_what): - appointment = get_object_or_404(Appointment, id=id) - if as_what == 'finished': - appointment.mark_as_finished() - elif as_what == 'cancelled': - appointment.mark_as_cancelled() - elif as_what == 'no_show': - appointment.mark_as_no_show() - else: - return e500_error(request) - return redirect(visit_details, id=appointment.visit.id) + appointment = get_object_or_404(Appointment, id=id) + if as_what == 'finished': + appointment.mark_as_finished() + elif as_what == 'cancelled': + appointment.mark_as_cancelled() + elif as_what == 'no_show': + appointment.mark_as_no_show() + else: + return e500_error(request) + return redirect(visit_details, id=appointment.visit.id) + def subject_visit_details(request, id): - locsubject = get_object_or_404(Subject, id=id) - visits = locsubject.visit_set.all() - endlist = [] - for vis in visits: - assign = vis.appointment_set.all() - finished = vis.is_finished - visid = vis.id - visit_title = vis.follow_up_title() - visform = VisitDetailForm(instance=vis) - endlist.append((visform,assign,finished,visid,visit_title)) - - return wrap_response(request, 'subjects/visitdetails.html', {'display': endlist, "id":id}) + locsubject = get_object_or_404(Subject, id=id) + visits = locsubject.visit_set.all() + endlist = [] + for vis in visits: + assign = vis.appointment_set.all() + finished = vis.is_finished + visid = vis.id + visit_title = vis.follow_up_title() + visform = VisitDetailForm(instance=vis) + endlist.append((visform, assign, finished, visid, visit_title)) + + return wrap_response(request, 'subjects/visitdetails.html', {'display': endlist, "id": id}) + def doctors(request): - doctors_list = Worker.objects.order_by('-last_name') - context = { - 'doctors_list': doctors_list - } + doctors_list = Worker.objects.order_by('-last_name') + context = { + 'doctors_list': doctors_list + } - return wrap_response(request, "doctors/index.html", context) + return wrap_response(request, "doctors/index.html", context) def doctor_add(request): - if request.method == 'POST': - form = WorkerAddForm(request.POST, request.FILES) - if form.is_valid(): - form.save() - return redirect(doctors) - else: - form = WorkerAddForm() - - return wrap_response(request, 'doctors/add.html', {'form': form}) + if request.method == 'POST': + form = WorkerAddForm(request.POST, request.FILES) + if form.is_valid(): + form.save() + return redirect(doctors) + else: + form = WorkerAddForm() + return wrap_response(request, 'doctors/add.html', {'form': form}) def doctor_edit(request, doctor_id): - the_doctor = get_object_or_404(Worker, id=doctor_id) - if request.method == 'POST': - form = WorkerEditForm(request.POST, request.FILES, instance=the_doctor) - if form.is_valid(): - form.save() - return redirect(doctors) - else: - form = WorkerEditForm(instance=the_doctor) - return wrap_response(request, 'doctors/edit.html', {'form': form}) + the_doctor = get_object_or_404(Worker, id=doctor_id) + if request.method == 'POST': + form = WorkerEditForm(request.POST, request.FILES, instance=the_doctor) + if form.is_valid(): + form.save() + return redirect(doctors) + else: + form = WorkerEditForm(instance=the_doctor) + return wrap_response(request, 'doctors/edit.html', {'form': form}) def doctor_details(request, doctor_id): - the_doctor = get_object_or_404(Worker, id=doctor_id) - form = WorkerDetailForm(instance=the_doctor) + the_doctor = get_object_or_404(Worker, id=doctor_id) + form = WorkerDetailForm(instance=the_doctor) - return wrap_response(request, 'doctors/details.html', {'form': form}) + return wrap_response(request, 'doctors/details.html', {'form': form}) def doctor_availability(request, doctor_id): - avall = Avaibility.objects.filter(person=doctor_id) - - avmon = avall.filter(day_number=1) - avtue = avall.filter(day_number=2) - avwed = avall.filter(day_number=3) - avthu = avall.filter(day_number=4) - avfri = avall.filter(day_number=5) - avsat = avall.filter(day_number=6) - avsun = avall.filter(day_number=7) - - context = { - 'avmon': avmon, - 'avtue': avtue, - 'avwed': avwed, - 'avthu': avthu, - 'avfri': avfri, - 'avsat': avsat, - 'avsun': avsun, - 'id': doctor_id - } - - return wrap_response(request, "doctors/availability_index.html", context) + avall = Avaibility.objects.filter(person=doctor_id) + + avmon = avall.filter(day_number=1) + avtue = avall.filter(day_number=2) + avwed = avall.filter(day_number=3) + avthu = avall.filter(day_number=4) + avfri = avall.filter(day_number=5) + avsat = avall.filter(day_number=6) + avsun = avall.filter(day_number=7) + + context = { + 'avmon': avmon, + 'avtue': avtue, + 'avwed': avwed, + 'avthu': avthu, + 'avfri': avfri, + 'avsat': avsat, + 'avsun': avsun, + 'id': doctor_id + } + + return wrap_response(request, "doctors/availability_index.html", context) def doctor_availability_delete(request, doctor_id, availability_id): - availibility = Avaibility.objects.filter(id=availability_id) - if len(availibility) > 0: - availibility.delete() - return redirect(doctoravail, id=doctor_id) + availibility = Avaibility.objects.filter(id=availability_id) + if len(availibility) > 0: + availibility.delete() + return redirect(doctoravail, id=doctor_id) # FIXME doctoravail doesn't exist def equipment_def(request): - equipment_list = Item.objects.order_by('-name') - context = { - 'equipment_list': equipment_list - } + equipment_list = Item.objects.order_by('-name') + context = { + 'equipment_list': equipment_list + } - return wrap_response(request, "eqdef/index.html", context) + return wrap_response(request, "eqdef/index.html", context) def equipment_and_rooms(request): - return wrap_response(request, "equipment_and_rooms/index.html", {}) + return wrap_response(request, "equipment_and_rooms/index.html", {}) def mail_templates(request): - return wrap_response(request, "mail_templates/index.html", {}) + return wrap_response(request, "mail_templates/index.html", {}) """ -#An initial draft of a function that was supposed to suggest date, room and worker for an appointment -def suggest_details(Appointment appoint): - - avaibleWorkers = Worker.objects.get() - if appoint.appointment_type__required_worker == 'DOCTOR': - avaibleWorkers.filter(role='DOCTOR') - elif appoint.appointment_type__required_worker == 'NURSE': - avaibleWorkers.filter(role__in=['DOCTOR','NURSE']) - elif appoint.appointment_type__required_worker == 'PSYCHOLOGIST': - avaibleWorkers.filter(role__in=['DOCTOR','PSYCHOLOGIST']) - - avaibleRooms = Room.objects.get - requireditems = appoint.appointment_type.required_equipment.filter(is_fixed=True) - reduce(operator.and_, (Q(equipment__contains=requireditems) for x in avaibleRooms)) - +# An initial draft of a function that was supposed to suggest date, room and worker for an appointment +def suggest_details(appoint): + avaibleWorkers = Worker.objects.get() + if appoint.appointment_type__required_worker == 'DOCTOR': + avaibleWorkers.filter(role='DOCTOR') + elif appoint.appointment_type__required_worker == 'NURSE': + avaibleWorkers.filter(role__in=['DOCTOR','NURSE']) + elif appoint.appointment_type__required_worker == 'PSYCHOLOGIST': + avaibleWorkers.filter(role__in=['DOCTOR','PSYCHOLOGIST']) + avaibleRooms = Room.objects.get + requireditems = appoint.appointment_type.required_equipment.filter(is_fixed=True) + reduce(operator.and_, (Q(equipment__contains=requireditems) for x in avaibleRooms)) """ + def get_today_midnight_date(): - today = datetime.datetime.now() - today_midnight = datetime.datetime(today.year,today.month,today.day) - return today_midnight + today = datetime.datetime.now() + today_midnight = datetime.datetime(today.year, today.month, today.day) + return today_midnight + def get_calendar_full_appointments(user): - month_ago = get_today_midnight_date() + datetime.timedelta(days=-31) - return Appointment.objects.filter( - datetime_when__gt = month_ago, - location__in = get_filter_locations(user), - ).order_by('datetime_when') + month_ago = get_today_midnight_date() + datetime.timedelta(days=-31) + return Appointment.objects.filter( + datetime_when__gt=month_ago, + location__in=get_filter_locations(user), + ).order_by('datetime_when') def appointments(request): - approaching_list = Appointment.objects.filter( - datetime_when__gt = get_today_midnight_date(), - location__in = get_filter_locations(request.user), - status = Appointment.APPOINTMENT_STATUS_SCHEDULED - ).order_by('datetime_when') + approaching_list = Appointment.objects.filter( + datetime_when__gt=get_today_midnight_date(), + location__in=get_filter_locations(request.user), + status=Appointment.APPOINTMENT_STATUS_SCHEDULED + ).order_by('datetime_when') + + full_list = get_calendar_full_appointments(request.user) - full_list = get_calendar_full_appointments(request.user) + context = { + 'approaching_list': approaching_list, + 'full_list': full_list + } - context = { - 'approaching_list': approaching_list, - 'full_list': full_list - } + return wrap_response(request, "appointments/index.html", context) - return wrap_response(request, "appointments/index.html",context) def unfinished_appointments(request): - appointments = get_unfinished_appointments(request.user) - context = { - 'appointment_list': appointments, - } + appointments = get_unfinished_appointments(request.user) + context = { + 'appointment_list': appointments, + } + + return wrap_response(request, "appointments/list.html", context) - return wrap_response(request, "appointments/list.html",context) def appointment_details(request, id): - the_appointment = get_object_or_404(Appointment, id=id) - form = AppointmentDetailForm(instance=the_appointment) - return wrap_response(request, 'appointments/details.html', {'form': form}) + the_appointment = get_object_or_404(Appointment, id=id) + form = AppointmentDetailForm(instance=the_appointment) + return wrap_response(request, 'appointments/details.html', {'form': form}) def appointment_add(request, id): - full_list = get_calendar_full_appointments(request.user) - if request.method == 'POST': - form = AppointmentAddForm(request.POST, request.FILES, user=request.user) - form.fields['visit'].widget = forms.HiddenInput() - if form.is_valid(): - form.save() - return redirect(visit_details, id=id) - else: - form = AppointmentAddForm(initial={'visit': id}, user=request.user) - form.fields['visit'].widget = forms.HiddenInput() - - return wrap_response(request, 'appointments/add.html', {'form': form, 'visitID': id, 'full_appointment_list': full_list}) + full_list = get_calendar_full_appointments(request.user) + if request.method == 'POST': + form = AppointmentAddForm(request.POST, request.FILES, user=request.user) + form.fields['visit'].widget = HiddenInput() + if form.is_valid(): + form.save() + return redirect(visit_details, id=id) + else: + form = AppointmentAddForm(initial={'visit': id}, user=request.user) + form.fields['visit'].widget = HiddenInput() + + return wrap_response(request, 'appointments/add.html', + {'form': form, 'visitID': id, 'full_appointment_list': full_list}) + def appointment_edit(request, id): - the_appointment = get_object_or_404(Appointment, id=id) - if request.method == 'POST': - form = AppointmentEditForm(request.POST, - request.FILES, - instance=the_appointment, - user=request.user - ) - if form.is_valid(): - form.save() - - data = form.cleaned_data - vis = data['visit'] - visit = get_object_or_404(Visit, id=vis.id) - - return redirect(appointments) - else: - form = AppointmentEditForm(instance=the_appointment,user=request.user) - - subject_form = SubjectDetailForm(instance=the_appointment.visit.subject) - - return wrap_response(request, 'appointments/edit.html', { - 'form': form, - 'subject_form': subject_form, - 'id':id, - 'appointment': the_appointment - }) + the_appointment = get_object_or_404(Appointment, id=id) + if request.method == 'POST': + form = AppointmentEditForm(request.POST, + request.FILES, + instance=the_appointment, + user=request.user + ) + if form.is_valid(): + form.save() + + data = form.cleaned_data + vis = data['visit'] + get_object_or_404(Visit, id=vis.id) + + return redirect(appointments) + else: + form = AppointmentEditForm(instance=the_appointment, user=request.user) + + subject_form = SubjectDetailForm(instance=the_appointment.visit.subject) + + return wrap_response(request, 'appointments/edit.html', { + 'form': form, + 'subject_form': subject_form, + 'id': id, + 'appointment': the_appointment + }) def appointment_edit_datetime(request, id): - the_appointment = get_object_or_404(Appointment, id=id) - if request.method == 'POST': - form = AppointmentEditForm(request.POST, request.FILES, instance=the_appointment,user=request.user) - if form.is_valid(): - form.save() - return redirect(appointments) - else: - the_appointment.datetime_when = the_appointment.visit.datetime_begin - form = AppointmentEditForm(instance=the_appointment, user=request.user) - return wrap_response(request, 'appointments/edit.html', {'form': form}) - -#because we don't wrap_response we must force login required + the_appointment = get_object_or_404(Appointment, id=id) + if request.method == 'POST': + form = AppointmentEditForm(request.POST, request.FILES, instance=the_appointment, user=request.user) + if form.is_valid(): + form.save() + return redirect(appointments) + else: + the_appointment.datetime_when = the_appointment.visit.datetime_begin + form = AppointmentEditForm(instance=the_appointment, user=request.user) + return wrap_response(request, 'appointments/edit.html', {'form': form}) + + +# because we don't wrap_response we must force login required @login_required def export_to_csv2(request, type="subjects"): - #Create the HttpResponse object with the appropriate CSV header. - response = HttpResponse(content_type='text/csv') - response['Content-Disposition'] = 'attachment; filename="'+type+'-'+get_today_midnight_date().strftime("%Y-%m-%d")+'.csv"' - - writer = csv.writer(response, quotechar =str(u'"'), quoting = csv.QUOTE_ALL) - if type=="subjects": - write_subjects_to_csv(writer) - elif type=="appointments": - write_appointments_to_csv(writer) - else: - return e500_error(request) - return response + # Create the HttpResponse object with the appropriate CSV header. + response = HttpResponse(content_type='text/csv') + response['Content-Disposition'] = 'attachment; filename="' + type + '-' + get_today_midnight_date().strftime( + "%Y-%m-%d") + '.csv"' + + writer = csv.writer(response, quotechar=str(u'"'), quoting=csv.QUOTE_ALL) + if type == "subjects": + write_subjects_to_csv(writer) + elif type == "appointments": + write_appointments_to_csv(writer) + else: + return e500_error(request) + return response + def write_subjects_to_csv(writer): - subject_fields = [] - for field in Subject._meta.fields: - if field.name!="ID": - subject_fields.append(field) + subject_fields = [] + for field in Subject._meta.fields: + if field.name != "ID": + subject_fields.append(field) - field_names = [] - for field in subject_fields: - field_names.append(field.verbose_name) + field_names = [] + for field in subject_fields: + field_names.append(field.verbose_name) - writer.writerow(field_names) + writer.writerow(field_names) + + subjects = Subject.objects.order_by('-last_name') + for subject in subjects: + row = [] + for field in subject_fields: + row.append(getattr(subject, field.name)) + writer.writerow([unicode(s).replace("\n", ";").replace("\r", ";").encode("utf-8") for s in row]) - subjects = Subject.objects.order_by('-last_name') - for subject in subjects: - row = [] - for field in subject_fields: - row.append(getattr(subject,field.name)) - writer.writerow([unicode(s).replace("\n", ";").replace("\r", ";").encode("utf-8") for s in row]) def write_appointments_to_csv(writer): - appointments_fields = [] - for field in Appointment._meta.fields: - if field.name!="visit" and field.name!="id" and field.name!="worker_assigned" and field.name!="appointment_types" and field.name!="room" and field.name!="flying_team": - appointments_fields.append(field) - - field_names = [] - field_names.append('ND number') - field_names.append('Family name') - field_names.append('Name') - field_names.append('Visit') - for field in appointments_fields: - field_names.append(field.verbose_name) - - writer.writerow(field_names) - - appointments = Appointment.objects.order_by('-datetime_when') - - for appointment in appointments: - row = [] - row.append(appointment.visit.subject.nd_number) - row.append(appointment.visit.subject.last_name) - row.append(appointment.visit.subject.first_name) - row.append(appointment.visit.follow_up_title()) - for field in appointments_fields: - row.append(getattr(appointment,field.name)) - type_string = "" - for type in appointment.appointment_types.all(): - type_string+=type.code+"," - row.append(type_string) - writer.writerow([unicode(s).replace("\n", ";").replace("\r", ";").encode("utf-8") for s in row]) + appointments_fields = [] + for field in Appointment._meta.fields: + if field.name != "visit" and field.name != "id" and field.name != "worker_assigned" and field.name != "appointment_types" and field.name != "room" and field.name != "flying_team": + appointments_fields.append(field) + + field_names = ['ND number', 'Family name', 'Name', 'Visit'] + for field in appointments_fields: + field_names.append(field.verbose_name) + + writer.writerow(field_names) + + appointments = Appointment.objects.order_by('-datetime_when') + + for appointment in appointments: + row = [appointment.visit.subject.nd_number, appointment.visit.subject.last_name, + appointment.visit.subject.first_name, appointment.visit.follow_up_title()] + for field in appointments_fields: + row.append(getattr(appointment, field.name)) + type_string = "" + for type in appointment.appointment_types.all(): + type_string += type.code + "," + row.append(type_string) + writer.writerow([unicode(s).replace("\n", ";").replace("\r", ";").encode("utf-8") for s in row]) + def export(request): - return wrap_response(request, 'export/index.html',{}) - -def get_kit_requests(user, start_date = None, end_date = None): - if start_date == None: - start_date = get_today_midnight_date() + datetime.timedelta(days=1) - end_date = start_date + datetime.timedelta(days=7) - else : - if isinstance(start_date, str): - start_date = parse_datetime(start_date) - if (end_date != None) and (isinstance(end_date, str)): - end_date = parse_datetime(end_date) - - appointment_types = AppointmentType.objects.filter(required_equipment__disposable=True) - - appointments = Appointment.objects.filter( - appointment_types__in = appointment_types, - datetime_when__gt = start_date, - location__in = get_filter_locations(user), - status = Appointment.APPOINTMENT_STATUS_SCHEDULED, - ) - if end_date!=None: - appointments = appointments.filter(datetime_when__lt = end_date) - - result = { - 'start_date' : start_date, - 'end_date' : end_date, - 'appointments' : appointments, - } - return result - -def get_kit_requests_data(request, start_date = None, end_date = None): - form = KitRequestForm() - if request.method=='POST': - form = KitRequestForm(request.POST) - if form.is_valid(): - form_data = form.cleaned_data - start_date = form_data.get('start_date') - end_date = form_data.get('end_date') - - params = get_kit_requests(request.user, start_date, end_date) - params.update({ - 'form': form - }) - return params + return wrap_response(request, 'export/index.html', {}) + + +def get_kit_requests(user, start_date=None, end_date=None): + if start_date is None: + start_date = get_today_midnight_date() + datetime.timedelta(days=1) + end_date = start_date + datetime.timedelta(days=7) + else: + if isinstance(start_date, str): + start_date = parse_datetime(start_date) + if (end_date is not None) and (isinstance(end_date, str)): + end_date = parse_datetime(end_date) + + appointment_types = AppointmentType.objects.filter(required_equipment__disposable=True) + + appointments = Appointment.objects.filter( + appointment_types__in=appointment_types, + datetime_when__gt=start_date, + location__in=get_filter_locations(user), + status=Appointment.APPOINTMENT_STATUS_SCHEDULED, + ) + if end_date is not None: + appointments = appointments.filter(datetime_when__lt=end_date) + + result = { + 'start_date': start_date, + 'end_date': end_date, + 'appointments': appointments, + } + return result + + +def get_kit_requests_data(request, start_date=None, end_date=None): + form = KitRequestForm() + if request.method == 'POST': + form = KitRequestForm(request.POST) + if form.is_valid(): + form_data = form.cleaned_data + start_date = form_data.get('start_date') + end_date = form_data.get('end_date') + + params = get_kit_requests(request.user, start_date, end_date) + params.update({ + 'form': form + }) + return params + def kit_requests(request): - return wrap_response(request, 'equipment_and_rooms/kit_requests.html', get_kit_requests_data(request)) + return wrap_response(request, 'equipment_and_rooms/kit_requests.html', get_kit_requests_data(request)) + -def kit_requests_send_mail(request, start_date, end_date = None): - return wrap_response(request, 'equipment_and_rooms/kit_requests_send_mail.html', get_kit_requests_data(request, start_date, end_date)) +def kit_requests_send_mail(request, start_date, end_date=None): + return wrap_response(request, 'equipment_and_rooms/kit_requests_send_mail.html', + get_kit_requests_data(request, start_date, end_date))