2024-02-29 11:05:07 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
2024-03-04 16:49:36 +01:00
|
|
|
|
2024-02-29 11:05:07 +01:00
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Title</title>
|
|
|
|
<link rel="stylesheet" href="../css/organization.css">
|
|
|
|
</head>
|
2024-03-04 16:49:36 +01:00
|
|
|
|
2024-02-29 12:20:08 +01:00
|
|
|
<body style="display: none;">
|
2024-02-29 11:05:07 +01:00
|
|
|
<div class="container">
|
2024-02-29 12:20:08 +01:00
|
|
|
<div class="hiring-badge" style="display: none;" id="isHiringBadge">Now Hiring</div>
|
2024-02-29 11:05:07 +01:00
|
|
|
<div class="logo-div">
|
|
|
|
<img class="logo" src="../content/blink-logo-small.jpg" alt="Company Logo">
|
|
|
|
</div>
|
2024-02-29 12:20:08 +01:00
|
|
|
<h1 id="organizationName">Blink</h1>
|
2024-02-29 11:05:07 +01:00
|
|
|
<div class="organization-details">
|
2024-02-29 12:20:08 +01:00
|
|
|
<p><b>Location: </b><label id="location">Naples, Italy</label></p>
|
2024-02-29 11:05:07 +01:00
|
|
|
<p><b>Email: </b><label id="email">contacts@blink-corporation.com</label></p>
|
|
|
|
<p><b>Hiring: </b><label id="isHiring">Yes</label></p>
|
|
|
|
</div>
|
|
|
|
<h2>About Us</h2>
|
|
|
|
<p id="description">Blink aims at creating a libre and decentralized LinkedIn alternative</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script src="../js/constants.js"></script>
|
|
|
|
<script src="../js/utils.js"></script>
|
|
|
|
|
|
|
|
<script>
|
2024-03-04 16:49:36 +01:00
|
|
|
window.addEventListener("load", async function () {
|
2024-02-29 11:05:07 +01:00
|
|
|
loadOrganization();
|
|
|
|
});
|
|
|
|
|
2024-03-04 16:49:36 +01:00
|
|
|
async function loadOrganization() {
|
2024-03-20 10:35:31 +01:00
|
|
|
const idOrganization = new URLSearchParams(window.location.search).get('id');
|
|
|
|
if (!idOrganization) {
|
2024-02-29 12:20:08 +01:00
|
|
|
alert("Invalid URL.");
|
|
|
|
return;
|
|
|
|
}
|
2024-03-20 10:35:31 +01:00
|
|
|
const response = await fetch(`${API_URL}/organizations/${idOrganization}`, {
|
2024-03-21 17:34:16 +01:00
|
|
|
headers: createHeaders(null)
|
2024-02-29 12:20:08 +01:00
|
|
|
});
|
|
|
|
const data = await response.json();
|
2024-03-04 16:49:36 +01:00
|
|
|
if (response.ok) {
|
2024-03-20 10:35:31 +01:00
|
|
|
populateFields(data.name, data.location, data.description, await isOrganizationHiring(idOrganization));
|
2024-02-29 12:20:08 +01:00
|
|
|
document.body.style.display = "block"; // Show page
|
2024-03-04 16:49:36 +01:00
|
|
|
} else {
|
2024-02-29 12:20:08 +01:00
|
|
|
alert(data.error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-04 16:49:36 +01:00
|
|
|
function populateFields(name, location, description, isHiring) {
|
2024-02-29 12:20:08 +01:00
|
|
|
document.getElementById('organizationName').textContent = name;
|
2024-02-29 12:44:57 +01:00
|
|
|
document.title = `${name} - Blink`
|
2024-02-29 12:20:08 +01:00
|
|
|
document.getElementById('location').textContent = location;
|
|
|
|
document.getElementById('description').textContent = description;
|
2024-03-04 16:49:36 +01:00
|
|
|
if (isHiring === true) {
|
2024-02-29 12:20:08 +01:00
|
|
|
document.getElementById('isHiring').textContent = 'Yes';
|
|
|
|
document.getElementById('isHiringBadge').style.display = 'block';
|
2024-03-04 16:49:36 +01:00
|
|
|
} else {
|
2024-03-20 10:35:31 +01:00
|
|
|
document.getElementById('isHiring').textContent = 'No';
|
2024-02-29 12:20:08 +01:00
|
|
|
}
|
|
|
|
|
2024-02-29 11:05:07 +01:00
|
|
|
}
|
2024-03-18 17:54:57 +01:00
|
|
|
|
|
|
|
async function isOrganizationHiring(organizationId) {
|
|
|
|
const response = await fetch(`${API_URL}/organizations/${organizationId}/joboffers`, {
|
2024-03-21 17:34:16 +01:00
|
|
|
headers: createHeaders(null)
|
2024-03-18 17:54:57 +01:00
|
|
|
});
|
|
|
|
const data = await response.json();
|
|
|
|
return data.length > 0;
|
|
|
|
}
|
2024-02-29 11:05:07 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
</body>
|
2024-03-04 16:49:36 +01:00
|
|
|
|
|
|
|
</html>
|