<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AcetylcoA Solutions - Order Codes and Prices</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 0;
            text-align: center;
        }
        header {
            background-color: #4CAF50;
            color: white;
            padding: 15px 0;
        }
        h1, h2, h3 {
            margin: 0;
        }
        .container {
            margin-top: 30px;
            padding: 20px;
        }
        .input-container {
            margin: 20px 0;
        }
        input[type="text"], input[type="submit"] {
            padding: 10px;
            width: 200px;
            margin: 5px;
        }
        #output {
            margin-top: 20px;
            font-weight: bold;
        }
        .copy-container {
            margin-top: 10px;
        }
        button {
            padding: 10px;
            cursor: pointer;
            background-color: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
        }
        button:hover {
            background-color: #45a049;
        }
        footer {
            margin-top: 30px;
            padding: 10px 0;
            background-color: #4CAF50;
            color: white;
        }
    </style>
</head>
<body>

<header>
    <h1>Welcome to AcetylcoA Solutions</h1>
    <h2>ADMIN CONTROL UNIT</h2>
    <h3>Find Codes, Items, and Prices</h3>
</header>

<div class="container">
    <div class="input-container">
        <h3>Find Order Number by Item Name:</h3>
        <input type="text" id="itemInput" placeholder="Type item name...">
        <input type="submit" value="Find Code" onclick="findCode()">
    </div>

    <div class="input-container">
        <h3>Find Item by Order Number:</h3>
        <input type="text" id="codeInput" placeholder="Type order number...">
        <input type="submit" value="Find Item" onclick="findItem()">
    </div>

    <div class="input-container">
        <h3>Find Prices by Item Name or Order Code:</h3>
        <input type="text" id="priceInput" placeholder="Type item name or code...">
        <input type="submit" value="Find Price" onclick="findPrice()">
    </div>

    <div id="output-container">
        <p id="output"></p>
        <div class="copy-container" id="copyContainer" style="display:none;">
            <button onclick="copyToClipboard()">Copy</button>
        </div>
    </div>
</div>

<script>
    const items = [
        { name: "SEMINAR REPORT", code: "SMR-A829X", prices: "Selling Price: #25,000, Returning Client: #22,000, Best Price: #20,000, Outline Writing: #3,000 - #4,000, Topic Generate: #2,000 per 3 topics" },
        { name: "SIWES REPORT", code: "SWR-T913F", prices: "Medical Field: #13,000 - #15,000, Pharmaceutical Field: #14,000 - #16,000, Industrial Field: #17,000 - #18,000, Research Institute: #15,000 - #17,000, Non-Science: #18,000 - #20,000" },
        { name: "PROJECT REPORT", code: "PJT-Z745D", prices: "Wistar Rat: #34,000 - #36,000, Gene Sequencing: #12,000 per Protein (11k each if more than one), Dr. Ajayi Student: #35,000, Dr. Adetunji Student: #35,000, Mr. Alex Student: #30,000, Prof. Oyewole Student: Undefined, Dr. Dare Student: #40,000 - #50,000" },
        { name: "CV/Resume Writing", code: "CVR-RESUME", prices: "Scholarship CV: #10,000, Job CV: #5,000, General CV: #7,000, Student CV: #4,000" }
    ];

    let currentResult = "";

    function findCode() {
        var input = document.getElementById("itemInput").value.toUpperCase();
        var output = document.getElementById("output");
        var copyContainer = document.getElementById("copyContainer");
        var found = false;

        items.forEach(function(item) {
            if (item.name.toUpperCase() === input) {
                currentResult = item.code;
                output.textContent = "Order Number for " + item.name + " is: " + item.code;
                found = true;
                copyContainer.style.display = "block";
            }
        });

        if (!found) {
            output.textContent = "Item not found, please check the name and try again.";
            copyContainer.style.display = "none";
        }
    }

    function findItem() {
        var input = document.getElementById("codeInput").value.toUpperCase();
        var output = document.getElementById("output");
        var copyContainer = document.getElementById("copyContainer");
        var found = false;

        items.forEach(function(item) {
            if (item.code.toUpperCase() === input) {
                currentResult = item.name;
                output.textContent = "Item for " + item.code + " is: " + item.name;
                found = true;
                copyContainer.style.display = "block";
            }
        });

        if (!found) {
            output.textContent = "Code not found, please check the code and try again.";
            copyContainer.style.display = "none";
        }
    }

    function findPrice() {
        var input = document.getElementById("priceInput").value.toUpperCase();
        var output = document.getElementById("output");
        var copyContainer = document.getElementById("copyContainer");
        var found = false;

        items.forEach(function(item) {
            if (item.name.toUpperCase() === input || item.code.toUpperCase() === input) {
                currentResult = item.prices.replace(/, /g, "<br>"); // Replace commas with line breaks
                output.innerHTML = "Prices for " + item.name + ":<br>" + currentResult;
                found = true;
                copyContainer.style.display = "block";
            }
        });

        if (!found) {
            output.textContent = "No pricing information found, please check the name or code and try again.";
            copyContainer.style.display = "none";
        }
    }

    function copyToClipboard() {
        var tempText = document.createElement("textarea");
        tempText.value = currentResult.replace(/<br>/g, "\n"); // Convert <br> tags to newline characters for copying
        document.body.appendChild(tempText);
        tempText.select();
        document.execCommand("copy");
        document.body.removeChild(tempText);
        alert("Result copied to clipboard!");
    }
</script>

<footer>
    <p>&copy; 2024 Acetylsupport Team</p>
</footer>

</body>
</html>
