<apex:page controller="AccountTransactionController">
<style>
.highlight-green {
background-color: #4CAF50;
color: white;
}
</style>
<apex:form>
<apex:pageMessages />
<apex:pageBlock title="Account Transaction">
<apex:pageBlockSection>
<apex:inputText value="{!accountNumber}" label="Account Number"/>
<apex:commandButton value="Check Account" action="{!checkAccount}" rerender="transactionSection, errorMessages"/>
</apex:pageBlockSection>
<apex:outputPanel id="transactionSection">
<apex:pageBlockSection rendered="{!accountExists}">
<apex:outputText value="Account Balance: {!accountBalance}"/>
<apex:selectRadio value="{!transactionType}">
<apex:selectOption itemLabel="Debit" itemValue="Debit"/>
<apex:selectOption itemLabel="Credit" itemValue="Credit"/>
</apex:selectRadio>
<apex:inputText value="{!transactionAmount}" label="Transaction Amount"/>
<apex:commandButton value="Submit" action="{!performTransaction}" rerender="transactionSection, transactionList"/>
</apex:pageBlockSection>
</apex:outputPanel>
<apex:outputPanel id="errorMessages">
<apex:pageMessages />
</apex:outputPanel>
<apex:outputPanel id="transactionList">
<apex:pageBlockSection title="Last Transactions">
<apex:dataTable value="{!lastTransactions}" var="transaction">
<apex:column headerValue="Transaction Date" value="{!transaction.Date__c}"/>
<apex:column headerValue="Transaction Type" value="{!transaction.Type__c}"/>
<apex:column headerValue="Amount" value="{!transaction.Amount__c}"/>
<apex:column styleClass="{!IF(transaction.Id == lastTransactionId, 'highlight-green', '')}">
<apex:facet name="header">Last Transaction</apex:facet>
</apex:column>
</apex:dataTable>
</apex:pageBlockSection>
</apex:outputPanel>
</apex:pageBlock>
</apex:form>
</apex:page>