<?php
$id = 'testimonial-' . $block['id'];
$login_id = get_field('login_id');
$url = 'http://103.109.52.3/webapi/api/EmployeeInfo';
$response = wp_remote_post(
    $url,
    array(
        'body' => array(
            'user_login_id' => 'api_user',
            'login_id' => $login_id,
            'auth_token' => 'api_user20230419045143'
        )
    )
);

$data = json_decode(wp_remote_retrieve_body($response), true);

// foreach ($data as $query) {
//     $EmployeeID = $query['EmployeeID'];
// }

echo '<div class="portfolio-item">';
// if (!empty($logo)) {
//     echo wp_get_attachment_image($logo['ID'], 'thumbnail', null, array('class' => 'portfolio-logo alignleft'));
// }
if (!empty($login_id)) {
    echo '<h3 class="portfolio-title">Faculty Member Information (Read only)</h3>';
    echo '<div class="portfolio-description"> <ul>';
    foreach ($data[0]  as $key => $value) {
        echo "<li> <strong>" . $key . " </strong>: " . $value . "</li>\n";
    }
    echo '</ul><p>' . $id . '</p> </div>';
} else {
    echo 'Please insert Login ID of the faculty member</ul></div>';
}

// var_dump($data[0]);
// print_r($data);
echo '</div>';
