' SummaryPage2_AccountAppHistoryItems_HistoryItemSummary
Option Explicit On
Option Strict On

' #################################################################
' Account Application History Summary page

' Version: 1.00 (30/03/2016)

' Usage: Accounts Applications form, Status page, History tab
' #################################################################

' Objects
Private mAccountAppHistoryItem As finAccountAppHistoryItem

Public Function Main(source As Object,
                     eventId As String,
                     eventArgs As ISKeyValueList,
                     ByRef handled As Boolean,
                     ByRef returnValues As ISKeyValueList,
                     ByRef text As String) As Boolean

  ' Assume Success
  Main = True

  ' Initialise
  mAccountAppHistoryItem = DirectCast(source, finAccountAppHistoryItem)

  ' Get Constants
  With ScriptInfo.Constants
  End With

  Select Case eventId
    Case ""
      ' Main event, i.e., return main page content
      Main = CreatePage(text)
  End Select

End Function

Private Function CreatePage(ByRef html As String) As Boolean

  Dim Ok As Boolean
  Dim sb As finHtmlSummaryPage2StringBuilder

  ' Assume Success
  Ok = True

  ' Initialise
  sb = finBL.CreateHtmlSummaryPage2StringBuilder()

  ' Initialise HTML
  With sb
    .Initialise(ScriptInfo)
    .HtmlHeaderBegin("", isefinSummaryPageStyle.Blocks)
    .HtmlHeaderEnd()
  End With

  If mAccountAppHistoryItem IsNot Nothing Then
    ' Begin Section
    sb.SectionColumnsBegin()

    ' General
    ' Begin Column 1
    sb.ColumnBegin("100%")

    ' Summary
    sb.BlockBegin("Summary", "", isefinSummaryPageBlockHeadingStyle.Main, False)
    sb.SummaryTablesAppend(finBL.SummaryPageStandardBlocks.AccountApp_HistoryItemSummary(ScriptInfo, mAccountAppHistoryItem, False))
    sb.BlockEnd()

    ' End Column 1
    sb.ColumnEnd()

    ' End Section
    sb.SectionColumnsEnd()
  End If

  ' Finalise HTML
  sb.HtmlFinalise()

  ' Resolve Templates
  html = sb.ToString(True)

  Return Ok

End Function