@extends('layouts.app')

@section("breadcrumb")

<li class="breadcrumb-item">@lang('menu.settings')</li>

<li class="breadcrumb-item active">@lang('menu.general_settings')</li>

@endsection



@section('extra_css')

<link href="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.11/summernote-lite.css" rel="stylesheet">

@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('menu.general_settings')

        </h3>

      </div>

      <div class="card-body">

        @if (count($errors) > 0)

          <div class="alert alert-danger">

            <ul>

            @foreach ($errors->all() as $error)

              <li>{{ $error }}</li>

            @endforeach

            </ul>

          </div>

        @endif



        {!! Form::open(['route' => 'settings.store','files'=>true,'method'=>'post']) !!}

        <div class="row">

          <div class="form-group col-md-4">

            {!! Form::label('app_name',__('fleet.app_name'),['class'=>"form-label"]) !!}

            {!! Form::text('name[app_name]',

            Hyvikk::get('app_name'),['class'=>"form-control",'required']) !!}

          </div>



          <div class="form-group col-md-4">

            {!! Form::label('email',__('fleet.email'),['class'=>"form-label"]) !!}

            {!! Form::text('name[email]',

            Hyvikk::get('email'),['class'=>"form-control",'required']) !!}

          </div>



          <div class="form-group col-md-4">

            {!! Form::label('badd1',__('fleet.badd1'),['class'=>"form-label"]) !!}

            {!! Form::text('name[badd1]',

            Hyvikk::get('badd1'),['class'=>"form-control",'required']) !!}

          </div>



          <div class="form-group col-md-4">

            {!! Form::label('badd2',__('fleet.badd2'),['class'=>"form-label"]) !!}

            {!! Form::text('name[badd2]',

            Hyvikk::get('badd2'),['class'=>"form-control",'required']) !!}

          </div>



          <div class="form-group col-md-4">

            {!! Form::label('city',__('fleet.city'),['class'=>"form-label"]) !!}

            {!! Form::text('name[city]',

            Hyvikk::get('city'),['class'=>"form-control",'required']) !!}

          </div>



          <div class="form-group col-md-4">

            {!! Form::label('state',__('fleet.state'),['class'=>"form-label"]) !!}

            {!! Form::text('name[state]',

            Hyvikk::get('state'),['class'=>"form-control",'required']) !!}

          </div>



          <div class="form-group col-md-3">

            {!! Form::label('country',__('fleet.country'),['class'=>"form-label"]) !!}

            {!! Form::text('name[country]',

            Hyvikk::get('country'),['class'=>"form-control",'required']) !!}

          </div>



          <div class="form-group col-md-3">

            {!! Form::label('dis_format',__('fleet.dis_format'),['class'=>"form-label"]) !!}

            {!! Form::select('name[dis_format]', ['km' => 'km', 'miles' => 'miles'], Hyvikk::get("dis_format"),['class'=>"form-control",'required']) !!}

          </div>



          <div class="form-group col-md-3">

            {!! Form::label('fuel_unit',__('fleet.fuel_unit'),['class'=>"form-label"]) !!}

            {!! Form::select('name[fuel_unit]', ['gallon' => 'gallon', 'liter' => 'liter','kWh'=>'kWh'], Hyvikk::get("fuel_unit"),['class'=>"form-control",'required']) !!}

          </div>



          <div class="form-group col-md-3">

            {!! Form::label('language',__('fleet.language'),['class'=>"form-label"]) !!}

            <a data-toggle="modal" data-target="#myModal6"><i class="fa fa-info-circle fa-lg" aria-hidden="true"  style="color: #8639dd"></i></a>

            <select id='name[language]' name='name[language]' class="form-control" required>

              <option value="">-</option>

              @if(Auth::user()->getMeta('language')!= null)

              @php ($language = Auth::user()->getMeta('language'))

              @else

              @php($language = Hyvikk::get("language"))

              @endif

              @foreach($languages as $lang)

                @if($lang != "vendor")

                  @php($l = explode('-',$lang))

                  @if($language == $lang)



                  <option value="{{$lang}}" selected> {{$l[0]}}</option>

                  @else

                  <option value="{{$lang}}" > {{$l[0]}} </option>

                  @endif

                @endif  

              @endforeach

            </select>

          </div>



          <div class="form-group col-md-3">

            {!! Form::label('time_interval',__('fleet.defaultTimeInterval'),['class'=>"form-label"]) !!}



              <div class="input-group mb-3">

                {!! Form::number('name[time_interval]',Hyvikk::get('time_interval'),['class'=>"form-control",'required','min'=>1]) !!}

                <div class="input-group-append">

                  <span class="input-group-text">day(s)</span>

                </div>

              </div>

          </div>



          <div class="form-group col-md-3">

            <label for="icon_img"> @lang('fleet.icon_img')</label>

            @if(Hyvikk::get('icon_img')!= null)

            <button type="button" class="btn btn-success view1 btn-xs" data-toggle="modal" data-target="#myModal3" id="view" title="@lang('fleet.image')" style="margin-bottom: 5px">

            @lang('fleet.view')

            </button>

            @endif

            <div class="input-group input-group-sm">

            {!! Form::file('icon_img') !!}

            </div>

          </div>

          <div class="form-group col-md-3">

            <label for="logo_img"> @lang('fleet.logo_img')(172px X 76px)</label>

            @if(Hyvikk::get('logo_img')!= null)

            <button type="button" class="btn btn-success view2 btn-xs" data-toggle="modal" data-target="#myModal3" id="view" title="@lang('fleet.image')" style="margin-bottom: 5px">

            @lang('fleet.view')

            </button>

            @endif

            <div class="input-group input-group-sm">

              {!! Form::file('logo_img') !!}

            </div>

          </div>


          <div class="form-group col-md-3">

            <label for="logo_img"> Website Fotter Logo Image(50px X 68px)</label>

            @if(Hyvikk::get('fotter_logo_img')!= null)

            <button type="button" class="btn btn-success view4 btn-xs" data-toggle="modal" data-target="#myModal40" id="view" title="@lang('fleet.image')" style="margin-bottom: 5px">

            @lang('fleet.view')

            </button>

            @endif

            <div class="input-group input-group-sm">

              {!! Form::file('fotter_logo_img') !!}

            </div>

          </div>



          <div class="form-group col-md-4">

            {!! Form::label('currency',__('fleet.currency'),['class'=>"form-label"]) !!}

            {!! Form::text('name[currency]',Hyvikk::get('currency'),['class'=>"form-control",'required','id'=>'currency']) !!}

            <span class="text-danger curr-symbol-err">Enter valid currency symbol</span>
          </div>

          <div class="form-group col-md-4">

            {!! Form::label('date_format',__('fleet.date_format'),['class'=>"form-label"]) !!}

            {!! Form::select('name[date_format]', ['d-m-Y' => 'dd-mm-yyyy ('.date('d-m-Y').')', 'Y-m-d' => 'yyyy-mm-dd ('.date('Y-m-d').')','m-d-Y'=>'mm-dd-yyyy ('.date('m-d-Y').')'], Hyvikk::get("date_format"),['class'=>"form-control",'required']) !!}

          </div>

          <div class="form-group col-md-4">

            {!! Form::label('tax_no',__('fleet.tax_no'),['class'=>"form-label"]) !!}

            {!! Form::text('name[tax_no]',

            Hyvikk::get('tax_no'),['class'=>"form-control",'required']) !!}

          </div>



          <div class="form-group col-md-4">

            {!! Form::label('vehicle_interval',__('fleet.vehicle_interval'),['class'=>"form-label"]) !!}

            {!! Form::number('name[vehicle_interval]',Hyvikk::get('vehicle_interval'),['class'=>"form-control",'required']) !!}

            <span id="interval_merr_vehicle" class="text-danger">Maximum vehicle interval can be 1440 minutes.</span>
            <span id="interval_lerr_vehicle" class="text-danger">Vehicle interval cannot be less than 0.</span>

          </div>

          <div class="form-group col-md-4">

            {!! Form::label('driver_interval',__('fleet.driver_interval'),['class'=>"form-label"]) !!}

            {!! Form::number('name[driver_interval]',Hyvikk::get('driver_interval'),['class'=>"form-control",'required']) !!}

            <span id="interval_merr_driver" class="text-danger">Maximum driver interval can be 1440 minutes.</span>
            <span id="interval_lerr_driver" class="text-danger">Driver interval cannot be less than 0.</span>

          </div>

          

          <div class="form-group col-md-4">

            {!! Form::label('tax_charge',__('fleet.tax_charge'),['class'=>"form-label"]) !!}

            <div class="row">

              <div class="col-md-8">

                {!! Form::text('udf1', null,['class' => 'form-control','id'=>'udf1','placeholder'=>__('fleet.Enter_Tax_Name')]) !!}

              </div>

              <div class="col-md-4">

                <button type="button" class="btn btn-info add_udf"> @lang('fleet.addNew')</button>

              </div>

            </div>

          </div>

          @php($udfs = json_decode(Hyvikk::get('tax_charge')))



          @if($udfs != null)

          <div class="col-md-4"><hr></div>

          <div class="col-md-4"><h4 class="text-center">@lang('fleet.tax_charge')</h4></div>

          <div class="col-md-4"><hr></div>

          @foreach($udfs as $key => $value)

          <div class="row col-md-6">

          <div class="col-md-8">  <div class="form-group"> <label class="form-label text-uppercase">{{$key}}</label> <div class="input-group mb-3"><input type="number" name="udf[{{$key}}]" class="form-control" required value="{{$value}}" min=0 step="0.01"> <div class="input-group-append"> <span class="input-group-text fa fa-percent"></span> </div> </div></div></div><div class="col-md-4"> <div class="form-group" style="margin-top: 30px"><button class="btn btn-danger" type="button" onclick="this.parentElement.parentElement.parentElement.remove();">@lang('fleet.Remove')</button> </div></div>

          </div>

          @endforeach

          @endif

          <div class="blank col-md-12"></div>

          <div class="form-group col-md-12">

            {!! Form::label('invoice_text',__('fleet.invoice_text'),['class'=>"form-label"]) !!}

            <a data-toggle="modal" data-target="#myModal5"><i class="fa fa-info-circle fa-lg" aria-hidden="true"  style="color: #8639dd"></i></a>

            {!! Form::textarea('name[invoice_text]',

            Hyvikk::get('invoice_text'),['class'=>"form-control",'size'=>'30x3']) !!}

          </div>



          <div class="col-md-12">

            <div class="form-group">

              {!! Form::label('web_footer',__('fleet.web_footer'), ['class' => 'form-label']) !!}

              <a data-toggle="modal" data-target="#myModal4"><i class="fa fa-info-circle fa-lg" aria-hidden="true"  style="color: #8639dd"></i></a>

              <textarea name="name[web_footer]" id="web_footer" class="form-control">{{ Hyvikk::get('web_footer') }}</textarea>

            </div>

          </div>


          <div class="col-md-3">

             <label>@lang('fleet.fuel_reimbursement_control')</label>

                           <a data-toggle="modal" data-target="#myModal4455"><i class="fa fa-info-circle fa-lg" aria-hidden="true"  style="color: #8639dd"></i></a>


                    <br>

                    <label class="switch">

                      <input type="checkbox" name="fuel_reimbursement_control" value="1"  @if(Hyvikk::get('fuel_reimbursement_control')==1) checked @endif>

                      <span class="slider round"></span>

                    </label>


          </div>


            <div class="col-md-3">

             <label>@lang('fleet.travel_allowance_control')</label>

                           <a data-toggle="modal" data-target="#myModal4466"><i class="fa fa-info-circle fa-lg" aria-hidden="true"  style="color: #8639dd"></i></a>


                    <br>

                    <label class="switch">

                      <input type="checkbox" name="travel_allowance_control" value="1"  @if(Hyvikk::get('travel_allowance_control')==1) checked @endif>

                      <span class="slider round"></span>

                    </label>


          </div>



          <div class="col-md-2">

            <div class="form-group">

              {!! Form::label('fuel_enable_driver',__('fleet.fuel_enable_driver'), ['class' => 'form-label']) !!}

              <a data-toggle="modal" data-target="#myModal2"><i class="fa fa-info-circle fa-lg" aria-hidden="true"  style="color: #8639dd"></i></a>

              <br>

              <label class="switch">

                <input type="checkbox" name="fuel_enable_driver" value="1" id="fuel_enable_driver" @if(Hyvikk::get('fuel_enable_driver')==1) checked @endif>

                <span class="slider round"></span>

              </label>

            </div>

          </div>

          <!-- <div class="col-md-2">

            <div class="form-group">

              {!! Form::label('income_enable_driver',__('fleet.income_enable_driver'), ['class' => 'form-label']) !!}

              <a data-toggle="modal" data-target="#myModal7"><i class="fa fa-info-circle fa-lg" aria-hidden="true"  style="color: #8639dd"></i></a>

              <br>

              <label class="switch">

                <input type="checkbox" name="income_enable_driver" value="1" id="income_enable_driver" @if(Hyvikk::get('income_enable_driver')==1) checked @endif>

                <span class="slider round"></span>

              </label>

             

            </div>

          </div>

         

          <div class="col-md-2">

            <div class="form-group">

              {!! Form::label('expense_enable_driver',__('fleet.expense_enable_driver'), ['class' => 'form-label']) !!}

              <a data-toggle="modal" data-target="#myModal8"><i class="fa fa-info-circle fa-lg" aria-hidden="true"  style="color: #8639dd"></i></a>

              <br>

              <label class="switch">

                <input type="checkbox" name="expense_enable_driver" value="1" id="expense_enable_driver" @if(Hyvikk::get('expense_enable_driver')==1) checked @endif>

                <span class="slider round"></span>

              </label>

            </div>

          </div>   -->
          

          <div class="col-md-12"><h5 style="font-weight: 700;">@lang('fleet.Fare_Mode')</h5></div>

        
          <div class="col-md-2">
            <label for="" class="form-label">@lang('fleet.Vehicle_Type_Wise') </label>

              <span data-toggle="modal" data-target="#vehicle_type_wise_fare-modal">
                <i class="fa fa-info-circle fa-lg" style="color:#8639dd"></i>
            </span>

            
            <br>
            <label class="switch">
              <input type="checkbox" name="fare_mode" value="type_wise" id="typeWiseToggle" class="fare-mode-checkbox" @if(Hyvikk::get('fare_mode')=="type_wise") checked @endif>
              <span class="slider round"></span>
            </label>
          </div>
          <div class="col-md-2">
            <label for="" class="form-label">@lang('fleet.Vehicle_Price_Wise')</label>
               <span data-toggle="modal" onclick="openInfoModal(event)"
                data-title="@lang('fleet.vehicle_price_wise_control_title')"
                data-description="@lang('fleet.vehicle_price_wise_control_info')">
                <i class="fa fa-info-circle fa-lg" style="color:#8639dd"></i>
            </span>
            <br>
            <label class="switch">
              <input type="checkbox" name="fare_mode" value="price_wise" id="priceWiseToggle" class="fare-mode-checkbox" @if(Hyvikk::get('fare_mode')=="price_wise") checked @endif>
              <span class="slider round"></span>
            </label>
          </div>
       




             <div class="col-md-3">
            <label>@lang('fleet.Return_Booking')</label>

             <span data-toggle="modal" onclick="openInfoModal(event)"
                                        data-title="@lang('fleet.return_booking_control_title')" data-description="@lang('fleet.return_booking_control_info')">
                                        <i class="fa fa-info-circle fa-lg" style="color:#8639dd"></i>
                                    </span>

            <br>

            <label class="switch">

              <input type="checkbox" name="return_booking" value="1"  @if(Hyvikk::get('return_booking')==1) checked @endif>

              <span class="slider round"></span>

            </label>

        </div>



       <div class="col-md-3">
            <label>@lang('fleet.Driver_Ride_Start_Control')</label>

             <span data-toggle="modal" onclick="openInfoModal(event)" data-title="@lang('fleet.driver_rider_control_title')"
                                    data-description="@lang('fleet.driver_rider_control_info')">
                                    <i class="fa fa-info-circle fa-lg" aria-hidden="true"
                                        style="color: #8639dd"></i></span>


            <br>

            <label class="switch">

              <input type="checkbox" name="driver_ride_control" value="1"  @if(Hyvikk::get('driver_ride_control')==1) checked @endif>

              <span class="slider round"></span>

            </label>

        </div>


        
          <div class="col-md-2">
              <label>@lang('fleet.Driver_Doc_Verfication')</label>

               <span data-toggle="modal" onclick="openInfoModal(event)"
                data-title="@lang('fleet.Driver_Doc_Verfication')"
                data-description="@lang('fleet.Driver_Doc_Verfication_info')">
                <i class="fa fa-info-circle fa-lg" style="color:#8639dd"></i>
            </span>

              <br>

              <label class="switch">

                <input type="checkbox" name="driver_doc_verification" value="1"  @if(Hyvikk::get('driver_doc_verification')==1) checked @endif>

                <span class="slider round"></span>

              </label>

          </div>



       
      

        </div>

        
        <div class="row">


          <div class="col-md-2">
            <label>@lang('fleet.dynamic_fare')</label>
             <span data-toggle="modal" data-target="#dynamic-fare-modal">
                                    <i class="fa fa-info-circle fa-lg" aria-hidden="true"
                                        style="color: #8639dd"></i></span>
            <br>
            <label class="switch">
                <input type="checkbox"
                      name="dynamic_fare"
                      id="dynamic_fare"
                      value="1"
                      @if(Hyvikk::get('dynamic_fare') == 1) checked @endif>
                <span class="slider round"></span>
            </label>
        </div>

        <div class="col-md-2" id="range-wrapper" style="display: none;">
            <label>@lang('fleet.range')</label>
              <span data-toggle="modal" onclick="openInfoModal(event)"
                data-title="@lang('fleet.range_control_title')"
                data-description="@lang('fleet.range_control_info')">
                <i class="fa fa-info-circle fa-lg" style="color:#8639dd"></i>
            </span>

            <br>
            <input type="number"
                  name="range"
                  id="range"
                  class="form-control"
                  value="{{ Hyvikk::get('range') }}">
        </div>

            
          <div class="col-md-2">
              <label>@lang('fleet.organization_mode')</label>

                 <span data-toggle="modal" onclick="openInfoModal(event)"
                    data-title="@lang('fleet.organization_control_title')"
                    data-description="@lang('fleet.organization_control_info')">
                    <i class="fa fa-info-circle fa-lg" style="color:#8639dd"></i>
                </span>


              <br>

              <label class="switch">

                <input type="checkbox" name="organization_mode" value="1"  @if(Hyvikk::get('organization_mode')==1) checked @endif>

                <span class="slider round"></span>

              </label>

          </div>


      


           <div class="col-md-2">
              <label>@lang('fleet.PromoCode')</label>

               <span data-toggle="modal" onclick="openInfoModal(event)"
                data-title="@lang('fleet.PromoCode')"
                data-description="@lang('fleet.Driver_Doc_Verfication_info')">
                <i class="fa fa-info-circle fa-lg" style="color:#8639dd"></i>
            </span>

              <br>

              <label class="switch">

                <input type="checkbox" name="promocode" value="1"  @if(Hyvikk::get('promocode')==1) checked @endif>

                <span class="slider round"></span>

              </label>

          </div>


           <div class="col-md-2">
              <label>@lang('fleet.customer_cancellation')</label>

               <span data-toggle="modal" onclick="openInfoModal(event)"
                data-title="@lang('fleet.PromoCode')"
                data-description="@lang('fleet.Driver_Doc_Verfication_info')">
                <i class="fa fa-info-circle fa-lg" style="color:#8639dd"></i>
            </span>

              <br>

              <label class="switch">

                <input type="checkbox" name="customer_cancellation" value="1"  @if(Hyvikk::get('customer_cancellation')==1) checked @endif>

                <span class="slider round"></span>

              </label>

          </div>






        </div>

        


      </div>

      <div class="card-footer">

        <div class="row">

          <div class="col-md-2">

            <div class="form-group">

              <input type="submit"  class="form-control btn btn-success" id="save_button" value="@lang('fleet.save')" />

            </div>

          </div>

          <div class="col-md-2">

            <div class="form-group">

              <button type="button" data-toggle="modal" data-target="#myModal"  class="form-control btn btn-danger">@lang('fleet.clear_database')</button>  

            </div>

          </div>

        </div>

      </div>

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

      </div>

    </div>

  </div>

</div>

<!-- Modal -->


<div id="myModal4466" class="modal fade" role="dialog">

  <div class="modal-dialog" role="document">

    <!-- Modal content-->

    <div class="modal-content">

      <div class="modal-header">

        <h4 class="modal-title">@lang('fleet.travel_allowance_control')</h4>

        <button type="button" class="close" data-dismiss="modal">&times;</button>

      </div>

      <div class="modal-body">

        <p>@lang('fleet.travel_allowance_info')</p>

      </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">@lang('fleet.close')</button>

      </div>

    </div>

  </div>

</div>



<div id="myModal4455" class="modal fade" role="dialog">

  <div class="modal-dialog" role="document">

    <!-- Modal content-->

    <div class="modal-content">

      <div class="modal-header">

        <h4 class="modal-title">@lang('fleet.fuel_reimbursement_control')</h4>

        <button type="button" class="close" data-dismiss="modal">&times;</button>

      </div>

      <div class="modal-body">

        <p>@lang('fleet.fuel_reimbursement_info')</p>

      </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">@lang('fleet.close')</button>

      </div>

    </div>

  </div>

</div>

<div id="myModal" class="modal fade" role="dialog">

  <div class="modal-dialog" role="document">

    <!-- Modal content-->

    <div class="modal-content">

      <div class="modal-header">

        <h4 class="modal-title">@lang('fleet.delete')</h4>

        <button type="button" class="close" data-dismiss="modal">&times;</button>

      </div>

      <div class="modal-body">

        <p>@lang('fleet.confirm_clear_database')</p>

        <p class="text-danger"><strong>@lang('fleet.note'): @lang('fleet.clear_database_note')</strong></p>

      </div>

      <div class="modal-footer">

        {!! Form::open(['url' => 'admin/clear-database','method'=>'post']) !!}

        <button class="btn btn-danger" type="submit">@lang('fleet.clear_database')</button>

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

        <button type="button" class="btn btn-default" data-dismiss="modal">@lang('fleet.close')</button>

      </div>

    </div>

  </div>

</div>

<!-- Modal -->



<!-- Modal 2-->

<div id="myModal2" class="modal fade" role="dialog">

  <div class="modal-dialog" role="document">

    <!-- Modal content-->

    <div class="modal-content">

      <div class="modal-header">

        <h4 class="modal-title">@lang('fleet.fuel_enable_driver')</h4>

        <button type="button" class="close" data-dismiss="modal">&times;</button>

      </div>

      <div class="modal-body">

        <p>@lang('fleet.fuel_enable_driver_info')</p>

      </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">@lang('fleet.close')</button>

      </div>

    </div>

  </div>

</div>

<!-- Modal 2-->


<!--model 3 -->

<div id="myModal40" class="modal fade" role="dialog" tabindex="-1">

  <div class="modal-dialog">

      <!-- Modal content-->

    <div class="modal-content">

        <div class="modal-header">

          <button type="button" class="close" data-dismiss="modal">&times;</button>

          <h4 class="modal-title"></h4>

        </div>

        <div class="modal-body">

          <div class="text-center">
            <img src="" class="myimg" style="height: 68px !important;width: 100px !important;">
          </div>
        

        </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">

          @lang('fleet.close')

        </button>

      </div>

    </div>

  </div>

</div>

<!--model 3 -->




<!--model 3 -->

<div id="myModal3" class="modal fade" role="dialog" tabindex="-1">

  <div class="modal-dialog">

      <!-- Modal content-->

    <div class="modal-content">

        <div class="modal-header">

          <button type="button" class="close" data-dismiss="modal">&times;</button>

          <h4 class="modal-title"></h4>

        </div>

        <div class="modal-body">

          <img src="" class="myimg">

        </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">

          @lang('fleet.close')

        </button>

      </div>

    </div>

  </div>

</div>

<!--model 3 -->



<!-- Modal 2-->

<div id="myModal4" class="modal fade" role="dialog">

  <div class="modal-dialog" role="document">

    <!-- Modal content-->

    <div class="modal-content">

      <div class="modal-header">

        <h4 class="modal-title">@lang('fleet.web_footer')</h4>

        <button type="button" class="close" data-dismiss="modal">&times;</button>

      </div>

      <div class="modal-body">

        <p>@lang('fleet.web_footer_info')</p>

      </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">@lang('fleet.close')</button>

      </div>

    </div>

  </div>

</div>

<!-- Modal 2-->



<!-- Modal 2-->

<div id="myModal5" class="modal fade" role="dialog">

  <div class="modal-dialog" role="document">

    <!-- Modal content-->

    <div class="modal-content">

      <div class="modal-header">

        <h4 class="modal-title">@lang('fleet.invoice_text')</h4>

        <button type="button" class="close" data-dismiss="modal">&times;</button>

      </div>

      <div class="modal-body">

        <p>@lang('fleet.invoice_text_info')</p>

      </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">@lang('fleet.close')</button>

      </div>

    </div>

  </div>

</div>

<!-- Modal 2-->



<div id="myModal6" class="modal fade" role="dialog">

  <div class="modal-dialog" role="document">

    <!-- Modal content-->

    <div class="modal-content">

      <div class="modal-header">

        <h4 class="modal-title">@lang('fleet.add_your_lang')</h4>

        <button type="button" class="close" data-dismiss="modal">&times;</button>

      </div>

      <div class="modal-body">

        <p>@lang('fleet.add_your_lang_info')</p>

        <p>

          <a href="https://fleetdocs.hyvikk.space/explore-features/settings/general-settings" target="_blank">@lang('fleet.click_here')</a>

        </p>

      </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">@lang('fleet.close')</button>

      </div>

    </div>

  </div>

</div>



<div id="myModal7" class="modal fade" role="dialog">

  <div class="modal-dialog" role="document">

    <!-- Modal content-->

    <div class="modal-content">

      <div class="modal-header">

        <h4 class="modal-title">@lang('fleet.income_enable_driver')</h4>

        <button type="button" class="close" data-dismiss="modal">&times;</button>

      </div>

      <div class="modal-body">

        <p>@lang('fleet.income_enable_driver_info')</p>

      </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">@lang('fleet.close')</button>

      </div>

    </div>

  </div>

</div>



<div id="myModal8" class="modal fade" role="dialog">

  <div class="modal-dialog" role="document">

    <!-- Modal content-->

    <div class="modal-content">

      <div class="modal-header">

        <h4 class="modal-title">@lang('fleet.expense_enable_driver')</h4>

        <button type="button" class="close" data-dismiss="modal">&times;</button>

      </div>

      <div class="modal-body">

        <p>@lang('fleet.expense_enable_driver_info')</p>

      </div>

      <div class="modal-footer">

        <button type="button" class="btn btn-default" data-dismiss="modal">@lang('fleet.close')</button>

      </div>

    </div>

  </div>

</div>



<div class="modal fade" role="dialog" id="info-modal" style="display: none;">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="infoModalLabel">@lang('fleet.travel_allowance_control')</h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>

            </div>
            <div class="modal-body">
                <p id="infoModalBody"></p>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"
                    id="infoModalFooterCloseButton">@lang('fleet.close')</button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="vehicle_type_wise_fare-modal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">

            <!-- HEADER -->
            <div class="modal-header bg-dark text-white">
                <h5 class="modal-title">
                    @lang('fleet.vehicle_type_wise_fare')
                </h5>
                <button type="button" class="close text-white" data-dismiss="modal">&times;</button>
            </div>

            <!-- BODY -->
            <div class="modal-body">

                <p>
                    @lang('fleet.fare_description')
                </p>

                <!-- FORMULA -->
                <h6 class="text-uppercase text-muted">
                    @lang('fleet.fare_formula_title')
                </h6>

                <div class="bg-dark text-white p-3 rounded mb-4 text-center" style="font-size:14px;">
                    <strong>
                        @lang('fleet.formula_line_1')  
                        <br>
                        @lang('fleet.formula_line_2')
                    </strong>
                </div>

                <!-- VARIABLES -->
                <h6 class="text-uppercase text-muted mb-3">
                    @lang('fleet.fare_variables')
                </h6>

                <div class="row text-center mb-4">

                    <!-- BASE FARE -->
                    <div class="col-md-4">
                        <div class="card">
                            <div class="card-body">
                                <small class="text-muted">
                                    @lang('fleet.base_fare')
                                </small>
                                <h6>
                                    {{ Hyvikk::get('currency') }}100
                                </h6>
                            </div>
                        </div>
                    </div>

                    <!-- BASE KM -->
                    <div class="col-md-4">
                        <div class="card">
                            <div class="card-body">
                                <small class="text-muted">
                                    @lang('fleet.base_km')
                                </small>
                                <h6>5 KM</h6>
                            </div>
                        </div>
                    </div>

                    <!-- STANDARD RATE -->
                    <div class="col-md-4">
                        <div class="card">
                            <div class="card-body">
                                <small class="text-muted">
                                    @lang('fleet.standard_rate')
                                </small>
                                <h6>
                                    {{ Hyvikk::get('currency') }}10 / KM
                                </h6>
                            </div>
                        </div>
                    </div>

                </div>

                <!-- EXAMPLE 1 -->
                <h6 class="text-uppercase text-muted mb-2">
                    @lang('fleet.example_1_title')
                </h6>

                <div class="card mb-3">
                    <div class="card-body text-center">

                        <p>
                            @lang('fleet.example_1_desc', ['km' => 4, 'base_km' => 5])
                        </p>

                        <strong>
                            @lang('fleet.example_1_result', [
                                'currency' => Hyvikk::get('currency'),
                                'amount' => 100
                            ])
                        </strong>
                        <br>

                        <small class="text-muted">
                            @lang('fleet.example_1_note')
                        </small>

                    </div>
                </div>

                <!-- EXAMPLE 2 -->
                <h6 class="text-uppercase text-muted mb-2">
                    @lang('fleet.example_2_title')
                </h6>

                <div class="card">
                    <div class="card-body text-center">

                        <p>
                            @lang('fleet.example_2_total_km', ['km' => 10])
                        </p>

                        <p>
                            @lang('fleet.example_2_extra_km', [
                                'total_km' => 10,
                                'base_km' => 5,
                                'extra' => 5
                            ])
                        </p>

                        <p>
                            @lang('fleet.example_2_extra_charge', [
                                'extra' => 5,
                                'rate' => Hyvikk::get('currency').'10',
                                'currency' => Hyvikk::get('currency'),
                                'charge' => 50
                            ])
                        </p>

                        <strong>
                            @lang('fleet.example_2_total_fare', [
                                'base' => 100,
                                'extra' => 50,
                                'total' => 150,
                                'currency' => Hyvikk::get('currency')
                            ])
                        </strong>

                    </div>
                </div>

            </div>

            <!-- FOOTER -->
            <div class="modal-footer">
                <button type="button" class="btn btn-dark" data-dismiss="modal">
                    @lang('fleet.close')
                </button>
            </div>

        </div>
    </div>
</div>


<div class="modal fade" id="dynamic-fare-modal" tabindex="-1">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">

            <!-- HEADER -->
            <div class="modal-header bg-dark text-white">
                <h5 class="modal-title">@lang('fleet.f_dynamic_fare_control')</h5>
                <button type="button" class="close text-white" data-dismiss="modal">&times;</button>
            </div>

            <!-- BODY -->
            <div class="modal-body">

                <p class="text-muted mb-4">
                    @lang('fleet.f_dynamic_fare_desc')
                </p>

                <!-- FORMULA -->
                <h6 class="text-uppercase text-muted">@lang('fleet.f_formula')</h6>
                <div class="bg-dark text-white text-center p-3 rounded mb-4">
                    <strong>@lang('fleet.f_formula_text')</strong>
                </div>

                <!-- VALUES -->
                <h6 class="text-uppercase text-muted mb-3">@lang('fleet.f_example_values')</h6>

                <div class="row text-center mb-4">

                    <div class="col-md-4 col-6 mb-3">
                        <div class="border rounded p-3">
                            <small class="text-muted d-block">@lang('fleet.f_daily_count')</small>
                            <strong>20</strong>
                        </div>
                    </div>

                    <div class="col-md-4 col-6 mb-3">
                        <div class="border rounded p-3">
                            <small class="text-muted d-block">@lang('fleet.f_weekly_count')</small>
                            <strong>70</strong>
                        </div>
                    </div>

                    <div class="col-md-4 col-12 mb-3">
                        <div class="border rounded p-3">
                            <small class="text-muted d-block">@lang('fleet.f_weekly_avg')</small>
                            <strong>70 ÷ 7 = 10</strong>
                        </div>
                    </div>

                </div>

                <!-- CALCULATION -->
                <h6 class="text-uppercase text-muted mb-3">@lang('fleet.f_example_calculation')</h6>

                <div class="border rounded p-3 mb-4 text-center">
                    <div class="row">

                        <div class="col-md-4 mb-3">
                            <small class="text-muted d-block">@lang('fleet.f_calculation')</small>
                            <strong>(20 × 0.75) + (10 × 0.25)</strong>
                        </div>

                        <div class="col-md-4 mb-3">
                            <small class="text-muted d-block">@lang('fleet.f_score')</small>
                            <strong>15 + 2.5 = <span class="text-success">17.5</span></strong>
                        </div>

                        <div class="col-md-4 mb-3">
                            <small class="text-muted d-block">@lang('fleet.f_result')</small>
                            <strong>@lang('fleet.f_final_count') = 17.5</strong><br>
                            <small class="text-muted">→ @lang('fleet.f_fare_range_applied')</small>
                        </div>

                    </div>
                </div>

                <!-- FLOW -->
                <div class="border rounded p-3 mb-4">

                    <div class="row text-center align-items-center">

                        <div class="col-md-2 col-6 mb-2">
                            <small class="text-muted d-block">@lang('fleet.f_score')</small>
                            <strong>17.5</strong>
                        </div>

                        <div class="col-md-1 d-none d-md-block">➜</div>

                        <div class="col-md-2 col-6 mb-2">
                            <small class="text-muted d-block">@lang('fleet.f_rounded')</small>
                            <strong>18</strong>
                        </div>

                        <div class="col-md-1 d-none d-md-block">➜</div>

                        <div class="col-md-2 col-6 mb-2">
                            <small class="text-muted d-block">@lang('fleet.f_range')</small>
                            <strong>15 - 20</strong>
                        </div>

                        <div class="col-md-1 d-none d-md-block">➜</div>

                        <div class="col-md-3 col-12 mb-2">
                            <small class="text-muted d-block">@lang('fleet.f_fare_increase')</small>
                            <strong class="text-success">+4%</strong>
                        </div>

                    </div>

                </div>

                <!-- NOTES -->
                <div class="alert alert-light mb-0">
                    <ul class="mb-0 pl-3">

                        <li>
                            <small class="text-muted">
                                @lang('fleet.f_dynamic_note')
                                <a href="{{url('/admin/dynamic-fare-range')}}" class="text-primary">
                                    @lang('fleet.f_dynamic_range_setting')
                                </a>
                            </small>
                        </li>

                        <li>
                            <small class="text-success font-weight-bold">
                                @lang('fleet.f_extra_note')
                            </small>
                        </li>

                    </ul>
                </div>

            </div>

            <!-- FOOTER -->
            <div class="modal-footer">
                <button class="btn btn-dark" data-dismiss="modal">
                    @lang('fleet.f_close')
                </button>
            </div>

        </div>
    </div>
</div>

@endsection



@section('script')

<script src="https://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.11/summernote-lite.js"></script>

<script>


     function openInfoModal(event) {
            let el = $(event.currentTarget);
            let description = el.data('description');
            let title = el.data('title')
            $('#info-modal').find('#infoModalLabel').text(title);
            $('#info-modal').find('#infoModalBody').html(description);
            $('#info-modal').modal('show');
        }



    document.addEventListener('DOMContentLoaded', function () {
        const dynamicFare = document.getElementById('dynamic_fare');
        const rangeWrapper = document.getElementById('range-wrapper');
        const rangeInput = document.getElementById('range');

        function toggleRange() {
            if (dynamicFare.checked) {
                rangeWrapper.style.display = 'block';
                rangeInput.setAttribute('required', 'required');
            } else {
                rangeWrapper.style.display = 'none';
                rangeInput.removeAttribute('required');
                rangeInput.value = '';
            }
        }

        // On page load
        toggleRange();

        // On toggle
        dynamicFare.addEventListener('change', toggleRange);
    });





document.addEventListener("DOMContentLoaded", function () {
  const typeWiseToggle = document.getElementById("typeWiseToggle");
  const priceWiseToggle = document.getElementById("priceWiseToggle");

  // Event listener for "Vehicle Type Wise" toggle
  typeWiseToggle.addEventListener("change", function () {
    if (typeWiseToggle.checked) {
      priceWiseToggle.checked = false; // Turn off "Vehicle Price Wise"
    } else if (!priceWiseToggle.checked) {
      typeWiseToggle.checked = true; // Ensure at least one is selected
    }
  });

  // Event listener for "Vehicle Price Wise" toggle
  priceWiseToggle.addEventListener("change", function () {
    if (priceWiseToggle.checked) {
      typeWiseToggle.checked = false; // Turn off "Vehicle Type Wise"
    } else if (!typeWiseToggle.checked) {
      priceWiseToggle.checked = true; // Ensure at least one is selected
    }
  });
});





    $(document).ready(function() {

      $('.curr-symbol-err').hide();
      $('[id^="interval_"]').hide();
      $("input[name='name[state]'], input[name='name[country]']").on('input', function() {
        var inputValue = $(this).val();
        var alphaRegex = /^[A-Za-z]+$/;
        if (!alphaRegex.test(inputValue)) {
          $(this).val(inputValue.replace(/[^A-Za-z]/g, ''));
        }
      });
      
      $('input[name="name[vehicle_interval]"], input[name="name[driver_interval]"]').on('input', function() {
        var inputValue = $(this).val();
        var numericValue = inputValue.replace(/[^0-9]/g, '');
        var limitedValue = numericValue.substring(0, 4);
        $(this).val(limitedValue);

        var vehicleInterval = parseInt($('input[name="name[vehicle_interval]"]').val());
        var driverInterval = parseInt($('input[name="name[driver_interval]"]').val());

        if (vehicleInterval >= 1440) {
          $('#interval_merr_vehicle').show();
          $('input[name="name[vehicle_interval]"]').val(1440);
        }
        else if (vehicleInterval < 0) {
          $('#interval_lerr_vehicle').show();
          $('input[name="name[vehicle_interval]"]').val(0);
        }
        else {
          $('#interval_merr_vehicle').hide();
          $('#interval_lerr_vehicle').hide();
        }

        if (driverInterval >= 1440) {
           $('#interval_merr_driver').show();
           $('input[name="name[driver_interval]"]').val(1440); 
        }
        else if (driverInterval < 0) {
          $('#interval_lerr_driver').show();
          $('input[name="name[driver_interval]"]').val(0); 
        }
        else {
          $('#interval_merr_driver').hide();
          $('#interval_lerr_driver').hide();
        }

      });

      $('#currency').on('input', function () {
            // Specify the allowed ASCII codes for currency symbols
            var allowedAsciiCodes = [36, 8364, 163, 165, 8377, 8355, 8363];

            // Get the input value
            var inputValue = $(this).val();

            // Check the ASCII code of each character in the input
            for (var i = 0; i < inputValue.length; i++) {
                var char = inputValue.charCodeAt(i);

                // Check if the character's ASCII code is not in the allowed list
                if (!allowedAsciiCodes.includes(char)) {
                    // If it's not allowed, clear the input
                    $(this).val('');
                    $('.curr-symbol-err').show();
                    return;
                }
            }
        });
    });
</script>

<script type="text/javascript">

  @if(Session::get('msg'))

    new PNotify({

        title: 'Success!',

        text: '{{ Session::get('msg') }}',

        type: 'success'

      });

  @endif

  

  $('.view4').click(function(){

    $('#myModal40 .modal-body .myimg').attr( "src","{{ asset('assets/images/'. Hyvikk::get('fotter_logo_img') ) }}");

    $('#myModal40 .modal-body .myimg').removeAttr( "height");

    $('#myModal40 .modal-body .myimg').removeAttr( "width");

  });


  $('.view1').click(function(){

    $('#myModal3 .modal-body .myimg').attr( "src","{{ asset('assets/images/'. Hyvikk::get('icon_img') ) }}");

    $('#myModal3 .modal-body .myimg').removeAttr( "height");

    $('#myModal3 .modal-body .myimg').removeAttr( "width");

  });



  $('.view2').click(function(){

    $('#myModal3 .modal-body .myimg').attr( "src","{{ asset('assets/images/'. Hyvikk::get('logo_img') ) }}");

    $('#myModal3 .modal-body .myimg').attr( "height","140px");

    $('#myModal3 .modal-body .myimg').attr( "width","300px");

  });



  $(".add_udf").click(function () {

    // alert($('#udf').val());

    var taxMessage = @json(__('fleet.Enter_Tax_Name'));

    var field = $('#udf1').val();

    if(field == "" || field == null){

      alert(taxMessage);

    }

    else{

      $(".blank").append('<div class="row col-md-12"><div class="col-md-4">  <div class="form-group"> <label class="form-label">'+ field.toUpperCase() +'</label> <div class="input-group mb-3"><input type="number" name="udf['+ field +']" class="form-control" placeholder="Enter '+ field +'" required min=0 step="0.01"> <div class="input-group-append"> <span class="input-group-text fa fa-percent"></span> </div> </div></div></div><div class="col-md-4"> <div class="form-group" style="margin-top: 30px"><button class="btn btn-danger" type="button" onclick="this.parentElement.parentElement.parentElement.remove();">Remove</button> </div></div></div>');

      $('#udf1').val("");

    }

  });



  $('#web_footer').summernote({

      placeholder: '',

      tabsize: 2,

      height: 100

  });

  // $('#traccar_enable').change(function() {

  //             if(this.checked) {

                

  //             }

  //             else {

              

  //             }

  

  // });

</script>

@endsection