From e6e1ceb28ed6513b542f6238c8c454648c16cc7b Mon Sep 17 00:00:00 2001 From: sajiv8 Date: Sun, 19 Oct 2025 10:04:47 +0530 Subject: [PATCH 1/2] changed some styles in the Fixed Deposit section like other sections --- .../forms/CreateFixedDepositForm.tsx | 46 +++++++++++++++---- .../sections/FixedDepositSection.tsx | 4 +- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src/dashboard/forms/CreateFixedDepositForm.tsx b/src/dashboard/forms/CreateFixedDepositForm.tsx index deb68ab..ea1f516 100644 --- a/src/dashboard/forms/CreateFixedDepositForm.tsx +++ b/src/dashboard/forms/CreateFixedDepositForm.tsx @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react'; import { getFDPlans, openFixedDeposit, type FixedDeposit, type FDPlan } from '../../api/fd'; +import { Wallet } from 'lucide-react'; interface CreateFixedDepositFormProps { onSuccess: (fd: FixedDeposit) => void; @@ -13,6 +14,8 @@ const CreateFixedDepositForm = ({ onSuccess, onError }: CreateFixedDepositFormPr const [plans, setPlans] = useState([]); const [loading, setLoading] = useState(false); const [fetchingPlans, setFetchingPlans] = useState(true); + const [success, setSuccess] = useState(false); + const [error, setError] = useState(null); useEffect(() => { const fetchPlans = async () => { @@ -35,18 +38,23 @@ const CreateFixedDepositForm = ({ onSuccess, onError }: CreateFixedDepositFormPr if (!savingsAccountNo || !amount || !selectedPlanId) return; setLoading(true); + setError(null); + setSuccess(false); + try { const response = await openFixedDeposit({ savings_account_no: savingsAccountNo, amount: Number(amount), plan_id: selectedPlanId }); + setSuccess(true); onSuccess(response); setSavingsAccountNo(''); setAmount(''); setSelectedPlanId(''); } catch (err: any) { const errorMsg = err.response?.data?.detail || err.message || 'Failed to create fixed deposit'; + setError(errorMsg); onError(errorMsg); } finally { setLoading(false); @@ -60,15 +68,25 @@ const CreateFixedDepositForm = ({ onSuccess, onError }: CreateFixedDepositFormPr if (fetchingPlans) { return ( -
+
Loading FD plans...
); } return ( -
-
+
+
+
+ +
+
+

Fixed Deposit

+

Open a new fixed deposit account

+
+
+ +
{selectedPlan && ( -
+

Plan Details

@@ -143,10 +161,22 @@ const CreateFixedDepositForm = ({ onSuccess, onError }: CreateFixedDepositFormPr
)} + {error && ( +
+ {error} +
+ )} + + {success && ( +
+ Fixed deposit created successfully! +
+ )} + diff --git a/src/dashboard/sections/FixedDepositSection.tsx b/src/dashboard/sections/FixedDepositSection.tsx index ef1cb7f..cf725c9 100644 --- a/src/dashboard/sections/FixedDepositSection.tsx +++ b/src/dashboard/sections/FixedDepositSection.tsx @@ -49,14 +49,14 @@ const FixedDepositSection = () => { /> {activeSubTab === 'create-fd' && ( -
+
{error && (
{error}
)} -
+

Create New Fixed Deposit Account

From b72d3f76f1eaad11feb4668f72d9c4780602935b Mon Sep 17 00:00:00 2001 From: sajiv8 Date: Sun, 19 Oct 2025 10:37:10 +0530 Subject: [PATCH 2/2] The Default selection was updated for all the sections --- src/dashboard/Dashboard.tsx | 12 ++++++------ src/dashboard/forms/CreateBranchForm.tsx | 23 ++++++++++++----------- src/dashboard/forms/UpdateBranchForm.tsx | 23 ++++++++++++----------- src/dashboard/sections/BranchSection.tsx | 11 ++++------- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/dashboard/Dashboard.tsx b/src/dashboard/Dashboard.tsx index 8c4b9b1..145a235 100644 --- a/src/dashboard/Dashboard.tsx +++ b/src/dashboard/Dashboard.tsx @@ -34,18 +34,18 @@ const Dashboard = () => { const handleMainTabChange = (tabId: MainTab) => { setActiveMainTab(tabId); - // Set default sub tab based on main tab, but none for customer-details + // Set default sub tab based on main tab - always first form const defaultSubTabs: Record = { 'transactions': 'bank-transfer', 'summary': 'branch-summary', - 'accounts': 'fixed-deposit', - 'create-account': 'fixed-deposit-new', - 'users': 'customers', + 'accounts': 'account-details', + 'create-account': 'joint-account-new', + 'users': 'create-user', 'customer-details': 'customer-info', - 'branches': 'summary', + 'branches': 'create-branch', 'savings-plans': 'create', 'my-profile': 'details', - 'fixed-deposits': 'fixed-deposit', + 'fixed-deposits': 'create-fd', }; setActiveSubTab(defaultSubTabs[tabId]); }; diff --git a/src/dashboard/forms/CreateBranchForm.tsx b/src/dashboard/forms/CreateBranchForm.tsx index 7a9f267..9e3447f 100644 --- a/src/dashboard/forms/CreateBranchForm.tsx +++ b/src/dashboard/forms/CreateBranchForm.tsx @@ -1,5 +1,4 @@ import React, { useState } from 'react'; -import { SubmitButton } from '../../components/common'; import type { CreateBranch, BranchDetails } from '../../features/branch'; interface CreateBranchFormProps { @@ -78,11 +77,11 @@ const CreateBranchForm: React.FC = ({ onSuccess, isLoadin } return ( - + {/* Parent handles API errors; this form shows local success state only */}
-
-