@extends('layouts.client')

@section('content-header')
    <h1>
        Configuration
        <small>Informations entreprise</small>
    </h1>
@endsection
@section('content')
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="box box-primary">
                <!-- form start -->
                {!! Form::model($company, ['route' => ['clients.configs.update'], 'class' => '', 'method' => 'POST', 'files' => true]) !!}
                @include('clients.configs._form')
                {!! Form::close() !!}
            </div>
        </div>
    </div>
@endsection

@section('scripts')
    <script>
        $(function(){
            $('#wilaya_id').on('change', function(){
                var $id_wilaya = $(this).val();
                $('#communes_container').load('/clients/admin/configs/wilayas/'+$id_wilaya+'/communes/select', function() {
                    //$('.select2').select2();
                })
            });

            // $('body').on('change', '#commune_id',function(){
                
            // });

            $('input[name="optionsGroupe"]').click(function(){
                if ($(this).val() == 'ultime') { // filiale
                    $('#container_groupes').hide();
                    $('#groupe_id').attr('required', false);
                    $('#groupe_id').val(null);
                }else{
                    $('#container_groupes').show();
                    $('#groupe_id').attr('required', true);
                    $('.select2').select2();
                }
            }); 
        })
    </script>
@endsection