@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 class="active">Create Service</li>
        </ol>
      </div>
    </div>
    <div class="clearfix"></div>
      <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
          <div class="x_panel">
              <div class="x_title">
                Update Client Details
                @include('commons.notifications')
                <div class="clearfix"></div>
              </div>
                {{-- start of content --}}
                <div class="x_content">
                  <br>
                      {!! Form::model($client, [
                          'method' => 'PATCH',
                          'url' => ['clients', $client],
                          'class' => 'form-horizontal form-label-left'
                      ]) !!}
                      <div class="row">
                          <div class="col-md-4">
                            <div class="form-group">
                              <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">Name</label>
                              <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('name') ? 'has-error' : ''}}">
                                {!! Form::text('name', old('name'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter client name' , 'id' => 'name']) !!}
                                {!! $errors->first('name', '<p class="help-block">:message</p>') !!}

                                <label for="fullname">Full Name * :</label>
                                <input type="text" id="fullname" class="form-control" name="fullname" required />
                              </div>
                            </div>
                            <div class="form-group">
                              <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">Contact Person</label>
                              <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('name') ? 'has-error' : ''}}">
                                {!! Form::text('contact_person', old('contact_person'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter Contact Person' , 'id' => 'contact_person']) !!}
                                {!! $errors->first('contact_person', '<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="email">Email</label>
                              <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('name') ? 'has-error' : ''}}">
                                {!! Form::text('email', old('email'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter email' , 'id' => 'email']) !!}
                                {!! $errors->first('email', '<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="skypeName">Skype Name</label>
                              <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('name') ? 'has-error' : ''}}">
                                {!! Form::text('skype_name', old('skype_name'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter Skype Name' , 'id' => 'skypeName']) !!}
                                {!! $errors->first('skype_name', '<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="linkedIn">Linked In</label>
                              <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('name') ? 'has-error' : ''}}">
                                {!! Form::text('linkedin_name', old('linkedin_name'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter LinkedIn Name' , 'id' => 'linkedIn']) !!}
                                {!! $errors->first('linkedin_name', '<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="country">Country</label>
                              <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('country') ? 'has-error' : ''}}">
                                {!! Form::select('country', $countries, old('country'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter Country ' , 'id' => 'country']) !!}
                                {!! $errors->first('country', '<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="currency">Currency</label>
                              <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('currency') ? 'has-error' : ''}}">
                                {!! Form::select('currency', $currency ,old('currency'), ['class' => 'form-control col-md-7 col-xs-12' , 'id' => 'currency']) !!}
                                {!! $errors->first('currency', '<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="status">Status</label>
                              <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('status') ? 'has-error' : ''}}">
                                {!! Form::select('status', $status ,old('status'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter Status ' , 'id' => 'status']) !!}
                                {!! $errors->first('status', '<p class="help-block">:message</p>') !!}
                              </div>
                            </div>

                          </div>
                          
                            <div class="col-md-4">
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="auth_user_id">Account Manager</label>
                                <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('auth_user_id') ? 'has-error' : ''}}">
                                  {!! Form::select('auth_user_id', $auth_users ,old('auth_user_id'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter Account Manager ' , 'id' => 'auth_user_id']) !!}
                                  {!! $errors->first('auth_user_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="type">Services</label>
                                <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('services') ? 'has-error' : ''}}">
                                  {!! Form::select('services[]', $service_type, ['1' => 'A2P', '2' => 'USSD'], ['class' => 'form-control col-md-7 col-xs-12 typeServices' , 'id' => 'services', '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="contractType">Contract Type</label>
                                <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('contract_type') ? 'has-error' : ''}}">
                                  {!! Form::select('contract_type', ['bilateral', 'unilateral'], old('contract_type'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Select Contract type' , 'id' => 'contractType']) !!}
                                  {!! $errors->first('contract_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="contractValidity">Contract Validity (years)</label>
                                <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('name') ? 'has-error' : ''}}">
                                  {!! Form::number('contract_validity', old('contract_validity'), ['class' => 'form-control col-md-7 col-xs-12', 'placeholder'=>'Enter Contract Validity Period' , 'id' => 'contractValidity']) !!}
                                  {!! $errors->first('contract_validity', '<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="type">Connections</label>
                                <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('connections') ? 'has-error' : ''}}">
                                  {!! Form::select('connections[]', $connections, null, ['class' => 'form-control col-md-7 col-xs-12 ' , 'id' => 'services', 'multiple'=> 'true']) !!}
                                  {!! $errors->first('connections', '<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="type">SMPP Connections Details</label>
                                <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('smpp_details') ? 'has-error' : ''}}">
                                  {!! Form::textarea('smpp_details', null, ['class' => 'form-control col-md-7 col-xs-12 ' , 'id' => 'smppDetails']) !!}
                                  {!! $errors->first('smpp_details', '<p class="help-block">:message</p>') !!}
                                </div>
                              </div>
                            </div>
                            <div class="col-md-4">
                              <div class="form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="payment_mode">Payment Mode</label>
                                <div class="col-md-6 col-sm-6 col-xs-12 {{ $errors->has('payment_mode') ? 'has-error' : ''}}">
                                  {!! Form::select('payment_mode', $payment_type, old('pay_mode'), ['class' => 'form-control col-md-7 col-xs-12' , 'id' => 'payment_mode']) !!}
                                  {!! $errors->first('payment_mode', '<p class="help-block">:message</p>') !!}
                                </div>
                              </div>
                              <div class="form-group">
                                  <label>Status *:</label>
                                  <p>
                                    Live:
                                    <input type="radio" class="flat" name="status" id="statusLive" value="Live" checked="" required /> 
                                    Prospective:
                                    <input type="radio" class="flat" name="status" id="statusProspect" value="Prospective" />
                                    Inactive
                                    <input type="radio" class="flat" name="status" id="statusInactive" value="Inactive" />
                                  </p>
                              </div>
                            </div>
                      </div>
                      <div class="remnants">
                        {"protocol" : "SMPP", "version" : "3.4", "IP Address" : "Port" : "8999", "password" : "password", "system_type" : "SMPP", "Bind_mode" : "TRX", "TPS":"50"}
                      </div>

                     
                      <div class="ln_solid"></div>
                      <div class="form-group">
                        <div class="col-md-12 col-sm-6 col-xs-12">
                          <button type="submit" class="btn btn-success btn-block"><i class="fa fa-save"></i> Update</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">
  $(function(){
    $('select').select2();
    // var PRESELECTED_FRUITS = ['A2P','USSD'];

    // $('.typeServices').select2({}).select2('val', PRESELECTED_FRUITS);  
    $('.typeServices').select2({
          tags : true
        });
  });
</script>
@endsection
