diff --git a/Android/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ProgressDialogBinding.class.uniqueId4 b/Android/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ProgressDialogBinding.class.uniqueId4 index f170ead6..e69de29b 100644 Binary files a/Android/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ProgressDialogBinding.class.uniqueId4 and b/Android/app/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/ProgressDialogBinding.class.uniqueId4 differ diff --git a/backend/index.js b/backend/index.js index 6fa707ad..f28fdc6e 100644 --- a/backend/index.js +++ b/backend/index.js @@ -42,8 +42,7 @@ app.use("/auth", authRoutes); app.use("/api", routes); app.use("/api", passwordResetRoutes); app.use("/vpi", userRoutes); -app.use("/api", adminRegistrationRoutes); - +app.use("/api/v1", adminRegistrationRoutes); const PORT = process.env.PORT || 3000; app.listen(PORT, () => { diff --git a/src/Admin/Pages/VigyForm.css b/src/Admin/Pages/VigyForm.css new file mode 100644 index 00000000..3f5f31b1 --- /dev/null +++ b/src/Admin/Pages/VigyForm.css @@ -0,0 +1,17 @@ +.vigy-form .nav-pills .nav-link.active { + background-color: #007bff; + color: #fff; +} + +.vigy-form .nav-pills .nav-link { + cursor: pointer; +} + +.vigy-form .form-check-label { + display: block; + margin-top: 1rem; +} + +.vigy-form .form-check-label input { + margin-right: 0.5rem; +} diff --git a/src/Admin/Pages/VigyForm.jsx b/src/Admin/Pages/VigyForm.jsx index fb6581cc..18660ffd 100644 --- a/src/Admin/Pages/VigyForm.jsx +++ b/src/Admin/Pages/VigyForm.jsx @@ -1,33 +1,35 @@ -import React, { useState } from 'react'; -import { Link } from 'react-router-dom'; -import InputField from '../components/RegisterAdmin/InputField'; -import SelectField from '../components/RegisterAdmin/SelectField'; -import FileInput from '../components/RegisterAdmin/FileInput'; -import Swal from 'sweetalert2'; - +import React, { useState } from "react"; +import { Link } from "react-router-dom"; +import InputField from "../components/RegisterAdmin/InputField"; +import SelectField from "../components/RegisterAdmin/SelectField"; +import FileInput from "../components/RegisterAdmin/FileInput"; +import Swal from "sweetalert2"; +import axios from "axios"; +import { ClipLoader } from "react-spinners"; const VigyForm = () => { - const [activeTab, setActiveTab] = useState('personal'); + const [activeTab, setActiveTab] = useState("personal"); const [formData, setFormData] = useState({ personal: {}, contact: {}, banking: {}, verification: {}, - additional: {} + additional: {}, }); + const [loading, setLoading] = useState(false); // Add this line const tabs = [ - { id: 'personal', label: 'Personal' }, - { id: 'contact', label: 'Contact' }, - { id: 'banking', label: 'Banking' }, - { id: 'verification', label: 'Verification' }, - { id: 'additional', label: 'Additional' }, + { id: "personal", label: "Personal" }, + { id: "contact", label: "Contact" }, + { id: "banking", label: "Banking" }, + { id: "verification", label: "Verification" }, + { id: "additional", label: "Additional" }, ]; const handleTabChange = (direction) => { - const currentIndex = tabs.findIndex(tab => tab.id === activeTab); + const currentIndex = tabs.findIndex((tab) => tab.id === activeTab); let newIndex; - if (direction === 'next') { + if (direction === "next") { newIndex = Math.min(currentIndex + 1, tabs.length - 1); } else { newIndex = Math.max(currentIndex - 1, 0); @@ -41,243 +43,247 @@ const VigyForm = () => { const handleInputChange = (e) => { const { name, value, type } = e.target; let processedValue = value; - - if (type === 'file') { + + if (type === "file") { processedValue = e.target.files[0]; } else { const inputProcessors = { - aadhaarNumber: val => val.replace(/\D/g, '').slice(0, 12), - phoneNumber: val => val.replace(/\D/g, '').slice(0, 10), - email: val => val.toLowerCase(), - bankAccountName: val => val.toUpperCase(), - bankBranch: val => val.toUpperCase(), - ifscCode: val => val.toUpperCase(), - bankAccountNumber: val => val.replace(/\D/g, '').slice(0, 18), - }; - - processedValue = inputProcessors[name] ? inputProcessors[name](value) : value; - } + aadhaarNumber: (val) => val.replace(/\D/g, "").slice(0, 12), + phoneNumber: (val) => val.replace(/\D/g, "").slice(0, 10), + email: (val) => val.toLowerCase(), + bankAccountName: (val) => val.toUpperCase(), + bankBranch: (val) => val.toUpperCase(), + ifscCode: (val) => val.toUpperCase(), + bankAccountNumber: (val) => val.replace(/\D/g, "").slice(0, 18), + }; - setFormData(prevData => ({ - ...prevData, - [activeTab]: { - ...prevData[activeTab], - [name]: processedValue + processedValue = inputProcessors[name] + ? inputProcessors[name](value) + : value; } - })); -}; + + setFormData((prevData) => ({ + ...prevData, + [activeTab]: { + ...prevData[activeTab], + [name]: processedValue, + }, + })); + }; const validateEmail = (email) => { - return email.includes('@'); + return email.includes("@"); }; const indianBanks = [ - { value: '', label: 'Select bank' }, - { value: 'SBI', label: 'State Bank of India' }, - { value: 'HDFC', label: 'HDFC Bank' }, - { value: 'ICICI', label: 'ICICI Bank' }, - { value: 'PNB', label: 'Punjab National Bank' }, - { value: 'BOB', label: 'Bank of Baroda' }, - { value: 'AXIS', label: 'Axis Bank' }, - { value: 'KOTAK', label: 'Kotak Mahindra Bank' }, - { value: 'IDBI', label: 'IDBI Bank' }, - { value: 'UBI', label: 'Union Bank of India' }, - { value: 'CANARA', label: 'Canara Bank' }, + { value: "", label: "Select bank" }, + { value: "SBI", label: "State Bank of India" }, + { value: "HDFC", label: "HDFC Bank" }, + { value: "ICICI", label: "ICICI Bank" }, + { value: "PNB", label: "Punjab National Bank" }, + { value: "BOB", label: "Bank of Baroda" }, + { value: "AXIS", label: "Axis Bank" }, + { value: "KOTAK", label: "Kotak Mahindra Bank" }, + { value: "IDBI", label: "IDBI Bank" }, + { value: "UBI", label: "Union Bank of India" }, + { value: "CANARA", label: "Canara Bank" }, ]; const renderTabContent = () => { const currentFormData = formData[activeTab] || {}; switch (activeTab) { - case 'personal': + case "personal": return ( <> - - - - ); - case 'contact': + case "contact": return ( <> - - - ); - case 'banking': + case "banking": return ( <> - - - - - - ); - case 'verification': + case "verification": return ( <>

- Verification Documents (only 50kb max, .pdf, .jpg, .jpeg, .png) + Verification Documents{" "} + + (only 50kb max, .pdf, .jpg, .jpeg, .png) +

- - - + - ); - case 'additional': + case "additional": return ( <> - - ); @@ -288,14 +294,23 @@ const VigyForm = () => { const handleSubmit = async (e) => { e.preventDefault(); + setLoading(true); // Add this line const formDataToSend = new FormData(); // Append all form fields to formDataToSend - Object.keys(formData).forEach(tab => { - Object.keys(formData[tab]).forEach(field => { - if (field === 'panCard' || field === 'addressProof' || field === 'profilePicture') { - formDataToSend.append(field, formData[tab][field], formData[tab][field].name); + Object.keys(formData).forEach((tab) => { + Object.keys(formData[tab]).forEach((field) => { + if ( + field === "panCard" || + field === "addressProof" || + field === "profilePicture" + ) { + formDataToSend.append( + field, + formData[tab][field], + formData[tab][field].name + ); } else { formDataToSend.append(field, formData[tab][field]); } @@ -303,25 +318,41 @@ const VigyForm = () => { }); try { - const response = await axios.post('http://localhost:8080/api/vigy_form', formDataToSend, { - headers: { - 'Content-Type': 'multipart/form-data', - }, - }); + const response = await axios.post( + "https://vigybag-backend.onrender.com/api/v1/vigy_form", + formDataToSend, + { + headers: { + "Content-Type": "multipart/form-data", + }, + } + ); console.log(response.data); - console.log('Form submitted successfully!'); - // Handle successful submission (e.g., show success message, redirect) + console.log("Form submitted successfully!"); + Swal.fire({ + icon: "success", + title: "Success", + text: "Form submitted successfully!", + }); } catch (error) { - console.error('Error submitting form:', error); - // Handle error (e.g., show error message) + console.error("Error submitting form:", error); + Swal.fire({ + icon: "error", + title: "Error", + text: "There was an error submitting the form.", + }); + } finally { + setLoading(false); // Add this line } }; return ( -
+
-

Registration Form

- +

+ Registration Form +

+
{tabs.map((tab) => ( @@ -329,8 +360,8 @@ const VigyForm = () => { key={tab.id} className={`px-4 py-2 text-sm sm:text-base ${ activeTab === tab.id - ? 'border-b-2 border-blue-500 text-blue-600' - : 'text-gray-500 hover:text-gray-700' + ? "border-b-2 border-blue-500 text-blue-600" + : "text-gray-500 hover:text-gray-700" }`} onClick={() => setActiveTab(tab.id)} > @@ -340,23 +371,53 @@ const VigyForm = () => {
-
+ {renderTabContent()} - {activeTab === 'additional' && ( + {activeTab === "additional" && (
-

Terms and Conditions

+

+ Terms and Conditions +

@@ -364,28 +425,38 @@ const VigyForm = () => { )}
- {activeTab !== tabs[tabs.length - 1].id ? ( - ) : ( - )}
@@ -395,4 +466,4 @@ const VigyForm = () => { ); }; -export default VigyForm; \ No newline at end of file +export default VigyForm; diff --git a/src/User/pages/Admin-Verification/Admin.jsx b/src/User/pages/Admin-Verification/Admin.jsx index f268f8a7..4afb09dd 100644 --- a/src/User/pages/Admin-Verification/Admin.jsx +++ b/src/User/pages/Admin-Verification/Admin.jsx @@ -220,4 +220,4 @@ const AdminVerificationPage = () => { ); }; -export default AdminVerificationPage; \ No newline at end of file +export default AdminVerificationPage;