@extends('layouts.master')
@section('navigation')
    @if($user->role==1)
        @include('local.managers.admins._new_navigation')
    @elseif($user->role==2)
        @include('local.managers.sCoords._new_navigation')
    @elseif($user->role==3)
        @include('local.managers.pCoords._new_navigation')
    @else
        @include('local.professors._navigation')
    @endif
@stop

@section('main')
@if(!Auth::user()->office_phone)
    <div class="row">
        <div class="col-md-12">
            <div class="alert alert-warning">
                <p>
                    Por favor actualice su información de contacto.
                    @if($user->role==1)

                    @elseif($user->role==2)
                        Esta información será visible por sus coordinadores de programa y profesores de su facultad.
                    @elseif($user->role==3)
                        Esta información será visible por sus coordinadores de programa y coordinador/a de facultad.
                    @else
                        Esta información será visible por profesores de su programa, y coordinadores de su facultad.
                    @endif

                </p>

            </div>
        </div>
    </div>
@endif
<div class="row">
    <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Account Information</h3>
            </div>
            <div class="panel-body">
                <div class="form-horizontal">
                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">Full Name</label>
                        <div class="col-sm-8">
                            <p class="form-control-static">{{ $user->first_name }} {{ $user->surnames }}</p>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">School</label>
                        <div class="col-sm-8">
                            <p class="form-control-static">
                                <!-- If user has a school id -->
                                @if(count($user->school))
                                    {{{ $user->school->name }}}
                                <!-- If user has no school, but has program -->
                                @elseif(count($user->programs))
                                    {{{ $user->programs[0]->school->name }}}
                                <!-- If user has neither -->
                                @else
                                    N/A
                                @endif
                            </p>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">Program(s)</label>
                        <div class="col-sm-8">
                            @if(count($user->programs))
                                @foreach($user->programs as $program)
                                    <p class="form-control-static">
                                        {{ $program->name }}
                                    </p>
                                @endforeach
                            @else
                                N/A
                            @endif
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">Account type</label>
                        <div class="col-sm-8">
                            <p class="form-control-static">
                                @if($user->role==1)
                                    Administrator
                                @elseif($user->role==2)
                                    School Coordinator
                                @elseif($user->role==3)
                                    Program Coordinator
                                @else
                                    Professor
                                @endif
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Contact Information</h3>
            </div>
            <div class="panel-body">
                <div class="form-horizontal">
                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">Email</label>
                        <div class="col-sm-8">
                                <p class="form-control-static">{{{ $user->email }}}</p>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">Office Phone</label>
                        <div class="col-sm-8">
                                <p class="form-control-static">
                                    @if($user->office_phone)
                                        {{{ $user->office_phone }}}

                                        @if($user->office_extension)
                                            <span>ext.</span> {{{ $user->office_extension }}}
                                        @endif
                                    @else
                                        Not set
                                    @endif
                                </p>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">Cell Phone</label>
                        <div class="col-sm-8">
                                <p class="form-control-static">
                                    @if($user->cell_phone)
                                        {{{ $user->cell_phone }}}
                                    @else
                                        Not set
                                    @endif
                                </p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title">Edit Contact Information</h3>
            </div>
            <div class="panel-body">
                {{ Form::model($user, array('action' => array('UsersController@update'), 'class'=>'form-horizontal')) }}
                    <div class="form-group">
                        {{ Form::label('office_phone', 'Office Phone', array('class' => 'col-md-4 control-label')) }}
                        <div class="col-md-8">
                            {{ Form::text('office_phone', Input::old('office_phone'), array('class'=>'form-control') )}}
                        </div>
                    </div>
                    <div class="form-group">
                        {{ Form::label('office_extension', 'Extension', array('class' => 'col-md-4 control-label')) }}
                        <div class="col-md-8">
                            {{ Form::text('office_extension', Input::old('office_extension'), array('class'=>'form-control') )}}
                        </div>
                    </div>
                    <div class="form-group">
                        {{ Form::label('cell_phone', 'Cell Phone', array('class' => 'col-md-4 control-label')) }}
                        <div class="col-md-8">
                            {{ Form::text('cell_phone', Input::old('cell_phone'), array('class'=>'form-control') )}}
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-12">
                            {{ Form::submit('Submit', array('class'=>'btn btn-sm btn-primary pull-right', 'name'=>'submit_contact_info')) }}
                        </div>
                    </div>
                {{ Form::close() }}
            </div>
        </div>
    </div>

</div>

@stop
