@extends('admin.layouts.app')

@section('content')
<div class="container-fluid px-4">
    <x-admin.page-header
        :title="__('admin/email-marketing.create_title')"
        icon="fas fa-envelope-open-text"
        :buttons="[
            ['label' => __('admin/common.back'), 'route' => route('admin.email-marketing.index'), 'icon' => 'fas fa-arrow-left', 'color' => 'outline-secondary'],
        ]"
    />

    <x-admin.alert />

    <form method="POST" action="{{ route('admin.email-marketing.store') }}">
        @csrf
        <x-admin.card>
            <div class="row g-3">
                <div class="col-md-6">
                    <label class="form-label">{{ __('admin/email-marketing.fields_name') }} <span class="text-danger">*</span></label>
                    <input type="text" class="form-control" name="name" value="{{ old('name') }}" required>
                    @error('name') <div class="invalid-feedback">{{ $message }}</div> @enderror
                </div>
                <div class="col-md-6">
                    <label class="form-label">{{ __('admin/email-marketing.fields_provider') }}</label>
                    <select class="form-select" name="provider">
                        <option value="">{{ __('admin/common.select') }}</option>
                        <option value="mailchimp">Mailchimp</option>
                        <option value="mailerlite">MailerLite</option>
                        <option value="local">Local</option>
                    </select>
                </div>
                <div class="col-md-12">
                    <label class="form-label">{{ __('admin/email-marketing.fields_description') }}</label>
                    <textarea class="form-control" name="description" rows="3">{{ old('description') }}</textarea>
                </div>
            </div>
        </x-admin.card>

        <x-admin.card :title="__('admin/email-marketing.defaults_title')" icon="fas fa-cog" class="mt-3">
            <div class="row g-3">
                <div class="col-md-4">
                    <label class="form-label">{{ __('admin/email-marketing.fields_default_from_name') }}</label>
                    <input type="text" class="form-control" name="default_from_name" value="{{ old('default_from_name') }}">
                </div>
                <div class="col-md-4">
                    <label class="form-label">{{ __('admin/email-marketing.fields_default_from_email') }}</label>
                    <input type="email" class="form-control" name="default_from_email" value="{{ old('default_from_email') }}">
                </div>
                <div class="col-md-4">
                    <label class="form-label">{{ __('admin/email-marketing.fields_default_reply_to') }}</label>
                    <input type="email" class="form-control" name="default_reply_to" value="{{ old('default_reply_to') }}">
                </div>
            </div>

            <x-slot:footer>
                <x-admin.form-actions :cancel-url="route('admin.email-marketing.index')" />
            </x-slot:footer>
        </x-admin.card>
    </form>
</div>
@endsection
