@extends('template.layout')

@section('styles')
    <link href="{{asset('css/pages/perfil.css')}}" rel="stylesheet" type="text/css" />
@endsection

@section('content')
    <h1 class="page-title"> Perfil
        <small>Empresa</small>
    </h1>
    <div class="profile">
        @include('alerts.index')
        <div class="row profile-account">
            <div class="col-md-3">
                <ul class="ver-inline-menu tabbable margin-bottom-10">
                    <li>
                        @if(is_null(Auth::user()->urlimagen))
                            <img src="{{ asset('img/demo/profile.png') }}" class="img-responsive pic-bordered profile-img" alt="img-perfil"/>
                        @else
                            <img src="{{ asset(Auth::user()->urlimagen) }}" class="img-responsive pic-bordered profile-img" alt="img-perfil"/>
                        @endif
                        {{--<a href="javascript:;" class="profile-edit"> edit </a>--}}
                    </li>
                    <li class="active">
                        <a data-toggle="tab" href="#tab_1" class="text-ellipsis">
                            <i class="fa fa-cog"></i> Informaci&oacute;n empresa </a>
                        <span class="after"> </span>
                    </li>
                    <li>
                        <a data-toggle="tab" href="#tab_2" class="text-ellipsis">
                            <i class="fa fa-lock"></i> Cambiar contrase&ntilde;a </a>
                    </li>
                </ul>
            </div>
            <div class="col-md-9">
                <div class="tab-content">
                    <div id="tab_1" class="tab-pane active">
                        <div class="profile-info">
                            <h1 class="font-blue sbold uppercase">{{ $empresa->nombre_organizacion }}</h1>
                            <ul class="list-inline">
                                <li>
                                    <i class="fa fa-user"></i> {{ $empresa->ruc }} </li>
                                <li>
                                    <i class="fa fa-asterisk"></i> {{ $empresa->entidad }} </li>
                                <li>
                                    <i class="fa fa-calendar"></i> {{ $empresa->formacion_empresa }} </li>
                            </ul>
                        </div>
                        {{ Form::open(array('id' => 'form-datos','route' => 'perfil.empresa')) }}
                        <div class="row">
                            {!! Form::hidden('id', $empresa->id) !!}
                            <div class="col-md-12 form-group">
                                <label class="control-label">Rubro</label>
                                {!! Form::text('rubro', null, array('placeholder' => $empresa->rubro,'class' => 'form-control', 'maxlength' => '50')) !!}
                            </div>
                            <div class="col-md-12 form-group">
                                <label class="control-label">Descripci&oacute;n</label>
                                {!! Form::textarea('descripcion', null, array('placeholder' => $empresa->descripcion,'class' => 'form-control', 'maxlength' => '400')) !!}
                            </div>
                            <div class="col-md-6 form-group">
                                <label class="control-label">Tel&eacute;fono</label>
                                {!! Form::text('telefono', null, array('placeholder' => $empresa->telefono,'class' => 'form-control', 'maxlength' => '7')) !!}
                            </div>
                            <div class="col-md-6 form-group">
                                <label class="control-label">Celular</label>
                                {!! Form::text('celular', null, array('placeholder' => $empresa->celular,'class' => 'form-control', 'maxlength' => '9')) !!}
                            </div>
                            <div class="col-md-6 form-group">
                                <label class="control-label">Correo</label>
                                {!! Form::email('correo', null, array('placeholder' => $empresa->email,'class' => 'form-control')) !!}
                            </div>
                            <div class="col-md-6 form-group">
                                <label class="control-label">Fax</label>
                                {!! Form::text('fax', null, array('placeholder' => $empresa->fax,'class' => 'form-control', 'maxlength' => '9')) !!}
                            </div>
                            <div class="col-md-12 form-group">
                                <label class="control-label">Direcci&oacute;n</label>
                                {!! Form::text('direccion', null, array('placeholder' => Auth::user()->direccion,'class' => 'form-control', 'maxlength' => '50')) !!}
                            </div>
                        </div>
                        <div class="margin-top-10">
                            <a href="javascript:;" class="btn btn-default"> Cancelar </a>
                            <button type="submit" class="btn btn-primary"> Guardar cambios </button>
                        </div>
                        {!! Form::close() !!}
                    </div>
                    <div id="tab_2" class="tab-pane">
                        {{ Form::open(array('id' => 'form-password','route' => 'perfil.password')) }}
                        <div class="row">
                            {!! Form::hidden('id', Auth::user()->id) !!}
                            <div class="col-md-12 form-group">
                                <label class="control-label">Contrase&ntilde;a actual</label>
                                {!! Form::password('password', array('class' => 'form-control', 'required' => 'required')) !!}
                            </div>
                            <div class="col-md-12 form-group">
                                <label class="control-label">Nueva Contrase&ntilde;a</label>
                                {!! Form::password('newpassword', array('id' => 'newpassword', 'class' => 'form-control', 'required' => 'required')) !!}
                            </div>
                            <div class="col-md-12 form-group">
                                <label class="control-label">Re-ingrese su nueva contrase&ntilde;a</label>
                                {!! Form::password('repassword', array('id' => 'repassword', 'class' => 'form-control', 'required' => 'required')) !!}
                            </div>
                        </div>
                        <div class="margin-top-10">
                            <a href="javascript:;" class="btn btn-default"> Cancelar </a>
                            <button type="submit" class="btn btn-primary"> Guardar cambios </button>
                        </div>
                        {!! Form::close() !!}
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('scripts')
    <script>
        $('#form-datos').validate({
            rules: {
                telefono: {
                    pattern: '^[0-9]{7}$'
                },
                celular: {
                    pattern: '^[0-9]{9}$'
                },
                fax: {
                    pattern: '^[0-9]{7,9}$'
                },
            }
        });
        $('#form-password').validate({
            rules: {
                newpassword : {
                    minlength : 5,
                },
                repassword : {
                    equalTo : "#newpassword"
                },
            }
        });
    </script>
@endsection