{{--
    Autor: Giovanni López O.
    @gmlo_89
--}}
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>{{ Config::get('core.app_name') }}</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <base href="{{ url('') }}">

        {{-- Cargamos los css necesarios. --}}
        
        
        {{-- Carga lo que ocupe algún modulo en el head --}}
        @yield('head')

        {{ HTML::script('backend/vendor/tinymce/tinymce.min.js'); }}

        {{-- Estilos para fancybox --}}
        {{ HTML::style('backend/vendor/fancybox/source/jquery.fancybox.css'); }}

        {{-- Estilos para datatables --}}
        {{ HTML::style('backend/css/datatables.css'); }}

        {{-- Styles for bootstrap-switch --}}
        {{ HTML::style('backend/vendor/bootstrap-switch/dist/css/bootstrap3/bootstrap-switch.min.css'); }}

        {{-- Styles for data-pickers --}}
        {{ HTML::style('backend/vendor/bootstrap-datepicker/css/datepicker3.css'); }}

        {{-- Estilos del Dashboard --}}
        @if(App::environment('local'))
            <link rel="stylesheet/less" type="text/css" href="{{ asset('backend/less/dashboard.less') }}" />
        @else
            {{ HTML::style('backend/css/dashboard.min.css') }}
        @endif


        {{-- Estilos para extender --}}
        {{ HTML::style('backend/css/ext.css'); }}

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>
    <body>
        
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-4 col-md-2 sidebar">
                    {{-- Menú lateral --}}
                    {{-- @include('dashboard::menu-lateral') --}}
                    {{ HTML::link('admin', Config::get('core.app_name'), array('class' => 'brand')); }}
                    {{ Dashboard::renderMenuLeft() }}
                </div>
                <div class="col-sm-8 col-sm-offset-4 col-md-10 col-md-offset-2 main-container">
                    {{-- Incluimos la vista del menú superior --}}
                    @include('dashboard::menu-top')
                    {{-- Contenido del modulo actual. --}}
                    @yield('content')
                </div>
            </div>
        </div>

        



        {{-- JS que se necesitaran a lo largo de la aplicación. --}}

        {{-- Variables JavaScript que se nesesitaran a lo largo de nuestra aplicación. --}}
        {{ JavaScript::renderVars() }}


        <script src="https://code.jquery.com/jquery.js"></script>
        <script>window.jQuery || document.write('<script src="{{ asset("backend/vendor/jquery/dist/jquery.js") }}"><\/script>')</script>
        
        @if(App::environment('local'))
            <!-- set options before less.js script -->
            <script>
              less = {
                env: "development",
                async: false,
                fileAsync: false,
                poll: 1000,
                functions: {},
                dumpLineNumbers: "comments",
                relativeUrls: false,
                rootpath: ""
              };
            </script>
            {{ HTML::script('backend/vendor/less/dist/less-1.7.0.min.js'); }}
        @endif
        
        {{ HTML::script('backend/js/bootstrap.min.js'); }}
        {{ HTML::script('backend/js/jquery.validate.js'); }}

        {{ JavaScript::makeVar('label_find_file', trans('dashboard::label.find_file')) }}
        
        {{-- Plugin para cambiar el estilo de todos los input con type="file" --}}
        {{ HTML::script('backend/vendor/bootstrap-filestyle/src/bootstrap-filestyle.js'); }}
        <script type="text/javascript">
            // Indicamos que todos los input[type="file"] van a tener un diseño especial
            $(":file").filestyle({buttonText: inncore.label_find_file});
        </script>

        {{-- Script para bootstrap-switch --}}
        {{ HTML::script('backend/vendor/bootstrap-switch/dist/js/bootstrap-switch.min.js'); }}
        <script type="text/javascript">
            $("[data-toggle='checkbox']").bootstrapSwitch();
        </script>

        {{-- Script for bootstrap-datapickers --}}
        {{ HTML::script('backend/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js'); }}



        {{-- Script for fancybox --}}
        {{ HTML::script('backend/vendor/fancybox/source/jquery.fancybox.js'); }}

        {{-- Script que ayuda para crear cuadros de dialogo de bootstrap --}}
        {{ HTML::script('backend/vendor/bootbox/bootbox.js'); }}
        <script type="text/javascript">
            // Definimos los valores default para bootbox
            bootbox.setDefaults({
                /**
                * @optional String
                * @default: en
                * which locale settings to use to translate the three
                * standard button labels: OK, CONFIRM, CANCEL
                */
                locale: "es",
                /**
                * @optional Boolean
                * @default: true
                * whether the dialog should be shown immediately
                */
                show: true,
                /**
                * @optional Boolean
                * @default: true
                * whether the dialog should be have a backdrop or not
                */
                backdrop: true,
                /**
                * @optional Boolean
                * @default: true
                * show a close button
                */
                closeButton: true,
                /**
                * @optional Boolean
                * @default: true
                * animate the dialog in and out (not supported in < IE 10)
                */
                animate: true,
                /**
                * @optional String
                * @default: null
                * an additional class to apply to the dialog wrapper
                */
                className: "my-modal"
            });
        </script>

        {{-- JS propio para cuando ocupe algunas funciones. --}}
        {{ HTML::script('backend/js/scripts.js'); }}

        {{ HTML::script('backend/js/jquery.dataTables.js'); }}
        {{ HTML::script('backend/js/datatables.js'); }}

        {{-- Para poner algunas instrucciones JS necesarias --}}
        <script type="text/javascript">
            // Habilitamos la propiedad para que los elementos con la clase .fancybox usen tal script
            $(".fancybox").fancybox();


            // Todos los textarea con la clase .editor-html van a usar tinymce
            tinymce.init({
                selector: "textarea.editor-html",
                file_browser_callback : elFinderBrowser,
                theme: "modern",
                height: 600,
                plugins: [
                     "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker",
                     "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
                     "save table contextmenu directionality emoticons template paste textcolor"
               ],
              // content_css: "css/content.css",
               toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | formatselect | bullist numlist outdent indent | l      ink image | print preview media fullpage | forecolor backcolor emoticons", 
               style_formats: [
                    {title: 'Bold text', inline: 'b'},
                    {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
                    {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
                    {title: 'Example 1', inline: 'span', classes: 'example1'},
                    {title: 'Example 2', inline: 'span', classes: 'example2'},
                    {title: 'Table styles'},
                    {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
                ]

             });
            function elFinderBrowser (field_name, url, type, win) {
              tinymce.activeEditor.windowManager.open({
                file: '/elfinder/tinymce',// use an absolute path!
                title: 'elFinder 2.0',
                width: 900,
                height: 450,
                resizable: 'yes'
              }, {
                setUrl: function (url) {
                  win.document.getElementById(field_name).value = url;
                }
              });
              return false;
            }
        </script>

        {{-- Carga los JS que ocupe cada modulo. --}}
        @yield('scripts')

    </body>
</html>