Example #1
0
        public ActionResult AddressBarSeparatorTemplatePartial(BreadcrumbItemModel value)
        {
            string id = value.Text != null?value.Text.Split(' ')[0].Split('.')[0] : "Home";

            List <MenuItem> parentMenuItems = new List <MenuItem>()
            {
                new MenuItem {
                    Items = new List <MenuItem>()
                }
            };
            List <MenuItem> subMenuItems = (List <MenuItem>)parentMenuItems[0].Items;
            var             items        = getItems(value.Text, false, value.Items);

            if (items != null)
            {
                foreach (var item in items)
                {
                    subMenuItems.Add(new MenuItem {
                        Text = item.Text, Id = item.Type
                    });
                }
            }
            ViewBag.subMenuItems = parentMenuItems;
            return(PartialView("_AddressBarSeparatorTemplatePartial", id));
        }
Example #2
0
        public async Task <IActionResult> EnterYourDetailsView(EnterYourDetailsBodyViewModel?model)
        {
            if (model != null && ModelState.IsValid)
            {
                if (await SendEmailAsync(model).ConfigureAwait(false))
                {
                    await DeleteSessionStateAsync().ConfigureAwait(false);

                    return(Redirect($"/{LocalPath}/{HomeController.ThankyouForContactingUsCanonicalName}"));
                }

                ModelState.AddModelError(string.Empty, "Unable to send message, please try again shortly");
            }

            var breadcrumbItemModel = new BreadcrumbItemModel
            {
                Route = ThisViewCanonicalName,
                Title = "Enter your details",
            };
            var viewModel = new EnterYourDetailsViewModel()
            {
                HtmlHead = new HtmlHeadViewModel
                {
                    CanonicalUrl = new Uri($"{Request.GetBaseAddress()}{LocalPath}/{ThisViewCanonicalName}", UriKind.RelativeOrAbsolute),
                    Title        = "Enter your details" + PageTitleSuffix,
                },
                Breadcrumb = BuildBreadcrumb(LocalPath, breadcrumbItemModel),
                EnterYourDetailsBodyViewModel = model,
            };

            Logger.LogInformation($"{nameof(EnterYourDetailsBody)} has returned content");

            return(this.NegotiateContentResult(viewModel));
        }
Example #3
0
        public async Task <IActionResult> Breadcrumb(SocRequestModel socRequest)
        {
            var jobGroupModel = await jobGroupDocumentService.GetAsync(w => w.Soc == socRequest.Soc, socRequest.Soc.ToString(CultureInfo.InvariantCulture)).ConfigureAwait(false);

            if (jobGroupModel != null)
            {
                BreadcrumbItemModel?breadcrumbItemModel = default;
                if (!string.IsNullOrWhiteSpace(socRequest.FromJobProfileCanonicalName) && jobGroupModel.JobProfiles != null && jobGroupModel.JobProfiles.Any())
                {
                    breadcrumbItemModel = new BreadcrumbItemModel()
                    {
                        Route = "/job-profiles/" + socRequest.FromJobProfileCanonicalName,
                        Title = jobGroupModel.JobProfiles.FirstOrDefault(f => !string.IsNullOrWhiteSpace(f.CanonicalName) && f.CanonicalName.Equals(socRequest.FromJobProfileCanonicalName, System.StringComparison.OrdinalIgnoreCase))?.Title,
                    };
                }

                var viewModel = BuildBreadcrumb(RegistrationPath, breadcrumbItemModel, jobGroupModel.Title);

                logger.LogInformation($"{nameof(Breadcrumb)} has succeeded for: {socRequest.Soc}");

                return(this.NegotiateContentResult(viewModel));
            }

            logger.LogWarning($"{nameof(Breadcrumb)} has returned no content for: {socRequest.Soc}");

            return(NoContent());
        }
Example #4
0
        public async Task <IActionResult> EnterYourDetailsView()
        {
            var sessionStateModel = await GetSessionStateAsync().ConfigureAwait(false);

            var breadcrumbItemModel = new BreadcrumbItemModel
            {
                Route = ThisViewCanonicalName,
                Title = "Enter your details",
            };
            var viewModel = new EnterYourDetailsViewModel()
            {
                HtmlHead = new HtmlHeadViewModel
                {
                    CanonicalUrl = new Uri($"{Request.GetBaseAddress()}{LocalPath}/{ThisViewCanonicalName}", UriKind.RelativeOrAbsolute),
                    Title        = "Enter your details" + PageTitleSuffix,
                },
                Breadcrumb = BuildBreadcrumb(LocalPath, breadcrumbItemModel),
                EnterYourDetailsBodyViewModel = new EnterYourDetailsBodyViewModel
                {
                    SelectedCategory = sessionStateModel?.State?.Category ?? Category.None,
                    MoreDetail       = sessionStateModel?.State?.MoreDetail,
                    IsCallback       = sessionStateModel?.State?.IsCallback ?? false,
                },
            };

            Logger.LogWarning($"{nameof(EnterYourDetailsView)} has returned content");

            return(this.NegotiateContentResult(viewModel));
        }
Example #5
0
        public async Task <IActionResult> ChatView()
        {
            var breadcrumbItemModel = new BreadcrumbItemModel
            {
                Route = ThisViewCanonicalName,
                Title = "Chat",
            };
            var viewModel = new ChatViewModel()
            {
                HtmlHead = new HtmlHeadViewModel
                {
                    CanonicalUrl = new Uri($"{Request.GetBaseAddress()}{LocalPath}/chat", UriKind.RelativeOrAbsolute),
                    Title        = "Webchat" + PageTitleSuffix,
                },
                Breadcrumb        = BuildBreadcrumb(LocalPath, breadcrumbItemModel),
                ChatViewBodyModel = mapper.Map <ChatViewBodyModel>(chatOptions),
            };

            var configurationSetModel = await configurationSetDocumentService.GetByIdAsync(ConfigurationSetKeyHelper.ConfigurationSetKey).ConfigureAwait(false) ?? new ConfigurationSetModel();

            viewModel.ChatViewBodyModel.PhoneNumber      = configurationSetModel?.PhoneNumber ?? ConfigurationSetModel.DefaultPhoneNumber;
            viewModel.ChatViewBodyModel.HowCanWeHelpLink = $"/{LocalPath}/{HowCanWeHelpController.ThisViewCanonicalName}";

            Logger.LogWarning($"{nameof(ChatView)} has returned content");

            return(this.NegotiateContentResult(viewModel));
        }
Example #6
0
        public async Task <IActionResult> HomeView()
        {
            await DeleteSessionStateAsync().ConfigureAwait(false);

            var configurationSetModel = await configurationSetDocumentService.GetByIdAsync(ConfigurationSetKeyHelper.ConfigurationSetKey).ConfigureAwait(false) ?? new ConfigurationSetModel();

            var breadcrumbItemModel = new BreadcrumbItemModel
            {
                Route = ThisViewCanonicalName,
                Title = "Contact us",
            };
            var viewModel = new HomeViewModel()
            {
                HtmlHead = new HtmlHeadViewModel
                {
                    CanonicalUrl = new Uri($"{Request.GetBaseAddress()}{LocalPath}", UriKind.RelativeOrAbsolute),
                    Title        = ContactUsPageTitleSuffix,
                },
                Breadcrumb        = BuildBreadcrumb(LocalPath, breadcrumbItemModel),
                HomeBodyViewModel = new HomeBodyViewModel
                {
                    PhoneNumber   = configurationSetModel?.PhoneNumber ?? ConfigurationSetModel.DefaultPhoneNumber,
                    LinesOpenText = configurationSetModel?.LinesOpenText,
                },
            };

            Logger.LogWarning($"{nameof(HomeView)} has returned content");

            return(this.NegotiateContentResult(viewModel));
        }
Example #7
0
        public void Can_Make_BreadcrumbsItemModel()
        {
            var breadcrumbsItemModel = new BreadcrumbItemModel(Name, Url, true);

            Assert.That(breadcrumbsItemModel.Title, Is.EqualTo(Name));
            Assert.That(breadcrumbsItemModel.Url, Is.EqualTo(Url));
            Assert.That(breadcrumbsItemModel.IsActive, Is.EqualTo(true));
        }
Example #8
0
        public async Task <IActionResult> HomeView(HomeBodyViewModel?model)
        {
            if (model != null && ModelState.IsValid)
            {
                switch (model.SelectedOption)
                {
                case HomeOption.Webchat:
                    return(Redirect($"/{LocalPath}/{ChatController.ThisViewCanonicalName}"));

                case HomeOption.SendAMessage:
                    if (await SetSessionStateAsync(Category.None, null, false).ConfigureAwait(false))
                    {
                        return(Redirect($"/{LocalPath}/{HowCanWeHelpController.ThisViewCanonicalName}"));
                    }

                    break;

                case HomeOption.Callback:
                    if (await SetSessionStateAsync(Category.None, null, true).ConfigureAwait(false))
                    {
                        return(Redirect($"/{LocalPath}/{HowCanWeHelpController.ThisViewCanonicalName}"));
                    }

                    break;

                case HomeOption.Sendletter:
                    return(Redirect($"/{LocalPath}/{SendUsLetterCanonicalName}"));
                }
            }

            var breadcrumbItemModel = new BreadcrumbItemModel
            {
                Route = ThisViewCanonicalName,
                Title = "Contact us",
            };
            var viewModel = new HomeViewModel()
            {
                HtmlHead = new HtmlHeadViewModel
                {
                    CanonicalUrl = new Uri($"{Request.GetBaseAddress()}{LocalPath}", UriKind.RelativeOrAbsolute),
                    Title        = ContactUsPageTitleSuffix,
                },
                Breadcrumb        = BuildBreadcrumb(LocalPath, breadcrumbItemModel),
                HomeBodyViewModel = model,
            };

            var configurationSetModel = await configurationSetDocumentService.GetByIdAsync(ConfigurationSetKeyHelper.ConfigurationSetKey).ConfigureAwait(false) ?? new ConfigurationSetModel();

            viewModel.HomeBodyViewModel !.PhoneNumber = configurationSetModel?.PhoneNumber ?? ConfigurationSetModel.DefaultPhoneNumber;
            viewModel.HomeBodyViewModel.LinesOpenText = configurationSetModel?.LinesOpenText;

            Logger.LogWarning($"{nameof(HomeView)} has returned content");

            return(this.NegotiateContentResult(viewModel));
        }
Example #9
0
        public IActionResult EnterYourDetailsBreadcrumb()
        {
            var breadcrumbItemModel = new BreadcrumbItemModel
            {
                Route = ThisViewCanonicalName,
                Title = "Enter your details",
            };
            var viewModel = BuildBreadcrumb(RegistrationPath, breadcrumbItemModel);

            Logger.LogInformation($"{nameof(EnterYourDetailsBreadcrumb)} has returned content");

            return(this.NegotiateContentResult(viewModel));
        }
Example #10
0
        public ActionResult AddressBarItemTemplatePartial(BreadcrumbItemModel value)
        {
            string id = value.Text != null?value.Text.Split(' ')[0].Split('.')[0] : "Home";

            List <MenuItem> menuItems = new List <MenuItem>()
            {
                new MenuItem
                {
                    Text    = value.Text,
                    IconCss = value.IconCss
                }
            };

            ViewBag.menuItems = menuItems;
            return(PartialView("_AddressBarItemTemplatePartial", id));
        }
        public async Task <IActionResult> HowCanWeHelpView(HowCanWeHelpBodyViewModel?model)
        {
            if (model != null && ModelState.IsValid)
            {
                switch (model.SelectedCategory)
                {
                case Category.AdviceGuidance:
                case Category.Courses:
                case Category.Website:
                case Category.Feedback:
                case Category.Other:
                    if (await SetSessionStateAsync(model.SelectedCategory.Value, model.MoreDetail, model.IsCallback).ConfigureAwait(false))
                    {
                        return(Redirect($"/{LocalPath}/{EnterYourDetailsController.ThisViewCanonicalName}"));
                    }

                    break;
                }
            }

            var breadcrumbItemModel = new BreadcrumbItemModel
            {
                Route = ThisViewCanonicalName,
                Title = Title,
            };
            var viewModel = new HowCanWeHelpViewModel()
            {
                HtmlHead = new HtmlHeadViewModel
                {
                    CanonicalUrl = new Uri($"{Request.GetBaseAddress()}{LocalPath}/{ThisViewCanonicalName}", UriKind.RelativeOrAbsolute),
                    Title        = Title + PageTitleSuffix,
                },
                Breadcrumb = BuildBreadcrumb(LocalPath, breadcrumbItemModel),
                HowCanWeHelpBodyViewModel = model,
            };

            Logger.LogWarning($"{nameof(HowCanWeHelpView)} has returned content");

            return(this.NegotiateContentResult(viewModel));
        }