Implement Subscription History and fix Interest Status Update flow
This commit is contained in:
1 parent
4ba4ce1e1b
commit
b3d33aca9c
42 files changed
+3950
-2677
No files matched your search
@@ -126,13 +126,20 @@ const PersonalDetailsForm = ({ onSubmitStep, errors: externalErrors, onFieldChan
|
||||
dispatch(updatePersonalDetails(updates));
|
||||
if (onFieldChange) onFieldChange(fieldsToClear);
|
||||
|
||||
if (!isEditMode) {
|
||||
dispatch(clearAllStepsFrom(2));
|
||||
}
|
||||
|
||||
if (localErrors[field]) {
|
||||
setLocalErrors(prev => ({ ...prev, [field]: "" }));
|
||||
}
|
||||
|
||||
// Real-time password match validation
|
||||
if (field === "confirmPassword" || field === "password") {
|
||||
const p = field === "password" ? value : data.password;
|
||||
const cp = field === "confirmPassword" ? value : data.confirmPassword;
|
||||
if (p && cp && p !== cp) {
|
||||
setLocalErrors(prev => ({ ...prev, confirmPassword: "Passwords do not match" }));
|
||||
} else if (p && cp && p === cp) {
|
||||
setLocalErrors(prev => ({ ...prev, confirmPassword: "" }));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const handleMobileSubmit = async () => {
|
||||
@@ -198,21 +205,27 @@ const PersonalDetailsForm = ({ onSubmitStep, errors: externalErrors, onFieldChan
|
||||
|
||||
const validateForm = () => {
|
||||
const newErrors = {};
|
||||
if (!data.profile_for) newErrors.profile_for = "Required";
|
||||
if (!data.gender) newErrors.gender = "Required";
|
||||
if (!data.name) newErrors.name = "Required";
|
||||
if (!data.mobile) newErrors.mobile = "Required";
|
||||
if (!data.email) newErrors.email = "Required";
|
||||
if (!isEditMode && !data.password) newErrors.password = "Required";
|
||||
if (!isEditMode && data.password !== data.confirmPassword) newErrors.confirmPassword = "Passwords do not match";
|
||||
if (!data.marital_status) newErrors.marital_status = "Required";
|
||||
if (!data.height) newErrors.height = "Required";
|
||||
if (!data.complexion) newErrors.complexion = "Required";
|
||||
if (!data.physical_status) newErrors.physical_status = "Required";
|
||||
if (!data.mother_language) newErrors.mother_language = "Required";
|
||||
if (!data.do_you_speak_telugu && data.do_you_speak_telugu !== 0) newErrors.do_you_speak_telugu = "Required";
|
||||
if (!data.inter_caste_parents && data.inter_caste_parents !== 0) newErrors.inter_caste_parents = "Required";
|
||||
if (data.known_languages.length === 0) newErrors.known_languages = "Required";
|
||||
if (!data.profile_for) newErrors.profile_for = "Profile created for is required";
|
||||
if (!data.gender) newErrors.gender = "Gender is required";
|
||||
if (!data.name) newErrors.name = "Name is required";
|
||||
if (!data.mobile) newErrors.mobile = "Mobile number is required";
|
||||
if (!data.email) newErrors.email = "Email is required";
|
||||
if (!isEditMode && !data.password) newErrors.password = "Password is required";
|
||||
if (!isEditMode && !data.confirmPassword) newErrors.confirmPassword = "Confirm Password is required";
|
||||
if (!isEditMode && data.password && data.confirmPassword && data.password !== data.confirmPassword) {
|
||||
newErrors.confirmPassword = "Passwords do not match";
|
||||
}
|
||||
if (!data.caste) newErrors.caste = "Caste is required";
|
||||
if (!data.sub_caste) newErrors.sub_caste = "Sub-Sect is required";
|
||||
|
||||
if (!data.marital_status) newErrors.marital_status = "Marital status is required";
|
||||
if (!data.height) newErrors.height = "Height is required";
|
||||
if (!data.complexion) newErrors.complexion = "Complexion is required";
|
||||
if (!data.physical_status) newErrors.physical_status = "Physical status is required";
|
||||
if (!data.mother_language) newErrors.mother_language = "Mother tongue is required";
|
||||
if (!data.do_you_speak_telugu && data.do_you_speak_telugu !== 0) newErrors.do_you_speak_telugu = "Telugu speaking status is required";
|
||||
if (!data.inter_caste_parents && data.inter_caste_parents !== 0) newErrors.inter_caste_parents = "Inter-caste parents status is required";
|
||||
if (data.known_languages.length === 0) newErrors.known_languages = "Known languages are required";
|
||||
|
||||
setLocalErrors(newErrors);
|
||||
return Object.keys(newErrors).length === 0;
|
||||
@@ -260,21 +273,27 @@ const PersonalDetailsForm = ({ onSubmitStep, errors: externalErrors, onFieldChan
|
||||
// 2. Perform general form validation
|
||||
if (!validateForm()) {
|
||||
const newErrors = {};
|
||||
if (!data.profile_for) newErrors.profile_for = "Required";
|
||||
if (!data.gender) newErrors.gender = "Required";
|
||||
if (!data.name) newErrors.name = "Required";
|
||||
if (!data.mobile) newErrors.mobile = "Required";
|
||||
if (!data.email) newErrors.email = "Required";
|
||||
if (!isEditMode && !data.password) newErrors.password = "Required";
|
||||
if (!isEditMode && data.password !== data.confirmPassword) newErrors.confirmPassword = "Passwords do not match";
|
||||
if (!data.marital_status) newErrors.marital_status = "Required";
|
||||
if (!data.height) newErrors.height = "Required";
|
||||
if (!data.complexion) newErrors.complexion = "Required";
|
||||
if (!data.physical_status) newErrors.physical_status = "Required";
|
||||
if (!data.mother_language) newErrors.mother_language = "Required";
|
||||
if (!data.do_you_speak_telugu && data.do_you_speak_telugu !== 0) newErrors.do_you_speak_telugu = "Required";
|
||||
if (!data.inter_caste_parents && data.inter_caste_parents !== 0) newErrors.inter_caste_parents = "Required";
|
||||
if (data.known_languages.length === 0) newErrors.known_languages = "Required";
|
||||
if (!data.profile_for) newErrors.profile_for = "Profile created for is required";
|
||||
if (!data.gender) newErrors.gender = "Gender is required";
|
||||
if (!data.name) newErrors.name = "Name is required";
|
||||
if (!data.mobile) newErrors.mobile = "Mobile number is required";
|
||||
if (!data.email) newErrors.email = "Email is required";
|
||||
if (!isEditMode && !data.password) newErrors.password = "Password is required";
|
||||
if (!isEditMode && !data.confirmPassword) newErrors.confirmPassword = "Confirm Password is required";
|
||||
if (!isEditMode && data.password && data.confirmPassword && data.password !== data.confirmPassword) {
|
||||
newErrors.confirmPassword = "Passwords do not match";
|
||||
}
|
||||
if (!data.caste) newErrors.caste = "Caste is required";
|
||||
if (!data.sub_caste) newErrors.sub_caste = "Sub-Sect is required";
|
||||
|
||||
if (!data.marital_status) newErrors.marital_status = "Marital status is required";
|
||||
if (!data.height) newErrors.height = "Height is required";
|
||||
if (!data.complexion) newErrors.complexion = "Complexion is required";
|
||||
if (!data.physical_status) newErrors.physical_status = "Physical status is required";
|
||||
if (!data.mother_language) newErrors.mother_language = "Mother tongue is required";
|
||||
if (!data.do_you_speak_telugu && data.do_you_speak_telugu !== 0) newErrors.do_you_speak_telugu = "Telugu speaking status is required";
|
||||
if (!data.inter_caste_parents && data.inter_caste_parents !== 0) newErrors.inter_caste_parents = "Inter-caste parents status is required";
|
||||
if (data.known_languages.length === 0) newErrors.known_languages = "Known languages are required";
|
||||
|
||||
toast.error("Please fill all mandatory fields");
|
||||
scrollToError(newErrors);
|
||||
@@ -581,8 +600,8 @@ const PersonalDetailsForm = ({ onSubmitStep, errors: externalErrors, onFieldChan
|
||||
|
||||
{/* 14. Caste / Community */}
|
||||
<div className="flex flex-col gap-2">
|
||||
<label className="text-gray-900 text-[15px]">Caste / Community</label>
|
||||
<FormControl fullWidth disabled={casteQuery.isLoading}>
|
||||
<label className="text-gray-900 text-[15px]">Caste / Community{requiredMark}</label>
|
||||
<FormControl fullWidth disabled={casteQuery.isLoading} error={Boolean(errors.caste)} id="caste">
|
||||
<InputLabel>Select Caste</InputLabel>
|
||||
<Select
|
||||
value={data.caste}
|
||||
@@ -593,13 +612,14 @@ const PersonalDetailsForm = ({ onSubmitStep, errors: externalErrors, onFieldChan
|
||||
<MenuItem key={opt.id} value={opt.id}>{opt.caste_name}</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
{errors.caste && <FormHelperText>{errors.caste}</FormHelperText>}
|
||||
</FormControl>
|
||||
</div>
|
||||
|
||||
{/* 15. Sub-Sect */}
|
||||
<div className="flex flex-col gap-2">
|
||||
<label className="text-gray-900 text-[15px]">Sub-Sect{requiredMark}</label>
|
||||
<FormControl fullWidth disabled={!data.caste || subCasteQuery.isLoading} id="sub_caste">
|
||||
<FormControl fullWidth disabled={!data.caste || subCasteQuery.isLoading} error={Boolean(errors.sub_caste)} id="sub_caste">
|
||||
<InputLabel>Select Sub-Sect</InputLabel>
|
||||
<Select
|
||||
value={data.sub_caste}
|
||||
@@ -610,6 +630,7 @@ const PersonalDetailsForm = ({ onSubmitStep, errors: externalErrors, onFieldChan
|
||||
<MenuItem key={opt.id} value={opt.id}>{opt.sub_caste_name}</MenuItem>
|
||||
))}
|
||||
</Select>
|
||||
{errors.sub_caste && <FormHelperText>{errors.sub_caste}</FormHelperText>}
|
||||
</FormControl>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user