from django.forms.models import inlineformset_factory, modelform_factory, modelformset_factory
from django import forms
from .models import SearchData
from django.forms import ModelForm
from django_google_maps import widgets as map_widgets
from django_google_maps import fields as map_fields

import django_filters


GeneralWidgets = {
    'startDate': forms.DateInput(format="%d/%m/%Y",attrs={'type': 'text', 'class': 'datepicker'}),
    'address': map_widgets.GoogleMapsAddressWidget,
    'photo': forms.FileInput,
    'sub_total':  forms.TextInput(attrs={'readonly': 'readonly'}),
    'vat': forms.TextInput(attrs={'readonly': 'readonly'}),
    'total': forms.TextInput(attrs={'readonly': 'readonly'}),

}

SearchForm = modelform_factory(
    SearchData,
    fields="__all__",
    widgets = GeneralWidgets,
    )
