<?php
    if ( !$user['superAdmin'] ) {
        exit;
    }

    if ( $clientId = $_POST['id'] ) {
        $client         = $db->row("SELECT * FROM client WHERE id = ?", $clientId);
        $client['user'] = $db->row("SELECT * FROM user WHERE clientId = ?", $clientId);
    }

    if ( $client ) :
?>
        <div class="form-floating mb-2">
            <input type="text" name="name" class="form-control" id="name" value="<?php echo $client['user']['name']; ?>" disabled>
            <label for="name">Name</label>
        </div>
        <div class="form-floating mb-2">
            <input type="email" name="email" class="form-control" id="email" value="<?php echo $client['email']; ?>" disabled>
            <label for="email">Email</label>
        </div>
        <label for="tokenLifetime" class="small text-muted mx-2">Token lifetime</label>
        <select name="tokenLifetime" class="form-select mb-2">
            <option value="30 minutes">30 minutes</option>
            <option value="1 hour">1 hour</option>
            <option value="4 hours">4 hours</option>
            <option value="12 hours">12 hours</option>
            <option value="24 hours">24 hours</option>
            <option value="48 hours">48 hours</option>
        </select>
        
        <input type="hidden" name="clientId" id="clientId" value="<?php echo $client['id']; ?>">
        <input type="hidden" name="userId" id="userId" value="<?php echo $client['user']['id']; ?>">
<?php
    endif;
?>