from django import forms

from booking.models import Booking


class BookingBaseForm(forms.ModelForm):
    """
    Base form for booking-related forms.
    This can be extended by other booking forms.
    """

    class Meta:
        fields = '__all__'
        model = Booking

class BookingCreateForm(BookingBaseForm):

    class Meta(BookingBaseForm.Meta):
        fields = ['number', 'vehicles', 'container_type', 'container_count', 'carrier', 'line', 'container_number']
        widgets = {
            'container_number': forms.TextInput(attrs={
                'oninput': 'validateContainerNumber(this)',
                'class': 'form-control'
            })
        }

class BookingUpdateForm(BookingBaseForm):

    class Meta(BookingBaseForm.Meta):
        fields = ['number', 'vehicles', 'container_type', 'container_count', 'carrier', 'line', 'container_number']
        widgets = {
            'container_number': forms.TextInput(attrs={
                'oninput': 'validateContainerNumber(this)',
                'class': 'form-control'
            })
        }