@extends('layouts.backend')

@section('title', $payment_method->exists ? 'Editando '.$payment_method->title : 'Crear nuevo método de pago')

@section('content')
    <!-- Page Header -->
    <div class="page-header">
        <div class="row align-items-end">
            <div class="col-sm mb-2 mb-sm-0">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb breadcrumb-no-gutter">
                        <li class="breadcrumb-item"><a class="breadcrumb-link" href="javascript:;">eCommerce</a></li>
                        <li class="breadcrumb-item"><a class="breadcrumb-link" href="{{ route('backend.payment_methods.index') }}">Métodos de pago</a></li>
                        <li class="breadcrumb-item active" aria-current="page">@yield('title')</li>
                    </ol>
                </nav>

                <h1 class="page-header-title">@yield('title')</h1>
            </div>
        </div>
        <!-- End Row -->
    </div>
    <!-- End Page Header -->

    <!-- Step Form -->
    {!! Form::model($payment_method, [
        'method' => $payment_method->exists ? 'put' : 'post',
        'route' => $payment_method->exists ? ['backend.payment_methods.update', $payment_method->id] : 'backend.payment_methods.store',
        'class' => 'js-step-form py-md-5',
        'files' => true
    ]) !!}
    <div class="row justify-content-lg-center">
        <div class="col-lg-8">
            <div class="card card-lg active">
                <!-- Body -->
                <div class="card-body">
                    <!-- Form Group -->
                    <div class="row form-group">
                        <label for="titleLabel" class="col-sm-3 col-form-label input-label">Nombre</label>

                        <div class="col-sm-9">
                            {!! Form::text('title', null, ['class' => 'form-control', 'id' => 'titleLabel']) !!}
                        </div>
                    </div>
                    <!-- End Form Group -->

                    <!-- Form Group -->
                    <div class="row form-group">
                        <label for="excerptLabel" class="col-sm-3 col-form-label input-label">Descripción</label>

                        <div class="col-sm-9">
                            {!! Form::textarea('excerpt', null, ['class' => 'form-control', 'id' => 'excerptLabel', 'rows' => 3]) !!}
                        </div>
                    </div>
                    <!-- End Form Group -->

                    <hr class="my-4">
                    <div class="form-group mb-0">
                        <!-- Toggle Switch -->
                        <label class="row toggle-switch" for="activeSwitch1">
                          <span class="col-8 col-sm-9 toggle-switch-content ml-0">
                            <span class="text-dark">Activo</span>
                          </span>
                            <span class="col-4 col-sm-3">
                            {!! Form::hidden('active', 0) !!}
                                {!! Form::checkbox('active', 1, $payment_method->exists ? null : true, ['class' => 'toggle-switch-input', 'id' => 'activeSwitch1']) !!}
                                <span class="toggle-switch-label ml-auto">
                              <span class="toggle-switch-indicator"></span>
                            </span>
                          </span>
                        </label>
                        <!-- End Toggle Switch -->
                    </div>
                </div>
                <!-- End Body -->

                <!-- Footer -->
                <div class="card-footer d-sm-flex align-items-sm-center">
                    <div class="ml-auto">
                        <button type="submit" class="btn btn-primary">{{ $payment_method->exists ? 'Actualizar' : 'Crear' }} método de pago</button>
                    </div>
                </div>
                <!-- End Footer -->
            </div>
        </div>
    </div>
    <!-- End Row -->
    {!! Form::close() !!}
    <!-- End Step Form -->
@endsection
