<commit_before>@using System.Threading.Tasks
@using CompetitionPlatform.Helpers
@using CompetitionPlatform.Models.ProjectViewModels
@model ProjectViewModel

@{
    ViewData["Title"] = Model.Name;
}

@{
    var createdDays = (DateTime.UtcNow - Model.Created).Days;
    var modifiedDays = (DateTime.UtcNow - Model.LastModified).Days;
    var createdDaysAgo = "";
    var modifiedDaysAgo = "";
    var projectUrl = Context.Request.Host + Context.Request.Path;
    var facebookSharingUrl = "https://www.facebook.com/sharer/sharer.php?u=" + projectUrl;
    var twitterSharingUrl = "https://twitter.com/share?url=http://" + projectUrl;
    var linkedinSharingUrl = "https://www.linkedin.com/cws/share?url=" + projectUrl;

    var facebookImgSharingUrl = "http://www.facebook.com/sharer.php?s=100&amp;p[title]=" + @Model.Name + "&amp;p[summary]=" + Model.Overview + "&amp;p[url]=" + projectUrl + "&amp;p[images][0]=~/images/lykkeshare.png";

    var fileExtension = "";
    if (Model.FileInfo != null)
    {
        fileExtension = Model.FileInfo.FileName.Split('.').Last();
    }

    if (createdDays == 0 || createdDays == 1)
    {
        createdDaysAgo = (createdDays == 0) ? "today" : "yesterday";
    }
    else
    {
        createdDaysAgo = " " + createdDays + " days ago";
    }

    if (modifiedDays == 0 || modifiedDays == 1)
    {
        modifiedDaysAgo = (modifiedDays == 0) ? "today" : "yesterday";
    }
    else
    {
        modifiedDaysAgo = " " + modifiedDays + " days ago";
    }

    var participantsCount = (!Model.ParticipantsPartial.Participants.Any()) ? "" : Model.ParticipantsPartial.Participants.Count().ToString();
    var commentsCount = (!Model.CommentsPartial.Comments.Any()) ? "" : Model.CommentsPartial.Comments.Count().ToString();
    var resultsCount = (!Model.ResultsPartial.Results.Any()) ? "" : Model.ResultsPartial.Results.Count().ToString();
    var winnersCount = "";
    if (Model.ResultsPartial.Winners != null && Model.ResultsPartial.Winners.Any())
    {
        winnersCount = Model.ResultsPartial.Winners.Count().ToString();
    }

    var infoTabActive = "";
    var commentsTabActive = "";
    var participantsTabActive = "";
    var resultsTabActive = "";
    var winnersTabActive = "";

    if (ViewBag.CommentsActive == true)
    {
        commentsTabActive = "active";
    }
    else if (ViewBag.ParticipantsActive == true)
    {
        participantsTabActive = "active";
    }
    else if (ViewBag.WinnersActive == true)
    {
        winnersTabActive = "active";
    }
    else if (ViewBag.ResultsActive == true)
    {
        resultsTabActive = "active";
    }
    else
    {
        infoTabActive = "active";
    }

    var checkCompetition = "";
    var checkSubmission = "";
    var checkVoting = "";

    var textCompetition = "";
    var textSubmission = "";
    var textVoting = "";

    var registrationCurrent = "";
    var submissionCurrent = "";
    var votingCurrent = "";
    var showDaysOfProject = false;
    var daysOfProject = Model.ResultsPartial.DaysOfContest == 1 ? "1 day" : Model.ResultsPartial.DaysOfContest + " days";

    switch (Model.Status)
    {
        case Status.Initiative:
            checkCompetition = "check--inprogress";
            checkSubmission = "check--inprogress";
            checkVoting = "check--inprogress";
            break;
        case Status.Registration:
            checkCompetition = "check--blue";
            checkSubmission = "check--inprogress";
            checkVoting = "check--inprogress";
            textCompetition = "text--blue";
            registrationCurrent = "_current";
            break;
        case Status.Submission:
            checkCompetition = "check--blue";
            checkSubmission = "check--green";
            checkVoting = "check--inprogress";
            textSubmission = "text--green";
            submissionCurrent = "_current";
            break;
        case Status.Voting:
            checkCompetition = "check--blue";
            checkSubmission = "check--green";
            checkVoting = "check--yellow";
            textVoting = "text--yellow";
            votingCurrent = "_current";
            break;
        case Status.Archive:
            checkCompetition = "check--blue";
            checkSubmission = "check--green";
            checkVoting = "check--yellow";
            showDaysOfProject = true;
            break;
    }

    var streamsProjectCount = 0;
    StreamProject currentProjectInStream = null;
    var previousProjectExists = false;
    StreamProject previousProject = null;
    var nextProjectExists = false;
    StreamProject nextProject = null;

    if (Model.StreamId != null)
    {
        streamsProjectCount = Model.StreamProjects.Max(x => x.Place);
        currentProjectInStream = Model.StreamProjects.FirstOrDefault(p => p.ProjectId == Model.Id);

        previousProjectExists = currentProjectInStream.Place - 2 >= 0;
        if (previousProjectExists)
        {
            previousProject = Model.StreamProjects[currentProjectInStream.Place - 2];
        }


        nextProjectExists = currentProjectInStream.Place < streamsProjectCount;
        if (nextProjectExists)
        {
            nextProject = Model.StreamProjects[currentProjectInStream.Place];
        }

    }
}

<section class="section section--lead section--padding">
    <div class="container container--extend">
        @if (Model.StreamId != null)
        {
            <div class="stream_header">
                <div class="stream_nav">
                    <div class="stream_nav__text">
                        Stream: <span>Stage @currentProjectInStream.Place/@streamsProjectCount</span>
                    </div>

                    <div class="stream_nav__index">
                        @foreach (var streamProj in Model.StreamProjects)
                        {
                            var active = "";
                            if (streamProj.ProjectId == Model.Id)
                            {
                                active = "stream_nav__dash--active";
                            }
                            <a asp-controller="Project" asp-action="ProjectDetails" asp-route-id="@streamProj.ProjectId" class="stream_nav__dash @active"></a>
                        }
                    </div>
                </div>

                @if (nextProjectExists)
                {
                    <a asp-controller="Project" asp-action="ProjectDetails" asp-route-id="@nextProject.ProjectId" class="next_stage">
                        <span class="hidden-xs hidden-sm">@nextProject.ProjectName</span>
                    </a>
                }

                @if (previousProjectExists)
                {
                    <a asp-controller="Project" asp-action="ProjectDetails" asp-route-id="@previousProject.ProjectId" class="prev_stage">
                        <span class="hidden-xs hidden-sm">@previousProject.ProjectName</span>
                    </a>
                }
            </div>
        }
        <div class="page__header">
            <div class="row">
                <div class="col-sm-8 automargin text-center">
                    <h2>@Model.Name</h2>
                    <h3 class="page__subtitle">@Model.Category</h3>
                </div>
            </div>
            @if (Model.CommentsPartial.IsAuthor || Model.IsAdmin)
            {
                <a asp-area="" asp-controller="Project" asp-action="Edit" asp-route-id="@Model.Id"><button class="btn btn-sm btn_edit">Edit</button></a>
            }
        </div>

        <div class="project_links">
            <div class="row">
                <div class="col-xs-5 col-sm-6 col-md-7 project_links__share">
                    <div class="card__actions">
                        <span class="action_text visible-xs-inline-block visible-sm-inline-block">Share:</span>
                        <a href="@twitterSharingUrl" class="action_link"><i class="icon icon--tw"></i> <span class="hidden-xs hidden-sm">Tweet</span></a>
                        <a href="@facebookSharingUrl" class="action_link"><i class="icon icon--fb_simple"></i> <span class="hidden-xs hidden-sm">Share</span></a>
                        <a href="@linkedinSharingUrl" class="action_link"><i class="icon icon--linkedin-icn"></i> <span class="hidden-xs hidden-sm">Share</span></a>
                        <button type="button" class="action_link _copy_link" aria-label="Copied!" data-clipboard-text="@projectUrl"><i class="icon icon--link"></i> <span class="hidden-xs hidden-sm">Copy link</span></button>
                    </div>
                </div>
                <div class="col-xs-7 col-sm-6 col-md-5 project_links__actions">
                    <div class="card__actions text-right">
                        @if (!Model.IsFollowing)
                        {
                            <a asp-area="" asp-controller="ProjectDetails" asp-action="FollowProject" asp-route-id="@Model.Id" id="followButton" class="action_link action_follow">
                                <i class="icon icon--follow"></i>Follow
                            </a>
                        }
                        else
                        {
                            <a asp-area="" asp-controller="ProjectDetails" asp-action="UnFollowProject" asp-route-id="@Model.Id" id="followButton" class="action_link action_follow active">
                                <i class="icon icon--follow"></i>Unfollow
                            </a>
                        }
                    </div>
                </div>
            </div>
        </div>
        <div class="row">

            @if (!string.IsNullOrEmpty(Model.PrizeDescription))
            {
                <div class="col-xs-12 col-sm-8 content__left">
                    <p>
                        @Html.Raw(Model.PrizeDescription)
                    </p>
                </div>
            }

            <div class="col-xs-12 col-sm-8 content__left">
                @if (Model.BudgetFirstPlace != 0)
                {
                    <div class="row prize_row">
                        <div class="col-xs-3">
                            <div class="prize">
                                <div class="prize__value">$@Model.BudgetFirstPlace</div>
                                <div class="prize__title">
                                    1<sup>st</sup>Prize
                                </div>
                            </div>
                        </div>
                        @if (Model.BudgetSecondPlace != null)
                        {
                            <div class="col-xs-3 hidden-xxs">
                                <div class="prize">
                                    <div class="prize__value">$@Model.BudgetSecondPlace</div>
                                    <div class="prize__title">
                                        2<sup>nd</sup>Prize
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-3 hidden-xxs">
                                <div class="prize">
                                    <div class="prize__value">$@Model.BudgetSecondPlace</div>
                                    <div class="prize__title">
                                        2<sup>nd</sup>Prize
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-3 hidden-xxs">
                                <div class="prize">
                                    <div class="prize__value">$@Model.BudgetSecondPlace</div>
                                    <div class="prize__title">
                                        2<sup>nd</sup>Prize
                                    </div>
                                </div>
                            </div>
                            <div class="col-xs-3 visible-xxs">
                                <div class="prize">
                                    <div class="prize__value">$@Model.BudgetSecondPlace</div>
                                    <div class="prize__title">
                                        2<sup>nd</sup>Prize
                                    </div>
                                </div>
                            </div>
                        }
                    </div>
                }

                @await Html.PartialAsync("ProjectDetailsStatusBarPartial", Model.StatusBarPartial)

            </div>

            <div class="col-xs-12 col-sm-4 content__right pull-right">
                <div class="row">
                    <div class="col-xs-6 col-sm-12">
                        @if (Model.ProjectExperts == null)
            {
                            <div class="user_badge">
                                <a href="/userprofile/@Model.AuthorIdentifier" class="user_badge__img">
                                    <img src="~/images/avatar.svg" alt="">
                                </a>
                                <div class="user_badge__info">
                                    <a href="/userprofile/@Model.AuthorIdentifier" class="user_badge__title">@Model.AuthorFullName</a>
                                    <div class="user_badge__desc">Creator</div>
                                </div>
                            </div>
                        }

                        @await Html.PartialAsync("ProjectDetailsStatusPartial", new ProjectDetailsStatusViewModel
                   {
                       ProjectId = Model.Id,
                       Status = Model.Status,
                       VotesFor = Model.VotesFor,
                       VotesAgainst = Model.VotesAgainst,
                       CompetitionRegistrationDeadline = Model.CompetitionRegistrationDeadline,
                       ImplementationDeadline = Model.ImplementationDeadline,
                       VotingDeadline = Model.VotingDeadline,
                       IsParticipant = Model.IsParticipant,
                       HasResult = Model.ParticipantsPartial.HasResult
                   })
                    </div>
                    <div class="col-xs-6 col-sm-12">

                        <ul class="list list--info">
                            @if (showDaysOfProject)
                            {
                                <li class="list__item">
                                    <div class="list__content">
                                        <div class="title @textCompetition">Days of the project</div>
                                        <p>@Model.Created.ToString("MMM d") - @Model.VotingDeadline.ToString("MMM d") (@daysOfProject)</p>
                                    </div>
                                </li>
                            }
                            @if (!Model.SkipRegistration)
                            {
                                <li class="list__item @registrationCurrent">
                                    <div class="list__icon">
                                        <span class="check @checkCompetition"></span>
                                    </div>
                                    <div class="list__content">
                                        <div class="title @textCompetition">Registration</div>
                                        @*<p>@Model.Created.ToString("MMM d") - @Model.CompetitionRegistrationDeadline.ToString("MMM d")</p>*@
                                        <p>@Model.Created.ToString("MMM d") - @Model.ImplementationDeadline.ToString("MMM d")</p>
                                    </div>
                                </li>
                            }
                            <li class="list__item @submissionCurrent">
                                <div class="list__icon">
                                    <span class="check @checkSubmission"></span>
                                </div>
                                <div class="list__content">
                                    <div class="title @textSubmission">Submissions</div>
                                    <p>@Model.CompetitionRegistrationDeadline.ToString("MMM d") - @Model.ImplementationDeadline.ToString("MMM d")</p>
                                </div>
                            </li>
                            @if (!Model.SkipVoting)
                            {
                                <li class="list__item @votingCurrent">
                                    <div class="list__icon">
                                        <span class="check @checkVoting"></span>
                                    </div>
                                    <div class="list__content">
                                        <div class="title @textVoting">Voting</div>
                                        <p>@Model.ImplementationDeadline.ToString("MMM d") - @Model.VotingDeadline.ToString("MMM d")</p>
                                    </div>
                                </li>
                            }
                        </ul>

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

            <div class="col-xs-12 col-sm-8 content__left">

                <ul class="nav nav-tabs" role="tablist" id="projectDetailsTabs">
                    <li role="presentation" class="@infoTabActive"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">Info</a></li>
                    <li role="presentation" class="@participantsTabActive">
                        <a href="#Participants" aria-controls="participants" role="tab" data-toggle="tab">
                            Participants
                            @if (!string.IsNullOrEmpty(participantsCount))
                            {
                                <sup>
                                    @participantsCount
                                </sup>
                            }
                        </a>
                    </li>
                    <li role="presentation" class="@commentsTabActive">
                        <a href="#Comments" aria-controls="comments" role="tab" data-toggle="tab">
                            Comments
                            @if (!string.IsNullOrEmpty(commentsCount))
                            {
                                <sup>
                                    @commentsCount
                                </sup>
                            }
                        </a>
                    </li>
                    <li role="presentation" class="@resultsTabActive">
                        <a href="#Results" aria-controls="results" role="tab" data-toggle="tab">
                            Results
                            @if (!string.IsNullOrEmpty(resultsCount))
                            {
                                <sup>
                                    @resultsCount
                                </sup>
                            }
                        </a>
                    </li>
                    <li role="presentation" class="@winnersTabActive">
                        <a href="#Winners" aria-controls="results" role="tab" data-toggle="tab">
                            Winners
                            @if (!string.IsNullOrEmpty(winnersCount))
                            {
                                <sup>
                                    @winnersCount
                                </sup>
                            }
                        </a>
                    </li>
                </ul>

                <div class="tab-content">
                    <div role="tabpanel" class="tab-pane @infoTabActive" id="info">
                        <div class="text">
                            @Html.Raw(Model.Description)
                        </div>
                        @if (Model.FileInfo != null)
            {
                var extension = fileExtension.Length > 2 ? fileExtension.ToUpper().Substring(0, 3) : fileExtension.ToUpper();

                            <div class="extend_block">
                                <h4>Brief</h4>

                                <div class="asset_link_list">
                                    <div class="asset_link asset_link--alt">
                                        <div class="asset_link__icon">
                                            @switch (fileExtension.ToLower())
                                            {
                                                case "pdf":
                                                    <div class="asset_icon asset_icon--red">PDF</div>
                                                    break;
                                                case "xls":
                                                case "xlsx":
                                                    <div class="asset_icon asset_icon--green">@fileExtension.ToUpper()</div>
                                                    break;
                                                case "jpg":
                                                    <div class="asset_icon asset_icon--yellow">JPG</div>
                                                    break;
                                                case "doc":
                                                case "docx":
                                                    <div class="asset_icon asset_icon--blue">@fileExtension.ToUpper()</div>
                                                    break;
                                                default:
                                                    <div class="asset_icon asset_icon--primary">@extension</div>
                                                    break;
                                            }
                                        </div>
                                        <div class="asset_link__action">
                                            <a class="btn btn--icon _delete_asset" asp-area="" asp-controller="ProjectDetails" asp-action="DownloadProjectFile" asp-route-id="@Model.Id">
                                                <i class="icon icon--download"></i>
                                            </a>
                                        </div>
                                        <div class="asset_link__info">
                                            <div class="asset_link__title overflow-visible">
                                                <a asp-area="" asp-controller="ProjectDetails" asp-action="DownloadProjectFile" asp-route-id="@Model.Id">@Model.FileInfo.FileName</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        }
                        @if (Model.ProjectExperts != null)
            {
                            <div class="extend_block">
                                <h4>Experts</h4>

                                <table class="table table--experts">
                                    @foreach (var expert in Model.ProjectExperts)
                                    {
                                        <tr>
                                            <td>
                                                <div class="user_badge user_badge--small">
                                                    <div class="user_badge__img">
                                                        @if (!string.IsNullOrEmpty(expert.UserIdentifier))
                                                        {
                                                            <a href="/userprofile/@expert.UserIdentifier"><img src="~/images/avatar.svg" alt=""></a>
                                                        }
                                                        else
                                                        {
                                                            <span><img src="~/images/avatar.svg" alt=""></span>
                                                        }

                                                    </div>
                                                    <div class="user_badge__info">
                                                        @if (!string.IsNullOrEmpty(expert.UserIdentifier))
                                                        {
                                                            <a href="/userprofile/@expert.UserIdentifier">@expert.FullName</a>
                                                        }
                                                        else
                                                        {
                                                            <span>@expert.FullName</span>
                                                        }

                                                    </div>
                                                </div>
                                            </td>
                                            <td>
                                                @if (!string.IsNullOrEmpty(expert.UserId) && expert.UserId == Model.AuthorId)
                                                {
                                                    <span class="label label--yellow">AUTHOR</span>
                                                }
                                                <span>@expert.Description</span>
                                            </td>
                                        </tr>
                                    }
                                </table>
                            </div>
                        }
                    </div>
                    <div role="tabpanel" class="tab-pane @participantsTabActive" id="Participants">
                        @await Html.PartialAsync("ParticipantsPartial", Model.ParticipantsPartial)
                    </div>

                    <div role="tabpanel" class="tab-pane @commentsTabActive" id="Comments">
                        @await Html.PartialAsync("CommentsPartial", Model.CommentsPartial)
                    </div>

                    <div role="tabpanel" class="tab-pane @resultsTabActive" id="Results">
                        @await Html.PartialAsync("ResultsPartial", Model.ResultsPartial)
                    </div>

                    <div role="tabpanel" class="tab-pane @winnersTabActive" id="Winners">
                        @await Html.PartialAsync("WinnersPartial", Model.ResultsPartial)
                    </div>
                </div>
            </div>


            <aside class="col-xs-12 col-sm-4 content__right">

                <h5 class="border-bottom">Tags</h5>

                <div class="tags_list">
                    <div class="tag_item">
                        <a href="">@Model.Category</a>
                    </div>
                    @if (Model.TagsList != null)
                    {
                        foreach (var category in Model.TagsList)
                        {
                            <div class="tag_item">
                                <a href="">@category</a>
                            </div>
                        }
                    }
                </div>
                @if (!string.IsNullOrEmpty(Model.ProgrammingResourceName) && !string.IsNullOrEmpty(Model.ProgrammingResourceLink))
                {
                    <h5 class="border-bottom">Programming resources</h5>

                    <ul class="list list--text_previews">
                        <li class="list__item">
                            <a href="@Model.ProgrammingResourceLink">
                                <div class="list__icon">
                                    <i class="icon icon--github"></i>
                                </div>
                                <div class="list__content">
                                    <span class="text-muted">@Model.ProgrammingResourceName</span>
                                </div>
                            </a>
                        </li>
                    </ul>
                }

                <h5 class="border-bottom">Project stream</h5>

                <ul class="list list--text_previews">
                    @foreach (var project in Model.OtherProjects)
                    {
                        <li class="list__item">
                            <a class="other-projects-name" asp-controller="Project" asp-action="ProjectDetails" asp-route-id="@project.Id">
                                <p>
                                    <b>@project.Name</b>
                                </p>
                                <span class="text-muted">$@project.BudgetFirstPlace &middot; @project.Members participants</span>
                            </a>
                        </li>
                    }
                </ul>
            </aside>
        </div>
    </div>
</section>
<img src="~/images/lykkeshare.png" style="display: none;" />
@if (ViewBag.ParticipantAdded != null && ViewBag.ParticipantAdded == true)
{
    <script src="~/js/vendor/jquery-1.11.2.min.js"></script>
    <script src="~/js/vendor/bootstrap.min.js"></script>
    <script>
        $(window).load(function () {
            $('#modal_success').modal('show');
        });
    </script>
}

@if (ViewBag.VotedForResult != null && ViewBag.VotedForResult == true)
{
    <script src="~/js/vendor/jquery-1.11.2.min.js"></script>
    <script src="~/js/vendor/bootstrap.min.js"></script>
    <script>
        $(window).load(function () {
            $('#modal_voted_for_result').modal('show');
        });
    </script>
}

@if (ViewBag.VotedTwice != null && ViewBag.VotedTwice == true)
{
    <script src="~/js/vendor/jquery-1.11.2.min.js"></script>
    <script src="~/js/vendor/bootstrap.min.js"></script>
    <script>
        $(window).load(function () {
            $('#modal_result_vote_removed').modal('show');
        });
    </script>
}<commit_msg>Custom prizes for the Implementation of trading algorithm project.<commit_after>@using System.Threading.Tasks
@using CompetitionPlatform.Helpers
@using CompetitionPlatform.Models.ProjectViewModels
@model ProjectViewModel

@{
    ViewData["Title"] = Model.Name;
}

@{
    var createdDays = (DateTime.UtcNow - Model.Created).Days;
    var modifiedDays = (DateTime.UtcNow - Model.LastModified).Days;
    var createdDaysAgo = "";
    var modifiedDaysAgo = "";
    var projectUrl = Context.Request.Host + Context.Request.Path;
    var facebookSharingUrl = "https://www.facebook.com/sharer/sharer.php?u=" + projectUrl;
    var twitterSharingUrl = "https://twitter.com/share?url=http://" + projectUrl;
    var linkedinSharingUrl = "https://www.linkedin.com/cws/share?url=" + projectUrl;

    var facebookImgSharingUrl = "http://www.facebook.com/sharer.php?s=100&amp;p[title]=" + @Model.Name + "&amp;p[summary]=" + Model.Overview + "&amp;p[url]=" + projectUrl + "&amp;p[images][0]=~/images/lykkeshare.png";

    var fileExtension = "";
    if (Model.FileInfo != null)
    {
        fileExtension = Model.FileInfo.FileName.Split('.').Last();
    }

    if (createdDays == 0 || createdDays == 1)
    {
        createdDaysAgo = (createdDays == 0) ? "today" : "yesterday";
    }
    else
    {
        createdDaysAgo = " " + createdDays + " days ago";
    }

    if (modifiedDays == 0 || modifiedDays == 1)
    {
        modifiedDaysAgo = (modifiedDays == 0) ? "today" : "yesterday";
    }
    else
    {
        modifiedDaysAgo = " " + modifiedDays + " days ago";
    }

    var participantsCount = (!Model.ParticipantsPartial.Participants.Any()) ? "" : Model.ParticipantsPartial.Participants.Count().ToString();
    var commentsCount = (!Model.CommentsPartial.Comments.Any()) ? "" : Model.CommentsPartial.Comments.Count().ToString();
    var resultsCount = (!Model.ResultsPartial.Results.Any()) ? "" : Model.ResultsPartial.Results.Count().ToString();
    var winnersCount = "";
    if (Model.ResultsPartial.Winners != null && Model.ResultsPartial.Winners.Any())
    {
        winnersCount = Model.ResultsPartial.Winners.Count().ToString();
    }

    var infoTabActive = "";
    var commentsTabActive = "";
    var participantsTabActive = "";
    var resultsTabActive = "";
    var winnersTabActive = "";

    if (ViewBag.CommentsActive == true)
    {
        commentsTabActive = "active";
    }
    else if (ViewBag.ParticipantsActive == true)
    {
        participantsTabActive = "active";
    }
    else if (ViewBag.WinnersActive == true)
    {
        winnersTabActive = "active";
    }
    else if (ViewBag.ResultsActive == true)
    {
        resultsTabActive = "active";
    }
    else
    {
        infoTabActive = "active";
    }

    var checkCompetition = "";
    var checkSubmission = "";
    var checkVoting = "";

    var textCompetition = "";
    var textSubmission = "";
    var textVoting = "";

    var registrationCurrent = "";
    var submissionCurrent = "";
    var votingCurrent = "";
    var showDaysOfProject = false;
    var daysOfProject = Model.ResultsPartial.DaysOfContest == 1 ? "1 day" : Model.ResultsPartial.DaysOfContest + " days";

    switch (Model.Status)
    {
        case Status.Initiative:
            checkCompetition = "check--inprogress";
            checkSubmission = "check--inprogress";
            checkVoting = "check--inprogress";
            break;
        case Status.Registration:
            checkCompetition = "check--blue";
            checkSubmission = "check--inprogress";
            checkVoting = "check--inprogress";
            textCompetition = "text--blue";
            registrationCurrent = "_current";
            break;
        case Status.Submission:
            checkCompetition = "check--blue";
            checkSubmission = "check--green";
            checkVoting = "check--inprogress";
            textSubmission = "text--green";
            submissionCurrent = "_current";
            break;
        case Status.Voting:
            checkCompetition = "check--blue";
            checkSubmission = "check--green";
            checkVoting = "check--yellow";
            textVoting = "text--yellow";
            votingCurrent = "_current";
            break;
        case Status.Archive:
            checkCompetition = "check--blue";
            checkSubmission = "check--green";
            checkVoting = "check--yellow";
            showDaysOfProject = true;
            break;
    }

    var streamsProjectCount = 0;
    StreamProject currentProjectInStream = null;
    var previousProjectExists = false;
    StreamProject previousProject = null;
    var nextProjectExists = false;
    StreamProject nextProject = null;

    if (Model.StreamId != null)
    {
        streamsProjectCount = Model.StreamProjects.Max(x => x.Place);
        currentProjectInStream = Model.StreamProjects.FirstOrDefault(p => p.ProjectId == Model.Id);

        previousProjectExists = currentProjectInStream.Place - 2 >= 0;
        if (previousProjectExists)
        {
            previousProject = Model.StreamProjects[currentProjectInStream.Place - 2];
        }


        nextProjectExists = currentProjectInStream.Place < streamsProjectCount;
        if (nextProjectExists)
        {
            nextProject = Model.StreamProjects[currentProjectInStream.Place];
        }

    }
}

<section class="section section--lead section--padding">
    <div class="container container--extend">
        @if (Model.StreamId != null)
        {
            <div class="stream_header">
                <div class="stream_nav">
                    <div class="stream_nav__text">
                        Stream: <span>Stage @currentProjectInStream.Place/@streamsProjectCount</span>
                    </div>

                    <div class="stream_nav__index">
                        @foreach (var streamProj in Model.StreamProjects)
                        {
                            var active = "";
                            if (streamProj.ProjectId == Model.Id)
                            {
                                active = "stream_nav__dash--active";
                            }
                            <a asp-controller="Project" asp-action="ProjectDetails" asp-route-id="@streamProj.ProjectId" class="stream_nav__dash @active"></a>
                        }
                    </div>
                </div>

                @if (nextProjectExists)
                {
                    <a asp-controller="Project" asp-action="ProjectDetails" asp-route-id="@nextProject.ProjectId" class="next_stage">
                        <span class="hidden-xs hidden-sm">@nextProject.ProjectName</span>
                    </a>
                }

                @if (previousProjectExists)
                {
                    <a asp-controller="Project" asp-action="ProjectDetails" asp-route-id="@previousProject.ProjectId" class="prev_stage">
                        <span class="hidden-xs hidden-sm">@previousProject.ProjectName</span>
                    </a>
                }
            </div>
        }
        <div class="page__header">
            <div class="row">
                <div class="col-sm-8 automargin text-center">
                    <h2>@Model.Name</h2>
                    <h3 class="page__subtitle">@Model.Category</h3>
                </div>
            </div>
            @if (Model.CommentsPartial.IsAuthor || Model.IsAdmin)
            {
                <a asp-area="" asp-controller="Project" asp-action="Edit" asp-route-id="@Model.Id"><button class="btn btn-sm btn_edit">Edit</button></a>
            }
        </div>

        <div class="project_links">
            <div class="row">
                <div class="col-xs-5 col-sm-6 col-md-7 project_links__share">
                    <div class="card__actions">
                        <span class="action_text visible-xs-inline-block visible-sm-inline-block">Share:</span>
                        <a href="@twitterSharingUrl" class="action_link"><i class="icon icon--tw"></i> <span class="hidden-xs hidden-sm">Tweet</span></a>
                        <a href="@facebookSharingUrl" class="action_link"><i class="icon icon--fb_simple"></i> <span class="hidden-xs hidden-sm">Share</span></a>
                        <a href="@linkedinSharingUrl" class="action_link"><i class="icon icon--linkedin-icn"></i> <span class="hidden-xs hidden-sm">Share</span></a>
                        <button type="button" class="action_link _copy_link" aria-label="Copied!" data-clipboard-text="@projectUrl"><i class="icon icon--link"></i> <span class="hidden-xs hidden-sm">Copy link</span></button>
                    </div>
                </div>
                <div class="col-xs-7 col-sm-6 col-md-5 project_links__actions">
                    <div class="card__actions text-right">
                        @if (!Model.IsFollowing)
                        {
                            <a asp-area="" asp-controller="ProjectDetails" asp-action="FollowProject" asp-route-id="@Model.Id" id="followButton" class="action_link action_follow">
                                <i class="icon icon--follow"></i>Follow
                            </a>
                        }
                        else
                        {
                            <a asp-area="" asp-controller="ProjectDetails" asp-action="UnFollowProject" asp-route-id="@Model.Id" id="followButton" class="action_link action_follow active">
                                <i class="icon icon--follow"></i>Unfollow
                            </a>
                        }
                    </div>
                </div>
            </div>
        </div>
        <div class="row">

            @if (!string.IsNullOrEmpty(Model.PrizeDescription))
            {
                <div class="col-xs-12 col-sm-8 content__left">
                    <p>
                        @Html.Raw(Model.PrizeDescription)
                    </p>
                </div>
            }

            <div class="col-xs-12 col-sm-8 content__left">
                @if (Model.Id != "implementation-of-market-making-trading-algorithm-across-the-globe")
                {
                    if (Model.BudgetFirstPlace != 0)
                    {
                        <div class="row prize_row">
                            <div class="col-xs-3">
                                <div class="prize">
                                    <div class="prize__value">$@Model.BudgetFirstPlace</div>
                                    <div class="prize__title">
                                        1<sup>st</sup>Prize
                                    </div>
                                </div>
                            </div>
                            @if (Model.BudgetSecondPlace != null)
                    {
                                <div class="col-xs-3 hidden-xxs">
                                    <div class="prize">
                                        <div class="prize__value">$@Model.BudgetSecondPlace</div>
                                        <div class="prize__title">
                                            2<sup>nd</sup>Prize
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xs-3 hidden-xxs">
                                    <div class="prize">
                                        <div class="prize__value">$@Model.BudgetSecondPlace</div>
                                        <div class="prize__title">
                                            2<sup>nd</sup>Prize
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xs-3 hidden-xxs">
                                    <div class="prize">
                                        <div class="prize__value">$@Model.BudgetSecondPlace</div>
                                        <div class="prize__title">
                                            2<sup>nd</sup>Prize
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xs-3 visible-xxs">
                                    <div class="prize">
                                        <div class="prize__value">$@Model.BudgetSecondPlace</div>
                                        <div class="prize__title">
                                            2<sup>nd</sup>Prize
                                        </div>
                                    </div>
                                </div>
                            }
                        </div>
                    }
                }
                else
                {
                    <div class="row prize_row">
                        <div class="col-xs-3">
                            <div class="prize">
                                <div class="prize__value">$@Model.BudgetFirstPlace</div>
                                <div class="prize__title">
                                    1<sup>st</sup>Prize
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-3 hidden-xxs">
                            <div class="prize">
                                <div class="prize__value">$1000</div>
                                <div class="prize__title">
                                    2<sup>nd</sup>Prize
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-3 hidden-xxs">
                            <div class="prize">
                                <div class="prize__value">$500</div>
                                <div class="prize__title">
                                    3<sup>rd</sup>Prize
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-3 hidden-xxs">
                            <div class="prize">
                                <div class="prize__value">$250</div>
                                <div class="prize__title">
                                    4-10 Prize
                                </div>
                            </div>
                        </div>
                        <div class="col-xs-3 visible-xxs">
                            <div class="prize">
                                <div class="prize__value">$@Model.BudgetSecondPlace</div>
                                <div class="prize__title">
                                    2<sup>nd</sup>Prize
                                </div>
                            </div>
                        </div>
                    </div>
                }

                @await Html.PartialAsync("ProjectDetailsStatusBarPartial", Model.StatusBarPartial)

            </div>

            <div class="col-xs-12 col-sm-4 content__right pull-right">
                <div class="row">
                    <div class="col-xs-6 col-sm-12">
                        @if (Model.ProjectExperts == null)
            {
                            <div class="user_badge">
                                <a href="/userprofile/@Model.AuthorIdentifier" class="user_badge__img">
                                    <img src="~/images/avatar.svg" alt="">
                                </a>
                                <div class="user_badge__info">
                                    <a href="/userprofile/@Model.AuthorIdentifier" class="user_badge__title">@Model.AuthorFullName</a>
                                    <div class="user_badge__desc">Creator</div>
                                </div>
                            </div>
                        }

                        @await Html.PartialAsync("ProjectDetailsStatusPartial", new ProjectDetailsStatusViewModel
                   {
                       ProjectId = Model.Id,
                       Status = Model.Status,
                       VotesFor = Model.VotesFor,
                       VotesAgainst = Model.VotesAgainst,
                       CompetitionRegistrationDeadline = Model.CompetitionRegistrationDeadline,
                       ImplementationDeadline = Model.ImplementationDeadline,
                       VotingDeadline = Model.VotingDeadline,
                       IsParticipant = Model.IsParticipant,
                       HasResult = Model.ParticipantsPartial.HasResult
                   })
                    </div>
                    <div class="col-xs-6 col-sm-12">

                        <ul class="list list--info">
                            @if (showDaysOfProject)
                            {
                                <li class="list__item">
                                    <div class="list__content">
                                        <div class="title @textCompetition">Days of the project</div>
                                        <p>@Model.Created.ToString("MMM d") - @Model.VotingDeadline.ToString("MMM d") (@daysOfProject)</p>
                                    </div>
                                </li>
                            }
                            @if (!Model.SkipRegistration)
                            {
                                <li class="list__item @registrationCurrent">
                                    <div class="list__icon">
                                        <span class="check @checkCompetition"></span>
                                    </div>
                                    <div class="list__content">
                                        <div class="title @textCompetition">Registration</div>
                                        @*<p>@Model.Created.ToString("MMM d") - @Model.CompetitionRegistrationDeadline.ToString("MMM d")</p>*@
                                        <p>@Model.Created.ToString("MMM d") - @Model.ImplementationDeadline.ToString("MMM d")</p>
                                    </div>
                                </li>
                            }
                            <li class="list__item @submissionCurrent">
                                <div class="list__icon">
                                    <span class="check @checkSubmission"></span>
                                </div>
                                <div class="list__content">
                                    <div class="title @textSubmission">Submissions</div>
                                    <p>@Model.CompetitionRegistrationDeadline.ToString("MMM d") - @Model.ImplementationDeadline.ToString("MMM d")</p>
                                </div>
                            </li>
                            @if (!Model.SkipVoting)
                            {
                                <li class="list__item @votingCurrent">
                                    <div class="list__icon">
                                        <span class="check @checkVoting"></span>
                                    </div>
                                    <div class="list__content">
                                        <div class="title @textVoting">Voting</div>
                                        <p>@Model.ImplementationDeadline.ToString("MMM d") - @Model.VotingDeadline.ToString("MMM d")</p>
                                    </div>
                                </li>
                            }
                        </ul>

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

            <div class="col-xs-12 col-sm-8 content__left">

                <ul class="nav nav-tabs" role="tablist" id="projectDetailsTabs">
                    <li role="presentation" class="@infoTabActive"><a href="#info" aria-controls="info" role="tab" data-toggle="tab">Info</a></li>
                    <li role="presentation" class="@participantsTabActive">
                        <a href="#Participants" aria-controls="participants" role="tab" data-toggle="tab">
                            Participants
                            @if (!string.IsNullOrEmpty(participantsCount))
                            {
                                <sup>
                                    @participantsCount
                                </sup>
                            }
                        </a>
                    </li>
                    <li role="presentation" class="@commentsTabActive">
                        <a href="#Comments" aria-controls="comments" role="tab" data-toggle="tab">
                            Comments
                            @if (!string.IsNullOrEmpty(commentsCount))
                            {
                                <sup>
                                    @commentsCount
                                </sup>
                            }
                        </a>
                    </li>
                    <li role="presentation" class="@resultsTabActive">
                        <a href="#Results" aria-controls="results" role="tab" data-toggle="tab">
                            Results
                            @if (!string.IsNullOrEmpty(resultsCount))
                            {
                                <sup>
                                    @resultsCount
                                </sup>
                            }
                        </a>
                    </li>
                    <li role="presentation" class="@winnersTabActive">
                        <a href="#Winners" aria-controls="results" role="tab" data-toggle="tab">
                            Winners
                            @if (!string.IsNullOrEmpty(winnersCount))
                            {
                                <sup>
                                    @winnersCount
                                </sup>
                            }
                        </a>
                    </li>
                </ul>

                <div class="tab-content">
                    <div role="tabpanel" class="tab-pane @infoTabActive" id="info">
                        <div class="text">
                            @Html.Raw(Model.Description)
                        </div>
                        @if (Model.FileInfo != null)
            {
                var extension = fileExtension.Length > 2 ? fileExtension.ToUpper().Substring(0, 3) : fileExtension.ToUpper();

                            <div class="extend_block">
                                <h4>Brief</h4>

                                <div class="asset_link_list">
                                    <div class="asset_link asset_link--alt">
                                        <div class="asset_link__icon">
                                            @switch (fileExtension.ToLower())
                                            {
                                                case "pdf":
                                                    <div class="asset_icon asset_icon--red">PDF</div>
                                                    break;
                                                case "xls":
                                                case "xlsx":
                                                    <div class="asset_icon asset_icon--green">@fileExtension.ToUpper()</div>
                                                    break;
                                                case "jpg":
                                                    <div class="asset_icon asset_icon--yellow">JPG</div>
                                                    break;
                                                case "doc":
                                                case "docx":
                                                    <div class="asset_icon asset_icon--blue">@fileExtension.ToUpper()</div>
                                                    break;
                                                default:
                                                    <div class="asset_icon asset_icon--primary">@extension</div>
                                                    break;
                                            }
                                        </div>
                                        <div class="asset_link__action">
                                            <a class="btn btn--icon _delete_asset" asp-area="" asp-controller="ProjectDetails" asp-action="DownloadProjectFile" asp-route-id="@Model.Id">
                                                <i class="icon icon--download"></i>
                                            </a>
                                        </div>
                                        <div class="asset_link__info">
                                            <div class="asset_link__title overflow-visible">
                                                <a asp-area="" asp-controller="ProjectDetails" asp-action="DownloadProjectFile" asp-route-id="@Model.Id">@Model.FileInfo.FileName</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        }
                        @if (Model.ProjectExperts != null)
            {
                            <div class="extend_block">
                                <h4>Experts</h4>

                                <table class="table table--experts">
                                    @foreach (var expert in Model.ProjectExperts)
                                    {
                                        <tr>
                                            <td>
                                                <div class="user_badge user_badge--small">
                                                    <div class="user_badge__img">
                                                        @if (!string.IsNullOrEmpty(expert.UserIdentifier))
                                                        {
                                                            <a href="/userprofile/@expert.UserIdentifier"><img src="~/images/avatar.svg" alt=""></a>
                                                        }
                                                        else
                                                        {
                                                            <span><img src="~/images/avatar.svg" alt=""></span>
                                                        }

                                                    </div>
                                                    <div class="user_badge__info">
                                                        @if (!string.IsNullOrEmpty(expert.UserIdentifier))
                                                        {
                                                            <a href="/userprofile/@expert.UserIdentifier">@expert.FullName</a>
                                                        }
                                                        else
                                                        {
                                                            <span>@expert.FullName</span>
                                                        }

                                                    </div>
                                                </div>
                                            </td>
                                            <td>
                                                @if (!string.IsNullOrEmpty(expert.UserId) && expert.UserId == Model.AuthorId)
                                                {
                                                    <span class="label label--yellow">AUTHOR</span>
                                                }
                                                <span>@expert.Description</span>
                                            </td>
                                        </tr>
                                    }
                                </table>
                            </div>
                        }
                    </div>
                    <div role="tabpanel" class="tab-pane @participantsTabActive" id="Participants">
                        @await Html.PartialAsync("ParticipantsPartial", Model.ParticipantsPartial)
                    </div>

                    <div role="tabpanel" class="tab-pane @commentsTabActive" id="Comments">
                        @await Html.PartialAsync("CommentsPartial", Model.CommentsPartial)
                    </div>

                    <div role="tabpanel" class="tab-pane @resultsTabActive" id="Results">
                        @await Html.PartialAsync("ResultsPartial", Model.ResultsPartial)
                    </div>

                    <div role="tabpanel" class="tab-pane @winnersTabActive" id="Winners">
                        @await Html.PartialAsync("WinnersPartial", Model.ResultsPartial)
                    </div>
                </div>
            </div>


            <aside class="col-xs-12 col-sm-4 content__right">

                <h5 class="border-bottom">Tags</h5>

                <div class="tags_list">
                    <div class="tag_item">
                        <a href="">@Model.Category</a>
                    </div>
                    @if (Model.TagsList != null)
                    {
                        foreach (var category in Model.TagsList)
                        {
                            <div class="tag_item">
                                <a href="">@category</a>
                            </div>
                        }
                    }
                </div>
                @if (!string.IsNullOrEmpty(Model.ProgrammingResourceName) && !string.IsNullOrEmpty(Model.ProgrammingResourceLink))
                {
                    <h5 class="border-bottom">Programming resources</h5>

                    <ul class="list list--text_previews">
                        <li class="list__item">
                            <a href="@Model.ProgrammingResourceLink">
                                <div class="list__icon">
                                    <i class="icon icon--github"></i>
                                </div>
                                <div class="list__content">
                                    <span class="text-muted">@Model.ProgrammingResourceName</span>
                                </div>
                            </a>
                        </li>
                    </ul>
                }

                <h5 class="border-bottom">Project stream</h5>

                <ul class="list list--text_previews">
                    @foreach (var project in Model.OtherProjects)
                    {
                        <li class="list__item">
                            <a class="other-projects-name" asp-controller="Project" asp-action="ProjectDetails" asp-route-id="@project.Id">
                                <p>
                                    <b>@project.Name</b>
                                </p>
                                <span class="text-muted">$@project.BudgetFirstPlace &middot; @project.Members participants</span>
                            </a>
                        </li>
                    }
                </ul>
            </aside>
        </div>
    </div>
</section>
<img src="~/images/lykkeshare.png" style="display: none;" />
@if (ViewBag.ParticipantAdded != null && ViewBag.ParticipantAdded == true)
{
    <script src="~/js/vendor/jquery-1.11.2.min.js"></script>
    <script src="~/js/vendor/bootstrap.min.js"></script>
    <script>
        $(window).load(function () {
            $('#modal_success').modal('show');
        });
    </script>
}

@if (ViewBag.VotedForResult != null && ViewBag.VotedForResult == true)
{
    <script src="~/js/vendor/jquery-1.11.2.min.js"></script>
    <script src="~/js/vendor/bootstrap.min.js"></script>
    <script>
        $(window).load(function () {
            $('#modal_voted_for_result').modal('show');
        });
    </script>
}

@if (ViewBag.VotedTwice != null && ViewBag.VotedTwice == true)
{
    <script src="~/js/vendor/jquery-1.11.2.min.js"></script>
    <script src="~/js/vendor/bootstrap.min.js"></script>
    <script>
        $(window).load(function () {
            $('#modal_result_vote_removed').modal('show');
        });
    </script>
}
{'fraction_non_alphanumeric': 0.1094793908953201, 'fraction_numerical': 0.003029578250817189, 'mean_word_length': 0.9579782086104087, 'pattern_counts': {'":': 12, '<': 823, '<?xml version=': 0, '>': 829, 'https://': 6, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 445, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '415119', 'n_tokens_mistral': 14531, 'n_tokens_neox': 13569, 'n_words': 2291}