fix(api): fix api endpoint logic #3

This commit is contained in:
shafin-r
2025-08-17 19:59:14 +06:00
parent 4f23f357e6
commit e3673951c6
7 changed files with 231 additions and 170 deletions

View File

@ -19,10 +19,15 @@ export default function ProfileManager({
setUserData((prev) => (prev ? { ...prev, [field]: value } : prev));
};
console.log(userData);
return (
<div className="mx-auto">
<div className="space-y-4">
{/* Full Name */}
<h1 className="text-xl font-semibold tracking-tight">
Personal Information
</h1>
<div className="space-y-2">
<Label
htmlFor="full_name"
@ -39,61 +44,24 @@ export default function ProfileManager({
readOnly={!edit}
/>
</div>
{/* College */}
<div className="space-y-2">
<Label
htmlFor="college"
htmlFor="username"
className="text-sm font-semibold text-gray-700"
>
College
Username
</Label>
<Input
id="college"
id="username"
type="text"
value={userData.college}
onChange={(e) => handleChange("college", e.target.value)}
value={userData.username}
onChange={(e) => handleChange("username", e.target.value)}
className="bg-gray-50 py-6"
readOnly={!edit}
/>
</div>
{/* SSC & HSC Rolls */}
<div className="flex gap-4">
<div className="space-y-2 w-full">
<Label
htmlFor="ssc_roll"
className="text-sm font-semibold text-gray-700"
>
SSC Roll
</Label>
<Input
id="ssc_roll"
type="number"
value={userData.ssc_roll}
onChange={(e) => handleChange("ssc_roll", Number(e.target.value))}
className="bg-gray-50 py-6"
readOnly={!edit}
/>
</div>
<div className="space-y-2 w-full">
<Label
htmlFor="hsc_roll"
className="text-sm font-semibold text-gray-700"
>
HSC Roll
</Label>
<Input
id="hsc_roll"
type="number"
value={userData.hsc_roll}
onChange={(e) => handleChange("hsc_roll", Number(e.target.value))}
className="bg-gray-50 py-6"
readOnly={!edit}
/>
</div>
</div>
{/* Email */}
<div className="space-y-2">
@ -130,6 +98,111 @@ export default function ProfileManager({
readOnly={!edit}
/>
</div>
<h1 className="text-xl tracking-tight font-semibold">
Educational Background
</h1>
<div className="space-y-2">
<Label
htmlFor="preparation_unit"
className="text-sm font-semibold text-gray-700"
>
Unit
</Label>
<Input
id="preparation_unit"
type="text"
value={userData.preparation_unit}
onChange={(e) => handleChange("preparation_unit", e.target.value)}
className="bg-gray-50 py-6"
readOnly={!edit}
/>
</div>
<div className="space-y-2">
<Label
htmlFor="college"
className="text-sm font-semibold text-gray-700"
>
College
</Label>
<Input
id="college"
type="text"
value={userData.college}
onChange={(e) => handleChange("college", e.target.value)}
className="bg-gray-50 py-6"
readOnly={!edit}
/>
</div>
<div className="flex gap-4">
<div className="space-y-2 w-full">
<Label
htmlFor="ssc_roll"
className="text-sm font-semibold text-gray-700"
>
SSC Roll
</Label>
<Input
id="ssc_roll"
type="number"
value={userData.ssc_roll}
onChange={(e) => handleChange("ssc_roll", Number(e.target.value))}
className="bg-gray-50 py-6"
readOnly={!edit}
/>
</div>
<div className="space-y-2 w-full">
<Label
htmlFor="ssc_board"
className="text-sm font-semibold text-gray-700"
>
SSC Board
</Label>
<Input
id="ssc_board"
type="text"
value={userData.ssc_board}
onChange={(e) => handleChange("ssc_board", e.target.value)}
className="bg-gray-50 py-6"
readOnly={!edit}
/>
</div>
</div>
<div className="flex gap-4">
<div className="space-y-2 w-full">
<Label
htmlFor="hsc_roll"
className="text-sm font-semibold text-gray-700"
>
HSC Roll
</Label>
<Input
id="hsc_roll"
type="number"
value={userData.hsc_roll}
onChange={(e) => handleChange("hsc_roll", Number(e.target.value))}
className="bg-gray-50 py-6"
readOnly={!edit}
/>
</div>
<div className="space-y-2 w-full">
<Label
htmlFor="hsc_board"
className="text-sm font-semibold text-gray-700"
>
HSC Board
</Label>
<Input
id="hsc_board"
type="text"
value={userData.hsc_board}
onChange={(e) => handleChange("hsc_board", e.target.value)}
className="bg-gray-50 py-6"
readOnly={!edit}
/>
</div>
</div>
</div>
</div>
);