-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DC-3126: return partials for conversations using fake data
- Loading branch information
1 parent
35038d4
commit d881659
Showing
21 changed files
with
955 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
app/uk/gov/hmrc/securemessagefrontend/controllers/ConversationsController.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2021 HM Revenue & Customs | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package uk.gov.hmrc.securemessagefrontend.controllers | ||
|
||
import play.api.i18n.I18nSupport | ||
import play.api.mvc.{ MessagesControllerComponents, _ } | ||
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendController | ||
import uk.gov.hmrc.securemessagefrontend.models.FakeData | ||
import uk.gov.hmrc.securemessagefrontend.views.html.partials.{ archivedMessages, conversations, recentMessages } | ||
import javax.inject.{ Inject, Singleton } | ||
|
||
@Singleton | ||
class ConversationsController @Inject()( | ||
controllerComponents: MessagesControllerComponents, | ||
conversationsPartial: conversations, | ||
recentMessages: recentMessages, | ||
archivedMessages: archivedMessages) | ||
extends FrontendController(controllerComponents) with I18nSupport { | ||
|
||
def display: Action[AnyContent] = Action { implicit request => | ||
Ok(conversationsPartial(latestMessagesPartial, archivedMessagesPartial)) | ||
} | ||
|
||
private def latestMessagesPartial()(implicit request: Request[_]) = recentMessages(FakeData.conversations) | ||
private def archivedMessagesPartial()(implicit request: Request[_]) = archivedMessages(FakeData.conversations) | ||
} |
41 changes: 41 additions & 0 deletions
41
app/uk/gov/hmrc/securemessagefrontend/controllers/MessagesController.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2021 HM Revenue & Customs | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package uk.gov.hmrc.securemessagefrontend.controllers | ||
|
||
import cats.implicits.catsSyntaxEq | ||
import com.google.inject.Inject | ||
import play.api.i18n.I18nSupport | ||
import play.api.mvc.{ Action, AnyContent, MessagesControllerComponents, Request } | ||
import uk.gov.hmrc.play.bootstrap.frontend.controller.FrontendController | ||
import uk.gov.hmrc.securemessagefrontend.models.FakeData | ||
import uk.gov.hmrc.securemessagefrontend.views.html.partials.{ message, messageContent } | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class MessagesController @Inject()( | ||
controllerComponents: MessagesControllerComponents, | ||
messageContent: messageContent, | ||
message: message) | ||
extends FrontendController(controllerComponents) with I18nSupport { | ||
|
||
def display(id: String): Action[AnyContent] = Action { implicit request => | ||
Ok(message(messagePartial(id))) | ||
} | ||
|
||
private def messageContent(messageId: String) = FakeData.messages.find(_.id === messageId).map(_.content) | ||
private def messagePartial(id: String)(implicit request: Request[_]) = messageContent(messageContent(id)) | ||
} |
133 changes: 133 additions & 0 deletions
133
app/uk/gov/hmrc/securemessagefrontend/models/Conversation.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* | ||
* Copyright 2021 HM Revenue & Customs | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package uk.gov.hmrc.securemessagefrontend.models | ||
|
||
final case class Conversation(id: String, url: String, topic: String, mrn: String, date: String) | ||
|
||
final case class ConversationMessage(id: String, content: String) | ||
|
||
object FakeData { | ||
val conversations: Seq[Conversation] = List( | ||
Conversation( | ||
"111", | ||
"/secure-message-frontend/conversation-message/111", | ||
"HMRC exports", | ||
"MRN 20GB16046891253600", | ||
"12 January 2021"), | ||
Conversation( | ||
"222", | ||
"/secure-message-frontend/conversation-message/222", | ||
"HMRC exports", | ||
"MRN 20GB16046891253601", | ||
"13 January 2021"), | ||
Conversation( | ||
"333", | ||
"/secure-message-frontend/conversation-message/222", | ||
"HMRC exports", | ||
"MRN 20GB16046891253601", | ||
"13 January 2021"), | ||
Conversation( | ||
"444", | ||
"/secure-message-frontend/conversation-message/222", | ||
"HMRC exports", | ||
"MRN 20GB16046891253601", | ||
"13 January 2021"), | ||
Conversation( | ||
"555", | ||
"/secure-message-frontend/conversation-message/222", | ||
"HMRC exports", | ||
"MRN 20GB16046891253601", | ||
"13 January 2021"), | ||
Conversation( | ||
"666", | ||
"/secure-message-frontend/conversation-message/222", | ||
"HMRC exports", | ||
"MRN 20GB16046891253601", | ||
"13 January 2021") | ||
) | ||
|
||
val messages: Seq[ConversationMessage] = List( | ||
ConversationMessage( | ||
"111", | ||
"<div>\n <p class=\"govuk-body\">Dear Customer</p>\n " + | ||
" <p class=\"govuk-body\">I found missing information for Customs Declaration MRN 20GB16046891253600" + | ||
" for a shipment of fireworks.</p>\n" + | ||
"<p class=\"govuk-body\">Please upload this form before your shipment can be cleared for export:</p>\n " + | ||
" <p class=\"govuk-body\">C672 form. “This form must accompany shipments of waste as mentioned in" + | ||
" Regulation 1013/2006 (OJ L 190) – Article 18 and Annex VII.”</p>\n " + | ||
" <p class=\"govuk-body\">Robin Newman</p>\n </div>" | ||
), | ||
ConversationMessage( | ||
"222", | ||
" <div>\n " + | ||
" <p class=\"govuk-body\">Dear Customer</p>\n " + | ||
" <p class=\"govuk-body\">I found missing information for Customs Declaration " + | ||
"MRN 20GB16046891253600 for a shipment of fireworks.</p>\n " + | ||
" <p class=\"govuk-body\">Please upload this form before your shipment can be cleared for export:</p>\n " + | ||
" <p class=\"govuk-body\">C672 form. “This form must accompany shipments" + | ||
" of waste as mentioned in Regulation 1013/2006 (OJ L 190) – Article 18 and Annex VII.”</p>\n " + | ||
" <p class=\"govuk-body\">Robin Newman</p>\n </div>" | ||
), | ||
ConversationMessage( | ||
"333", | ||
" <div>\n " + | ||
" <p class=\"govuk-body\">Dear Customer</p>\n " + | ||
" <p class=\"govuk-body\">I found missing information for Customs Declaration " + | ||
"MRN 20GB16046891253600 for a shipment of fireworks.</p>\n " + | ||
" <p class=\"govuk-body\">Please upload this form before your shipment can be cleared for export:</p>\n " + | ||
" <p class=\"govuk-body\">C672 form. " + | ||
"“This form must accompany shipments of waste as mentioned in Regulation 1013/2006 (OJ L 190)" + | ||
" – Article 18 and Annex VII.”</p>\n <p class=\"govuk-body\">Robin Newman</p>\n " + | ||
" </div>" | ||
), | ||
ConversationMessage( | ||
"444", | ||
" <div>\n " + | ||
" <p class=\"govuk-body\">Dear Customer</p>\n " + | ||
" <p class=\"govuk-body\">I found missing information for Customs Declaration MRN " + | ||
"20GB16046891253600 for a shipment of fireworks.</p>\n " + | ||
" <p class=\"govuk-body\">Please upload this form before your shipment can be cleared for export:</p>\n " + | ||
" <p class=\"govuk-body\">C672 form. “This form must accompany shipments of waste " + | ||
"as mentioned in Regulation 1013/2006 (OJ L 190) – Article 18 and Annex VII.”</p>\n " + | ||
" <p class=\"govuk-body\">Robin Newman</p>\n </div>" | ||
), | ||
ConversationMessage( | ||
"555", | ||
" <div>\n " + | ||
" <p class=\"govuk-body\">Dear Customer</p>\n " + | ||
" <p class=\"govuk-body\">I found missing information for Customs Declaration MRN 20GB16046891253600" + | ||
" for a shipment of fireworks.</p>\n " + | ||
" <p class=\"govuk-body\">Please upload this form before your shipment can be cleared for export:</p>\n " + | ||
" <p class=\"govuk-body\">C672 form. “This form must accompany shipments of waste as mentioned " + | ||
"in Regulation 1013/2006 (OJ L 190) – Article 18 and Annex VII.”</p>\n " + | ||
" <p class=\"govuk-body\">Robin Newman</p>\n </div>" | ||
), | ||
ConversationMessage( | ||
"666", | ||
" <div>\n " + | ||
" <p class=\"govuk-body\">Dear Customer</p>\n " + | ||
" <p class=\"govuk-body\">I found missing information for Customs " + | ||
"Declaration MRN 20GB16046891253600 for a shipment of fireworks.</p>\n " + | ||
" <p class=\"govuk-body\">Please upload this form before your shipment can be cleared " + | ||
"for export:</p>\n <p class=\"govuk-body\">C672 form." + | ||
" “This form must accompany shipments of waste as mentioned in Regulation 1013/2006 (OJ L 190) " + | ||
"– Article 18 and Annex VII.”</p>\n <p class=\"govuk-body\">Robin Newman</p>\n " + | ||
" </div>" | ||
) | ||
) | ||
|
||
} |
83 changes: 83 additions & 0 deletions
83
app/uk/gov/hmrc/securemessagefrontend/views/partials/archivedMessages.scala.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
@* | ||
* Copyright 2021 HM Revenue & Customs | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*@ | ||
|
||
@import uk.gov.hmrc.securemessagefrontend.views.html._ | ||
@import uk.gov.hmrc.securemessagefrontend.models._ | ||
|
||
@this(layout: Layout) | ||
|
||
@(conversations: Seq[Conversation])(implicit request: Request[_], messages: Messages) | ||
|
||
<details class="govuk-details" data-module="govuk-details"> | ||
<summary class="govuk-details__summary"> | ||
<span class="govuk-details__summary-text"> | ||
@Messages("conversation.page.filter.text") | ||
</span> | ||
</summary> | ||
<div class="govuk-details__text"> | ||
<div class="govuk-form-group"> | ||
<fieldset class="govuk-fieldset" aria-describedby="waste-hint"> | ||
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l"> | ||
<p> | ||
Select topics you want to view | ||
</p> | ||
</legend> | ||
<div class="govuk-checkboxes"> | ||
<div class="govuk-checkboxes__item"> | ||
<input class="govuk-checkboxes__input" id="waste" name="waste" type="checkbox" value="carcasses"> | ||
<label class="govuk-label govuk-checkboxes__label" for="waste"> | ||
Border force cargo and inspections | ||
</label> | ||
</div> | ||
<div class="govuk-checkboxes__item"> | ||
<input class="govuk-checkboxes__input" id="waste-2" name="waste" type="checkbox" value="mines"> | ||
<label class="govuk-label govuk-checkboxes__label" for="waste-2"> | ||
HMRC exports | ||
</label> | ||
</div> | ||
<div class="govuk-checkboxes__item"> | ||
<input class="govuk-checkboxes__input" id="waste-3" name="waste" type="checkbox" value="farm"> | ||
<label class="govuk-label govuk-checkboxes__label" for="waste-3"> | ||
HMRC imports | ||
</label> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</details> | ||
|
||
|
||
<table class="govuk-table"> | ||
<thead class="govuk-table__head"> | ||
<tr class="govuk-table__row"> | ||
<th scope="col" class="govuk-table__header">@Messages("conversation.page.subject")</th> | ||
<th scope="col" class="govuk-table__header">@Messages("conversation.page.date")</th> | ||
</tr> | ||
</thead> | ||
<tbody class="govuk-table__body"> | ||
@for(conversation <- conversations) { | ||
<tr class="govuk-table__row"> | ||
<td class="govuk-table__cell"> | ||
@{conversation.topic} | ||
<p class="govuk-body"> | ||
<a href=@{conversation.url} class="govuk-link" >@{conversation.mrn}</a> needs action | ||
</p> | ||
</td> | ||
<td class="govuk-table__cell">@{conversation.date}</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> |
45 changes: 45 additions & 0 deletions
45
app/uk/gov/hmrc/securemessagefrontend/views/partials/conversations.scala.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@* | ||
* Copyright 2021 HM Revenue & Customs | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*@ | ||
|
||
@import uk.gov.hmrc.securemessagefrontend.views.html._ | ||
@import play.twirl.api.HtmlFormat | ||
@import uk.gov.hmrc.govukfrontend.views.html.components._ | ||
|
||
@this(layout: Layout, govukAccordion : GovukAccordion,govukBackLink : GovukBackLink) | ||
|
||
@(recentMessages: HtmlFormat.Appendable, archievedMessages: HtmlFormat.Appendable)(implicit request: Request[_], messages: Messages) | ||
|
||
<h1 class="govuk-heading-l"> @Messages("conversation.page.heading")</h1> | ||
|
||
<div> | ||
@govukAccordion(Accordion( | ||
id = "accordion-with-summary-sections", | ||
items = Seq( | ||
Section( | ||
headingContent = Text(Messages("conversation.page.recent.messages.heading")), | ||
summaryContent = Text(Messages("conversation.page.recent.messages.summary")), | ||
content = HtmlContent( | ||
recentMessages) | ||
), | ||
Section( | ||
headingContent = Text(Messages("conversation.page.archive.messages.heading")), | ||
summaryContent = Text(Messages("conversation.page.archive.messages.summary")), | ||
content = HtmlContent( | ||
archievedMessages) | ||
) | ||
) | ||
)) | ||
</div> |
37 changes: 37 additions & 0 deletions
37
app/uk/gov/hmrc/securemessagefrontend/views/partials/message.scala.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
@* | ||
* Copyright 2021 HM Revenue & Customs | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*@ | ||
|
||
@import uk.gov.hmrc.securemessagefrontend.views.html._ | ||
@import play.twirl.api.HtmlFormat | ||
@this(layout: Layout, govukPanel: GovukPanel,govukBackLink : GovukBackLink) | ||
|
||
@(message: HtmlFormat.Appendable)(implicit request: Request[_], messages: Messages) | ||
<div class="govuk-width-container"> | ||
<a href="/secure-message-frontend/conversations" class="govuk-back-link">Back</a> | ||
|
||
<main class="govuk-main-wrapper"> | ||
|
||
<div class="govuk-grid-row" style="width:100%"> | ||
<div> | ||
<h3 class="govuk-heading-m">MRN 20GB16046891253600 needs action</h3> | ||
<p>HMRC sent this message on 20 January 2021 at 8:23am</p> | ||
@message | ||
</div> | ||
</div> | ||
|
||
</main> | ||
</div> | ||
|
Oops, something went wrong.