<?php
include "db.class.php";

$db = new DBMain();

$results = $db->exec_query('jobcards', ['*'], '', '', '', '', "1", 'ORDER BY record_id DESC LIMIT 100');

?>
<style>
    .apple-form {
        display: flex;
        flex-direction: column;
        align-items: center;
        font-family: 'Arial', sans-serif;
        width: 80%;
        border: #007AFF 1px solid;
        border-radius: 25px;
        margin-left: auto;
        padding: 5vw;
        margin-right: auto;
    }

    .form-group {
        display: flex;
        flex-direction: column;
        margin-bottom: 10px;
        width: 700px;
        margin-left: auto;
        margin-right: auto;
        flex-wrap: wrap;
        background-color: whitesmoke;
        border-radius: 10px;
        padding: 10px;
    }

    .form-group label {
        margin-bottom: 5px;
    }

    .form-group input {
        padding: 10px 20px;
        border: none;
        border-radius: 5px;
        background-color: #007AFF;
        color: #fff;
        cursor: pointer;
        margin-top: 10px;
        width: 100%;
    }

    .form-group select {
        padding: 5px;
        border: 1px solid #ccc;
        border-radius: 5px;
        width: 100%;
        max-width: 300px;
    }

    .form-group textarea {
        padding: 5px;
        border: 1px solid #ccc;
        border-radius: 5px;
        width: 100%;
        max-width: 300px;
    }

    .form-group button {
        padding: 10px 20px;
        border: none;
        border-radius: 5px;
        background-color: #007AFF;
        color: #fff;
        cursor: pointer;
        margin-top: 10px;
    }

    h1 {
        display: flex;
        justify-content: center;
        font-size: 50px;
    }

    h2 {
        font-size: 30px;
    }

    .apple-form input[type=submit] {
        padding: 10px 20px;
        border: none;
        border-radius: 5px;
        background-color: #007AFF;
        color: #fff;
        cursor: pointer;
        margin-top: 10px;
    }

    @media (max-width: 480px) {
        .apple-form {
            flex-direction: column;
        }

        .form-group {
            margin-bottom: 5px;
        }
    }

    .back_btn {
        position: absolute;
        left: 1%;
        top: 1%;
        width: 25%;
        height: fit-content;
        background-color: #007AFF;
        color: #fff;
        border-radius: 10px;
        padding: 1%;
        text-align: center;
    }
</style>
<br>
<h1>RESULTS</h1>
<style>
    .back_btn {
        position: absolute;
        left: 1%;
        top: 1%;
        width: 25%;
        height: fit-content;
        background-color: #007AFF;
        color: #fff;
        border-radius: 10px;
        padding: 1%;
        text-align: center;
    }
</style>
<a href='index.php'>
    <div class='back_btn'>
        BACK
    </div>
</a>
<?php while ($jobcards = $results->fetch_assoc()) { ?>
    <div class="form-group" style="border: #007AFF 1px solid;">
        <form action="edit_jobcard.php" method="POST">
            <h2>JOBCARD NUMBER : <?php echo $jobcards['jobcard_number']; ?></h2>
            <h2>SCULPTURE NAME : <?php echo $jobcards['sculpture_name']; ?></h>
                <h2>ARTIST NAME : <?php echo $jobcards['artist_name']; ?></h2>
                <input type='text' name='record_id' value='<?php echo $jobcards['record_id']; ?>' hidden>
                <input type='submit' value='OPEN'>
        </form>

    </div>
    <br>

<?php } ?>