Your IP : 216.73.216.86


Current Path : /home/emeraadmin/public_html/4d695/
Upload File :
Current File : /home/emeraadmin/public_html/4d695/completedsubtaskform.php.tar

home/emeraadmin/public_html/pages/completedsubtaskform.php000064400000027446151676734210020176 0ustar00<?php
//show error if not id is passed with url parameter not quarry parameter
if (!isset($_GET['id'])) {
    echo "Invalid Request";
    exit();
}
else {
    $id = $_GET['id'];

    require_once '../Service/TaskFormService.php';

    $TaskFormService = new TaskFormService();

    $subtask = $TaskFormService->getTaskFormById($id);

    //check if subtask is empty
    if (empty($subtask)) {
        echo "No subtask found";
        exit();
    }

}
?>


<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Preview Holiday Program Cleaning Checklist</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

        body {
            font-family: 'Poppins', sans-serif;
            background:  url('http://localhost/CleaningChecklist/cover.jpg') no-repeat center center fixed;
            background-size: cover;
            padding: 20px;
            margin: 0;
        }

        .container {
            background-color: #fff;
            background: linear-gradient(to right, #e6f7ff, #ccf2ff);
            box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
            padding: 40px;
            border-radius: 20px;
            max-width: 800px;
            margin: auto;
        }

        .header {
            text-align: center;
            margin-bottom: 40px;
        }

        .header img {
            width: 170px;
            height: auto;
        }

        h1 {
            text-align: center;
            font-size: 3.5em;
            margin-bottom: 30px;
            color: #1e3c72;
            text-shadow: 3px 3px 5px rgba(0, 0, 0, 0.3);
            background: linear-gradient(to right, #1e3c72, #2a5298);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-family: 'Poppins', sans-serif;
        }

        .form-group label {
            font-weight: bold;
            color: #1e3c72;
            font-size: 1.3em;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
        }

        .form-control {
            border: 2px solid #2a5298;
            border-radius: 10px;
            font-size: 1.0em;
            padding: 14px;
            width: 100%;
            margin-bottom: 25px;
            transition: all 0.3s ease;
        }

        .form-control:focus {
            outline: none;
            border-color: #1e3c72;
            box-shadow: 0 0 7px rgba(30, 60, 114, 0.5);
        }

        .form-check-label {
            font-weight: bold;
            color: #1e3c72;
            margin-left: 10px;
            font-size: 1.3em;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
        }

        .signature-pad {
            border: 2px dashed #2a5298;
            border-radius: 10px;
            height: 150px;
            background-color: #fff;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
            margin-top: 25px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .signature-pad:hover {
            border-color: #1e3c72;
        }

        .note {
            font-size: 1.2em;
            color: #1e3c72;
            margin-top: 25px;
            text-align: center;
            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
        }

        .section h2 {
            font-size: 1.5em;
            color: #1e3c72;
            margin-bottom: 20px;
            text-align: left;
            background: linear-gradient(to right, #1e3c72, #2a5298);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
            font-family: 'Poppins', sans-serif;
        }

        .btn-primary {
            background: linear-gradient(to right, #2a5298, #1e3c72);
            color: #fff;
            border: none;
            padding: 15px 30px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 20px;
            margin-top: 35px;
            display: block;
            width: 100%;
            transition: all 0.3s ease;
        }

        .btn-primary:hover {
            background: linear-gradient(to right, #1e3c72, #2a5298);
        }

        .footer {
            border-top: 1px solid #ccc;
            padding-top: 20px;
            margin-top: 35px;
            font-size: 1em;
            color: #555;
            text-align: center;
        }
        .section {
            margin-bottom: 20px;
        }

        .form-check {
            display: flex;
            align-items: center;
            margin-bottom: 5px;
        }

        .form-check-input {
            width: 20px;
            height: 20px;
            margin-right: 8px; /* Small space between checkbox and label */
        }

        .form-check-label {
            margin: 0;
            font-weight: normal; /* Ensure sentences are not bold */
        }

        .footer a {
            color: #1e3c72;
            text-decoration: none;
        }

        .footer a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>

<div class="container">
    <div class="header">
        <img src="../src/img/Emera-Primary-Logo.png" alt="Company Logo">
    </div>

    <h1>Preview Holiday Program Cleaning Checklist</h1>

    <form>
        <div class="form-group">
            <label for="schoolName">School Name:</label>
            <h3><?= htmlspecialchars($subtask->school_name) ?></h3>
        </div>
        <div class="form-group">
            <label for="date">Date:</label>
            <h3><?= htmlspecialchars($subtask->date) ?></h3>
        </div>
        <div class="section">
            <h2>Checklist</h2>
            <div class="checkboxes">
                <?php
                // Get the main_areas data
                $main_areas_data = $subtask->main_areas;

                // Define all possible items for each section
                $all_main_area_items = [
                    "Vacuum/Sweep hard floors and carpet areas",
                    "Disinfect and mop hard floor areas",
                    "Bin Emptied"
                ];

                $all_kitchen_area_items = [
                    "Vacuum/Sweep hard floors",
                    "Disinfect and mop hard floor areas",
                    "Clean and wipe benchtops surroundings",
                    "Bin Emptied"
                ];

                $all_bathroom_area_items = [
                    "Clean and disinfect sinks and taps",
                    "Clean and disinfect toilets",
                    "Floor sweep and mop",
                    "Bin Emptied"
                ];

                // Function to render checkboxes
                function renderCheckboxes($all_items, $selected_items) {
                    foreach ($all_items as $item) {
                        $is_checked = in_array($item, $selected_items); // Check if the item is in the selected items array
                        echo '<div class="form-check">';
                        echo '<input class="form-check-input" type="checkbox" ' . ($is_checked ? 'checked' : '') . ' disabled>';
                        echo '<label class="form-check-label">' . htmlspecialchars($item) . '</label>';
                        echo '</div>';
                    }
                }

                // Function to render raw checkboxes
                function renderRawCheckboxes($raw_data, $all_items) {
                    $selected_items = explode(", ", $raw_data);
                    foreach ($all_items as $item) {
                        $is_checked = in_array($item, $selected_items); // Check if the item is in the selected items array
                        echo '<div class="form-check">';
                        echo '<input class="form-check-input" type="checkbox" ' . ($is_checked ? 'checked' : '') . ' disabled>';
                        echo '<label class="form-check-label">' . htmlspecialchars($item) . '</label>';
                        echo '</div>';
                    }
                }

                // Check if main_areas_data is a valid JSON string
                $decoded_data = json_decode($main_areas_data, true);

                if (json_last_error() === JSON_ERROR_NONE) {
                    // If valid JSON, render based on JSON data
                    echo '<h2>Main Area</h2>';
                    renderCheckboxes($all_main_area_items, $decoded_data['mainArea'] ?? []);

                    echo '<h2>Kitchen Area</h2>';
                    renderCheckboxes($all_kitchen_area_items, $decoded_data['kitchenArea'] ?? []);

                    echo '<h2>Bathrooms and Toilets</h2>';
                    renderCheckboxes($all_bathroom_area_items, $decoded_data['bathroomArea'] ?? []);
                } else {

                $main_areas = explode(", ", $subtask->main_areas);
                foreach ($main_areas as $area) {
                    echo '<div class="form-check">';
                    echo '<input class="form-check-input" type="checkbox" checked disabled>';
                    echo '<label class="form-check-label">' . htmlspecialchars($area) . '</label>';
                    echo '</div>';
                }

                }
                ?>
            </div>



        </div>



        <div class="section">
            <label for="notes">Notes:</label>
            <textarea id="notes" name="notes" rows="4" class="form-control" readonly><?= htmlspecialchars($subtask->notes) ?></textarea>
        </div>

        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label for="clientName" style="flex: 1;">Client Representative Name:</label>
                    <input type="text" id="clientName" name="clientName" value="<?= htmlspecialchars($subtask->client_name) ?>" readonly style="flex: 1;">
                </div>
                <div class="form-group">
                    <label for="clientSignature" style="flex: 1;">Client Representative Signature:</label>
                    <img src="<?= htmlspecialchars($subtask->client_signature   ) ?>" alt="Client Signature" class="signature-pad" style="flex: 1;">
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label for="staffName" style="flex: 1;">Emera Staff Member Name:</label>
                    <input type="text" id="staffName" name="staffName" value="<?= htmlspecialchars($subtask->staff_name) ?>" readonly style="flex: 1;">
                </div>
                <div class="form-group">
                    <label for="staffSignature" style="flex: 1;">Emera Staff Member Signature:</label>
                    <img src="<?= htmlspecialchars($subtask->staff_signature) ?>" alt="Staff Signature" class="signature-pad" style="flex: 1;">
                </div>
            </div>
        </div>

        <div class="note">
            This Document is to be completed after every visit from the professional cleaner. Once completed, please take a photo and send it to your supervisor.
        </div>
    </form>

<!--    <div class="footer">-->
<!--        EMERA HOLDINGS PTY LTD<br>www.emeraholdings.com.au<br>-->
<!--        16 Stelvio Close, Lynbrook 3975, Vic<br>-->
<!--        Phone: 1300 153 114<br>Email: info@emeraholdings.com.au-->
<!--    </div>-->
</div>

</body>
</html>