@extends('admin/layouts/contentLayoutMaster')
@section('content-sidebar')
@section('title', $title)

@section('vendor-style')
{{-- vednor css files --}}
<link rel="stylesheet" href="">
@endsection
@section('content')
<!-- Add rows table -->
<?php
$live_test = Config::get('params.live_test');
$required = "";
?>
<section id="add-row">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">{{$title}}</h4>
                </div>
                <div class="card-content">

                    <div class="card-body">
                        <div class="row"> 
                            <div class="col-md-12 col-xs-12 col-lg-12">
                                @include("messages")
                            </div>
                        </div>
                        
                        <div class="row">
                            
                            <ul class="nav nav-tabs nav-fill" id="myTab" role="tablist">


                                
                                @foreach($settings as $key=>$category)
                                
                                <li class="nav-item">
                                    <a id="order-tab-fill" data-target="#{{$key}}" data-toggle="tab" class="nav-link small text-uppercase @if($loop->iteration == 1) active @endif">{{ $loop->iteration }} - {{$category['title']}}</a>
                                </li>
                                <??>
                                @endforeach


                            </ul>
                        </div>

                        {!! Form::model($model, ['files' => true,'class' => 'number-tab-steps wizard-circle wizard clearfix','url' => ['admin/settings/update'], 'method' => 'post']) !!}



                        <div class="tab-content">
                            @foreach($settings as $key=>$category)

                            <div class="tab-pane @if($loop->iteration == 1) active @endif" id="{{$key}}">
                                <div class="row">
                                    <div class="col-sm-12 col-md-12 col-lg-12">
                                        @foreach($category["data"] as $key1=>$row)

                                        <div class="form-group">
                                            <input type="hidden" name="IDS[]" value="{{$row->id}}" />
                                            {!! Form::label($row->title) !!}
                                            <?php $status = Config::get('settings.' . $row->title);
                                            ?>
                                            @if($row->Type=="dropdown")

                                            {!! Form::select('Content[]', $status,$row->content,['class' => 'form-control',$required]) !!}
                                            @else
                                            {!! Form::text('Content[]', $row->content , array('class' => 'form-control',$required) ) !!}       
                                            @endif
                                        </div>
                                        @endforeach
                                    </div>
                                </div>

                            </div>
                            @endforeach


                        </div>




                        <br clear="all"/>
                        <div class="row">
                            <div class="col-md-8">
                                <button type="submit" class="btn btn-primary mr-1 mb-1 waves-effect waves-light">Save</button>
                                <a href="{{url('settings')}}" class="btn btn-outline-warning mr-1 mb-1 waves-effect waves-light">Cancel</a>
                            </div>
                        </div>

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


                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<!--/ Add rows table -->
<!--/ Scroll - horizontal and vertical table -->
@endsection
@include('vendor_script')
@section('myscript')
<script>
    $(document).ready(function () {
//alert('hello');
        $('div li a').click(function (e) {

            $('div li a').removeClass('active');
            $('.tab-content div').removeClass('active');
            var id_name = this.hash.substr(1); //gets the text after # in href
            $("#" + id_name).addClass('active');
            $('#active_tab').attr('val', id_name.toString());

            $("#active_tab").val("#" + id_name);
            var $this = $(this);
            if (!$this.hasClass('active')) {
                $this.addClass('active');
            }
            //e.preventDefault();
        });
    });
</script>

@endsection