vs4vijay commited on
Commit
4c5c200
·
verified ·
1 Parent(s): f3888ac

Add 1 files

Browse files
Files changed (1) hide show
  1. index.html +110 -3
index.html CHANGED
@@ -70,6 +70,13 @@
70
  background-color: #6e8efb !important;
71
  color: #ffffff;
72
  }
 
 
 
 
 
 
 
73
  </style>
74
  </head>
75
  <body class="bg-gray-50 min-h-screen">
@@ -95,6 +102,16 @@
95
 
96
  <!-- Main Content -->
97
  <main class="container mx-auto px-4 py-8">
 
 
 
 
 
 
 
 
 
 
98
  <!-- Hero Section -->
99
  <section class="mb-12">
100
  <div class="bg-white rounded-xl p-8 card-shadow">
@@ -109,6 +126,9 @@
109
  <button id="exploreBtn" class="border border-purple-600 text-purple-600 hover:bg-purple-50 px-6 py-3 rounded-lg font-medium transition duration-300 flex items-center">
110
  <i class="fas fa-search mr-2"></i> Explore Cards
111
  </button>
 
 
 
112
  </div>
113
  </div>
114
  <div class="md:w-1/2 flex justify-center">
@@ -145,9 +165,14 @@
145
  <section class="mb-12">
146
  <div class="flex justify-between items-center mb-6">
147
  <h2 class="text-2xl font-bold text-gray-800">My Credit Cards</h2>
148
- <button id="refreshCardsBtn" class="text-purple-600 hover:text-purple-800 flex items-center">
149
- <i class="fas fa-sync-alt mr-2"></i> Refresh
150
- </button>
 
 
 
 
 
151
  </div>
152
  <div id="myCardsContainer" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
153
  <!-- Cards will be added here dynamically -->
@@ -566,10 +591,15 @@
566
  const cardNameInput = document.getElementById('cardName');
567
  const myCardsContainer = document.getElementById('myCardsContainer');
568
  const refreshCardsBtn = document.getElementById('refreshCardsBtn');
 
 
569
  const chatContainer = document.getElementById('chatContainer');
570
  const chatInput = document.getElementById('chatInput');
571
  const sendChatBtn = document.getElementById('sendChatBtn');
572
  const quickQuestionBtns = document.querySelectorAll('.quick-question-btn');
 
 
 
573
 
574
  // Modal toggle
575
  addCardBtn.addEventListener('click', () => {
@@ -1012,6 +1042,83 @@
1012
  addChatMessage('assistant', 'Your cards have been refreshed!');
1013
  });
1014
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1015
  // Initial render
1016
  renderCards();
1017
  </script>
 
70
  background-color: #6e8efb !important;
71
  color: #ffffff;
72
  }
73
+ .rotate {
74
+ animation: rotate 1s linear infinite;
75
+ }
76
+ @keyframes rotate {
77
+ from { transform: rotate(0deg); }
78
+ to { transform: rotate(360deg); }
79
+ }
80
  </style>
81
  </head>
82
  <body class="bg-gray-50 min-h-screen">
 
102
 
103
  <!-- Main Content -->
104
  <main class="container mx-auto px-4 py-8">
105
+ <!-- Sync Status Bar -->
106
+ <div id="syncStatus" class="hidden bg-blue-100 border-l-4 border-blue-500 text-blue-700 p-4 mb-6 rounded">
107
+ <div class="flex items-center">
108
+ <div id="syncSpinner" class="mr-3 rotate">
109
+ <i class="fas fa-sync-alt text-blue-500"></i>
110
+ </div>
111
+ <p id="syncMessage">Syncing your cards from connected banks...</p>
112
+ </div>
113
+ </div>
114
+
115
  <!-- Hero Section -->
116
  <section class="mb-12">
117
  <div class="bg-white rounded-xl p-8 card-shadow">
 
126
  <button id="exploreBtn" class="border border-purple-600 text-purple-600 hover:bg-purple-50 px-6 py-3 rounded-lg font-medium transition duration-300 flex items-center">
127
  <i class="fas fa-search mr-2"></i> Explore Cards
128
  </button>
129
+ <button id="syncCardsBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg font-medium transition duration-300 flex items-center">
130
+ <i class="fas fa-sync-alt mr-2"></i> Sync Cards
131
+ </button>
132
  </div>
133
  </div>
134
  <div class="md:w-1/2 flex justify-center">
 
165
  <section class="mb-12">
166
  <div class="flex justify-between items-center mb-6">
167
  <h2 class="text-2xl font-bold text-gray-800">My Credit Cards</h2>
168
+ <div class="flex space-x-4">
169
+ <button id="refreshCardsBtn" class="text-purple-600 hover:text-purple-800 flex items-center">
170
+ <i class="fas fa-sync-alt mr-2"></i> Refresh
171
+ </button>
172
+ <button id="bankSyncBtn" class="text-blue-600 hover:text-blue-800 flex items-center">
173
+ <i class="fas fa-university mr-2"></i> Sync with Banks
174
+ </button>
175
+ </div>
176
  </div>
177
  <div id="myCardsContainer" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
178
  <!-- Cards will be added here dynamically -->
 
591
  const cardNameInput = document.getElementById('cardName');
592
  const myCardsContainer = document.getElementById('myCardsContainer');
593
  const refreshCardsBtn = document.getElementById('refreshCardsBtn');
594
+ const bankSyncBtn = document.getElementById('bankSyncBtn');
595
+ const syncCardsBtn = document.getElementById('syncCardsBtn');
596
  const chatContainer = document.getElementById('chatContainer');
597
  const chatInput = document.getElementById('chatInput');
598
  const sendChatBtn = document.getElementById('sendChatBtn');
599
  const quickQuestionBtns = document.querySelectorAll('.quick-question-btn');
600
+ const syncStatus = document.getElementById('syncStatus');
601
+ const syncMessage = document.getElementById('syncMessage');
602
+ const syncSpinner = document.getElementById('syncSpinner');
603
 
604
  // Modal toggle
605
  addCardBtn.addEventListener('click', () => {
 
1042
  addChatMessage('assistant', 'Your cards have been refreshed!');
1043
  });
1044
 
1045
+ // Simulate syncing with banks
1046
+ function syncWithBanks() {
1047
+ syncStatus.classList.remove('hidden');
1048
+ syncMessage.textContent = "Connecting to your bank accounts...";
1049
+
1050
+ // Simulate API calls to different banks
1051
+ setTimeout(() => {
1052
+ syncMessage.textContent = "Fetching cards from HDFC Bank...";
1053
+
1054
+ setTimeout(() => {
1055
+ syncMessage.textContent = "Fetching cards from ICICI Bank...";
1056
+
1057
+ setTimeout(() => {
1058
+ syncMessage.textContent = "Fetching cards from SBI...";
1059
+
1060
+ setTimeout(() => {
1061
+ // Simulate finding new cards
1062
+ const newCards = [
1063
+ {
1064
+ name: "ICICI Amazon Pay",
1065
+ type: "cashback",
1066
+ annualFee: 0,
1067
+ rewardsRate: "5% cashback",
1068
+ benefits: [
1069
+ "5% cashback on Amazon",
1070
+ "2% cashback on other spends",
1071
+ "No annual fee"
1072
+ ]
1073
+ },
1074
+ {
1075
+ name: "SBI SimplyCLICK",
1076
+ type: "online shopping",
1077
+ annualFee: 499,
1078
+ rewardsRate: "10x rewards",
1079
+ benefits: [
1080
+ "10x rewards on Amazon, BookMyShow",
1081
+ "5x rewards on other online spends",
1082
+ "E-vouchers worth ₹2,000 annually"
1083
+ ]
1084
+ }
1085
+ ];
1086
+
1087
+ // Only add cards that don't already exist
1088
+ newCards.forEach(newCard => {
1089
+ if (!myCards.some(card => card.name === newCard.name)) {
1090
+ myCards.push(newCard);
1091
+ }
1092
+ });
1093
+
1094
+ renderCards();
1095
+
1096
+ syncMessage.textContent = "Sync complete! Found 2 new cards.";
1097
+ syncSpinner.classList.remove('rotate');
1098
+ syncSpinner.innerHTML = '<i class="fas fa-check-circle text-green-500"></i>';
1099
+
1100
+ setTimeout(() => {
1101
+ syncStatus.classList.add('hidden');
1102
+ syncSpinner.innerHTML = '<i class="fas fa-sync-alt text-blue-500"></i>';
1103
+ syncSpinner.classList.add('rotate');
1104
+
1105
+ if (newCards.length > 0) {
1106
+ addChatMessage('assistant', `I've found ${newCards.length} new cards in your bank accounts! They've been added to your wallet.`);
1107
+ } else {
1108
+ addChatMessage('assistant', "Your cards are up to date. No new cards found in your bank accounts.");
1109
+ }
1110
+ }, 2000);
1111
+
1112
+ }, 1500);
1113
+ }, 1500);
1114
+ }, 1500);
1115
+ }, 1000);
1116
+ }
1117
+
1118
+ // Sync buttons
1119
+ bankSyncBtn.addEventListener('click', syncWithBanks);
1120
+ syncCardsBtn.addEventListener('click', syncWithBanks);
1121
+
1122
  // Initial render
1123
  renderCards();
1124
  </script>