from django import forms
from .models import Firma, Fatura, FaturaKalemi

class FirmaForm(forms.ModelForm):
    class Meta:
        model = Firma
        fields = ['ad', 'vergi_no', 'mersis_no', 'adres']
        widgets = {
            'ad': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Firma Tam Adı'}),
            'vergi_no': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Vergi No / TC Kimlik No'}),
            'mersis_no': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'MERSİS No (Opsiyonel)'}),
            'adres': forms.Textarea(attrs={'class': 'form-control', 'rows': 3, 'placeholder': 'Firma Adresi'}),
        }

class FaturaForm(forms.ModelForm):
    class Meta:
        model = Fatura
        fields = ['firma', 'fatura_no', 'tarih', 'ara_toplam', 'kdv_toplam', 'genel_toplam', 'pdf_dosyasi']
        widgets = {
            'firma': forms.Select(attrs={'class': 'form-select'}),
            'fatura_no': forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Fatura No'}),
            'tarih': forms.DateInput(attrs={'class': 'form-control', 'type': 'date'}),
            'ara_toplam': forms.NumberInput(attrs={'class': 'form-control', 'step': '0.01'}),
            'kdv_toplam': forms.NumberInput(attrs={'class': 'form-control', 'step': '0.01'}),
            'genel_toplam': forms.NumberInput(attrs={'class': 'form-control', 'step': '0.01'}),
            'pdf_dosyasi': forms.FileInput(attrs={'class': 'form-control'}),
        }
