@extends('layouts.app')
@section("breadcrumb")
<li class="breadcrumb-item">@lang('menu.settings')</li>
<li class="breadcrumb-item active">@lang('fleet.mail_settings')</li>
@endsection
@section('extra_css')
<style type="text/css">
  .nav-link {
    padding: .5rem !important;
  }

  .custom .nav-link.active {

      background-color: #21bc6c !important;
  }

  /* The switch - the box around the slider */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

/* Hide default HTML checkbox */
.switch input {display:none;}

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
  -webkit-transform: translateX(26px);
  -ms-transform: translateX(26px);
  transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

</style>
@endsection
@section('content')
<div class="row">
  <div class="col-md-12">
    <div class="card card-success">
      <div class="card-header">
        <h3 class="card-title">@lang('fleet.mail_settings')
        </h3>
      </div>

     {!! Form::open(['route' => 'mail-settings.store','method'=>'post','class' => 'form-reset']) !!}
            {!! Form::hidden('user_id', Auth::user()->id) !!}

             <div class="row m-3">

              <div class="col-md-4">
                    <label>@lang('fleet.mail_mailer')</label>
                    <div class="form-group">
                        <input type="text" name="mail_mailer" class="form-control" value="{{('smtp' ?? Hyvikk::get('mail_mailer'))}}" readonly>
                    </div>
                </div>

                <div class="col-md-4">
                    <label>@lang('fleet.mail_host')</label>
                    <div class="form-group">
                        <input type="text" name="host" class="form-control" value="{{Hyvikk::get('mail_host')}}" required>
                    </div>
                </div>

                <div class="col-md-4">
                    <label>@lang('fleet.mail_port')</label>
                    <div class="form-group">
                        <input type="text" name="port" class="form-control" value="{{Hyvikk::get('mail_port')}}" required>
                    </div>
                </div>
            </div>

            <div class="row m-3">
                <div class="col-md-4">
                    <label>@lang('fleet.mail_username')</label>
                    <div class="form-group">
                        <input type="text" name="username" class="form-control" value="{{Hyvikk::get('mail_username')}}" required>
                    </div>
                </div>

                <div class="col-md-4">
                    <label>@lang('fleet.mail_password')</label>
                    <div class="form-group">
                        <input type="password" name="password" class="form-control" value="{{Hyvikk::get('mail_password')}}" required>
                    </div>
                </div>

                 <div class="col-md-4">
                    <label>@lang('fleet.mail_encryption')</label>
                    <div class="form-group">
                        <!-- <input type="password" name="password" class="form-control" value="{{Hyvikk::get('mail_password')}}" required> -->

                        <select name="encryption" class="form-control" required>
                            <option value="">Select Mail Encryption</option>
                            <option value="tls" @if(Hyvikk::get("mail_encryption") == "tls") selected @endif>TLS</option>
                            <option value="ssl" @if(Hyvikk::get("mail_encryption") == "ssl") selected @endif>SSL</option>
                        </select>


                    </div>
                </div>


            </div>

           <div class="row m-3">
                <div class="col-md-12">
                    {!! Form::submit(__('fleet.test'), ['class' => 'btn btn-success']) !!}
                </div>
            </div>

        {!! Form::close() !!}

      </div>
    </div>
  </div>
</div>
@endsection

@section("script")

<script type="text/javascript">
  @if(Session::get('msg'))
    new PNotify({
        title: 'Success!',
        text: '{{ Session::get('msg') }}',
        type: 'success'
      });
  @endif

  @if(session('error'))
    new PNotify({
        title: 'Error!',
        text: "{{ session('error') }}",
        type: 'error'
    });
@endif

</script>

@endsection