Ignore:
Timestamp:
06/17/24 21:59:14 (5 months ago)
Author:
223021 <daniel.ilievski.2@…>
Branches:
main
Children:
08f82ec
Parents:
b248810
Message:

Added an edit profile page for both job seekers and recruiters, where they can upload profile pictures/company logos and edit their profile data. Added profile page specifically for recruiters. Refactored existing code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jobvista-frontend/src/views/admin_panel/AdminPanel.js

    rb248810 rbefb988  
    44import {useState, useEffect} from "react";
    55import {AdminActions} from "../../redux/actions/adminActions";
     6import {notifyAccessUpdate} from "../../utils/toastUtils";
    67
    78export const AdminPanel = () => {
     
    2425            setRecruiters(recruitersState)
    2526            console.log("Fetch all recruiters STATE")
     27            console.log(recruitersState)
     28
    2629        }
    2730    }, [recruitersState])
     
    3235    };
    3336
    34     const handleAccessChange = (recruiterId, newAccessStatus) => {
     37    const handleAccessChange = (recruiterId, companyName, newAccessStatus) => {
     38
    3539        setRecruiters(prevState =>
    3640            prevState.map(recruiter =>
     
    4145        );
    4246
    43         console.log(recruiterId + " " + newAccessStatus)
    44 
    4547        dispatch(AdminActions.changeAccess(recruiterId, newAccessStatus, (success, response) => {
    4648            if(success) {
    47                 console.log("Access changed")
     49                notifyAccessUpdate(companyName)
    4850            }
    4951        }));
     
    5153
    5254    return (
    53         <div className="applications-container mt-5">
     55        <div className="custom-container mt-5">
    5456            <table className="table table-striped">
    5557                <thead>
     
    6466                </thead>
    6567                <tbody>
    66                 {recruiters.map((recruiter) => (
     68                {recruitersState.map((recruiter) => (
    6769                    <tr key={recruiter.id}>
    6870                        <th scope="row">{recruiter.id}</th>
     
    7072                        <td>{recruiter.email}</td>
    7173                        <td>{recruiter.companyName}</td>
    72                         <td>{recruiter.phoneNumber}</td>
     74                        <td>{recruiter.contactPhoneNumber}</td>
    7375                        <td>
    7476                            <label className="switch">
     
    7678                                    type="checkbox"
    7779                                    checked={recruiter.hasAccess}
    78                                     onChange={(e) => handleAccessChange(recruiter.id, e.target.checked)}
     80                                    onChange={(e) => handleAccessChange(recruiter.id, recruiter.companyName, e.target.checked)}
    7981                                />
    8082                                <span className="slider"></span>
Note: See TracChangeset for help on using the changeset viewer.