Complete bank selector dropdown and SWIFT/BIC registry
- Added Bank type and BankRegistry interface - Created banks service with CRUD operations and validation - Added bank dropdown to Transactions page with ESTRBRRJ as default - Extended Transaction type with bankSwiftCode field - Added unit tests for bank registry - Bank information stored in TypeScript module (can be migrated to DB/XML)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useMemo, useCallback } from 'react';
|
||||
import { useTransactionStore } from '../stores/transactionStore';
|
||||
import type { Transaction } from '@brazil-swift-ops/types';
|
||||
import { calculateTransactionEOUplift, getDefaultConverter } from '@brazil-swift-ops/utils';
|
||||
import { calculateTransactionEOUplift, getDefaultConverter, getAllBanks, getBankBySwiftCode } from '@brazil-swift-ops/utils';
|
||||
import {
|
||||
validateAmount,
|
||||
validateCurrency,
|
||||
@@ -189,6 +189,35 @@ export default function TransactionsPage() {
|
||||
<h2 className="text-lg font-semibold">New Transaction</h2>
|
||||
</div>
|
||||
<form onSubmit={handleSubmit} className="p-6 space-y-4">
|
||||
{/* Bank Selection */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Bank (SWIFT/BIC) *
|
||||
</label>
|
||||
<select
|
||||
value={selectedBankSwiftCode}
|
||||
onChange={(e) => setSelectedBankSwiftCode(e.target.value)}
|
||||
className="w-full border border-gray-300 rounded-md px-3 py-2"
|
||||
required
|
||||
>
|
||||
{banks.map((bank) => (
|
||||
<option key={bank.swiftCode} value={bank.swiftCode}>
|
||||
{bank.swiftCode} - {bank.institutionName} ({bank.city})
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{selectedBank && (
|
||||
<div className="mt-2 p-3 bg-blue-50 border border-blue-200 rounded-md">
|
||||
<p className="text-sm text-blue-800">
|
||||
<strong>Selected Bank:</strong> {selectedBank.institutionName}
|
||||
</p>
|
||||
<p className="text-xs text-blue-600 mt-1">
|
||||
{selectedBank.city}, {selectedBank.country} | SWIFT: {selectedBank.swiftCode}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||
Direction
|
||||
|
||||
Reference in New Issue
Block a user