File tree Expand file tree Collapse file tree 4 files changed +34
-1
lines changed Expand file tree Collapse file tree 4 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,15 @@ export async function PUT(
53
53
}
54
54
}
55
55
56
+ if ( data . isActive !== undefined ) {
57
+ if ( typeof data . isActive !== "boolean" ) {
58
+ return NextResponse . json (
59
+ { message : "isActive must be a boolean value" } ,
60
+ { status : 400 } ,
61
+ ) ;
62
+ }
63
+ }
64
+
56
65
const response = await axios . put (
57
66
`${ process . env . NEXT_PUBLIC_API_URL } /api/referrals/${ id } ` ,
58
67
data ,
Original file line number Diff line number Diff line change @@ -253,7 +253,9 @@ const MyProfile: React.FC = () => {
253
253
</ p >
254
254
255
255
{ /* Alumni Details */ }
256
- { ( data . role === "alumni" || data . role === "admin" ) &&
256
+ { ( data . role === "alumni" ||
257
+ data . role === "admin" ||
258
+ ( data . role === "student" && data . alumniDetails ?. verified === false ) ) &&
257
259
data . alumniDetails && (
258
260
< div className = "space-y-6 border-t border-gray-200 pt-6" >
259
261
{ data . alumniDetails . verified === false && (
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export default function UpdateReferral({
29
29
setIsOpen,
30
30
refetch,
31
31
} : EditReferralProps ) {
32
+ console . log ( "Editing referral:" , referral ) ;
32
33
const [ formData , setFormData ] = useState < ReferralFormData > ( {
33
34
jobDetails : {
34
35
title : referral . jobDetails . title ,
@@ -39,6 +40,7 @@ export default function UpdateReferral({
39
40
} ,
40
41
lastApplyDate : referral . lastApplyDate . split ( "T" ) [ 0 ] ,
41
42
numberOfReferrals : referral . numberOfReferrals ,
43
+ isActive : referral . isActive ,
42
44
} ) ;
43
45
44
46
const updateReferralMutation = useMutation ( {
@@ -195,6 +197,25 @@ export default function UpdateReferral({
195
197
/>
196
198
</ LabelInputContainer >
197
199
200
+ < LabelInputContainer >
201
+ < label htmlFor = "isActive" className = "flex items-center space-x-2" >
202
+ < span > Active</ span >
203
+ < Input
204
+ id = "isActive"
205
+ name = "isActive"
206
+ type = "checkbox"
207
+ checked = { formData . isActive }
208
+ onChange = { ( e ) =>
209
+ setFormData ( ( prev ) => ( {
210
+ ...prev ,
211
+ isActive : e . target . checked ,
212
+ } ) )
213
+ }
214
+ className = "w-4 h-4"
215
+ />
216
+ </ label >
217
+ </ LabelInputContainer >
218
+
198
219
< Button
199
220
type = "submit"
200
221
className = "w-full"
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export interface ReferralFormData {
25
25
jobDetails : JobDetails ;
26
26
lastApplyDate : string ;
27
27
numberOfReferrals : number ;
28
+ isActive ?: boolean ;
28
29
}
29
30
30
31
export interface ReferralFilters {
You can’t perform that action at this time.
0 commit comments