from django import forms
from . import models

class ChartForm(forms.ModelForm):
    name = "Chart"
    class Meta:
        model = models.Chart
        fields = (
            'patient',
            'assignment',
            'student_name',
            'student_id'
        )
        labels = {
            'student_id': 'Student ID'
        }
        widgets = {
            'patient': forms.TextInput(attrs = {
                'autofocus': 'autofocus'
                })
        }

class EntryForm(forms.ModelForm):
    name = "Note"
    class Meta:
        model = models.Entry
        fields = (
            'time',
            'notes',
        )
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class OralCareForm(forms.ModelForm):
    name = "Oral care"
    class Meta:
        model = models.OralCare
        fields = (
            'time',
            'assistance',
            'dentures_upper',
            'dentures_lower',
            'notes',
        )
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class BathingForm(forms.ModelForm):
    name = "Bathing"
    class Meta:
        model = models.Bathing
        fields = (
            'time',
            'method',
            'method_other',
            'notes',
        )
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            }),
            'method_other': forms.TextInput(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class ToiletingForm(forms.ModelForm):
    name = "Toileting"
    class Meta:
        model = models.Toileting
        fields = (
            'time',
            'assistance',
            'method',
            'brief_change',
            'perineal_care',
            'catheter_care',
            'notes',
        )
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class DressingForm(forms.ModelForm):
    name = "Dressing"
    class Meta:
        model = models.Dressing
        fields = (
            'time',
            'time_of_day',
            'assistance',
            'notes',
        )
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class MealForm(forms.ModelForm):
    name ="Meal" 
    class Meta:
        model = models.Meal
        fields = (
            'time',
            'kind',
            'amount_consumed',
            'notes',
        )
        labels = {
            'amount_consumed': 'Amount consumed (as %)'
        }
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            }),
            'amount_consumed': forms.NumberInput(attrs = {
                'min': 0,
                'max': 100,
            })
        }


class RangeOfMotionForm(forms.ModelForm):
    name = "Range of motion"
    class Meta:
        model = models.RangeOfMotion
        fields = (
            'time',
            'motion_kind',
            'antiembolic_stockings',
            'turn_or_position_change',
            'notes',
        )
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class AmbulationForm(forms.ModelForm):
    name = "Ambulation"
    class Meta:
        model = models.Ambulation
        fields = (
            'time',
            'method',
            'assistance',
            'devices_used',
            'notes',
        )
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class VitalsForm(forms.ModelForm):
    name = "Vitals"
    class Meta:
        model = models.Vitals
        fields = (
            'time',
            'o2_saturation',
            'temperature',
            'temperature_units',
            'pulse',
            'respirations',
            'blood_pressure_systolic',
            'blood_pressure_diastolic',
            'weight',
            'weight_units',
            'notes',
        )
        labels = {
            'o2_saturation': 'O2 saturation (as %)',
            'respirations': 'Respirations per min'

        }
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            }),
            'o2_saturation': forms.NumberInput(attrs = {
                'min': 0,
                'max': 100,
            }),
            'temperature': forms.NumberInput(attrs = {
                'min': 30,
                'max': 110,
            }),
            'pulse': forms.NumberInput(attrs = {
                'max': 250,
            })
        }


class FluidIntakeForm(forms.ModelForm):
    name = "Fluid intake"
    class Meta:
        model = models.FluidIntake
        fields = (
            'time',
            'fluid_type',
            'intake_amount',
            'npo',
            'notes',
        )
        labels = {
            'intake_amount': 'Intake amout (in mL)',
            'npo': 'NPO',
        }
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class UrineForm(forms.ModelForm):
    name = "Urine"
    class Meta:
        model = models.Urine
        fields = (
            'time',
            'assistance',
            'amount',
            'color',
            'notes',
        )
        labels = {
            'amount': 'Amount (in mL)'
        }
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class EmesisForm(forms.ModelForm):
    name = "Emesis"
    class Meta:
        model = models.Emesis
        fields = (
            'time',
            'amount',
            'color',
            'notes',
        )
        labels = {
            'amount': 'Amount (in mL)'
        }
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class BowelMovementForm(forms.ModelForm):
    name = "Bowel movement"
    class Meta:
        model = models.BowelMovement
        fields = (
            'time',
            'assistance',
            'amount',
            'color',
            'consistency',
            'notes',
        )
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class PainLevelForm(forms.ModelForm):
    name = "Pain level"
    class Meta:
        model = models.PainLevel
        fields = (
            'time',
            'score',
            'reported_to_nurse',
            'notes',
        )
        labels = {
            'score': 'Score (out of 10)'
        }
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            }),
            'score': forms.NumberInput(attrs= {
                'min': 0,
                'max': 10,
            })
        }



class OxygenLevelForm(forms.ModelForm):
    name = "Oxygen level"
    class Meta:
        model = models.OxygenLevel
        fields = (
            'time',
            'oxygen_level',
            'delivery_method',
            'notes',
        )
        labels = {
            'oxygen_level': 'Oxygen (LPM)'
        }
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            }),
            'oxygen_level': forms.NumberInput(attrs= {
                'max': 21,
            })
        }


class RestraintForm(forms.ModelForm):
    name = "Restraint"
    class Meta:
        model = models.Restraint
        fields = (
            'time',
            'restraints_used',
            'restraints_soft',
            'notes',
        )
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


class SafetyForm(forms.ModelForm):
    name = "Safety"
    class Meta:
        model = models.Safety
        fields = (
            'time',
            'call_light_in_reach',
            'bed_low',
            'brakes_on',
            'falls',
            'nausea',
            'vomiting',
            'confusion',
            'combative',
            'notes',
        )
        widgets = {
            'time': forms.TextInput(attrs = {
                'autofocus': 'autofocus',
                'placeholder': 'e.g. 15:00',
                'pattern': '^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]|[0-5][0-9]:[0-5][0-9])$',
            }),
            'notes': forms.Textarea(attrs = {
                'placeholder': 'Please explain…',
            })
        }


