text:
import {NgModule}      from '@angular/core';
import {CloudinaryService} from "./cloudinary.service";
import{CloudinarySettingComponent} from"./cloudinary.component";
import{SharedModule} from '../../../shared/shared.module';

@NgModule({
    imports: [SharedModule],
    declarations: [CloudinarySettingComponent],
    providers: [CloudinaryService]
})

export class CloudinaryModule {
}

redpajama_set_name: RedPajamaGithub


text: Landing page for the "Just Don't Wear Blackface" custom url.


text:
FactoryBot.define do
  factory :skill do
    sequence(:name) { |n| "#{Faker::Lorem.words(number: 3).join(' ')}#{n}" }
    association(:user)
    association(:skill_category)
  end
end


text:
import { NgModule }       from '@angular/core';
import { BrowserModule }  from '@angular/platform-browser';
import { FormsModule }    from '@angular/forms';
import { HttpModule }    from '@angular/http';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {
    MdTabsModule, MdCardModule, MdButtonModule, MdIconModule, MdIconRegistry, MdInputModule,
    MdListModule, MdGridListModule, MdTooltipModule, MdDialog, MaterialModule
} from '@angular/material';

import { AppRoutingModule }     from './app-routing.module';
import {AuthGuard} from './guards/auth.guard';

// Components
import { AppComponent }        from './components/app.component';
import {LoginComponent} from './components/login.component';
import {ProfileComponent, ChangeSettingsDialog} from './components/profile.component';
import {AlertBoxComponent} from './components/shared/alert-box.component';
import {GamesComponent} from './components/games.component';
import {GameService} from './services/game.service';
import {LoaderComponent} from './components/shared/loader.component';
import {GameComponent} from './components/game.component';
import {MatchComponent} from './components/match.component';
import {TipsterComponent} from './components/tipster.component';
import {TipsterService} from './services/tipster.service';
import {BetService} from './services/bet.service';
import {UserService} from './services/user.service';
import {BetComponent} from './components/bet.component';
import {TipsterboxComponent} from './components/shared/tipsterbox.component';
import {TipstersCompareDialog, TipstersComponent} from './components/tipsters.component';
import {RankingComponent} from "./components/ranking.component";

// import 'hammerjs';

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        HttpModule,
        AppRoutingModule,
        BrowserAnimationsModule,
        MdCardModule,
        MdButtonModule,
        MdIconModule,
        MdInputModule,
        MdTabsModule,
        MdListModule,
        MdGridListModule,
        MdTooltipModule,
        MaterialModule
    ],
    declarations: [
        AppComponent,
        GamesComponent,
        LoginComponent,
        ProfileComponent,
        AlertBoxComponent,
        LoaderComponent,
        GameComponent,
        MatchComponent,
        TipsterComponent,
        BetComponent,
        TipsterboxComponent,
        ChangeSettingsDialog,
        TipstersComponent,
        RankingComponent,
        TipstersCompareDialog
    ],
    entryComponents: [
        ChangeSettingsDialog,
        TipstersCompareDialog
    ],
    providers: [
        MdIconRegistry,
        MdDialog,
        AuthGuard,
        GameService,
        TipsterService,
        BetService,
        UserService
    ],
    bootstrap: [ AppComponent ]
})
export class AppModule {
}


text:
st:
  published_at: 2016-09-01
  type: Classroom
seo:
  title: How do I check the headers/raw source of an email?
  description: How do I check the headers/raw source of an email?
  keywords: bounces, email, headers, raw, source
title: How do I check the headers/raw source of an email?
weight: 0
layout: page
zendesk_id: 203965613
navigation:
  show: true
---

Being able to check the raw headers of an email can be incredibly useful when troubleshooting. Headers bely all sorts of details about a messages' security, composition, and even the journey it takes from point A to point B.

Our Support agents may sometimes ask you to give us the raw source or headers of an email to help them solve email issues, below are a few methods for for obtaining headers in some popular mail clients.

**Gmail** :

![]({{root_url}}/images/headersgif2.gif)

**Thunderbird** :

![]({{root_url}}/images/TbirdheadersGIF.gif)

**Outlook: **

![]({{root_url}}/images/Outlookheaders.gif)

**Yahoo:**

Sadly, Yahoo does not offer an option in their web tool to view the headers from received messages.


text:
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports Telerik.Web.UI
Imports SistFoncreagro.BussinesLogic
Imports SistFoncreagro.BussinessEntities
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Data.OleDb
Public Class ListaOperaciones
    Inherits System.Web.UI.Page
    Private _ordersExpandedState As Hashtable
    Private _selectedState As Hashtable
    Dim Transaccion As New TransaccionBL
    Dim IdSubDiario As Integer
    Dim EjercicioBL As New EjercicioBL
    Dim estadoMes As String = ""
    Dim Tipo As String
    Dim ProyectoBL As New ProyectoBL
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        IdSubDiario = Request.QueryString("IdSubDiario")

        estadoMes = EjercicioBL.GetEstadoMes(Session("Anio"), Session("Mes"))
        If estadoMes = "C" Then
            Me.RadGrid1.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.None
        End If

        Select Case IdSubDiario
            Case 2
                Me.Label1.Text = "Listado de Cuentas por Pagar"
                Tipo = "C"
            Case 3
                Me.Label1.Text = "Listado de Ventas"
                Tipo = "V"
            Case 4
                Me.Label1.Text = "Listado de Honorarios Profesionales"
                Tipo = "H"
            Case 70
                Me.Label1.Text = "Listado de Percepciones"
                Tipo = "P"
        End Select
        If Not IsPostBack Then
            'reset states
            Me._ordersExpandedState = Nothing
            Me.Session("_ordersExpandedState") = Nothing
            Me._selectedState = Nothing
            Me.Session("_selectedState") = Nothing
        End If
    End Sub

    Protected Sub RadGrid1_ItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.ItemCommand
        Dim cadena_java As String

        If e.CommandName = Telerik.Web.UI.RadGrid.ExportToExcelCommandName OrElse e.CommandName = Telerik.Web.UI.RadGrid.ExportToWordCommandName OrElse e.CommandName = Telerik.Web.UI.RadGrid.ExportToPdfCommandName Then
            ConfigureExport()
        ElseIf e.CommandName = "InitInsert" Then
            e.Canceled = True
            Session("IdTransaccion") = 0
            'Session("Ventana") = "~\Contabilidad\Formularios\ListaTransacciones.aspx"
            Select Case IdSubDiario
                Case 2
                    ' Response.Redirect("~\Contabilidad\Formularios\FrmCompras.aspx")
                    cadena_java = "<script type='text/javascript'> " & _
                                             " radopen('FrmCompras.aspx','Formulario'); " & _
                                             Chr(60) & "/script>"
                    ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                Case 3
                    ' Response.Redirect("~\Contabilidad\Formularios\FrmVentas.aspx")
                    cadena_java = "<script type='text/javascript'> " & _
                                            " radopen('FrmVentas.aspx','Formulario'); " & _
                                            Chr(60) & "/script>"
                    ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                Case 4
                    'Response.Redirect("~\Contabilidad\Formularios\FrmHonorarios.aspx")
                    cadena_java = "<script type='text/javascript'> " & _
                                            " radopen('FrmHonorarios.aspx','Formulario'); " & _
                                            Chr(60) & "/script>"
                    ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                Case 70
                    'Response.Redirect("~\Contabilidad\Formularios\FrmHonorarios.aspx")
                    cadena_java = "<script type='text/javascript'> " & _
                                            " radopen('FrmPercepciones.aspx','Formulario'); " & _
                                            Chr(60) & "/script>"
                    ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
            End Select
        End If
        If "Transacciones".Equals(e.Item.OwnerTableView.Name) Then
            If e.CommandName = "Anular" Then
                Dim IdTran As String = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("IdTransaccion").ToString
                Transaccion.UpdateEstadoTRANSACCION(IdTran, "N")
                Me.RadGrid1.DataBind()
            ElseIf e.CommandName = "Ver" Then
                Dim IdTran As String = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("IdTransaccion").ToString
                Session("IdTransaccion") = IdTran
                If Tipo = "C" Then
                    cadena_java = "<script type='text/javascript'> " & _
                                                 " window.open('Voucher.aspx?Tipo=C'); " & _
                                                 Chr(60) & "/script>"
                    ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                ElseIf Tipo = "V" Then
                   cadena_java = "<script type='text/javascript'> " & _
                                                 " window.open('Voucher.aspx?Tipo=V'); " & _
                                                 Chr(60) & "/script>"
                    ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                ElseIf Tipo = "H" Then
                    cadena_java = "<script type='text/javascript'> " & _
                                                 " window.open('Voucher.aspx?Tipo=H'); " & _
                                                 Chr(60) & "/script>"
                    ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                ElseIf Tipo = "P" Then
                    cadena_java = "<script type='text/javascript'> " & _
                                                 " window.open('Voucher.aspx?Tipo=C'); " & _
                                                 Chr(60) & "/script>"
                    ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                End If
            ElseIf e.CommandName = "Editar" Then
                Dim IdTran As String = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("IdTransaccion").ToString
                Session("IdTransaccion") = IdTran

                Select Case IdSubDiario
                    Case 2
                        cadena_java = "<script type='text/javascript'> " & _
                                                 " radopen('FrmCompras.aspx','Formulario'); " & _
                                                 Chr(60) & "/script>"
                        ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                    Case 3
                        cadena_java = "<script type='text/javascript'> " & _
                                                " radopen('FrmVentas.aspx','Formulario'); " & _
                                                Chr(60) & "/script>"
                        ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                    Case 4
                        cadena_java = "<script type='text/javascript'> " & _
                                                " radopen('FrmHonorarios.aspx','Formulario'); " & _
                                                Chr(60) & "/script>"
                        ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                    Case 70
                        cadena_java = "<script type='text/javascript'> " & _
                                                " radopen('FrmPercepciones.aspx','Formulario'); " & _
                                                Chr(60) & "/script>"
                        ScriptManager.RegisterStartupScript(Page, GetType(Page), "Cerrar", cadena_java.ToString, False)
                End Select
            End If
        End If

        'save the expanded/selected state in the session
        If e.CommandName = RadGrid.ExpandCollapseCommandName Then
            'Is the item about to be expanded or collapsed
            If Not e.Item.Expanded Then
                'Save its unique index among all the items in the hierarchy
                Me.ExpandedStates(e.Item.ItemIndexHierarchical) = True
            Else
                'collapsed
                Me.ExpandedStates.Remove(e.Item.ItemIndexHierarchical)
                Me.ClearSelectedChildren(e.Item.ItemIndexHierarchical)
                Me.ClearExpandedChildren(e.Item.ItemIndexHierarchical)
            End If
            'Is the item about to be selected
        ElseIf e.CommandName = RadGrid.SelectCommandName Then
            'Save its unique index among all the items in the hierarchy
            Me.SelectedStates(e.Item.ItemIndexHierarchical) = True
            'Is the item about to be deselected
        ElseIf e.CommandName = RadGrid.DeselectCommandName Then
            Me.SelectedStates.Remove(e.Item.ItemIndexHierarchical)
        End If

    End Sub
    Public Sub ConfigureExport()
        RadGrid1.ExportSettings.ExportOnlyData = True
        RadGrid1.ExportSettings.IgnorePaging = True
        RadGrid1.ExportSettings.OpenInNewWindow = True
    End Sub

    Protected Sub RadGrid1_DeleteCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.DeleteCommand
        If "Transacciones".Equals(e.Item.OwnerTableView.Name) Then
            Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
            Try
                Dim ID As String = (CType(e.Item, GridDataItem)).OwnerTableView.DataKeyValues(e.Item.ItemIndex)("IdTransaccion").ToString
                Transaccion.DeleteTransaccion(ID)
                ' Me.RadGrid1.Rebind()
            Catch ex As Exception
                Dim radalertscript As String = "<script language='javascript'>function f(){radalert('<b>¡No se puede eliminar el registro!</b> ', 330, 210); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>"
                Page.ClientScript.RegisterStartupScript(Me.[GetType](), "radalert", radalertscript)
                e.Canceled = True
            End Try
        End If
    End Sub
    Public Function DescEstado(ByVal Estado As String) As String
        Dim descripcion As String = ""
        Select Case Estado
            Case "S"
                descripcion = "Sin Procesar"
            Case "P"
                descripcion = "Procesado"
            Case "A"
                descripcion = "Actualizado"
            Case "N"
                descripcion = "Anulado"
            Case "C"
                descripcion = "Cancelado"
            Case "E"
                descripcion = "Errado"
            Case "V"
                descripcion = "Validado"
        End Select
        Return descripcion
    End Function
    Public Function Color(ByVal Estado As String) As Drawing.Color
        Dim col As Drawing.Color
        Select Case Estado
            Case "S"
                col = Drawing.Color.Red
            Case "P"
                col = Drawing.Color.Blue
            Case "A"
                col = Drawing.Color.Blue
            Case "N"
                col = Drawing.Color.Gray
            Case "C"
                col = Drawing.Color.Black
            Case "V"
                col = Drawing.Color.Blue
            Case "E"
                col = Drawing.Color.Red
        End Select

        Return col
    End Function

    Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
        If "Transacciones".Equals(e.Item.OwnerTableView.Name) Then
            If estadoMes = "C" Then
                For i = 0 To e.Item.OwnerTableView.Items.Count - 1
                    e.Item.OwnerTableView.Items.Item(i)("eliminar").Enabled = False
                    e.Item.OwnerTableView.Items.Item(i)("anular").Enabled = False
                    e.Item.OwnerTableView.Items.Item(i)("eliminar").BackColor = Drawing.Color.Gray
                    e.Item.OwnerTableView.Items.Item(i)("anular").BackColor = Drawing.Color.Gray
                Next
            Else
                For i = 0 To e.Item.OwnerTableView.Items.Count - 1
                    If (CType(e.Item.OwnerTableView.Items(i).FindControl("Label2"), Label).Text = "Anulado") Then
                        'e.Item.OwnerTableView.Items.Item(i)("editar").Enabled = False
                        'e.Item.OwnerTableView.Items.Item(i)("eliminar").Enabled = False
                        'e.Item.OwnerTableView.Items.Item(i)("anular").Enabled = False
                        e.Item.OwnerTableView.Items.Item(i).BackColor = Drawing.Color.Silver
                    End If
                Next
            End If
        End If
    End Sub
    Public Function Proyecto(ByVal id As Int32) As String
        Dim nombre As String
        nombre = ProyectoBL.GetFromProyectoByIdProyecto(id).Codigo
        Return nombre
    End Function
    Private ReadOnly Property ExpandedStates() As Hashtable
        Get
            If Me._ordersExpandedState Is Nothing Then
                _ordersExpandedState = TryCast(Me.Session("_ordersExpandedState"), Hashtable)
                If _ordersExpandedState Is Nothing Then
                    _ordersExpandedState = New Hashtable()
                    Me.Session("_ordersExpandedState") = _ordersExpandedState
                End If
            End If

            Return Me._ordersExpandedState
        End Get
    End Property

    'Clear the state for all expanded children if a parent item is collapsed
    Private Sub ClearExpandedChildren(ByVal parentHierarchicalIndex As String)
        Dim indexes As String() = New String(Me.ExpandedStates.Keys.Count - 1) {}
        Me.ExpandedStates.Keys.CopyTo(indexes, 0)
        For Each index As String In indexes
            'all indexes of child items
            If index.StartsWith(parentHierarchicalIndex + "_") OrElse index.StartsWith(parentHierarchicalIndex + ":") Then
                Me.ExpandedStates.Remove(index)
            End If
        Next
    End Sub

    Private Sub ClearSelectedChildren(ByVal parentHierarchicalIndex As String)
        Dim indexes As String() = New String(Me.SelectedStates.Keys.Count - 1) {}
        Me.SelectedStates.Keys.CopyTo(indexes, 0)
        For Each index As String In indexes
            'all indexes of child items
            If index.StartsWith(parentHierarchicalIndex + "_") OrElse index.StartsWith(parentHierarchicalIndex + ":") Then
                Me.SelectedStates.Remove(index)
            End If
        Next
    End Sub

    'Save/load selected states Hash from the session
    'this can also be implemented in the ViewState
    Private ReadOnly Property SelectedStates() As Hashtable
        Get
            If Me._selectedState Is Nothing Then
                _selectedState = TryCast(Me.Session("_selectedState"), Hashtable)
                If _selectedState Is Nothing Then
                    _selectedState = New Hashtable()
                    Me.Session("_selectedState") = _selectedState
                End If
            End If

            Return Me._selectedState
        End Get
    End Property

    Protected Sub RadGrid1_DataBound1(ByVal sender As Object, ByVal e As EventArgs) Handles RadGrid1.DataBound
        'Expand all items using our custom storage
        Dim indexes As String() = New String(Me.ExpandedStates.Keys.Count - 1) {}
        Me.ExpandedStates.Keys.CopyTo(indexes, 0)

        Dim arr As New ArrayList(indexes)
        'Sort so we can guarantee that a parent item is expanded before any of
        'its children
        arr.Sort()

        For Each key As String In arr
            Dim value As Boolean = CBool(Me.ExpandedStates(key))
            If value Then
                RadGrid1.Items(key).Expanded = True
            End If
        Next

        'Select all items using our custom storage
        indexes = New String(Me.SelectedStates.Keys.Count - 1) {}
        Me.SelectedStates.Keys.CopyTo(indexes, 0)

        arr = New ArrayList(indexes)
        'Sort to ensure that a parent item is selected before any of its children
        arr.Sort()

        For Each key As String In arr
            Dim value As Boolean = CBool(Me.SelectedStates(key))
            If value Then
                RadGrid1.Items(key).Selected = True
            End If
        Next
    End Sub

    Protected Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
        If e.Argument = "Validar" Then
            If Session("IdTransaccion") > 0 Then

                If Transaccion.GetTransaccionByIdTransaccion(Session("IdTransaccion")).Estado = "S" Then
                    Select Case IdSubDiario
                        Case 2
                            Dim cadena_java As String = _
                                             "<script type='text/javascript'> " & _
                                             " if (confirm('¡Debe validar el Voucher!')) { radopen('FrmCompras.aspx','Formulario'); }  " & _
                                             Chr(60) & "/script>"
                            ScriptManager.RegisterStartupScript(Page, GetType(Page), "AlertaX", cadena_java.ToString, False)
                            Me.RadGrid1.Rebind()

                        Case 3
                            Dim cadena_java As String = _
                                             "<script type='text/javascript'> " & _
                                             " if (confirm('¡Debe validar el Voucher!')) { radopen('FrmVentas.aspx','Formulario'); }  " & _
                                             Chr(60) & "/script>"
                            ScriptManager.RegisterStartupScript(Page, GetType(Page), "AlertaX", cadena_java.ToString, False)
                            Me.RadGrid1.Rebind()
                        Case 4
                            Dim cadena_java As String = _
                                             "<script type='text/javascript'> " & _
                                             " if (confirm('¡Debe validar el Voucher!')) { radopen('FrmHonorarios.aspx','Formulario'); }  " & _
                                             Chr(60) & "/script>"
                            ScriptManager.RegisterStartupScript(Page, GetType(Page), "AlertaX", cadena_java.ToString, False)
                            Me.RadGrid1.Rebind()
                        Case 70
                            Dim cadena_java As String = _
                                             "<script type='text/javascript'> " & _
                                             " if (confirm('¡Debe validar el Voucher!')) { radopen('FrmPercepciones.aspx','Formulario'); }  " & _
                                             Chr(60) & "/script>"
                            ScriptManager.RegisterStartupScript(Page, GetType(Page), "AlertaX", cadena_java.ToString, False)
                            Me.RadGrid1.Rebind()
                    End Select

                Else
                    Me.RadGrid1.Rebind()
                End If
            End If
        ElseIf e.Argument = "Actualizar" Then
            Me.RadGrid1.Rebind()
        End If
    End Sub
End Class


text:
/*
* Module dependencies
*/

import React from 'react';
import { Router, Route } from 'react-router'
import Material from '../node_modules/material-design-lite/material.min.js';
import Header from './components/shared/header';
import Footer from './components/shared/footer';
import Home from './components/home';
import Blog from './components/Blog';
import Portfolio from './components/Portfolio';
import Social from './components/Social';
import About from './components/About';

class App extends React.Component {
  render(){
    return

          {this.props.children}

  }
}

//TODO: extract routes to a different file.
let routes = <Router>
      <Route path="/" component={App}>
        <Route path="home" component={Home} />
        <Route path="blog" component={Blog} />
        <Route path="portfolio" component={Portfolio} />
        <Route path="social" component={Social} />
        <Route path="about" component={About} />
      </Route>
    </Router>

React.render(routes, document.getElementById('app-container'));


text:
module AdminLTE
  module Rails
    VERSION = '1.3.3'
  end
end


text:
package org.innovateuk.ifs.management.assessment.controller;

import com.fasterxml.jackson.databind.JsonNode;
import lombok.extern.slf4j.Slf4j;
import org.innovateuk.ifs.assessment.service.CompetitionInviteRestService;
import org.innovateuk.ifs.commons.security.SecuredBySpring;
import org.innovateuk.ifs.invite.resource.ParticipantStatusResource;
import org.innovateuk.ifs.management.assessor.form.OverviewAssessorsFilterForm;
import org.innovateuk.ifs.management.assessor.form.OverviewSelectionForm;
import org.innovateuk.ifs.management.assessor.populator.CompetitionInviteAssessorsOverviewModelPopulator;
import org.innovateuk.ifs.management.cookie.CompetitionManagementCookieController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

import static java.util.Arrays.asList;
import static java.util.Optional.empty;
import static java.util.Optional.of;
import static org.innovateuk.ifs.invite.resource.ParticipantStatusResource.PENDING;
import static org.innovateuk.ifs.invite.resource.ParticipantStatusResource.REJECTED;

/**
 * This controller handles the Overview tab for inviting assessors to a Competition.
 */
@Slf4j
@Controller
@RequestMapping("/competition/{competitionId}/assessors")
@SecuredBySpring(value = "Controller", description = "TODO", securedType = InviteAssessorsOverviewController.class)
@PreAuthorize("hasPermission(#competitionId, 'org.innovateuk.ifs.competition.resource.CompetitionCompositeId', 'ASSESSMENT')")
public class InviteAssessorsOverviewController extends CompetitionManagementCookieController<OverviewSelectionForm> {

    private static final String FILTER_FORM_ATTR_NAME = "filterForm";
    private static final String SELECTION_FORM = "overviewSelectionForm";

    @Autowired
    private CompetitionInviteRestService competitionInviteRestService;

    @Autowired
    private CompetitionInviteAssessorsOverviewModelPopulator inviteAssessorsOverviewModelPopulator;

    @Override
    protected String getCookieName() {
        return SELECTION_FORM;
    }

    @Override
    protected Class<OverviewSelectionForm> getFormType() {
        return OverviewSelectionForm.class;
    }

    @GetMapping("/pending-and-declined")
    public String overview(Model model,
                           @Valid @ModelAttribute(FILTER_FORM_ATTR_NAME) OverviewAssessorsFilterForm filterForm,
                           @ModelAttribute(name = SELECTION_FORM, binding = false) OverviewSelectionForm selectionForm,
                           @SuppressWarnings("unused") BindingResult bindingResult,
                           @PathVariable("competitionId") long competitionId,
                           @RequestParam(defaultValue = "0") int page,
                           @RequestParam(value = "filterChanged", required = false) boolean filterChanged,
                           HttpServletRequest request,
                           HttpServletResponse response) {

        updateOverviewSelectionForm(request, response, competitionId, selectionForm, filterForm, filterChanged);

        model.addAttribute("model", inviteAssessorsOverviewModelPopulator.populateModel(
                competitionId,
                page,
                filterForm.getStatus(),
                filterForm.getCompliant(),
                filterForm.getAssessorName()
        ));

        return "assessors/overview";
    }

    private void updateOverviewSelectionForm(HttpServletRequest request,
                                             HttpServletResponse response,
                                             long competitionId,
                                             OverviewSelectionForm selectionForm,
                                             OverviewAssessorsFilterForm filterForm,
                                             boolean filterChanged) {
        OverviewSelectionForm storedSelectionForm = getSelectionFormFromCookie(request, competitionId).orElse(new OverviewSelectionForm());

        if (storedSelectionForm.anyFilterIsActive()
                && !filterForm.anyFilterIsActive()
                && !filterChanged
                && storedSelectionForm.anySelectionIsMade()) {
            updateFilterForm(filterForm, storedSelectionForm);
        }

        OverviewSelectionForm trimmedOverviewForm = trimSelectionByFilteredResult(
                storedSelectionForm,
                filterForm.getStatus(),
                filterForm.getCompliant(),
                filterForm.getAssessorName(),
                competitionId);
        selectionForm.setSelectedInviteIds(trimmedOverviewForm.getSelectedInviteIds());
        selectionForm.setAllSelected(trimmedOverviewForm.getAllSelected());
        selectionForm.setSelectedStatus(filterForm.getStatus().orElse(null));
        selectionForm.setCompliant(filterForm.getCompliant().orElse(null));
        selectionForm.setAssessorName(filterForm.getAssessorName().orElse(null));

        saveFormToCookie(response, competitionId, selectionForm);
    }

    private void updateFilterForm(OverviewAssessorsFilterForm filterForm, OverviewSelectionForm storedSelectionForm) {
        filterForm.setStatus(storedSelectionForm.getSelectedStatus() == null ? empty() :
                of(storedSelectionForm.getSelectedStatus()));

        filterForm.setCompliant(storedSelectionForm.getCompliant() == null ? empty() :
                of(storedSelectionForm.getCompliant()));

        filterForm.setAssessorName(storedSelectionForm.getAssessorName() == null ? empty() :
                of(storedSelectionForm.getAssessorName()));
    }

    private OverviewSelectionForm trimSelectionByFilteredResult(OverviewSelectionForm selectionForm,
                                                                Optional<ParticipantStatusResource> status,
                                                                Optional<Boolean> compliant,
                                                                Optional<String> assessorName,
                                                                Long competitionId) {
        List<Long> filteredResults = getAllInviteIds(competitionId, status, compliant, assessorName);
        OverviewSelectionForm updatedSelectionForm = new OverviewSelectionForm();

        selectionForm.getSelectedInviteIds().retainAll(filteredResults);
        updatedSelectionForm.setSelectedInviteIds(selectionForm.getSelectedInviteIds());

        if (updatedSelectionForm.getSelectedInviteIds().equals(filteredResults)  && !updatedSelectionForm.getSelectedInviteIds().isEmpty()) {
            updatedSelectionForm.setAllSelected(true);
        } else {
            updatedSelectionForm.setAllSelected(false);
        }

        return updatedSelectionForm;
    }

    @PostMapping(value = "/pending-and-declined", params = {"selectionId"})
    public @ResponseBody JsonNode selectAssessorForResendList(
            @PathVariable("competitionId") long competitionId,
            @RequestParam("selectionId") long assessorId,
            @RequestParam("isSelected") boolean isSelected,
            @RequestParam Optional<ParticipantStatusResource> status,
            @RequestParam Optional<Boolean> compliant,
            @RequestParam Optional<String> assessorName,
            HttpServletRequest request,
            HttpServletResponse response) {

        boolean limitExceeded = false;
        try {
            List<Long> InviteIds = getAllInviteIds(competitionId, status, compliant, assessorName);
            OverviewSelectionForm selectionForm = getSelectionFormFromCookie(request, competitionId).orElse(new OverviewSelectionForm());
            if (isSelected) {
                int predictedSize = selectionForm.getSelectedInviteIds().size() + 1;
                if(limitIsExceeded(predictedSize)){
                    limitExceeded = true;
                } else {
                    selectionForm.getSelectedInviteIds().add(assessorId);
                    if (selectionForm.getSelectedInviteIds().containsAll(InviteIds)) {
                        selectionForm.setAllSelected(true);
                    }
                }
            } else {
                selectionForm.getSelectedInviteIds().remove(assessorId);
                selectionForm.setAllSelected(false);
            }
            saveFormToCookie(response, competitionId, selectionForm);
            return createJsonObjectNode(selectionForm.getSelectedInviteIds().size(), selectionForm.getAllSelected(), limitExceeded);
        } catch (Exception e) {
            log.error("exception thrown selecting assessor for resend list", e);
            return createFailureResponse();
        }
    }

    @PostMapping(value = "/pending-and-declined", params = {"addAll"})
    public @ResponseBody JsonNode addAllAssessorsToResendList(Model model,
                                                              @PathVariable("competitionId") long competitionId,
                                                              @RequestParam("addAll") boolean addAll,
                                                              @RequestParam(defaultValue = "0") int page,
                                                              @RequestParam Optional<ParticipantStatusResource> status,
                                                              @RequestParam Optional<Boolean> compliant,
                                                              @RequestParam Optional<String> assessorName,
                                                              HttpServletRequest request,
                                                              HttpServletResponse response) {
        try {
            OverviewSelectionForm selectionForm = getSelectionFormFromCookie(request, competitionId).orElse(new OverviewSelectionForm());

            if (addAll) {
                selectionForm.setSelectedInviteIds(getAllInviteIds(competitionId, status, compliant, assessorName));
                selectionForm.setAllSelected(true);
            } else {
                selectionForm.getSelectedInviteIds().clear();
                selectionForm.setAllSelected(false);
            }

            saveFormToCookie(response, competitionId, selectionForm);

            return createSuccessfulResponseWithSelectionStatus(selectionForm.getSelectedInviteIds().size(), selectionForm.getAllSelected(), false);
        } catch (Exception e) {
            log.error("exception thrown adding assessors to resend list", e);

            return createFailureResponse();
        }
    }

    private List<Long> getAllInviteIds(long competitionId,
                                       Optional<ParticipantStatusResource> status,
                                       Optional<Boolean> compliant,
                                       Optional<String> assessorName) {
        List<ParticipantStatusResource> statuses = status.map(Collections::singletonList)
                .orElseGet(() -> asList(REJECTED, PENDING));
        return competitionInviteRestService.getAssessorsNotAcceptedInviteIds(competitionId, statuses, compliant, assessorName).getSuccess();
    }
}


text:
/**********
 *
 *
 *  mex interface to compute locally scaled distance matrix
 *
 *  To mexify:
 *             mex  scale_dist.cpp;
 *
 *
 *  [D_LS,A_LS,LS] = scale_dist(D,n);
 *
 *  Input:
 *    D = distance matrix
 *    n = the distance to the n'th neighbor is taken as the local scale
 *
 *  Output:
 *    D_LS = scaled distance matrix
 *    A_LS = scaled affinity matrix
 *    LS = the local scales
 *
 *
 *  Lihi Zelnik (Caltech) Feb.2005
 *
 *
 ************/

#include "mex.h"
#include "matrix.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

/* ////////////// macros to address input  */
#define DISTMATRIX  prhs[0]
#define NEIGHBORIND prhs[1]

#define DEBUG 0    /* set to 1 and mex to see print outs */

/* ////////////// sort array */
typedef double T;
void mysort(T* data, int N)
{
    int     i, j;
    T       v, t;

    if(N<=1) return;

  /* Partition elements  */
    v = data[0];
    i = 0;
    j = N;
    for(;;)
    {
        while(data[++i] < v && i < N) { }
        while(data[--j] > v) { }
        if(i >= j) break;
        t = data[i]; data[i] = data[j]; data[j] = t;
    }
    t = data[i-1]; data[i-1] = data[0]; data[0] = t;
    mysort(data, i-1);
    mysort(data+i, N-i);
}

/*   //////////////// main   */

void
mexFunction (
int nlhs, mxArray* plhs[],
int nrhs, const mxArray* prhs[])
{
  /* Make sure at most two output arguments are expected */
    if (nlhs < 1) {
        mexErrMsgTxt("Too few output arguments.");
        return;
    }
    if (nlhs > 3) {
        mexErrMsgTxt("Too many output arguments.");
        return;
    }
  /* Make sure input number is sufficient */
    if (nrhs < 1) {
        mexErrMsgTxt("Too few input arguments.");
        return;
    }
    if (nrhs > 2) {
        mexErrMsgTxt("Too many input arguments.");
        return;
    }

    if( DEBUG )
        mexPrintf("Just starting\n");

  /* get the neighbor index */
    const int K = (int) mxGetScalar(NEIGHBORIND);

    if( DEBUG )
        mexPrintf("Got the neighbor index %d\n",K);

        /* check matrix dimensions */
    const int *idims =  mxGetDimensions(DISTMATRIX);
    if(idims[0] != idims[1])
        mexErrMsgTxt("Distance matrix must be square");
    const int node_num = idims[0];

    if(mxIsSparse(DISTMATRIX)) {   /* Sparse matrix handling */

        if( DEBUG )
            mexPrintf("Detected the matrix is sparse with %d nodes\n",node_num);

    /* Pointers to non zero rows, cols and values */
        int *distmat_rows = mxGetIr(DISTMATRIX);
        int *distmat_cols = mxGetJc(DISTMATRIX);
        double *distmat_values = mxGetPr(DISTMATRIX);
        int non_zero = mxGetNzmax(DISTMATRIX);

        if( DEBUG )
            mexPrintf("There are %d non zeros\n",non_zero);

    /***************************
     * find for each node (column) the distance to the K'th neighbor
     * where K = neighbor_index
     */

        int i,j;
        double *values,*neighbor_dist;
        neighbor_dist = (double*)mxCalloc(node_num,sizeof(double));

        int starting_row_index, stopping_row_index, current_index;
        int row_num,col_total, is_main_d_set;
        for (j=0; j<node_num; j++)  {   /* loop over all columns */
            /* For each column fill in all the nonzero in the values array */
            starting_row_index = distmat_cols[j];
            stopping_row_index = distmat_cols[j+1];
            if (starting_row_index == stopping_row_index) {
                /* no elements in this column */
                neighbor_dist[j] = 0;
                continue;
            }
            else {
                row_num = stopping_row_index - starting_row_index;
                values = (double*)mxCalloc(row_num,sizeof(double));
                col_total = 0;
                for (current_index = starting_row_index;
                current_index < stopping_row_index;
                current_index++)  {
                    i = distmat_rows[current_index];
                    values[col_total++] = distmat_values[current_index];
                }
                /* Now sort the values array */
                mysort(values, col_total);

                /* Save the distance to K'th neighbor */
                if( col_total < K ){
                    neighbor_dist[j] = values[col_total-1];
                }
                else{
                    neighbor_dist[j] = values[K-1];
                }

                mxFree(values);
            }
        }
        if( DEBUG )
            mexPrintf("Processesed all columns safely, current_index=%d\n",current_index);

        /************* Now, scale the distance and copy to output */
        /* prepare output arrays */
        double *scales,*scaled_dist,*affinity;

        plhs[0] = mxDuplicateArray(prhs[0]);
        scaled_dist = mxGetPr(plhs[0]);

        if (nlhs > 1) {
            plhs[1] = mxDuplicateArray(prhs[0]);
            affinity = mxGetPr(plhs[1]);
        }
        if (nlhs > 2) {
            plhs[2] = mxDuplicateArray(prhs[0]);
            scales = mxGetPr(plhs[2]);
        }

        /* Go over the distance matrix and scale it */
        double s;
        for (j=0; j<node_num; j++)  {   /* loop over all columns */
            starting_row_index = distmat_cols[j];
            stopping_row_index = distmat_cols[j+1];
            if (starting_row_index == stopping_row_index) {
                continue;
            }
            else {  /* loop over all rows for current column */
                for (current_index = starting_row_index;
                current_index < stopping_row_index;
                current_index++)  {
                    i = distmat_rows[current_index];
                    s = sqrt(neighbor_dist[i] * neighbor_dist[j]);
                    if( s < 0.004 )
                        s = 0.004;
                    scaled_dist[current_index] = distmat_values[current_index] / s;
                    if( nlhs > 1 )
                        affinity[current_index] = exp(-scaled_dist[current_index]);
                    if( nlhs > 2 )
                        scales[current_index] = s;
                }
            }
        }
        mxFree(neighbor_dist);
        if( DEBUG )
            mexPrintf("All columns scaled safely, current_index=%d\n",current_index);

    }
    /*******************   FULL MATRICES ******************************/
    else { /* Full matrix handling  */

        if( DEBUG )
            mexPrintf("Detected the matrix is full with %d nodes\n",node_num);

        /* Pointers to values */
        double *distmat_values = mxGetPr(DISTMATRIX);

        /***************************
         * find for each node (column) the distance to the K'th neighbor
         * where K = neighbor_index
         */
        int i,j;
        double *values,*neighbor_dist;
        neighbor_dist = (double*)mxCalloc(node_num,sizeof(double));
        values = (double*)mxCalloc(node_num,sizeof(double));

        int total = 0;
        for (j=0; j<node_num; j++)  {   /* loop over all columns */
            for (i=0; i<node_num; i++ ){
                values[i] = distmat_values[total++];
            }
            /* Now sort the values array */
            mysort(values, node_num);

            /* Save the distance to K'th neighbor */
            /* This is K and not K-1 since the distance to itself is also set */
            neighbor_dist[j] = values[K];
        }
        mxFree(values);
        if( DEBUG )
            mexPrintf("Processesed all columns safely, total=%d\n",total);

        /************* Now, scale the distance and copy to output */

        /* prepare output arrays */
        double *scales,*scaled_dist,*affinity;

        plhs[0] = mxDuplicateArray(prhs[0]);
        scaled_dist = mxGetPr(plhs[0]);

        if (nlhs > 1) {
            plhs[1] = mxDuplicateArray(prhs[0]);
            affinity = mxGetPr(plhs[1]);
        }
        if (nlhs > 2) {
            plhs[2] = mxDuplicateArray(prhs[0]);
            scales = mxGetPr(plhs[2]);
        }

        /* prepare value arrays */
        /* Go over the distance matrix and scale it */
        total = 0;
        double s;
        for (j=0; j<node_num; j++)  {   /* loop over all columns */
            for (i=0; i<node_num; i++ ){
                s = sqrt(neighbor_dist[i] * neighbor_dist[j]);
                if( s < 0.004 )
                    s = 0.004;
                scaled_dist[total] = distmat_values[total] / s;
                if( nlhs > 1 )
                    affinity[total] = exp(-scaled_dist[total]);
                if( nlhs > 2 )
                    scales[total] = s;
                total++;
            }
        }
        mxFree(neighbor_dist);
        if( DEBUG )
            mexPrintf("All columns scaled safely, total=%d\n",total);
    }

    return;
}


text:
    <navigation-column></navigation-column>

        <md-content class='md-padding' flex>
            Make sure you have the appropriate permissions to access this page.
        </md-content>

        <toolbar-row></toolbar-row>
        <md-tabs md-selected="vm.selectedIndex" md-dynamic-height md-border-bottom>
            <md-tab label='With roles'>
                <md-content>

                        <all-people-presentation flex></all-people-presentation>

                        <all-people-inactive-presentation flex></all-people-inactive-presentation>

                </md-content>
            </md-tab>
            <md-tab label='Without roles'>
                <md-content>
                    <all-people-no-roles-presentation flex></all-people-no-roles-presentation>
                </md-content>
            </md-tab>
            <md-tab ng-repeat="(num,person) in vm.thisPerson" label='{{person.name}}'>
                <md-tabs md-selected="vm.selectedIndexProductivity[num]" md-dynamic-height md-border-bottom>
                    <md-tab label='Info'>
                        <md-content>

                                    <manager-authorization></manager-authorization>
                                    <manager-person-left></manager-person-left>
                                    <manager-fct-mctes></manager-fct-mctes>
                                    <manager-password-reset></manager-password-reset>
                                    <manager-user-permissions></manager-user-permissions>
                                    <manager-person-nuclear-info></manager-person-nuclear-info>
                                    <manager-person-contact-info></manager-person-contact-info>
                                    <manager-person-identifications-info></manager-person-identifications-info>
                                    <manager-person-cars-info></manager-person-cars-info>
                                    <manager-person-emergency-contacts-info></manager-person-emergency-contacts-info>
                                    <manager-person-finished-degrees></manager-person-finished-degrees>
                                    <manager-person-ongoing-degrees></manager-person-ongoing-degrees>

                                    <manager-person-photo></manager-person-photo>
                                    <manager-person-pole></manager-person-pole>
                                    <manager-person-institutional-contacts-info></manager-person-institutional-contacts-info>
                                    <manager-person-urls></manager-person-urls>
                                    <manager-person-department></manager-person-department>
                                    <manager-person-professional></manager-person-professional>
                                    <manager-person-responsibles></manager-person-responsibles>
                                    <manager-person-current-roles></manager-person-current-roles>
                                    <manager-person-cost-center ng-if="vm.isPorto(num)"></manager-person-cost-center>
                                    <manager-person-author-names></manager-person-author-names>

                        </md-content>
                    </md-tab>
                    <md-tab label='Publications'>

                            <md-content>

                                    <manager-person-publications-large
                                        ng-if="vm.showTable()"
                                        data-person="{{person.id}}"
                                        data-name="{{person.colloquial_name}}"
                                        flex>
                                    </manager-person-publications-large>
                                    <manager-person-publications-small
                                        ng-if="!vm.showTable()"
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-person-publications-small>
                                    <manager-add-person-publications-large
                                        ng-if="vm.showTable()"
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-add-person-publications-large>
                                    <manager-add-person-publications-small
                                        ng-if="!vm.showTable()"
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-add-person-publications-small>

                                    <manager-add-person-publications-pure-large ng-if="vm.showTable()"
                                        data-person="{{person.id}}"
                                        data-pureres="{{person.researcher_data[0].pure_id}}"
                                        data-puretech="{{person.technician_data[0].pure_id}}"
                                        data-purescman="{{person.science_manager_data[0].pure_id}}" flex>
                                    </manager-add-person-publications-pure-large>
                                    <manager-add-person-publications-pure-small ng-if="!vm.showTable()"
                                        data-person="{{person.id}}"
                                        data-pureres="{{person.researcher_data[0].pure_id}}"
                                        data-puretech="{{person.technician_data[0].pure_id}}"
                                        data-purescman="{{person.science_manager_data[0].pure_id}}" flex>
                                    </manager-add-person-publications-pure-small>

                                    <manager-add-person-publications-orcid-large
                                        ng-if="vm.showTable()"
                                        data-person="{{person.id}}"
                                        data-orcidres="{{person.researcher_data[0].ORCID}}"
                                        data-orcidtech="{{person.technician_data[0].ORCID}}"
                                        data-orcidscman="{{person.science_manager_data[0].ORCID}}"
                                        flex>
                                    </manager-add-person-publications-orcid-large>
                                    <manager-add-person-publications-orcid-small
                                        ng-if="!vm.showTable()"
                                        data-person="{{person.id}}"
                                        data-orcidres="{{person.researcher_data[0].ORCID}}"
                                        data-orcidtech="{{person.technician_data[0].ORCID}}"
                                        data-orcidscman="{{person.science_manager_data[0].ORCID}}"
                                        flex>
                                    </manager-add-person-publications-orcid-small>

                            </md-content>

                    </md-tab>
                    <md-tab label='Communications'>

                            <md-content flex>

                                    <manager-person-communications-large
                                        ng-if="vm.showTable()"
                                        data-person="{{person.id}}"
                                        data-name="{{person.colloquial_name}}"
                                        flex>
                                    </manager-person-communications-large>
                                    <manager-person-communications-small
                                        ng-if="!vm.showTable()"
                                        data-person="{{person.id}}"
                                        data-name="{{person.colloquial_name}}"
                                        flex>
                                    </manager-person-communications-small>
                                    <manager-add-person-communications-large
                                        ng-if="vm.showTable()"
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-add-person-communications-large>
                                    <manager-add-person-communications-small
                                        ng-if="!vm.showTable()"
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-add-person-communications-small>
                                    <manager-add-person-communications-orcid-large
                                        ng-if="vm.showTable()"
                                        data-person="{{person.id}}"
                                        data-orcidres="{{person.researcher_data[0].ORCID}}"
                                        data-orcidtech="{{person.technician_data[0].ORCID}}"
                                        data-orcidscman="{{person.science_manager_data[0].ORCID}}"
                                        flex>
                                    </manager-add-person-communications-orcid-large>
                                    <manager-add-person-communications-orcid-small
                                        ng-if="!vm.showTable()"
                                        data-person="{{person.id}}"
                                        data-orcidres="{{person.researcher_data[0].ORCID}}"
                                        data-orcidtech="{{person.technician_data[0].ORCID}}"
                                        data-orcidscman="{{person.science_manager_data[0].ORCID}}"
                                        flex>
                                    </manager-add-person-communications-orcid-small>

                            </md-content>

                    </md-tab>
                    <md-tab label='Funding'>

                            <md-content flex>

                                    <manager-person-projects-large
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-person-projects-large>
                                    <manager-person-agreements-large
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-person-agreements-large>
                                    <manager-person-trainings-large
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-person-trainings-large>

                            </md-content>

                    </md-tab>
                    <md-tab label='Patents'>

                            <md-content flex>

                                    <manager-person-patents-large
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-person-patents-large>

                            </md-content>

                    </md-tab>
                    <md-tab label='Datasets'>

                            <md-content flex>

                                    <manager-person-datasets-large
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-person-datasets-large>

                            </md-content>

                    </md-tab>
                    <md-tab label='Startups'>

                            <md-content flex>

                                    <manager-person-startups-large
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-person-startups-large>

                            </md-content>

                    </md-tab>
                    <md-tab label='Prizes'>

                            <md-content flex>

                                    <manager-person-prizes-large
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-person-prizes-large>

                            </md-content>

                    </md-tab>
                    <md-tab label='Boards'>

                            <md-content flex>

                                    <manager-person-boards-large
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-person-boards-large>

                            </md-content>

                    </md-tab>
                    <md-tab label='Outreach'>

                            <md-content flex>

                                    <manager-person-outreach-large
                                        data-person="{{person.id}}"
                                        flex>
                                    </manager-person-outreach-large>

                            </md-content>

                    </md-tab>
                </md-tabs>
            </md-tab>
            <md-tab label='To Validate'>
                <md-tabs md-selected="vm.selectedIndexValidate" md-dynamic-height md-border-bottom>
                    <md-tab label='List'>
                        <md-content>

                                <list-people-validate flex></list-people-validate>

                        </md-content>
                    </md-tab>
                    <md-tab ng-repeat="(num,name) in vm.nameDetailsValidate" label='{{name}}'>
                        <md-content>

                                    <validate-person></validate-person>
                                    <validate-fct-mctes></validate-fct-mctes>
                                    <validate-user-permissions></validate-user-permissions>
                                    <validate-person-photo></validate-person-photo>
                                    <validate-person-nuclear-info></validate-person-nuclear-info>
                                    <validate-person-pole></validate-person-pole>
                                    <validate-person-contact-info></validate-person-contact-info>
                                    <validate-person-identifications-info></validate-person-identifications-info>
                                    <validate-person-cars-info></validate-person-cars-info>

                                    <validate-person-institutional-contacts-info></validate-person-institutional-contacts-info>
                                    <validate-person-department></validate-person-department>
                                    <validate-person-professional></validate-person-professional>
                                    <validate-person-responsibles></validate-person-responsibles>
                                    <validate-person-current-roles></validate-person-current-roles>

                        </md-content>
                    </md-tab>
                </md-tabs>
            </md-tab>
        </md-tabs>