<?php
session_start();
if (!isset($_SESSION['loggedin'])) {
    exit("unauthorized");
}

include "../../php/database.php";
?>


<div class="card-title mb-3">Contatti studio paghe</div>
<hr style="margin:0">
<table id="jpayments_office_tables" class="display" style="width: 100%;">
    <thead>
        <tr>
            <th>Azienda</th>
            <th>Nome</th>
            <th>E-mail</th>
            <th>Invio cartellini</th>
            <th></th>
        </tr>
    </thead>
    <?php
    $sql    = "SELECT * FROM payments_office ORDER BY name ASC";
    $result = mysqli_query($con, $sql);
    while ($row = mysqli_fetch_assoc($result)) {
        echo "<tr>";
        echo "<td>" . $row["company"] . "</td>";
        echo "<td>" . $row["name"] . "</td>";
        echo "<td>" . $row["email"] . "</td>";
        if ($row["send_attendance"] == 1) {
            echo "<td>SI</td>";
        } else {
            echo "<td>NO</td>";
        }
        echo "<td><i class='fa-solid fa-trash' aria-hidden='true' style='float: right; cursor: pointer' onclick='deletePaymentsOffice(" . $row["id"] . ")'></i><i class='fa-solid fa-magnifying-glass' aria-hidden='true' style='float: right; margin-right: 20px; cursor: pointer' onclick='editPaymentsOffice(" . $row["id"] . ")'></i></td>";
        echo "</tr>";
    }
    ?>
    </tbody>
</table>