icon bug solved in edit profile

This commit is contained in:
Senthamilselvi 2025-11-06 17:12:02 +05:30
parent 9d0aca9f59
commit c5a8cb33f4
2 changed files with 33 additions and 64 deletions

View File

@ -264,45 +264,28 @@ export const TextField = ({
className="pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4"
/>
)}
{isPasswordField && showToggle && (
<button
type="button"
onClick={() => setShowPassword((prev) => !prev)}
className="absolute right-3 top-1/2 -translate-y-1/2 text-[#92722A] hover:text-[#7b5c1f]"
aria-label={showPassword ? toggleLabels.hide : toggleLabels.show}
title={showPassword ? toggleLabels.hide : toggleLabels.show}
>
{showPassword ? (
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-4 w-4"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<path strokeLinecap="round" strokeLinejoin="round" d="M3 3l18 18" />
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M10.58 10.58A2 2 0 0012 14a2 2 0 001.42-.58M16.68 16.68C15.28 17.54 13.69 18 12 18 7 18 3.73 14.82 2 12c.58-.9 1.34-1.83 2.26-2.68M9.88 4.13C10.56 4.05 11.27 4 12 4c5 0 8.27 3.18 10 6-.46.72-1.03 1.43-1.71 2.1"
/>
</svg>
) : (
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-4 w-4"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
>
<path strokeLinecap="round" strokeLinejoin="round" d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8S1 12 1 12z" />
<circle cx="12" cy="12" r="3" />
</svg>
)}
</button>
)}
{isPasswordField && showToggle && (
<button
type="button"
onClick={() => setShowPassword((prev) => !prev)}
className="absolute right-3 top-1/2 -translate-y-1/2 text-[#92722A] hover:text-[#7b5c1f]"
aria-label={showPassword ? toggleLabels.hide : toggleLabels.show}
title={showPassword ? toggleLabels.hide : toggleLabels.show}
>
{showPassword ? (
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path strokeLinecap="round" strokeLinejoin="round" d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8S1 12 1 12z" />
<circle cx="12" cy="12" r="3" />
</svg>
) : (
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path strokeLinecap="round" strokeLinejoin="round" d="M3 3l18 18" />
<path strokeLinecap="round" strokeLinejoin="round" d="M10.58 10.58A2 2 0 0012 14a2 2 0 001.42-.58M16.68 16.68C15.28 17.54 13.69 18 12 18 7 18 3.73 14.82 2 12c.58-.9 1.34-1.83 2.26-2.68M9.88 4.13C10.56 4.05 11.27 4 12 4c5 0 8.27 3.18 10 6-.46.72-1.03 1.43-1.71 2.1" />
</svg>
)}
</button>
)}
</div>
{error && <p className="mt-1 text-xs text-[#B91C1C]">{error}</p>}
</div>

View File

@ -479,7 +479,7 @@ useEffect(() => {
establishment_city_town_id: form.contactCityTownId ? Number(form.contactCityTownId) : null,
establishment_emirate_id: form.contactEmirateId ? Number(form.contactEmirateId) : null,
corporate_city_town_id: form.corporateCityTownId ? Number(form.corporateCityTownId) : null,
corporate_emirate_id: form.corporateEmirateId ? Number(form.corporateEmirateId) : null,
corporate_emirate_id: form.corporateEmirateId ? Number(form.corporateEmirateId) : null,
establishment_postal_code: form.contactPostalCode || "",
establishment_po_box: form.contactPoBox || "",
establishment_makani_number: form.contactMakaniNumber || "",
@ -511,28 +511,27 @@ useEffect(() => {
(Number(form.employmentEmiratiFemale) || 0) +
(Number(form.employmentNonEmiratiMale) || 0) +
(Number(form.employmentNonEmiratiFemale) || 0),
updated_by: 1
updated_by: 1,
};
console.log("Payload sent:", establishmentData);
if (establishmentId) {
console.log('Updating establishment with ID:', establishmentId);
await updateEstablishment(establishmentId, establishmentData);
alert('Profile updated successfully!');
console.log("Updating establishment with ID:", establishmentId);
await updateEstablishment(establishmentId, establishmentData);
console.log("Profile updated successfully!");
onClose();
} else {
console.error('No establishment ID provided for update');
alert('Error: No establishment ID provided for update');
console.error("No establishment ID provided for update");
alert("Error: No establishment ID provided for update");
}
} catch (error) {
console.error('Error saving profile:', error);
alert('Failed to update profile. Please try again.');
console.error("Error saving profile:", error);
alert("Failed to update profile. Please try again.");
} finally {
setLoading(false);
}
};
};
const renderStepContent = () => {
switch (activeStep) {
@ -563,7 +562,7 @@ useEffect(() => {
/>
<div className="space-y-1">
<TextField
label="New Password"
label="Password"
value={form.userProfilePassword || ""}
onChange={(e) => handleFormChange("userProfilePassword", e.target.value)}
placeholder="Enter password"
@ -575,19 +574,6 @@ useEffect(() => {
{passwordError && <p className="text-xs text-[#B91C1C]">{passwordError}</p>}
{passwordReuseError && <p className="text-xs text-[#B91C1C]">{passwordReuseError}</p>}
</div>
<div className="space-y-1">
<TextField
label="Confirm Password"
value={form.userProfileConfirmPassword || ""}
onChange={(e) => handleFormChange("userProfileConfirmPassword", e.target.value)}
placeholder="Confirm password"
width="100%"
type="password"
showToggle
className={confirmError ? 'border-red-500' : ''}
/>
{confirmError && <p className="text-xs text-[#B91C1C]">{confirmError}</p>}
</div>
</div>
</div>
</div>