source: jobvista-frontend/src/views/job_advertisements/DeleteJobAdModal.js@ befb988

main
Last change on this file since befb988 was befb988, checked in by 223021 <daniel.ilievski.2@…>, 3 months ago

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.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1import React, {useState} from "react";
2import "../shared_css/Modal.css";
3
4import 'react-responsive-modal/styles.css';
5import {Modal} from 'react-responsive-modal';
6import Select from "react-select";
7
8//Validation
9import * as yup from "yup";
10import {yupResolver} from "@hookform/resolvers/yup";
11import {Controller, useForm} from "react-hook-form";
12
13
14import {employmentStatusOptions, industryOptions, jobTypeOptions} from "../selectOptions";
15import {useDispatch, useSelector} from "react-redux";
16import {JobAdvertisementActions} from "../../redux/actions/jobAdvertisementActions";
17import {notifyJobAdDelete} from "../../utils/toastUtils";
18
19
20export const DeleteJobAdModal = (jobAd) => {
21 const [modal, setModal] = useState(false);
22 const dispatch = useDispatch();
23 const auth = useSelector(state => state.auth.currentUser)
24 const toggleModal = () => {
25 setModal(!modal);
26 };
27
28 const addJobAdvertisement = async () => {
29 try {
30 dispatch(JobAdvertisementActions.deleteJobAdvertisement(jobAd.props.id, (success, response) => {
31 if (success) {
32 // console.log("Job Advertisement deleted")
33 toggleModal()
34 notifyJobAdDelete()
35 }
36 }))
37 } catch (err) {
38 console.error(err)
39 }
40 }
41
42 return (<div className="modal-wrap">
43 <i className="fa-solid fa-trash trash-delete-btn" onClick={toggleModal}></i>
44 <Modal open={modal} onClose={toggleModal} center classNames="job-advertisement-modal">
45 <i className="fa-solid fa-x btn-close-modal" style={{color: "black"}} onClick={toggleModal}></i>
46 <div className="modal-delete-content">
47 <div className="row modal-delete-content-inside">
48 <div className="col-md-1"><i className="fa-regular fa-circle-xmark x-icon"></i></div>
49 <div className="col-md-11 modal-delete-text">
50 <h4>Are you sure?</h4>
51 <p>Do you really want to delete this advertisement? This process cannot be undone.</p>
52 </div>
53 </div>
54 <div className="modal-delete-buttons">
55 <button className="cancel-btn" onClick={toggleModal}>Cancel</button>
56 <button className="delete-btn" onClick={addJobAdvertisement}> Delete</button>
57 </div>
58 </div>
59 </Modal>
60 </div>)
61}
Note: See TracBrowser for help on using the repository browser.