From 9276317f78a557e17a4bdabb9bbc2723ab22ee69 Mon Sep 17 00:00:00 2001
From: dvkdo <89021521+devkdo@users.noreply.github.com>
Date: Tue, 8 Oct 2024 04:33:34 +0000
Subject: [PATCH 01/10] init
---
esl/index.html | 24 +++++++++++++
esl/index.js | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 122 insertions(+)
create mode 100644 esl/index.html
create mode 100644 esl/index.js
diff --git a/esl/index.html b/esl/index.html
new file mode 100644
index 0000000..b2892d2
--- /dev/null
+++ b/esl/index.html
@@ -0,0 +1,24 @@
+
+
+
+
+
-
-
+
+
+
Upload XLS or XLSX file of Student Registration
+
+
+
+
+
-
-
diff --git a/esl/script.js b/esl/script.js
index fa91263..fa171fd 100644
--- a/esl/script.js
+++ b/esl/script.js
@@ -14,12 +14,11 @@ const A_LEVEL3 =
const A_DAYMON = "Monday - lunes - segunda-feira";
const A_DAYTUE = "Tuesday - martes - terça-feira";
+
function processXLS() {
const fileInput = document.getElementById("input-file");
const file = fileInput.files[0];
- console.log(file);
-
if (file) {
const reader = new FileReader();
reader.onload = function (e) {
@@ -94,16 +93,7 @@ function evenDistribute(anyList, l1, l2) {
const listAny = anyList.slice();
const lengthListAny = listAny.length;
- console.log(
- "START LENGTHS",
- "sizeAny",
- listAny.length,
- lengthListAny,
- "size1",
- list1.length,
- "size2",
- list2.length
- );
+ console.log(`Registered: beginner (${list1.length}), intermediate (${listAny.length}), advanced (${list2.length})`);
let loop = 0;
let done = false;
@@ -137,44 +127,36 @@ function evenDistribute(anyList, l1, l2) {
}
loop++;
}
- // console.log("loop count", loop);
- console.log(
- "FINAL LENGTHS",
- "sizeAny",
- listAny.length,
- "size1",
- list1.length,
- "size2",
- list2.length
- );
+
+ console.log(`Distributed: beginner (${list1.length}), intermediate (${listAny.length}), nonbeginner (${list2.length})`);
+
return { beg: list1, nonbeg: list2 };
}
function displayLists(l1, l2, l3, l4) {
const output = document.getElementById("output");
- output.innerHTML = `
+ output.innerHTML = `
Monday Beginner (${l1.length})
${JSON.stringify(
l1,
null,
2
- )}
-
Monday Non-Beginner (${l2.length})
${JSON.stringify(
+ )}
+
Monday Non-Beginner (${l2.length})
${JSON.stringify(
l2,
null,
2
- )}
-
Tuesday Beginner (${l3.length})
${JSON.stringify(
+ )}
+
Tuesday Beginner (${l3.length})
${JSON.stringify(
l3,
null,
2
- )}
-
Tuesday Non-Beginner (${l4.length})
${JSON.stringify(
+ )}
+
Tuesday Non-Beginner (${l4.length})
${JSON.stringify(
l4,
null,
2
- )}
+ )}
`;
}
-// document.getElementById("input-file").addEventListener("change", processXLS);
document.getElementById("btn-sort").addEventListener("click", processXLS);
From 6fca7e2781a739f39a7398c58984601e1e12edf1 Mon Sep 17 00:00:00 2001
From: dvkdo <89021521+devkdo@users.noreply.github.com>
Date: Wed, 9 Oct 2024 21:52:47 +0000
Subject: [PATCH 05/10] mailing list displays
---
esl/index.css | 21 +++++++++++----------
esl/index.html | 10 +++++++---
esl/script.js | 31 +++++++++++++++++++++++++------
3 files changed, 43 insertions(+), 19 deletions(-)
diff --git a/esl/index.css b/esl/index.css
index 92329e0..58b925a 100644
--- a/esl/index.css
+++ b/esl/index.css
@@ -1,11 +1,12 @@
-.container{
- margin: 10px;
- padding: 10px;
- }
- .section-green {
- background-color: honeydew;
- color: black;
+.container {
+ margin: 10px;
+ padding: 10px;
+}
+
+.section-green {
+ background-color: honeydew;
+ color: black;
/* border: 2px solid black; */
- margin: 20px;
- padding: 20px;
- }
\ No newline at end of file
+ margin: 20px;
+ padding: 20px;
+}
\ No newline at end of file
diff --git a/esl/index.html b/esl/index.html
index 9a74390..a4a2d2b 100644
--- a/esl/index.html
+++ b/esl/index.html
@@ -9,13 +9,17 @@
-
+
-
Upload XLS or XLSX file of Student Registration
+
+
Upload XLS or XLSX file of Student Registration
+
-
+
+
+
diff --git a/esl/script.js b/esl/script.js
index 2874bc7..7a909ce 100644
--- a/esl/script.js
+++ b/esl/script.js
@@ -14,10 +14,28 @@ const A_LEVEL3 =
const A_DAYMON = "Monday - lunes - segunda-feira";
const A_DAYTUE = "Tuesday - martes - terça-feira";
-document.getElementById("btn-sort").addEventListener("click", processXLS);
-
-
-function processXLS() {
+// document.getElementById("btn-sort").addEventListener("click", getClasses);
+// document.getElementById("btn-emails").addEventListener("click", getEmails);
+document.getElementById("btn-emails").addEventListener("click", processXLS);
+
+// function getEmails(){
+// let result=[];
+// processXLS(result);
+// console.log("processed result", result);
+
+// const mondays = result[0];
+// const tuesdays = result[1];
+// displayEmails(mondays.beg, mondays.nonbeg, tuesdays.beg, tuesdays.nonbeg);
+
+// }
+// function getClasses(){
+// const result = processXLS();
+// const mondays = result[0];
+// const tuesdays = result[1];
+// displayLists(mondays.beg, mondays.nonbeg, tuesdays.beg, tuesdays.nonbeg);
+// }
+
+function processXLS(result) {
const fileInput = document.getElementById("input-file");
const file = fileInput.files[0];
@@ -79,10 +97,12 @@ function processXLS() {
});
const mondays = evenDistribute(monAny, mon1, mon2);
const tuesdays = evenDistribute(tueAny, tue1, tue2);
- // displayLists(mondays.beg, mondays.nonbeg, tuesdays.beg, tuesdays.nonbeg);
displayEmails(mondays.beg, mondays.nonbeg, tuesdays.beg, tuesdays.nonbeg);
+ // result = (new Array([mondays, tuesdays]));
+ // console.log("result", result);
};
reader.readAsArrayBuffer(file);
+
} else {
alert("Please upload an XLS/XLSX file.");
}
@@ -130,15 +150,15 @@ function evenDistribute(anyList, l1, l2) {
}
loop++;
}
-
- console.log(`Distributed: beginner (${list1.length}), intermediate (${listAny.length}), nonbeginner (${list2.length})`);
-
+
+ console.log(`Distributed: beginner (${list1.length}), intermediate (${listAny.length}), nonbeginner (${list2.length})`);
+
return { beg: list1, nonbeg: list2 };
}
-function getEmailString(list) {
+function getEmailString(list){
let emails = "";
- for (let student of list.values()) {
+ for(let student of list.values()){
const entry = `"${student.name}"<${student.email}>,`;
emails += entry;
}
@@ -146,11 +166,25 @@ function getEmailString(list) {
}
function displayEmails(l1, l2, l3, l4) {
- const emailstring = getEmailString(l1);
- const output = document.getElementById("output");
- output.classList.add("section-green");
- output.innerHTML = `
Mailing list
Monday Beginner (${l1.length})`;
- output.textContent += emailstring;
+ const outputContainer = document.getElementById("output-container");
+ outputContainer.classList.add("section-green");
+
+ const outputHeaders1 = document.getElementById("output-headers1");
+ const outputHeaders2 = document.getElementById("output-headers2");
+ const outputHeaders3 = document.getElementById("output-headers3");
+ const outputHeaders4 = document.getElementById("output-headers4");
+ const output1 = document.getElementById("output1");
+ const output2 = document.getElementById("output2");
+ const output3 = document.getElementById("output3");
+ const output4 = document.getElementById("output4");
+ outputHeaders1.innerHTML = `
Mailing list
Monday Beginner (${l1.length})`;
+ outputHeaders2.innerHTML = `
Mailing list
Monday NonBeginner (${l2.length})`;
+ outputHeaders3.innerHTML = `
Mailing list
Tuesday Beginner (${l3.length})`;
+ outputHeaders4.innerHTML = `
Mailing list
Tuesday NonBeginner (${l4.length})`;
+ output1.textContent += getEmailString(l1);
+ output2.textContent += getEmailString(l2);
+ output3.textContent += getEmailString(l3);
+ output4.textContent += getEmailString(l4);
}
function displayLists(l1, l2, l3, l4) {
From 252d8b90eae5f4af6d54b84a58d5aaffd1ab00b6 Mon Sep 17 00:00:00 2001
From: dvkdo <89021521+devkdo@users.noreply.github.com>
Date: Thu, 10 Oct 2024 17:28:11 +0000
Subject: [PATCH 07/10] working pen
---
esl/index.css | 12 ++--
esl/index.html | 8 +--
esl/script.js | 147 +++++++++++++++++++++++++++++++++++++++----------
3 files changed, 129 insertions(+), 38 deletions(-)
diff --git a/esl/index.css b/esl/index.css
index 58b925a..99998e9 100644
--- a/esl/index.css
+++ b/esl/index.css
@@ -1,12 +1,14 @@
-.container {
+.container{
margin: 10px;
padding: 10px;
}
-
.section-green {
background-color: honeydew;
color: black;
- /* border: 2px solid black; */
+/* border: 2px solid black; */
margin: 20px;
- padding: 20px;
-}
\ No newline at end of file
+ padding: 20px;
+}
+.gap-bottom{
+ margin-bottom: 20px;
+}
diff --git a/esl/index.html b/esl/index.html
index 8833274..219f04d 100644
--- a/esl/index.html
+++ b/esl/index.html
@@ -19,13 +19,13 @@