Your IP : 216.73.216.86


Current Path : /home/emeraadmin/www/4d695/
Upload File :
Current File : /home/emeraadmin/www/4d695/viewunassignedtasks.php.tar

home/emeraadmin/public_html/pages/subcontractor/viewunassignedtasks.php000064400000014035151701473470022715 0ustar00<?php
// Include head.php
include('head.php');

require_once '../../Classes/Database.php';
require_once '../../Service/TaskService.php';
require_once '../../Classes/System.php';
require_once '../../Service/ServiceService.php';



$System = new System();
// Create TaskService instance
$taskService = new TaskService();

$serviceService = new ServiceService();
$services = $serviceService->getAllServicesForDropdown();
// Fetch tasks from the database

$tasks = $taskService->getUnassignedTasks();
?>

<div class="main-content">
    <div class="container-fluid">
        <!-- Your existing HTML content -->
        <div class="page-header">
            <!-- Your existing header -->
        </div>

        <!-- Task viewing section -->
        <div class="row">
            <div class="col-md-12">
                <div class="card">
                    <div class="card-header">
                        <h3>View Tasks</h3>
                    </div>
                    <div class="card-body">
                        <div class="form-group row">
                            <div class="col-sm-3">
                                <label for="filter_service" class="col-form-label">Filter Service Name:</label>
                                <input type="text" class="form-control" id="filter_service">
                            </div>
                            <div class="col-sm-3">
                                <label for="filter_region" class="col-form-label">Filter Region:</label>
                                <select class="form-control" id="filter_region">
                                    <option value="">All Regions</option>
                                    <?php
                                    // Collect unique regions
                                    $uniqueRegions = [];
                                    foreach ($services as $service) {
                                        if (!in_array($service->region, $uniqueRegions)) {
                                            $uniqueRegions[] = $service->region;
                                            ?>
                                            <option value="<?= htmlspecialchars($service->region) ?>"><?= htmlspecialchars($service->region) ?></option>
                                            <?php
                                        }
                                    }
                                    ?>
                                </select>
                            </div>
                            <div class="col-sm-3">
                                <label for="filter_frequency" class="col-form-label">Filter Frequency:</label>
                                <select class="form-control" id="filter_frequency">
                                    <option value="">All Frequencies</option>
                                    <option value="daily">Daily</option>
                                    <option value="3x/week">3x/week</option>
                                    
                                </select>

                            </div>
                        </div>
                        <table id="super_advanced_table" class="table">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>Service Name</th>
                                <th>Region</th>
                                <th>Frequency</th>
                                <th>Created At</th>
                                <th>Public Status</th>
                                <th>Actions</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach ($tasks as $task): ?>
                                <tr>
                                    <td><?php echo 'TSK-000'.$task->id; ?></td>
                                    <td><?php echo $task->service_name; ?></td>
                                    <td><?php echo $task->region; ?></td>
                                    <td><?php echo $task->frequency; ?></td>
                                    <td><?php echo date('F j, Y, g:i a', strtotime($task->created_at)); ?></td>
                                    <td>
                                        <label class="badge badge-<?php echo $task->isPublic ? 'yellow' : 'green'; ?>"><?php echo $task->isPublic ? 'Public' : 'Not Public'; ?></label>
                                    </td>
                                    <td>
                                        <a href="viewunassignedtask.php?id=<?php echo $System->encryptData($task->id); ?>" class="btn btn-primary">View Details</a>
                                    </td>
                                </tr>
                            <?php endforeach; ?>
                            </tbody>
                        </table>
                    </div>
                    <script>
                        $(document).ready(function () {
                            // Initialize DataTable
                            var table = $('#super_advanced_table').DataTable({
                                // Configure initial settings if needed
                            });

                            // Add custom filters
                            $('#filter_service').on('keyup', function () {
                                table.column(1).search(this.value).draw();
                            });

                            $('#filter_region').on('change', function () {
                                table.column(2).search($(this).val()).draw();
                            });

                            $('#filter_frequency').on('change', function () {
                                table.column(3).search($(this).val()).draw();
                            });


                        });
                    </script>
                </div>
            </div>
        </div>


    </div>
</div>

<?php include('footer.php'); ?>