@extends('layouts.master')
@section('page_title')
    @if(isset($page_title))
        {{ $page_title }}
    @endif
@endsection
@section('content')
  <div class="">
    <div class="page-title">
      <div class="title_left" style="width:800px !important;">
        <ol class="breadcrumb">
          <li><a href="{!! url('dashboard') !!}">Dashboard</a></li>
          <li><a href="{!! url('infrastructure/vpn') !!}">VPN List</a></li>
          <li class="active">New VPN Configs</li>
        </ol>
      </div>
    </div>
    <div class="clearfix"></div>
      <div class="row">
        @include('commons.notifications')
        <div class="col-md-12 col-sm-12 col-xs-12">
          <div class="x_panel">
              <div class="x_title">
                New VPN Configs
                <div class="clearfix"></div>
              </div>
                {{-- start of content --}}
                <div class="x_content">
                  <br>
                      {!! Form::open(['url' => 'infrastructure/storevpn', 'class' => 'form-horizontal form-label-left', 'files' => 'true']) !!}
                      <div class="row">
                        <div class="col-md-12">

                          <div class="form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="partnerType">Partner Type</label>
                            <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('partner_type') ? 'has-error' : ''}}">
                              {!! Form::select('partner_type', $partner_type_arr ,old('partner_type'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'- Select -' , 'id' => 'partnerType', 'required' => 'true']) !!}
                              {!! $errors->first('partner_type', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="partnerTypeID">Partner *</label>
                            <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('partner_type_id') ? 'has-error' : ''}}">              
                              {!! Form::select('partner_type_id', $partners_arr, old('partner_type_id'),  ['class' => 'form-control', 'placeholder'=>'- Select -' , 'id' => 'partnerTypeID', 'required' => 'true']) !!}
                              {!! $errors->first('partner_type_id', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>                        
                          <div class="form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="vpnServices">Services</label>
                            <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('services') ? 'has-error' : ''}}">
                              {!! Form::select('services', $services_arr, old('services'), ['class' => 'form-control col-md-7 col-xs-12', 'id' => 'vpnServices', 'multiple' => 'true']) !!}
                              {!! $errors->first('services', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="vpn_device">VPN Device (Maker/Model)</label>
                            <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('vpn_device') ? 'has-error' : ''}}">
                              {!! Form::text('vpn_device', old('vpn_device'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Remote VPN Device' , 'id' => 'remoteVpnDevice']) !!}
                              {!! $errors->first('vpn_device', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="remotePeerIp">Remote Peer IP *</label>
                            <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('remotePeerIp') ? 'has-error' : ''}}">
                              {!! Form::text('remote_peer_ip', old('remote_peer_ip'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Remote Peer IP' , 'id' => 'remotePeerIp']) !!}
                              {!! $errors->first('remote_peer_ip', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="remoteIps">Remote IPs (ACLs) *</label>
                            <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('partner_access_control_list') ? 'has-error' : ''}}">
                              {!! Form::text('partner_access_control_list', old('partner_access_control_list'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Remote IPs seperated by commas' , 'id' => 'remoteIps']) !!}
                              {!! $errors->first('partner_access_control_list', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="localIps">Local IPs (ACLs) *</label>
                            <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('local_access_control_list') ? 'has-error' : ''}}">
                              {!! Form::text('local_access_control_list', old('local_access_control_list'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter local IPs seperated by commas' , 'id' => 'localIps']) !!}
                              {!! $errors->first('local_access_control_list', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="dateReceived">Date Received</label>
                            <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('date_received') ? 'has-error' : ''}}">
                              {!! Form::text('date_received', old('date_received'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter date' , 'id' => 'dateReceived']) !!}
                              {!! $errors->first('date_received', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>
                          <div class="form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="vpnFormFile">VPN Form</label>
                            <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('vpn_form') ? 'has-error' : ''}}">
                              {!! Form::file('vpn_form', old('vpn_form'), ['class' => 'form-control col-md-7 col-xs-12', 'id' => 'vpnFormFile']) !!}
                              {!! $errors->first('vpn_form', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>
                          
                        </div>
                        <div class="clearfix"></div>
                        <div class="ln_solid"></div>
                        <div class="col-md-6"> 
                          <h4 class="text-center"><strong>Phase 1 Settings</strong></h4>
                          <div class="form-group">
                            <div class="col-md-12 {{ $errors->has('phase_1_raw_settings') ? 'has-error' : ''}}">
                              {!! Form::textarea('phase_1_raw_settings', old('phase_1_raw_settings'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'' , 'id' => 'phase1RawSettings']) !!}
                              {!! $errors->first('phase_1_raw_settings', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>
                        </div>
                        <div class="col-md-6"> 
                          <h4 class="text-center"><strong>Phase 2 Settings</strong></h4>
                          <!-- <p class="text-center">Enter Phase 2 Settings</p> -->

                          <div class="form-group">
                            <div class="col-md-12 {{ $errors->has('phase_2_raw_settings') ? 'has-error' : ''}}">
                              {!! Form::textarea('phase_2_raw_settings', old('phase_2_raw_settings'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'' , 'id' => 'phase2RawSettings']) !!}
                              {!! $errors->first('phase_2_raw_settings', '<p class="help-block">:message</p>') !!}
                            </div>
                          </div>
                          
                          </div>
                        </div>
                      </div>       
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-12">
                          <button type="submit" class="btn btn-success btn-block"><i class="fa fa-save"></i> Save</button>
                        </div>
                      </div>
                  {!! Form::close() !!}
                </div>
                {{-- end of x_content --}}
              </div>
              {{-- end of x_panel --}}
            </div>
          </div>

        </div>

@endsection

@section('javascript')
<script type="text/javascript" src="{{ url('public/assets/js/vpn_configs.js') }}"></script>
<script type="text/javascript">
  $(function(){
    $('select').select2();

  });
</script>
@endsection
