Git Upload

This commit is contained in:
Steven Tracey 2023-04-26 13:47:29 -04:00
parent 54a5dbf2d7
commit 4d7dce223a
8 changed files with 240 additions and 0 deletions

5
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

12
.idea/VCardFrontend.iml Normal file
View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/VCardFrontend.iml" filepath="$PROJECT_DIR$/.idea/VCardFrontend.iml" />
</modules>
</component>
</project>

25
.idea/watcherTasks.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectTasksOptions">
<TaskOptions isEnabled="true">
<option name="arguments" value="$FileName$:$FileNameWithoutExtension$.css" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="ERROR" />
<option name="fileExtension" value="scss" />
<option name="immediateSync" value="true" />
<option name="name" value="SCSS" />
<option name="output" value="$FileNameWithoutExtension$.css:$FileNameWithoutExtension$.css.map" />
<option name="outputFilters">
<array />
</option>
<option name="outputFromStdout" value="false" />
<option name="program" value="$PROJECT_DIR$/../../../../Program Files/sass/sass" />
<option name="runOnExternalChanges" value="true" />
<option name="scopeName" value="Project Files" />
<option name="trackOnlyRoot" value="true" />
<option name="workingDir" value="$FileDir$" />
<envs />
</TaskOptions>
</component>
</project>

110
index.html Normal file
View File

@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
<link rel="stylesheet" href="stylesheet.css">
<title>*DEV* CAIU VCard Creator *DEV*</title>
<script>
document.addEventListener('DOMContentLoaded', function () {
const inputs = Array.from(
document.querySelectorAll('input[name=extension], input[name=cellNumber], input[name=directLine]')
);
const inputListener = e => {
inputs.filter(i => i !== e.target).forEach(i => (i.required = !e.target.value.length));
};
inputs.forEach(i => i.addEventListener('input', inputListener));
});
</script>
</head>
<body>
<nav class="navbar navbar-light bg-light">
<a class="navbar-brand" href="#">
<img src="https://resources.finalsite.net/images/f_auto,q_auto/v1619001051/caiuorg/cjwogofoj9lsqxvuwnd8/Logo_CAIU_color1.png" alt="">
</a>
<div class="nav-container">
<label class="nav-align" for="newBackendUrlInput">Change Backend Url</label>
<input type="text" class="form-control nav-align" id="newBackendUrlInput" name="newBackendUrlInput">
<button class="btn btn-primary nav-align" id="changeBackendButton">Change Backend Url</button>
</div>
<div class="nav-container">
<p class="nav-align">Backend Status</p>
<span class="connected nav-align backend-status-indicator"></span>
<button class="btn btn-primary nav-align" id="checkBackendButton">Reload</button>
</div>
</nav>
<main class="page contact-page">
<section class="portfolio-block contact">
<div class="container">
<h2 class="text-center mt-5 h2">Current Backend Url: 127.0.0.1:8090</h2>
<h1 class="text-center mt-5 h1">** DEV ENV** - VCard Creator - ** DEV ENV **</h1>
<form method="post" class="form-group mt-5">
<div class="form-group">
<label for="full_name">Full Name &amp; Credentials</label>
<input type="text" class="form-control" id="full_name" name="full_name" maxlength="36" required="">
</div>
<div class="form-group">
<label for="title">Title</label>
<input type="text" class="form-control" id="title" name="title" maxlength="48" required="">
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" required="">
</div>
<div class="form-group">
<label for="location">Location:</label>
<select class="form-control" id="location" name="location">
<option value="Capital Area Early Learning Center">Capital Area Early Learning Center</option>
<option value="Capital Area Intermediate Unit">Capital Area Intermediate Unit</option>
<option value="Hill Top Academy">Hill Top Academy</option>
<option value="Hershey Elementary/Derry PS">Hershey Elementary/Derry PS</option>
<option value="Londonderry Elementary">Londonderry Elementary</option>
<option value="Upper Dauphin Elementary School">Upper Dauphin Elementary School</option>
<option value="PA STEAM">PA STEAM</option>
<option value="Conewago Elementary">Conewago Elementary</option>
</select>
</div>
<div class="form-group">
<input type="checkbox" id="directLineCheckbox" onclick="handleCheckbox()">
<label for="directLineCheckbox">Direct Line</label>
</div>
<div class="form-group" id="directLineInput" style="display:none">
<label for="directLine">Direct Line:</label>
<input type="text" class="form-control" id="directLine" name="directLine" maxlength="15" required="">
</div>
<div class="form-group" ,="" id="extensioninput">
<label for="extension">Extension</label>
<input type="tel" class="form-control" id="extension" name="extension" required="">
</div>
<div class="form-group">
<label for="cellNumber">Cell Number</label>
<input type="tel" class="form-control" id="cellNumber" name="cellNumber" maxlength="15" required="">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</section>
</main>
<script src="script.js"></script>
<script>
loadBackendUrl();
document.getElementById("changeBackendButton").addEventListener("click", saveBackendUrl, false);
document.getElementById("checkBackendButton").addEventListener("click", checkBackend, false);
</script>
</body>
</html>

48
script.js Normal file
View File

@ -0,0 +1,48 @@
function handleCheckbox() {
const extensionInput = document.getElementById("extensionInput");
const directLineInput = document.getElementById("directLineInput");
if (document.getElementById("directLineCheckbox").checked) {
extensionInput.style.display = "none";
directLineInput.style.display = "block";
document.getElementById("extension").value = "";
} else {
extensionInput.style.display = "block";
directLineInput.style.display = "none";
document.getElementById("directLine").value = "";
}
}
let backendUrl = "http://127.0.0.1:8090"
async function checkBackend() {
try {
const response = await fetch(backendUrl);
console.log('Backend up with code ', response.status);
console.log(response);
} catch (err) {
console.log(err);
}
}
function saveBackendUrl() {
let url = document.getElementById("newBackendUrlInput").value;
if (!(url.includes("http://") || url.includes("https://") && url !== "")) {
url = "http://" + url;
}
document.cookie = "backendUrl=" + url;
console.log("Saved new backendUrl ", url);
}
function loadBackendUrl() {
let cookieArray = document.cookie.split(";");
for (let i = 0; i < cookieArray.length; i++) {
let cookie = cookieArray[i].split("=");
if (cookie[0] === "backendUrl") {
backendUrl = cookie[1];
console.log("Set backendUrl to ", backendUrl);
} else {
console.log("Unable to load backendUrl from cookie, defaulting to 127.0.0.1:8090");
}
}
}

7
static/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

25
stylesheet.css Normal file
View File

@ -0,0 +1,25 @@
.nav-align {
height: 4em;
vertical-align: middle;
padding-left: 20px;
padding-right: 20px;
float: right;
}
.nav-container {
display: inline-flex;
position: relative;
float: right;
}
.backend-status-indicator {
font-size: 4em;
}
.connected {
color: #28a745;
}
.disconnected {
color: #dc3545;
}