<div class="card  collapsed-card card-primary">
    <div class="card-header">
        <h3 class="card-title">Assicurazione</h3>
        <div class="card-tools">
            <button type="button" class="btn btn-tool" data-card-widget="collapse"><i
                    class="fas fa-plus"></i></button>
        </div>
    </div>
    <div class="card-body">
        <form wire:submit.prevent="savePolizza">
            <div class="row mb-3">
                <div class="col-md-4">
                    <label>Contraente</label>
                    <div class="row">
                        <div class="col-sm-9">
                            <select class="form-control anagrafica_id" wire:model="anagrafica_id" required>
                                @if ($anagrafica_id)
                                    <option value="{{ $anagrafica_id }}">
                                        {{ $this->getAnagrafica($anagrafica_id) }}
                                    </option>
                                @endif
                            </select>
                        </div>
                        <div class="col-sm-3">
                            <a class="btn btn-primary"
                            wire:click.prevent="addAnagraficaPolizza"
                            href="#"
                            role="button">
                             +&nbsp;
                         </a>
                        </div>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label>Compagnia</label>
                        <select class="form-control compagnia_id" wire:model="compagnia_id" required>
                        </select>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label>Agenzia</label>
                        <select class="form-control agenzia" wire:model="agenzia">
                        </select>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-4">
                    <div class="form-group">
                        <label>Numero Polizza</label>
                        <input type="text" class="form-control polizza_num"
                            wire:model.debounce.500ms="polizza_num" required>

                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label>Valida dal</label>
                        <div class="input-group">
                            <input type="date" class="form-control valida_dal" wire:model="valida_dal" required>
                        </div>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label>Valida al</label>
                        <div class="input-group">
                            <input type="date" class="form-control valida_al" wire:model="valida_al" required>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12 text-right">
                    @if (!$this->validated)
                        <button type="submit" class="btn btn-primary">Salva</button>
                    @endif
                </div>
            </div>
        </form>
    </div>
</div>
