Skip to content

Commit

Permalink
Common Header - Integration related (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmverma authored Oct 18, 2024
1 parent 4f7ad21 commit 3fc275a
Showing 1 changed file with 34 additions and 25 deletions.
59 changes: 34 additions & 25 deletions Frontend/CO.CDP.OrganisationApp/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
<link rel="stylesheet" href="/css/site.css">
<title>Central Digital Platform - GOV.UK</title>
</head>

@{
var ftsService = config["FtsService"] ?? "";
ftsService = ftsService.EndsWith("/") ? ftsService.TrimEnd(new Char[] { '/' }) : ftsService;
}

<body class="govuk-template__body">
<script>document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' govuk-frontend-supported' : '');</script>

Expand All @@ -48,8 +54,8 @@
</a>
</div>
<div class="govuk-header__content">
<a href="#" class="govuk-header__link govuk-header__service-name">
SIRSI
<a href="@ftsService" class="govuk-header__link govuk-header__service-name">
Find a Tender
</a>
<nav aria-label="Menu" class="govuk-header__navigation">
<button type="button" class="govuk-header__menu-button govuk-js-header-toggle" aria-controls="navigation" hidden>
Expand All @@ -58,14 +64,27 @@
<ul id="navigation" class="govuk-header__navigation-list">
@if (User?.Identity?.IsAuthenticated == true)
{
var ftsService = config["FtsService"] ?? "";
var showMyNotice = !string.IsNullOrEmpty(ftsService);

@if (await userInfoService.HasTenant())
{
var organisationId = userInfoService.GetOrganisationId();
if (organisationId != null)
{
<li class="govuk-header__navigation-item">
<a class="govuk-header__link" href="@($"{ftsService}/login?organisation_id={organisationId}&redirect_url=/search/results")">
Search
</a>
</li>

<li class="govuk-header__navigation-item">
<a class="govuk-header__link" href="@($"{ftsService}/login?organisation_id={organisationId}&redirect_url=/dashboard")">
My notices
</a>
</li>
}

<li class="govuk-header__navigation-item">
<a class="govuk-header__link" href="/organisation-selection">
Dashboard
My account
</a>
</li>
}
Expand All @@ -78,30 +97,20 @@
</li>
</authorize>

if (showMyNotice == true)
{
var urlPath = Context.Request.Path;
Regex regex = new Regex(RegExPatterns.OrganisationId);
Match match = regex.Match(urlPath);
string guid = match.Success == true ? match.Groups[1].Value : string.Empty;

if (!string.IsNullOrEmpty(guid))
{
ftsService = config["FtsService"]?.Replace("an_organisation_id", guid) ?? string.Empty;

<li class="govuk-header__navigation-item">
<a class="govuk-header__link" href="@ftsService">
My notices
</a>
</li>
}
}
<li class="govuk-header__navigation-item" style="float:right;">
<li class="govuk-header__navigation-item">
<a class="govuk-header__link" href="/one-login/sign-out">
Sign out
</a>
</li>
}
else
{
<li class="govuk-header__navigation-item">
<a class="govuk-header__link" href="/one-login/sign-in">
Sign in
</a>
</li>
}
</ul>
</nav>
</div>
Expand Down

0 comments on commit 3fc275a

Please sign in to comment.