# Path: appointment/models.py
# class Appointment(Note):
# 
#     class Meta(object):
#         ordering = ["-clindate", "-clintime"]
# 
#     PSYCH_NIGHT = 'PSYCH_NIGHT'
#     ACUTE_FOLLOWUP = 'ACUTE_FOLLOWUP'
#     CHRONIC_CARE = 'CHRONIC_CARE'
#     VACCINE = 'VACCINE'
#     APPOINTMENT_TYPES = (
#         (PSYCH_NIGHT, 'Psych Night'),
#         (ACUTE_FOLLOWUP, 'Acute Followup'),
#         (CHRONIC_CARE, 'Chronic Care'),
#         (VACCINE, "Vaccine Followup")
#     )
# 
#     clindate = models.DateField(verbose_name="Appointment Date")
#     clintime = models.TimeField(
#         verbose_name="Time of Appointment",
#         default=generate_default_appointment_time)
#     appointment_type = models.CharField(
#         max_length=15, choices=APPOINTMENT_TYPES,
#         verbose_name='Appointment Type', default=CHRONIC_CARE)
#     comment = models.TextField(
#         help_text="What should happen at this appointment?")
# 
#     pt_showed = models.NullBooleanField(
#         verbose_name="Patient Showed",
#         blank=True, help_text="Did the patient come to this appointment?")
# 
#     history = HistoricalRecords()
# 
#     def __str__(self):
#         return "Appointment ({type}) for {name} on {date}".format(
#             type=self.verbose_appointment_type(),
#             name=self.patient.name(),
#             date=str(self.clindate))
# 
#     def verbose_appointment_type(self):
#         appointment_type_index = list(zip(*self.APPOINTMENT_TYPES))[0].index(
#             self.appointment_type)
# 
#         return self.APPOINTMENT_TYPES[appointment_type_index][1]
# 
#     def clean(self):
#         ids = Appointment.objects.filter(clindate=self.clindate).\
#             values_list('id', flat=True)
# 
#         if (ids.count() >= settings.OSLER_MAX_APPOINTMENTS and
#                 self.id not in ids):
#             raise ValidationError(
#                 "Osler is configured only to allow %s appointments per day" %
#                 settings.OSLER_MAX_APPOINTMENTS)


from builtins import object
from django.forms import ModelForm, TimeInput
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from bootstrap3_datetime.widgets import DateTimePicker
from .models import Appointment
from __future__ import unicode_literals




class AppointmentForm(ModelForm):

    class Meta(object):
        model = Appointment
        fields = ['clindate', 'clintime', 'appointment_type', 'comment',

# Path: appointment/models.py
# class Appointment(Note):
# 
#     class Meta(object):
#         ordering = ["-clindate", "-clintime"]
# 
#     PSYCH_NIGHT = 'PSYCH_NIGHT'
#     ACUTE_FOLLOWUP = 'ACUTE_FOLLOWUP'
#     CHRONIC_CARE = 'CHRONIC_CARE'
#     VACCINE = 'VACCINE'
#     APPOINTMENT_TYPES = (
#         (PSYCH_NIGHT, 'Psych Night'),
#         (ACUTE_FOLLOWUP, 'Acute Followup'),
#         (CHRONIC_CARE, 'Chronic Care'),
#         (VACCINE, "Vaccine Followup")
#     )
# 
#     clindate = models.DateField(verbose_name="Appointment Date")
#     clintime = models.TimeField(
#         verbose_name="Time of Appointment",
#         default=generate_default_appointment_time)
#     appointment_type = models.CharField(
#         max_length=15, choices=APPOINTMENT_TYPES,
#         verbose_name='Appointment Type', default=CHRONIC_CARE)
#     comment = models.TextField(
#         help_text="What should happen at this appointment?")
# 
#     pt_showed = models.NullBooleanField(
#         verbose_name="Patient Showed",
#         blank=True, help_text="Did the patient come to this appointment?")
# 
#     history = HistoricalRecords()
# 
#     def __str__(self):
#         return "Appointment ({type}) for {name} on {date}".format(
#             type=self.verbose_appointment_type(),
#             name=self.patient.name(),
#             date=str(self.clindate))
# 
#     def verbose_appointment_type(self):
#         appointment_type_index = list(zip(*self.APPOINTMENT_TYPES))[0].index(
#             self.appointment_type)
# 
#         return self.APPOINTMENT_TYPES[appointment_type_index][1]
# 
#     def clean(self):
#         ids = Appointment.objects.filter(clindate=self.clindate).\
#             values_list('id', flat=True)
# 
#         if (ids.count() >= settings.OSLER_MAX_APPOINTMENTS and
#                 self.id not in ids):
#             raise ValidationError(
#                 "Osler is configured only to allow %s appointments per day" %
#                 settings.OSLER_MAX_APPOINTMENTS)


# Path: appointment/forms.py
from builtins import object
from django.forms import ModelForm, TimeInput
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from bootstrap3_datetime.widgets import DateTimePicker
from .models import Appointment

from __future__ import unicode_literals




class AppointmentForm(ModelForm):

    class Meta(object):
        model = Appointment
        fields = ['clindate', 'clintime', 'appointment_type', 'comment',

                  'patient']