Merge branch 'classes-bessones'
diff --git a/TableParser.py b/TableParser.py
index d8d4802..537f393 100644
--- a/TableParser.py
+++ b/TableParser.py
@@ -44,8 +44,7 @@
classes = td_hora['class'];
if td_hora.has_attr('class') and not td_hora['class'][0] in self.EMPTY_CELL_CLASSES:
- assignaturaRaw = td_hora.get_text().strip()
- assignatura = assignaturaRaw.lower()
+ assignatura = td_hora.get_text().strip()
aulaRaw = table.find_all("th")[column].get_text().strip()
aula = p.match(aulaRaw).group(1)
durada = int(td_hora.get("rowspan"))*30
@@ -58,7 +57,7 @@
endsDateTime = beginsDateTime + timedelta(minutes=durada)
ends = int(endsDateTime.timestamp())
- print(("Afegint " if db != None else "") + assignaturaRaw
+ print(("Afegint " if db != None else "") + assignatura
+ ", " + hora
+ ", " + str(durada) + "mins"
+ ", " + aula)
diff --git a/css/bulma-adjustments.css b/css/bulma-adjustments.css
index 8931934..a722717 100644
--- a/css/bulma-adjustments.css
+++ b/css/bulma-adjustments.css
@@ -1,3 +1,7 @@
+html {
+ min-width: auto;
+}
+
.buttons.grid {
display: flex;
flex-direction: row;
@@ -24,26 +28,54 @@
}
#dev-mode {
- background: #d23f31;
- border: 1px solid #3e2723;
- box-shadow: 0 0 4px rgba(0,0,0,.14), 0 2px 4px rgba(0,0,0,.28);
- color: #fff;
- font-size: 10px;
- font-weight: 700;
- right: 20px;
- line-height: 18px;
- margin: -9px -50px;
- opacity: .87;
- position: absolute;
- text-align: center;
- text-shadow: 1px 1px 0 #4e342e;
- top: 20px;
- transform: rotate(45deg);
- width: 100px;
- z-index: 99;
- cursor: pointer;
+ background: #d23f31;
+ border: 1px solid #3e2723;
+ box-shadow: 0 0 4px rgba(0,0,0,.14), 0 2px 4px rgba(0,0,0,.28);
+ color: #fff;
+ font-size: 10px;
+ font-weight: 700;
+ right: 20px;
+ line-height: 18px;
+ margin: -9px -50px;
+ opacity: .87;
+ position: absolute;
+ text-align: center;
+ text-shadow: 1px 1px 0 #4e342e;
+ top: 20px;
+ transform: rotate(45deg);
+ width: 100px;
+ z-index: 99;
+ cursor: pointer;
}
-#dev-mode.hidden {
- display: none;
-}
\ No newline at end of file
+.hidden {
+ display: none;
+}
+
+#fme-maps-container h4 {
+ font-weight: bold;
+}
+
+.maps {
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+}
+
+.maps .map {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ max-width: 500px;
+
+ margin: 8px;
+}
+
+.maps .map .map--label {
+ font-weight: 300;
+ margin-top: 2px;
+ margin-bottom: 2px;
+}
diff --git a/images/README.md b/images/README.md
new file mode 100644
index 0000000..61700dc
--- /dev/null
+++ b/images/README.md
@@ -0,0 +1 @@
+Icons made by <a href="http://www.freepik.com/" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon"> www.flaticon.com</a>
diff --git a/images/icon-128.png b/images/icon-128.png
new file mode 100644
index 0000000..0e49818
--- /dev/null
+++ b/images/icon-128.png
Binary files differ
diff --git a/images/icon-64.png b/images/icon-64.png
new file mode 100644
index 0000000..91b6296
--- /dev/null
+++ b/images/icon-64.png
Binary files differ
diff --git a/images/sofa.png b/images/sofa.png
new file mode 100644
index 0000000..91b6296
--- /dev/null
+++ b/images/sofa.png
Binary files differ
diff --git a/img/LICENSE.md b/img/LICENSE.md
new file mode 100644
index 0000000..fb788e8
--- /dev/null
+++ b/img/LICENSE.md
@@ -0,0 +1,3 @@
+Els continguts d'aquesta carpeta provenen de https://fme.upc.edu/ca/la-facultat/edifici/plafo-fme-a4.pdf/view.
+
+(C) Universitat Politècnica de Catalunya · BarcelonaTech (UPC)
diff --git a/img/p0.png b/img/p0.png
new file mode 100644
index 0000000..b04e781
--- /dev/null
+++ b/img/p0.png
Binary files differ
diff --git a/img/p1.png b/img/p1.png
new file mode 100644
index 0000000..16a123d
--- /dev/null
+++ b/img/p1.png
Binary files differ
diff --git a/img/ps.png b/img/ps.png
new file mode 100644
index 0000000..b3b9015
--- /dev/null
+++ b/img/ps.png
Binary files differ
diff --git a/index.html b/index.html
index fd34ad3..24803d8 100644
--- a/index.html
+++ b/index.html
@@ -2,8 +2,18 @@
<html lang="ca">
<head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta charset="UTF-8">
+ <title>Seients DAFME</title>
+
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="manifest" href="manifest.json">
+
+ <!-- Apple web app -->
+ <link rel="apple-touch-icon" href="./images/icon-64.png">
+ <meta name="apple-mobile-web-app-title" content="Seients DAFME">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <meta name="apple-mobile-web-app-status-bar-style" content="white">
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.0/css/bulma.min.css">
<link rel="stylesheet" href="./css/bulma-adjustments.css">
@@ -31,7 +41,7 @@
var begins = new Date(parseInt(final_JSON.class.begins)*1000);
var ends = new Date(parseInt(final_JSON.class.ends)*1000);
- document.getElementById('subject-final').textContent = final_JSON.class.friendly_name;
+ document.getElementById('subject-final').textContent = final_JSON.class.friendly_name || final_JSON.class.calendar_name;
document.getElementById('classroom-final').textContent = final_JSON.class.room;
document.getElementById('date-final').textContent = begins.toLocaleDateString();
document.getElementById('time-final').textContent = formatDate(begins) + ' - ' + formatDate(ends);
@@ -124,6 +134,12 @@
})
.then(response => response.json())
.then(data => {
+ if (data.payload.classes.length == 0) {
+ document.getElementById('no-subjects').classList.remove('hidden');
+ } else {
+ document.getElementById('fme-maps-container').classList.remove('hidden');
+ }
+
for (var [i, classe] of data.payload.classes.entries()) {
console.log(classe);
@@ -137,7 +153,7 @@
var header = document.createElement('div');
header.classList.add('message-header');
- header.textContent = classe.friendly_name;
+ header.textContent = classe.friendly_name || classe.calendar_name;
var body = document.createElement('div');
body.classList.add('message-body');
@@ -214,7 +230,25 @@
</p>
</div><br>
-->
- <div id="subject-container" class="grid buttons"></div><br>
+ <div id="subject-container" class="grid buttons"></div>
+ <div id="no-subjects" class="hidden">No s'està impartint cap classe en aquests moments.</div>
+ <div id="fme-maps-container" class="hidden">
+ <h4>Mapes de les aules de l'FME</h4>
+ <div class="maps">
+ <div class="map">
+ <img src="img/ps.png">
+ <div class="map--label">Planta <b>-1</b></div>
+ </div>
+ <div class="map">
+ <img src="img/p0.png">
+ <div class="map--label">Planta <b>0</b></div>
+ </div>
+ <div class="map">
+ <img src="img/p1.png">
+ <div class="map--label">Planta <b>1</b></div>
+ </div>
+ </div>
+ </div>
</section>
@@ -270,7 +304,7 @@
<button id="send-button" class="button is-link is-large">Omple el formulari</button><br><br>
Hi ha errors? <br /><a class="button is-link is-light" href="https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform">Completa el formulari manualment</a>
- </section>
+ </section>
<script>
var current_section = "section-1";
@@ -338,7 +372,7 @@
params.append("entry." + idsFormulari.begins, formatDate(begins));
params.append("entry." + idsFormulari.ends, formatDate(ends));
params.append("entry." + idsFormulari.rows[final_JSON.letter], 'Columna ' + final_JSON.number);
- // params.append("entry." + idsFormulari.notes, '[Autogenerat per delefme/covid-tracability -- Assignatura seleccionada: ' + final_JSON.class.friendly_name + ']');
+ // params.append("entry." + idsFormulari.notes, '[Autogenerat per delefme/covid-tracability -- Assignatura seleccionada: ' + (final_JSON.class.friendly_name || final_JSON.class.calendar_name) + ']');
var formulari_link = formBaseUrl + '?' + params.toString() + '#i1';
window.location.href = formulari_link;
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..dab7bd1
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,21 @@
+{
+ "short_name": "Seients DAFME",
+ "name": "Seients DAFME",
+ "description": "App per la traçabilitat del COVID a la FME",
+ "icons": [
+ {
+ "src": "images/icon-128.png",
+ "type": "image/png",
+ "sizes": "128x128"
+ },
+ {
+ "src": "images/icon-64.png",
+ "type": "image/png",
+ "sizes": "128x128"
+ }
+ ],
+ "background_color": "#ffffff",
+ "theme_color": "#ffffff",
+ "display": "fullscreen",
+ "start_url": "index.html?utm_source=homescreen"
+}