@extends('layouts.client')

@section('content')



    <div class="container">
        <div class="row" style="width:100%;">
            <div class="col-md-10 col-md-offset-1">
                <div class="panel panel-default">

                    {{--<div class="panel-heading">Panel de {{ $user->name }} {{ $user->surname }}</div>--}}
                    <div style="padding:16px;">

                        @if(session()->has('message'))
                            <div class="alert alert-success alert-dismissable">
                                <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>

                                {{ session()->get('message') }}
                            </div>
                        @endif
                        @if ($errors->any())
                            <div class="alert alert-danger">
                                <ul>
                                    @foreach ($errors->all() as $error)
                                        <li>{{ $error }}</li>
                                    @endforeach
                                </ul>
                            </div>
                        @endif

                        <a  class="btn btn-default "href="{{URL::to('/')}}/task/create-selector"><< Volver al índice creación de tareas sin guardar los cambios</a>

                        @include('task.forms.'.$type)

                    </div>

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


    <div id="demo"></div>
@endsection


@section('scripts')
    <script>

        // function myFunction() {
        //     var x = document.getElementsByTagName("input");
        //
        //     console.log("x: " + x);
        //     console.log("Number of inputs: " + x.length);
        //
        //     var arrayOfInputNames = [];
        //
        //     for (var i = 0; i < x.length; i++) {
        //         //for(key in x) {
        //         console.log("i: " + i);
        //         console.log("value: " + x[i].name);
        //
        //         arrayOfInputNames.push(x[i].name);
        //     }
        //
        //     console.log(arrayOfInputNames);
        //     document.getElementById("demo").innerHTML = arrayOfInputNames;
        // }
        //
        // $(document).ready(function(){
        //   //  myFunction();
        // })

    </script>


{{--    @include('task.forms.event_scripts')--}}

     @if($type=='event_create' || $type=='event_edit' || $type=='evento_create' || $type=='evento_edit')
         <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
         <script>


             var disableddates = ["12-25-2018","1-1-2019","5-1-2018","5-25-2018","7-9-2018"];//mes,dia,año ,acà se agrega días feriados inamovibles
             function DisableSpecificDates(date) {
                 var m = date.getMonth();
                 var d = date.getDate();
                 var y = date.getFullYear();
                 var currentdate = (m + 1) + '-' + d + '-' + y ;
                 for (var i = 0; i < disableddates.length; i++) {
                     if ($.inArray(currentdate, disableddates) != -1 ) {
                         return [false];
                     }
                 }
                 var weekenddate = $.datepicker.noWeekends(date);
                 return weekenddate;
             }

             $.datepicker.regional['es'] = {
                 closeText: 'Cerrar',
                 prevText: '<Ant',
                 nextText: 'Sig>',
                 currentText: 'Hoy',
                 monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
                 monthNamesShort: ['Ene','Feb','Mar','Abr', 'May','Jun','Jul','Ago','Sep', 'Oct','Nov','Dic'],
                 dayNames: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
                 dayNamesShort: ['Dom','Lun','Mar','Mié','Juv','Vie','Sáb'],
                 dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','Sá'],
                 weekHeader: 'Sm',
                 dateFormat: 'dd/mm/yy',
                 firstDay: 1,
                 isRTL: false,
                 showMonthAfterYear: false,
                 yearSuffix: '',
                 // beforeShowDay: DisableSpecificDates,
                 minDate: 1
             };
             $.datepicker.setDefaults($.datepicker.regional['es']);
             $('#deadline').datepicker();

             $('.draft').click(function (){
                 if (this.checked == true){
                     swal("Las tareas en borrador no se envían para su procesamiento");
                 }
             })

         </script>

    @endif
    @include('task.forms.event_scripts')
    @if($type=='email_create' || $type=='email_edit')
        @include('task.forms.email_scripts')
    @endif

    @endsection


