diff --git a/index.html b/index.html index 5b3cc9f..1c98724 100644 --- a/index.html +++ b/index.html @@ -61,7 +61,7 @@

Internships @ RanchiMall

-

+

@@ -101,37 +101,29 @@ Pellentesque aliquam maximus risus, vel sed vehicula.

- +
+

Projects

This is some random text which will be replaced with much more creative introduction to the Project List

-
-
+ +
+ +
- -
-

About

- -

Lorem ipsum dolor sit amet, consectetur et adipiscing elit. Praesent eleifend dignissim arcu, at - eleifend sapien imperdiet ac. Aliquam erat volutpat. Praesent urna nisi, fringila lorem et vehicula - lacinia quam. Integer sollicitudin mauris nec lorem luctus ultrices. Aliquam libero et malesuada - fames ac ante ipsum primis in faucibus. Cras viverra ligula sit amet ex mollis mattis lorem ipsum - dolor sit amet.

-
- - +

Apply

-
+
@@ -174,8 +166,8 @@
-->
    -
  • -
  • +
  • +
- +

Applicant List

@@ -9427,7 +9419,7 @@ } // Handler for Applicant form submission - document.getElementById('applicationform').addEventListener('submit', (ev) => { + document.getElementById('applyactionlist_apply').addEventListener('click', (ev) => { ev.preventDefault() aname = document.getElementById('name').value @@ -9474,11 +9466,69 @@ let mainObj = {} mainObj[afloid] = detailsObj - floCloudAPI.sendGeneralData(JSON.stringify(mainObj), 'test2') - document.getElementById('resetform').click() + floCloudAPI.sendGeneralData(JSON.stringify(mainObj), 'test3').then((result) => { + + if (result.split(":")[0].trim() == "Data sent to supernode") { + //document.getElementById('directapply_resetform').click() + alert(`You have sucessfully applied for ${aproject}`) + // 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 + } + } + + + } + else { + alert("Something went wrong, please reload the page") + } + }) }) + // handler for project form submission + document.getElementById('projectactionlist_apply').addEventListener('click', (ev) => { + ev.preventDefault() + + if (myFloID_isApplicant) { + + let checkeditem = null + let projectradioOptions = document.getElementById('projectlist').children + for (let i = 0; i < projectradioOptions.length; i++) { + if (projectradioOptions[i].children[0].checked) { + 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 + } + } + document.getElementById('applyactionlist_apply').click() + } + } + else { + alert('You are a new intern.. please use Apply page for the first time') + } + + }) + // Handler to generate new priv key pair document.getElementById("generatenewflopair").addEventListener('click', (ev) => { @@ -9547,46 +9597,22 @@ document.getElementById('floid').value = myFloID //App functions.... - /*loadRIBC() - .then(loadres => { - }) */ let ribcAppdata = floCloudAPI.requestObjectData('RIBC', options = { senderIDs: false, receiverID: "FMeiptdJNtYQEtzyYAVNP8fjsDJ1i4EPfE", application: 'RIBC' }) - let ribcGendata = floCloudAPI.requestGeneralData('test2') + let ribcGendata = floCloudAPI.requestGeneralData('test3') Promise.all([ribcAppdata, ribcGendata]).then((values) => { console.log("Hey I'm here, the promises just got resolved") console.log(values) - // Project list related operations - let projectDetails = floGlobals.appObjects.RIBC.projectDetails - let projectDetailsKeys = Object.keys(projectDetails) - - let projectlistContainer = document.getElementById('projectlist') - let formprojectlistContainer = document.getElementById('formprojectlist') - for (let i = 0; i < projectDetailsKeys.length; i++) { - - newHtml = `
- - -
-

${projectDetails[projectDetailsKeys[i]].projectDescription}

` - projectlistContainer.innerHTML = projectlistContainer.innerHTML + newHtml - - applicationformHtml = `` - formprojectlistContainer.innerHTML = formprojectlistContainer.innerHTML + applicationformHtml - } - - document.getElementById('projectactionlist').style.display = 'flex' - // User list related operations - let applicantsArray = floGlobals.generalData['{"application":"TEST_MODE","type":"test2"}'] + let applicants_InformationArray = floGlobals.generalData['{"application":"TEST_MODE","type":"test3"}'] let applicantsIDarray = [] let projectlisttablebody = document.getElementById('projectlisttablebody') - for (let i = 0; i < applicantsArray.length; i++) { - let currentapplicantID = applicantsArray[i]['sender'] + for (let i = 0; i < applicants_InformationArray.length; i++) { + let currentapplicantID = applicants_InformationArray[i]['sender'] applicantsIDarray.push(currentapplicantID) - let jsonMessage = JSON.parse(applicantsArray[i]['message']) + let jsonMessage = JSON.parse(applicants_InformationArray[i]['message']) // appending application to applicant list projectlisttablebody.innerHTML = projectlisttablebody.innerHTML + @@ -9598,12 +9624,12 @@ if (applicantsIDarray.includes(myFloID)) { - window.isApplicant = true - window.applicantProjects = [] - for (let i = 0; i < applicantsArray.length; i++) { - if (myFloID == applicantsArray[i]['sender']) { - var temp = JSON.parse(applicantsArray[i]['message']) - applicantProjects.push(temp[myFloID]['project']) + window.myFloID_isApplicant = true + window.myFloID_Projects = [] + 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']) // force user to not change his details if he already exists if (i == 0) { @@ -9619,14 +9645,41 @@ document.getElementById('dob').readOnly = true document.getElementById('whatsapp').value = temp[myFloID]['whatsapp'] document.getElementById('whatsapp').readOnly = true + document.getElementById('directapply_resetform').style.display = 'none' } } } } else { - window.isApplicant = false + window.myFloID_isApplicant = false } + // Project list related operations + let projectDetails = floGlobals.appObjects.RIBC.projectDetails + let projectDetailsKeys = Object.keys(projectDetails) + + let projectlistContainer = document.getElementById('projectlist') + let formprojectlistContainer = document.getElementById('formprojectlist') + for (let i = 0; i < projectDetailsKeys.length; i++) { + let disabledtext = '' + if (myFloID_isApplicant==true && myFloID_Projects.includes(projectDetails[projectDetailsKeys[i]].projectName)) { + disabledtext = 'disabled' + } + newHtml = `
+ + +

${projectDetails[projectDetailsKeys[i]].projectDescription}

+
` + + projectlistContainer.innerHTML = projectlistContainer.innerHTML + newHtml + + // Apply form + applicationformHtml = `` + formprojectlistContainer.innerHTML = formprojectlistContainer.innerHTML + applicationformHtml + } + + document.getElementById('projectactionlist').style.display = 'flex' + }); @@ -9634,10 +9687,6 @@ } - function checkboxBehaviour() { - console.log('I just clicked a checkbox') - } -