internapply/index.html
2024-01-26 02:39:58 +05:30

1005 lines
33 KiB
HTML

<!DOCTYPE HTML>
<!--
Dimension by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>Internship @ RanchiMall</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="assets/css/main.css" />
<noscript>
<link rel="stylesheet" href="assets/css/noscript.css" />
</noscript>
<script id="floGlobals">
/* Constants for FLO blockchain operations !!Make sure to add this at beginning!! */
const floGlobals = {
blockchain: "FLO",
adminID: "F8cnZpcc3sc98DTTrPMr6ZtRon7Vk4fm1Y",
application: "INTERN_APPLICATIONS",
}
</script>
<style>
.flex {
display: flex;
}
.align-center {
align-items: center;
}
.justify-right {
margin-left: auto;
}
#svgsection {
width: 200px;
margin: 0 auto;
padding: 20px;
}
.hide {
opacity: 0;
pointer-events: none;
}
#textCopied {
padding: 0.6rem 1.2rem;
border-radius: 2rem;
background: #ffffff20;
color: white;
position: fixed;
bottom: 0;
pointer-events: none;
margin: 2rem 0;
left: 50%;
transform: translateX(-50%);
transition: 0.3s opacity ease;
z-index: 20;
}
.spinner {
animation: rotate 1.4s linear infinite;
-webkit-animation: rotate 1.4s linear infinite;
-moz-animation: rotate 1.4s linear infinite;
width: 174px;
height: 174px;
position: relative;
}
.spinner-dot {
width: 274px;
height: 274px;
position: relative;
top: 0;
}
@keyframes rotate {
to {
transform: rotate(360deg);
}
}
@-webkit-keyframes rotate {
to {
-webkit-transform: rotate(360deg);
}
}
@-moz-keyframes rotate {
to {
transform: rotate(360deg);
}
}
.path {
stroke-dasharray: 170;
stroke-dashoffset: 20;
}
.svgsvg {
width: 100px;
display: block;
margin: 40px auto 0;
}
.svgpath {
stroke-dasharray: 1000;
stroke-dashoffset: 0;
&.svgcircle {
-webkit-animation: dash .9s ease-in-out;
animation: dash .9s ease-in-out;
}
&.svgline {
stroke-dashoffset: 1000;
-webkit-animation: dash .9s .35s ease-in-out forwards;
animation: dash .9s .35s ease-in-out forwards;
}
&.svgcheck {
stroke-dashoffset: -100;
-webkit-animation: dash-check .9s .35s ease-in-out forwards;
animation: dash-check .9s .35s ease-in-out forwards;
}
}
.svgp {
text-align: center;
margin: 20px 0 60px;
font-size: 1.25em;
&.svgsuccess {
color: #73AF55;
}
&.svgerror {
color: #D06079;
}
}
@-webkit-keyframes svgdash {
0% {
stroke-dashoffset: 1000;
}
100% {
stroke-dashoffset: 0;
}
}
@keyframes svgdash {
0% {
stroke-dashoffset: 1000;
}
100% {
stroke-dashoffset: 0;
}
}
@-webkit-keyframes svgdash-check {
0% {
stroke-dashoffset: -100;
}
100% {
stroke-dashoffset: 900;
}
}
@keyframes svgdash-check {
0% {
stroke-dashoffset: -100;
}
100% {
stroke-dashoffset: 900;
}
}
</style>
<style>
.embed-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
max-width: 100%;
}
.embed-container iframe,
.embed-container object,
.embed-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
</head>
<body class="is-preload" onload="onLoadStartUp()">
<h5 id="textCopied" class="hide">
Copied
</h5>
<!-- Wrapper -->
<div id="wrapper">
<!-- Header -->
<header id="header">
<div class="logo">
<!--<span class="icon fa-gem"></span>-->
<img class='icon' src='images/transparent_logo_white.png' style='max-width: 100%; max-height: 100%;'>
</div>
<div class="content">
<div class="inner">
<h1>Internships @ RanchiMall</h1>
<h4 id='welcome_message_top'></h4>
<h3 id='welcome_message_bottom' style='text-transform: initial;'></h3>
<!--<p>A fully responsive site template designed by <a href="https://html5up.net">HTML5 UP</a> and
released<br />
for free under the <a href="https://html5up.net/license">Creative Commons</a> license.</p>-->
<p>Join the blockchain revolution by being part of RanchiMall's <br>World Class Internship projects,
<br>curated under <a
href="https://medium.com/ranchimall/ranchi-mall-internship-blockchain-contract-b00193fd188c"
target="_blank">RanchiMall Internship Blockchain Contract</a>
</p>
</div>
</div>
<nav>
<ul>
<li><a href="#intro">Intro</a></li>
<li><a href="#projects">Projects</a></li>
<li><a href="#apply">Apply</a></li>
<!--<li><a href="#elements">Elements</a></li>-->
<li><a href="#list">List</a></li>
<li><a href="#intern">Intern</a></li>
</ul>
</nav>
</header>
<!-- Main -->
<div id="main">
<!-- Intro -->
<article id="intro">
<h2 class="major">Intro</h2>
<span class="image main"><img src="images/projects.png" alt="" /></span>
<p>RanchiMall invites applications for Internship for Projects listed here. All applicants will need to
generate their blockchain ID, and then store the private key safely to
access our:
<ul>
<li><a href="https://ranchimall.github.io/internapply" target="_blank">Application Portal @
<em>ranchimall.github.io/internapply</em></a></li>
<li><a href="https://ranchimall.github.io/RIBC" target="_blank">Internship Portal @
<em>ranchimall.github.io/RIBC</em></a></li>
<li><a href="https://ranchimall.github.io/p2p-content-collaboration" target="_blank">Content
Collaboration Portal @
<em>ranchimall.github.io/p2p-content-collaboration</em></a></li>
</ul>
The process of applying and Internship is:
</p>
<h3>INTERN SELECTION PROCESS</h3>
<h4>EVALUATION PHASE</h4>
<ol>
<li>Initial Training on Marketing, Actual Project Skills and Blockchain</li>
<li>Applicants have to undergo a test on training</li>
<li>First Task on Marketing, Actual Project Skills and Blockchain</li>
<li>Evaluator Feedback on first task; repeat of first task if standards are not met</li>
<li>Second Task on Marketing, Actual Project Skills and Blockchain</li>
<li>Evaluator and Consumer Feedback on second task; repeat of second task if standards are not met
</li>
<li>Third Task on Marketing, Actual Project Skills and Blockchain</li>
<li>Consumer Feedback on task: In this phase the feedback will come from general users on Social
Media; if feedback is not good, repeat the third task</li>
<li>Issuance of Competency Certificates to those whose complete third task</li>
<li>Stipend phase, to be selected among certificate holders - Four levels of stipend: Starter,
Motivated, Passionate, Self Realized</li>
<li>Anyone who drops out can get participation certificate, indicating till what round he/she
reached</li>
</ol>
<h4>INTERNSHIP PHASE</h4>
<p>Internship phase will begin with regular work on Marketing and Project related assignments</p>
<h4>STIPEND PAYMENT BY LEVEL</h4>
<ul>
<div class="table-wrapper">
<table>
<tbody>
<tr>
<td>Starter</td>
<td>Rs 2000 per month</td>
</tr>
<tr>
<td>Motivated</td>
<td>Rs 5000 per month</td>
</tr>
<tr>
<td>Passionate</td>
<td>Rs 7000 per month</td>
</tr>
<tr>
<td>Self Realized</td>
<td>Rs 10000 per month</td>
</tr>
</tbody>
</table>
</div>
</ul>
<p><em>Keep the Private Key very safe. Do not share with anyone.</em>
<br><br>
For any more details, tweet us at <a href="https://twitter.com/ranchimallflo"
target="_blank">@ranchimallflo</a> and we will respond immediately
</p>
</article>
<!-- Project List & information -->
<article id="projects">
<h2 class="major">Projects</h2>
<div class='embed-container'><iframe src='https://www.youtube.com/embed/CrfXqwy_d2I' frameborder='0'
allowfullscreen></iframe></div>
<br>
<h4>Select Project</h4>
<form id="projectform" autocomplete="off" onsubmit="return false">
<div class="fields" id='projectlist'>
</div>
<ul id='projectactionlist' class="actions" style="display:none">
<li><input type="submit" value="Apply" id="projectactionlist_apply" /></li>
<li><input type="reset" value="Reset" id='projectresetform' /></li>
</ul>
</form>
</article>
<!-- Apply for project -->
<article id="apply">
<div id="applytabmain">
<h2 class="major">Apply</h2>
<form id='applicationform' autocomplete="off" onsubmit="return false">
<div class="fields">
<div class="field half">
<label for="name">Name</label>
<input type="text" name="name" id="name" />
</div>
<div class="field half">
<label for="email">Email</label>
<input type="text" name="email" id="email" />
</div>
<div class="field half">
<label for="college">College</label>
<input type="text" name="college" id="college" />
</div>
<div class="field half">
<label for="course">Course</label>
<input type="text" name="course" id="course" />
</div>
<div class="field half">
<label for="dob">DOB</label>
<input type="text" name="dob" id="dob" placeholder="DD/MM/YYYY" />
</div>
<div class="field half">
<label for="whatsapp">WhatsApp Number</label>
<input type="text" name="whatsapp" id="whatsapp" placeholder="10 digit number" />
</div>
<div class="field half">
<label for="floid">FLO ID</label>
<input type="text" name="floid" id="floid" readonly />
</div>
<div class="field half">
<label for="floid">Project</label>
<!--<input type="text" name="floid" id="floid" />-->
<select name="formprojectlist" id="formprojectlist">
<option disabled selected value> -- select project -- </option>
</select>
</div>
<!--<div class="field" style='display:"none"'>
<label for="message">Message</label>
<textarea name="message" id="message" rows="4"></textarea>
</div> -->
</div>
<ul class="actions">
<li><input type="submit" value="Apply" class="primary" id="applyactionlist_apply" /></li>
<li><input type="reset" value="Reset" id='directapply_resetform' /></li>
</ul>
</form>
</div>
<div id="applytabwaiting" style='display: none;'>
<section id="svgsection">
<svg class="spinner" width="174px" height="174px" viewBox="0 0 66 66"
xmlns="http://www.w3.org/2000/svg">
<circle class="path" fill="transparent" stroke-width="2" cx="33" cy="33" r="30"
stroke="url(#gradient)" />
<linearGradient id="gradient">
<stop offset="50%" stop-color="#42d179" stop-opacity="1" />
<stop offset="65%" stop-color="#42d179" stop-opacity=".5" />
<stop offset="100%" stop-color="#42d179" stop-opacity="0" />
</linearGradient>
</circle>
<svg class="spinner-dot dot" width="5px" height="5px" viewBox="0 0 66 66"
xmlns="http://www.w3.org/2000/svg" x="37" y="1.5">
<circle class="path" fill="#42d179" cx="33" cy="33" r="30" />
</circle>
</svg>
</svg>
</section>
<h3 style="text-align:center; text-transform: initial;">Application sent to FLO Blockchain Cloud
</h3>
<h3 style="text-align:center; text-transform: initial;">Waiting for response</h3>
</div>
<div id="applytabsuccessful" class="svgshiz" style='display: none;'>
<section id="svgsectionsuccess">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130.2 130.2" class="svgsvg">
<circle class="svgpath svgcircle" fill="none" stroke="#73AF55" stroke-width="6"
stroke-miterlimit="10" cx="65.1" cy="65.1" r="62.1" />
<polyline class="svgpath svgcheck" fill="none" stroke="#73AF55" stroke-width="6"
stroke-linecap="round" stroke-miterlimit="10"
points="100.2,40.2 51.5,88.8 29.8,67.5 " />
</svg>
<p class="svgsuccess svgp">Success!!</p>
</section>
<h3 style="text-align:center; text-transform: initial;">Application has been recorded
</h3>
</div>
<div id="applytabfailure" class="svgshiz" style='display: none;'>
<section id="svgsectionfailure">
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 130.2 130.2" class="svgsvg">
<circle class="svgpath svgcircle" fill="none" stroke="#D06079" stroke-width="6"
stroke-miterlimit="10" cx="65.1" cy="65.1" r="62.1" />
<line class="svgpath svgline" fill="none" stroke="#D06079" stroke-width="6"
stroke-linecap="round" stroke-miterlimit="10" x1="34.4" y1="37.9" x2="95.8" y2="92.3" />
<line class="svgpath svgline" fill="none" stroke="#D06079" stroke-width="6"
stroke-linecap="round" stroke-miterlimit="10" x1="95.8" y1="38" x2="34.4" y2="92.2" />
</svg>
<p class="svgerror svgp">Bummer!</p>
</section>
<h3 style="text-align:center; text-transform: initial;">Please try again
</h3>
</div>
</article>
<!-- List of all applicants -->
<article id="list">
<h2 class="major">Applicant List</h2>
<section>
<!--<h3 class="major">Table</h3>
<h4>Default</h4>-->
<div class="table-wrapper">
<table>
<thead>
<tr>
<th>FLO ID</th>
<th>Project</th>
</tr>
</thead>
<tbody id='projectlisttablebody'>
</tbody>
</table>
</div>
</section>
</article>
<!-- List of alistll applicants -->
<article id="intern">
<h2 class="major">Intern Information</h2>
<section>
<label for="internfloid">Intern FLO ID</label>
<input type="text" name="internfloid" id="internfloid" value="" disabled />
<br>
<label for="internprivatekey">Private Key</label>
<input type="text" name="internprivatekey" id="internprivatekey" value="" disabled />
</section>
<section>
<p></p>
<p> <strong>NEVER</strong> lose your Private Key<br>
<strong>NEVER</strong> share your Private Key with anyone<br><br>
Losing your Private Key means losing all the accomplishments, data & money attached to your
Internship ID. Private Key once lost can <strong>NEVER</strong> be recovered. Please store
it safely.
</p>
<h4></h4>
</section>
</article>
<!-- Login -->
<article id="signin">
<div id="signinmain">
<h2 class="major">Sign In</h2>
<p>Welcome to Internships @ RanchiMall<br>Please enter your FLO Private Key to Sign In</p>
<!--<p>This is <b>bold</b> and this is <strong>strong</strong>. This is <i>italic</i> and this is
<em>emphasized</em>.
This is <sup>superscript</sup> text and this is <sub>subscript</sub> text.
This is <u>underlined</u> and this is code: <code>for (;;) { ... }</code>. Finally, <a
href="#">this is a link</a>.</p>-->
<section>
<form id="signinform" autocomplete="off" onsubmit="return false">
<div class="fields">
<div class="field">
<label for="priv_key_field">Private Key</label>
<input type="password" name="priv_key_field" id="priv_key_field" value="" />
</div>
</div>
<ul class="actions">
<li><input type="submit" value="Sign In" class="primary" id='privkey_signin_btn' /></li>
</ul>
</form>
</section>
<section>
<p>Don't have a Private Key yet? <u id="generatenewflopair"
style="cursor: pointer;"><strong>Click Here</strong></u></p>
<h4></h4>
</section>
</div>
<div id="genprivkey" style="display:none">
<section>
<span id="signingoback" style="cursor: pointer;"><span>
< </span>
<h2 class="major" style="display:inline"> Sign In</h2>
</span>
<p></p>
<label for="newfloid">FLO ID</label>
<input type="text" name="newfloid" id="newfloid" value="" disabled />
<br>
<label for="newprivatekey">Private Key</label>
<div class="flex align-center">
<input class="copy" type="text" name="newprivatekey" id="newprivatekey" value=""
disabled />
<button class="justify-right" onclick="copyToClipboard(this.parentNode)">copy</button>
</div>
</section>
<section>
<p></p>
<p><strong>SAVE</strong> the private key securely now before leaving<br>
<strong>NEVER</strong> lose your Private Key<br>
<strong>NEVER</strong> share your Private Key with anyone<br><br>
Losing your Private Key means losing all the accomplishments, data & money attached to your
Internship ID. Private Key once lost can <strong>NEVER</strong> be recovered. Please store
it safely.
</p>
<ul class="actions">
<li><input type="submit" value="Sign In" class="primary" id='privkey_signin_btn_alt' /></li>
</ul>
<h4></h4>
</section>
</div>
</article>
</div>
<!-- Footer -->
<footer id="footer">
<!--<p class="copyright">Design: <a href="https://html5up.net">HTML5 UP</a>.</p>-->
<p class="copyright" style="cursor: pointer;" id='logout_button'>Logout</p>
</footer>
</div>
<!-- BG -->
<div id="bg"></div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/browser.min.js"></script>
<script src="assets/js/breakpoints.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
<script src="assets/js/lib.js"></script>
<script src="assets/js/lib.js" type="text/javascript"></script>
<script src="assets/js/floCrypto.min.js" type="text/javascript"></script>
<script src="assets/js/btcOperator.min.js" type="text/javascript"></script>
<script src="assets/js/floBlockchainAPI.min.js" type="text/javascript"></script>
<script src="assets/js/compactIDB.min.js" type="text/javascript"></script>
<script src="assets/js/floCloudAPI.min.js" type="text/javascript"></script>
<script src="assets/js/floDapps.min.js" type="text/javascript"></script>
<script>
/*async function loadRIBC() {
floCloudAPI.requestObjectData('RIBC', options = { senderIDs: false, receiverID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE", application: 'RIBC' })
}*/
function validateEmail(mail) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)) {
return (true)
}
alert("You have entered an invalid email address!")
return (false)
}
function validatePhonenumber(inputtxt) {
var phoneno = /^\d{10}$/;
if ((inputtxt.value.match(phoneno))) {
return true;
} else {
alert("You have entered an invalid phone number!");
return false;
}
}
function copyToClipboard(parent) {
let toast = document.getElementById('textCopied'),
textToCopy = parent.querySelector('.copy').value;
navigator.clipboard.writeText(textToCopy)
toast.classList.remove('hide');
setTimeout(() => {
toast.classList.add('hide');
}, 2000)
}
async function fetchInternApplicants() {
let applicants = await floCloudAPI.requestGeneralData('test')
}
// Handler for Applicant form submission
document.getElementById('applyactionlist_apply').addEventListener('click', (ev) => {
ev.preventDefault()
let mainObj = validateForm()
if (mainObj != 0) {
document.getElementById('applytabmain').style.display = 'none'
document.getElementById('applytabwaiting').style.display = 'initial'
floCloudAPI.sendGeneralData(JSON.stringify(mainObj), 'applicationbank_1').then((result, mainObj) => {
if (result.split(":")[0].trim() == "Data sent to supernode") {
//document.getElementById('directapply_resetform').click()
document.getElementById('applytabwaiting').style.display = 'none'
document.getElementById('applytabsuccessful').style.display = 'initial'
setTimeout(function () {
document.getElementById('applytabsuccessful').style.display = 'none';
document.getElementById('applytabmain').style.display = 'initial';
window.location.href = "#list";
}, 2500)
// disable project from apply list and other list
let projectlistchildren = document.getElementById('projectlist').children
for (let i = 0; i < projectlistchildren.length; i++) {
if (projectlistchildren[i].children[0].dataset.projectname == aproject) {
projectlistchildren[i].children[0].disabled = true
}
}
let applicationform_projectlist = document.getElementById('formprojectlist').children
for (let i = 0; i < applicationform_projectlist.length; i++) {
if (applicationform_projectlist[1].value == aproject) {
applicationform_projectlist[1].disabled = true
}
}
let projectlisttablebody = document.getElementById('projectlisttablebody')
// appending application to applicant list
projectlisttablebody.innerHTML =
`<tr>
<td>${myFloID}</td>
<td>${aproject}</td>
</tr>` + projectlisttablebody.innerHTML
} else {
document.getElementById('applytabwaiting').style.display = 'none'
document.getElementById('applytabfailure').style.display = 'initial'
setTimeout(function () {
document.getElementById('applytabfailure').style.display = 'none';
document.getElementById('applytabmain').style.display = 'initial'
}, 2500)
}
})
}
})
function validateForm() {
var encryption_pubkey = '0362A48A86B7F82AA76A177DD60A1222AD477ACAE5C5AD2C6229F14C78CE2BD2B7'
aname = document.getElementById('name').value
aemail = document.getElementById('email').value
acollege = document.getElementById('college').value
acourse = document.getElementById('course').value
adob = document.getElementById('dob').value
awhatsapp = document.getElementById('whatsapp').value
afloid = myFloID
aproject = document.getElementById('formprojectlist').value
if (!myFloID_isApplicant) {
// name validation
aname = aname.replace(/\s+/g, ' ')
aname = aname.trim()
if (aname == '' || aname.length < 2) {
alert('You have entered an invalid name!')
return 0
}
// email validation
aemail = aemail.replace(/\s+/g, ' ')
aemail = aemail.trim()
if (!validateEmail(aemail)) {
return 0
}
aemail = floCrypto.encryptData(aemail, encryption_pubkey)
// college validation
acollege = acollege.replace(/\s+/g, ' ')
acollege = acollege.trim()
if (acollege == '' || acollege.length < 2) {
alert('You have entered an invalid college!')
return 0
}
acollege = floCrypto.encryptData(acollege, encryption_pubkey)
// couse validation
acourse = acourse.replace(/\s+/g, ' ')
acourse = acourse.trim()
if (acourse == '' || acourse.length < 2) {
alert('You have entered an invalid course!')
return 0
}
acourse = floCrypto.encryptData(acourse, encryption_pubkey)
// date of birthyvalidation
if (!(/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/.test(adob))) {
alert('You have entered an invalid date of birth!')
return 0
}
adob = floCrypto.encryptData(adob, encryption_pubkey)
// whatsapp validation
if (!(/^\d{10}$/.test(awhatsapp))) {
alert('You have entered an invalid whatsapp number!')
return 0
}
awhatsapp = floCrypto.encryptData(awhatsapp, encryption_pubkey)
if (aproject == '') {
alert("You haven't selected any project")
return 0
}
}
let detailsObj = {
'name': aname,
'email': aemail,
'college': acollege,
'course': acourse,
'dob': adob,
'whatsapp': awhatsapp,
'project': aproject
}
let mainObj = {}
mainObj[afloid] = detailsObj
return mainObj
}
// handler for project form submission
document.getElementById('projectactionlist_apply').addEventListener('click', (ev) => {
ev.preventDefault()
let checkeditem = null
let projectradioOptions = document.getElementById('projectlist').children
for (let i = 0; i < projectradioOptions.length; i++) {
if (projectradioOptions[i].children[0].checked && !projectradioOptions[i].children[0].disabled) {
checkeditem = projectradioOptions[i].children[0].dataset.projectname
}
}
if (checkeditem == null) {
alert("No project selected")
} else {
let applicationform_projectlist = document.getElementById('formprojectlist').children
for (let i = 0; i < applicationform_projectlist.length; i++) {
if (applicationform_projectlist[i].value == checkeditem) {
applicationform_projectlist[i].selected = true
}
}
}
if (myFloID_isApplicant) {
document.getElementById('applyactionlist_apply').click()
} else {
// redirect to applypage
window.location.href = "#apply"
}
})
// Handler to generate new priv key pair
document.getElementById("generatenewflopair").addEventListener('click', (ev) => {
document.getElementById('signinmain').style.display = 'none'
document.getElementById('genprivkey').style.display = 'initial'
let newFloID = floCrypto.generateNewID()
document.getElementById('newfloid').value = newFloID.floID
document.getElementById('newprivatekey').value = newFloID.privKey
})
document.getElementById("signingoback").addEventListener('click', (ev) => {
document.getElementById('signinmain').style.display = 'initial'
document.getElementById('genprivkey').style.display = 'none'
})
document.getElementById("logout_button").addEventListener('click', (ev) => {
floDapps.clearCredentials().then((result) => {
alert(result)
location.reload()
})
})
let myInput = function () {
return new Promise((resolve, reject) => {
// do either resolve to take in private key, or reject to do guest login
document.getElementById('privkey_signin_btn').addEventListener('click', (ev) => {
console.log(
'Test message to check if on click listener is working inside the Promise')
let priv_key_field = document.getElementById('priv_key_field')
if (priv_key_field.value.trim().length > 40) {
resolve(priv_key_field.value.trim())
} else {
alert('Please enter correct private key.')
}
})
document.getElementById('privkey_signin_btn_alt').addEventListener('click', (ev) => {
alert('Please store your Private Key safely')
document.getElementById('priv_key_field').value = document.getElementById(
"newprivatekey").value
document.getElementById('privkey_signin_btn').click()
})
})
}
</script>
<script id="onLoadStartUp">
function onLoadStartUp() {
window.location.href = `${window.location.origin}${window.location.pathname}#signin`
document.querySelector("#signin .close").style.display = 'none'
//floDapps.addStartUpFunction('Sample', Promised Function)
//floDapps.setAppObjectStores({sampleObs1:{}, sampleObs2:{options{autoIncrement:true, keyPath:'SampleKey'}, Indexes:{sampleIndex:{}}}})
//floDapps.setCustomPrivKeyInput( () => { FUNCTION BODY *must return private key* } )
floDapps.setCustomPrivKeyInput(myInput)
floDapps.launchStartUp().then(result => {
document.body.click()
document.querySelector("#signin .close").style.display = 'initial'
document.getElementById('welcome_message_top').innerText = `Welcome`
document.getElementById('welcome_message_bottom').innerText = `${myFloID}`
document.getElementById('floid').value = document.getElementById('internfloid').value = myFloID
document.getElementById('internprivatekey').value = myPrivKey
//App functions....
let ribcAppdata = floCloudAPI.requestObjectData('RIBC', options = {
senderIDs: false,
receiverID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE",
application: 'RIBC'
})
let ribcGendata = floCloudAPI.requestGeneralData('applicationbank_1')
Promise.all([ribcAppdata, ribcGendata]).then((values) => {
console.log("The promises just got resolved")
console.log(values)
// User list related operations
let applicants_InformationArray = floGlobals.generalData[
'{"application":"INTERN_APPLICATIONS","type":"applicationbank_1"}']
let applicantsIDarray = []
let projectlisttablebody = document.getElementById('projectlisttablebody')
for (let i = 0; i < applicants_InformationArray.length; i++) {
let currentapplicantID = applicants_InformationArray[i]['sender']
applicantsIDarray.push(currentapplicantID)
let jsonMessage = JSON.parse(applicants_InformationArray[i]['message'])
// appending application to applicant list
projectlisttablebody.innerHTML = projectlisttablebody.innerHTML +
`<tr>
<td>${currentapplicantID}</td>
<td>${jsonMessage[currentapplicantID]['project']}</td>
</tr>`
}
if (applicantsIDarray.includes(myFloID)) {
window.myFloID_isApplicant = true
window.myFloID_Projects = []
var tcounter = 0
for (let i = 0; i < applicants_InformationArray.length; i++) {
if (myFloID == applicants_InformationArray[i]['sender']) {
var temp = JSON.parse(applicants_InformationArray[i]['message'])
myFloID_Projects.push(temp[myFloID]['project'])
debugger
// force user to not change his details if he already exists
if (tcounter == 0) {
document.getElementById('name').value = temp[myFloID]['name']
document.getElementById('name').readOnly = true
document.getElementById('email').value = 'encrypted'
document.getElementById('email').readOnly = true
document.getElementById('college').value = 'encrypted'
document.getElementById('college').readOnly = true
document.getElementById('course').value = 'encrypted'
document.getElementById('course').readOnly = true
document.getElementById('dob').value = 'encrypted'
document.getElementById('dob').readOnly = true
document.getElementById('whatsapp').value = 'encrypted'
document.getElementById('whatsapp').readOnly = true
//document.getElementById('applyactionlist_apply').style.display = 'none'
//document.getElementById('directapply_resetform').style.display = 'none'
//document.getElementById('applyactionlist_apply').disabled = 'true'
//document.getElementById('directapply_resetform').disabled = 'true'
tcounter = tcounter + 1
}
}
}
} else {
window.myFloID_isApplicant = false
}
// Project list related operations
// todo : remove this hard coded stuff later on
let projectDetails = floGlobals.appObjects.RIBC.projectDetails
/*let projectDetails = {}
projectDetails["2020_project_4"] = projectDetails1["2020_project_4"]
delete(projectDetails1) */
let projectDetailsKeys = Object.keys(projectDetails)
projectDetailsKeys = projectDetailsKeys.reverse()
let projectlistContainer = document.getElementById('projectlist')
let formprojectlistContainer = document.getElementById('formprojectlist')
for (let i = 0; i < projectDetailsKeys.length; i++) {
let disabledtext = ''
let radionametext = 'projectlistitem'
let checkedtext = ''
if (myFloID_isApplicant == true && myFloID_Projects.includes(projectDetails[
projectDetailsKeys[i]].projectName)) {
disabledtext = 'disabled'
radionametext = `${radionametext}${i}`
checkedtext = 'checked'
}
newHtml = `<div class="field">
<input type="radio" name="${radionametext}" id="project${i}" data-projectname="${projectDetails[projectDetailsKeys[i]].projectName}" ${disabledtext} ${checkedtext}>
<label for="project${i}">${projectDetails[projectDetailsKeys[i]].projectName}</label>
<p>${projectDetails[projectDetailsKeys[i]].projectDescription}</p>
</div>`
projectlistContainer.innerHTML = projectlistContainer.innerHTML + newHtml
// Apply form
applicationformHtml =
`<option value="${projectDetails[projectDetailsKeys[i]].projectName}" ${disabledtext}>${projectDetails[projectDetailsKeys[i]].projectName}</option>`
formprojectlistContainer.innerHTML = formprojectlistContainer.innerHTML +
applicationformHtml
}
document.getElementById('projectactionlist').style.display = 'flex'
});
}).catch(error => console.error(error))
}
</script>
</body>
</html>