summaryrefslogtreecommitdiff
path: root/app/bits
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-11-11 23:47:49 +0100
committerMinteck <contact@minteck.org>2022-11-11 23:47:49 +0100
commit209356b8ade1920b50d1d3a1a5e121c6623d167b (patch)
tree5301396987d1510f715a0b1c24754873af19e1dc /app/bits
parent2c4ae43e688a9873e86211ea0e7aeb9ba770dd77 (diff)
downloadpluralconnect-209356b8ade1920b50d1d3a1a5e121c6623d167b.tar.gz
pluralconnect-209356b8ade1920b50d1d3a1a5e121c6623d167b.tar.bz2
pluralconnect-209356b8ade1920b50d1d3a1a5e121c6623d167b.zip
Update
Diffstat (limited to 'app/bits')
-rwxr-xr-xapp/bits/assets/switching.js17
-rwxr-xr-xapp/bits/index.html77
-rwxr-xr-xapp/bits/static/black.css (renamed from app/bits/assets/black.css)0
-rwxr-xr-xapp/bits/static/chart.js (renamed from app/bits/assets/chart.js)0
-rwxr-xr-xapp/bits/static/create.js (renamed from app/bits/assets/create.js)0
-rw-r--r--app/bits/static/default.png (renamed from app/bits/assets/default.png)bin1600 -> 1600 bytes
-rwxr-xr-xapp/bits/static/delete.js (renamed from app/bits/assets/delete.js)0
-rwxr-xr-xapp/bits/static/easteregg.js (renamed from app/bits/assets/easteregg.js)0
-rwxr-xr-xapp/bits/static/error.js (renamed from app/bits/assets/error.js)0
-rw-r--r--app/bits/static/fonts.woff2 (renamed from app/bits/assets/fonts.woff2)bin158900 -> 158900 bytes
-rw-r--r--app/bits/static/global.css (renamed from app/bits/assets/global.css)17
-rwxr-xr-xapp/bits/static/graph.js (renamed from app/bits/assets/graph.js)0
-rwxr-xr-xapp/bits/static/load.js (renamed from app/bits/assets/load.js)0
-rwxr-xr-xapp/bits/static/logo-alt.svg (renamed from app/bits/assets/logo-alt.svg)0
-rwxr-xr-xapp/bits/static/logo.icns (renamed from app/bits/assets/logo.icns)bin402662 -> 402662 bytes
-rwxr-xr-xapp/bits/static/logo.ico (renamed from app/bits/assets/logo.ico)bin139062 -> 139062 bytes
-rwxr-xr-xapp/bits/static/logo.png (renamed from app/bits/assets/logo.png)bin4968 -> 4968 bytes
-rwxr-xr-xapp/bits/static/logo.svg (renamed from app/bits/assets/logo.svg)0
-rw-r--r--app/bits/static/material.css (renamed from app/bits/assets/material.css)0
-rwxr-xr-xapp/bits/static/material.js (renamed from app/bits/assets/material.js)0
-rwxr-xr-xapp/bits/static/misc.js (renamed from app/bits/assets/misc.js)0
-rwxr-xr-xapp/bits/static/mobile-p1.js (renamed from app/bits/assets/mobile-p1.js)0
-rwxr-xr-xapp/bits/static/mobile-p2.js (renamed from app/bits/assets/mobile-p2.js)0
-rwxr-xr-xapp/bits/static/mobile-p3.js (renamed from app/bits/assets/mobile-p3.js)0
-rwxr-xr-xapp/bits/static/page.js (renamed from app/bits/assets/page.js)0
-rwxr-xr-xapp/bits/static/plural.js (renamed from app/bits/assets/plural.js)0
-rwxr-xr-xapp/bits/static/refresh.js (renamed from app/bits/assets/refresh.js)33
-rwxr-xr-xapp/bits/static/switching.js35
-rwxr-xr-xapp/bits/static/trendline.js (renamed from app/bits/assets/trendline.js)0
-rwxr-xr-xapp/bits/static/visibility.js (renamed from app/bits/assets/visibility.js)0
30 files changed, 133 insertions, 46 deletions
diff --git a/app/bits/assets/switching.js b/app/bits/assets/switching.js
deleted file mode 100755
index daa5a6e..0000000
--- a/app/bits/assets/switching.js
+++ /dev/null
@@ -1,17 +0,0 @@
-function switchToStats() {
- document.getElementById("switcher-1").style.display = "";
- document.getElementById("switcher-0").style.display = "none";
- document.getElementById("title-1").style.display = "";
- document.getElementById("title-0").style.display = "none";
- document.getElementById("list").style.display = "none";
- document.getElementById("stats").style.display = "";
-}
-
-function switchToList() {
- document.getElementById("switcher-1").style.display = "none";
- document.getElementById("switcher-0").style.display = "";
- document.getElementById("title-1").style.display = "none";
- document.getElementById("title-0").style.display = "";
- document.getElementById("list").style.display = "";
- document.getElementById("stats").style.display = "none";
-} \ No newline at end of file
diff --git a/app/bits/index.html b/app/bits/index.html
index e81c2a8..40640c7 100755
--- a/app/bits/index.html
+++ b/app/bits/index.html
@@ -9,14 +9,14 @@
</script>
<!-- Material Design -->
- <link rel="stylesheet" href="./assets/material.css">
- <script src="./assets/material.js"></script>
+ <link rel="stylesheet" href="static/material.css">
+ <script src="static/material.js"></script>
<style>
@font-face {
font-family: 'Material Symbols Outlined';
font-style: normal;
font-weight: 400;
- src: url("assets/fonts.woff2") format('woff2');
+ src: url("static/fonts.woff2") format('woff2');
}
.material-symbols-outlined {
@@ -37,24 +37,24 @@
</style>
<!-- CSS -->
- <link rel="stylesheet" href="./assets/global.css">
- <link rel="stylesheet" href="./assets/black.css">
+ <link rel="stylesheet" href="static/global.css">
+ <link rel="stylesheet" href="static/black.css">
<!-- Libs -->
- <script src="./assets/chart.js"></script>
- <script src="./assets/trendline.js"></script>
+ <script src="static/chart.js"></script>
+ <script src="static/trendline.js"></script>
<!-- Components -->
- <script src="./assets/error.js"></script>
- <script src="./assets/load.js"></script>
- <script src="./assets/refresh.js"></script>
- <script src="./assets/create.js"></script>
- <script src="./assets/misc.js"></script>
- <script src="./assets/delete.js"></script>
- <script src="./assets/easteregg.js"></script>
- <script src="./assets/switching.js"></script>
- <script src="./assets/visibility.js"></script>
- <script src="./assets/plural.js"></script>
+ <script src="static/error.js"></script>
+ <script src="static/load.js"></script>
+ <script src="static/refresh.js"></script>
+ <script src="static/create.js"></script>
+ <script src="static/misc.js"></script>
+ <script src="static/delete.js"></script>
+ <script src="static/easteregg.js"></script>
+ <script src="static/switching.js"></script>
+ <script src="static/visibility.js"></script>
+ <script src="static/plural.js"></script>
</head>
<body style="position:fixed;inset:0;">
<div id="loadfailure" style="font-family:sans-serif;position:fixed;inset:0;background:black;display:none;z-index:999999999;">
@@ -67,10 +67,10 @@
</div>
<div id="error" style="background-color:red;display:none;position:fixed;z-index:999999;color:black;font-family:monospace;inset:0;"></div>
<div id="loader" style="background:#222;transition:opacity 500ms;z-index:9999;position:fixed;inset:0;display:flex;align-items: center;justify-content: center;">
- <img alt="" src="assets/logo.svg" id="loader-img" style="background: transparent;border-radius: 999px;width:96px;">
- <div id="loader-text" style="display:none;position:fixed;color:white;top:10px;left:0;right:0;text-align:center;">Waiting for assets...</div>
+ <img alt="" src="static/logo.svg" id="loader-img" style="background: transparent;border-radius: 999px;width:96px;">
+ <div id="loader-text" style="display:none;position:fixed;color:white;top:10px;left:0;right:0;text-align:center;">Waiting for static...</div>
</div>
-<script src="./assets/mobile-p1.js"></script>
+<script src="static/mobile-p1.js"></script>
<div id="app" style="display:none;position:fixed;z-index:3;">
<header class="mdc-top-app-bar">
<div class="mdc-top-app-bar__row">
@@ -82,17 +82,21 @@
<span id="title-1" style="display:none;">
Statistics
</span>
+ <span id="title-2" style="display:none;">
+ Expenses
+ </span>
</span>
</section>
<section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-end">
- <button class="material-symbols-outlined mdc-top-app-bar__action-item mdc-icon-button" aria-label="Toggle visibility of sensitive information" onclick="toggleVisibility()" id="visibility-icon">visibility</button>
+ <!--<button class="material-symbols-outlined mdc-top-app-bar__action-item mdc-icon-button" aria-label="Toggle visibility of sensitive information" onclick="toggleVisibility()" id="visibility-icon">visibility</button>-->
+ <button class="material-symbols-outlined mdc-top-app-bar__action-item mdc-icon-button" aria-label="List" onclick="switchToList()" id="switcher-1">receipt_long</button>
<button class="material-symbols-outlined mdc-top-app-bar__action-item mdc-icon-button" aria-label="Statistics" onclick="switchToStats()" id="switcher-0">insights</button>
- <button class="material-symbols-outlined mdc-top-app-bar__action-item mdc-icon-button" aria-label="List" onclick="switchToList()" id="switcher-1" style="display:none;">receipt_long</button>
- <button class="material-symbols-outlined mdc-top-app-bar__action-item mdc-icon-button" id="header-user" aria-label="User" style="margin-right: 12px;"><img onerror="this.src='./assets/default.png'" id="user-profile" alt="" style="border-radius: 999px;width: 36px;height: 36px;vertical-align: middle;display:inline-block;position: relative;top: -5px;background: rgb(37, 37, 37);" src=""></button>
+ <button class="material-symbols-outlined mdc-top-app-bar__action-item mdc-icon-button" aria-label="List" onclick="switchToExpenses()" id="switcher-2">shopping_bag</button>
+ <button class="material-symbols-outlined mdc-top-app-bar__action-item mdc-icon-button" id="header-user" aria-label="User" style="margin-right: 12px;"><img onerror="this.src='./static/default.png'" id="user-profile" alt="" style="border-radius: 999px;width: 36px;height: 36px;vertical-align: middle;display:inline-block;position: relative;top: -5px;background: rgb(37, 37, 37);" src=""></button>
</section>
</div>
</header>
- <script src="./assets/mobile-p2.js"></script>
+ <script src="static/mobile-p2.js"></script>
<div class="mdc-touch-target-wrapper" style="position: fixed;bottom: 16px;right: 16px;z-index: 99999;">
<button class="mdc-fab mdc-fab--mini mdc-fab--touch" onclick="addDialog.open();" style="width: 48px;height: 48px;">
<div class="mdc-fab__ripple"></div>
@@ -217,7 +221,7 @@
<ul id="demo-zone" style="display:none;">
<div class="transaction" data-transaction-id="%transactionId%" style="padding:10px;border-bottom: 1px solid rgba(0, 0, 0, .25);display:grid;grid-template-columns: 48px 1fr;grid-column-gap: 15px;">
<div class="transaction-user" style="display:flex;align-items: center;justify-content: center;">
- <img onerror="this.src='./assets/default.png'" alt="%picture%" style="border-radius: 999px;width: 48px;height: 48px;">
+ <img onerror="this.src='./static/default.png'" alt="%picture%" style="border-radius: 999px;width: 48px;height: 48px;">
</div>
<div class="transaction-details">
<b>%user%</b> %type% <span style="color:var(--perc-color);"><b>%amount_bc%</b> <i>(%amount_cc%)</i></span><br>
@@ -229,7 +233,7 @@
<span class="mdc-list-item__ripple"></span>
<span class="mdc-list-item__text">
<div class="mdc-list-item__groups">
- <img class="mdc-list-item__picture" onerror="this.src='./assets/default.png'" alt="%picture%" style="border-radius: 999px;width: 36px;height: 36px;">
+ <img class="mdc-list-item__picture" onerror="this.src='./static/default.png'" alt="%picture%" style="border-radius: 999px;width: 36px;height: 36px;">
<div class="mdc-list-item__contents">
<span class="mdc-list-item__primary-text">%user% %type% <span style="color:var(--perc-color);filter:invert(1);"><b>%amount_bc%</b> <i>(%amount_cc%)</i></span></span>
<span class="mdc-list-item__secondary-text">%time% · %description%</span>
@@ -285,6 +289,21 @@
<br>
</div>
+ <div id="expenses" style="display:none;position:fixed;top:64px;left:0;bottom:0;right:0;overflow-x:auto;">
+ <table id="expenses-table">
+ <thead>
+ <tr>
+ <th>Item name</th>
+ <th>Cost</th>
+ <th>Completeness</th>
+ </tr>
+ </thead>
+
+ <tbody id="expenses-items"></tbody>
+ </table>
+ <br>
+ </div>
+
<div id="goal" style="display:none;
position: fixed;
background: rgb(64, 64, 64);
@@ -310,8 +329,8 @@
"></span></span></div>
</main>
</div>
-<script src="./assets/mobile-p3.js"></script>
-<script src="./assets/page.js"></script>
-<script src="./assets/graph.js"></script>
+<script src="static/mobile-p3.js"></script>
+<script src="static/page.js"></script>
+<script src="static/graph.js"></script>
</body>
</html>
diff --git a/app/bits/assets/black.css b/app/bits/static/black.css
index 30aed8f..30aed8f 100755
--- a/app/bits/assets/black.css
+++ b/app/bits/static/black.css
diff --git a/app/bits/assets/chart.js b/app/bits/static/chart.js
index abaf010..abaf010 100755
--- a/app/bits/assets/chart.js
+++ b/app/bits/static/chart.js
diff --git a/app/bits/assets/create.js b/app/bits/static/create.js
index 5e98955..5e98955 100755
--- a/app/bits/assets/create.js
+++ b/app/bits/static/create.js
diff --git a/app/bits/assets/default.png b/app/bits/static/default.png
index 7fba660..7fba660 100644
--- a/app/bits/assets/default.png
+++ b/app/bits/static/default.png
Binary files differ
diff --git a/app/bits/assets/delete.js b/app/bits/static/delete.js
index 0c6ce5e..0c6ce5e 100755
--- a/app/bits/assets/delete.js
+++ b/app/bits/static/delete.js
diff --git a/app/bits/assets/easteregg.js b/app/bits/static/easteregg.js
index cb05ea6..cb05ea6 100755
--- a/app/bits/assets/easteregg.js
+++ b/app/bits/static/easteregg.js
diff --git a/app/bits/assets/error.js b/app/bits/static/error.js
index d16ae0b..d16ae0b 100755
--- a/app/bits/assets/error.js
+++ b/app/bits/static/error.js
diff --git a/app/bits/assets/fonts.woff2 b/app/bits/static/fonts.woff2
index 6f97617..6f97617 100644
--- a/app/bits/assets/fonts.woff2
+++ b/app/bits/static/fonts.woff2
Binary files differ
diff --git a/app/bits/assets/global.css b/app/bits/static/global.css
index 0025f09..aa927b4 100644
--- a/app/bits/assets/global.css
+++ b/app/bits/static/global.css
@@ -136,4 +136,21 @@ body {
background: rgb(37, 37, 37);
filter: invert(1);
margin-top: 8px;
+}
+
+#expenses-table {
+ margin-left: auto;
+ margin-right: auto;
+ margin-top: 20px;
+ max-width: 95vw;
+ border-collapse: collapse;
+}
+
+#expenses-table th, #expenses-table td {
+ border: 1px solid rgba(255, 255, 255, .25);
+ padding: 10px 20px;
+}
+
+#expenses-table thead {
+ border-bottom: 2px solid rgba(255, 255, 255, .25);
} \ No newline at end of file
diff --git a/app/bits/assets/graph.js b/app/bits/static/graph.js
index 0503b99..0503b99 100755
--- a/app/bits/assets/graph.js
+++ b/app/bits/static/graph.js
diff --git a/app/bits/assets/load.js b/app/bits/static/load.js
index c748656..c748656 100755
--- a/app/bits/assets/load.js
+++ b/app/bits/static/load.js
diff --git a/app/bits/assets/logo-alt.svg b/app/bits/static/logo-alt.svg
index 516972d..516972d 100755
--- a/app/bits/assets/logo-alt.svg
+++ b/app/bits/static/logo-alt.svg
diff --git a/app/bits/assets/logo.icns b/app/bits/static/logo.icns
index 1738301..1738301 100755
--- a/app/bits/assets/logo.icns
+++ b/app/bits/static/logo.icns
Binary files differ
diff --git a/app/bits/assets/logo.ico b/app/bits/static/logo.ico
index 189621b..189621b 100755
--- a/app/bits/assets/logo.ico
+++ b/app/bits/static/logo.ico
Binary files differ
diff --git a/app/bits/assets/logo.png b/app/bits/static/logo.png
index d39dcd7..d39dcd7 100755
--- a/app/bits/assets/logo.png
+++ b/app/bits/static/logo.png
Binary files differ
diff --git a/app/bits/assets/logo.svg b/app/bits/static/logo.svg
index 68c7b1c..68c7b1c 100755
--- a/app/bits/assets/logo.svg
+++ b/app/bits/static/logo.svg
diff --git a/app/bits/assets/material.css b/app/bits/static/material.css
index ed29523..ed29523 100644
--- a/app/bits/assets/material.css
+++ b/app/bits/static/material.css
diff --git a/app/bits/assets/material.js b/app/bits/static/material.js
index 6f57299..6f57299 100755
--- a/app/bits/assets/material.js
+++ b/app/bits/static/material.js
diff --git a/app/bits/assets/misc.js b/app/bits/static/misc.js
index 776f3d9..776f3d9 100755
--- a/app/bits/assets/misc.js
+++ b/app/bits/static/misc.js
diff --git a/app/bits/assets/mobile-p1.js b/app/bits/static/mobile-p1.js
index 3794299..3794299 100755
--- a/app/bits/assets/mobile-p1.js
+++ b/app/bits/static/mobile-p1.js
diff --git a/app/bits/assets/mobile-p2.js b/app/bits/static/mobile-p2.js
index e69de29..e69de29 100755
--- a/app/bits/assets/mobile-p2.js
+++ b/app/bits/static/mobile-p2.js
diff --git a/app/bits/assets/mobile-p3.js b/app/bits/static/mobile-p3.js
index e69de29..e69de29 100755
--- a/app/bits/assets/mobile-p3.js
+++ b/app/bits/static/mobile-p3.js
diff --git a/app/bits/assets/page.js b/app/bits/static/page.js
index 785fb73..785fb73 100755
--- a/app/bits/assets/page.js
+++ b/app/bits/static/page.js
diff --git a/app/bits/assets/plural.js b/app/bits/static/plural.js
index e9916dd..e9916dd 100755
--- a/app/bits/assets/plural.js
+++ b/app/bits/static/plural.js
diff --git a/app/bits/assets/refresh.js b/app/bits/static/refresh.js
index acf223f..b5acde1 100755
--- a/app/bits/assets/refresh.js
+++ b/app/bits/static/refresh.js
@@ -292,6 +292,39 @@ async function refresh() {
}
}
+ let expenses = JSON.parse(localStorage.getItem("bits-expenses"));
+ let expenses_balance = totalEUR;
+ let expenses_dom = "";
+
+ for (let expense of expenses) {
+ let completeness = 0;
+ let missing;
+
+ if (expense['eur'] <= expenses_balance) {
+ completeness = 1;
+ } else {
+ missing = expense['eur'] - expenses_balance;
+ completeness = 1 - (missing / expense['eur']);
+ }
+
+ if (completeness < 0) {
+ completeness = 0;
+ missing = null;
+ }
+
+ expenses_dom += `
+ <tr style="background-color: ${completeness >= 0.9999 ? '#00ff0022' : completeness > 0 ? '#ffff0016' : '#ff000022'}">
+ <td>${expense['item']}</td>
+ <td>${expense['eur'].toFixed(2)}€, £${expense['gbp'].toFixed(2)}</td>
+ <td>${(completeness * 100).toFixed(2)}%${missing ? ` (missing ${missing.toFixed(2)}€)` : ``}</td>
+ </tr>
+ `;
+
+ expenses_balance -= expense['eur'];
+ }
+
+ document.getElementById("expenses-items").innerHTML = expenses_dom;
+
document.getElementById("loader-text").innerText = "";
updateLoader();
diff --git a/app/bits/static/switching.js b/app/bits/static/switching.js
new file mode 100755
index 0000000..293de72
--- /dev/null
+++ b/app/bits/static/switching.js
@@ -0,0 +1,35 @@
+function switchToStats() {
+ //document.getElementById("switcher-1").style.display = "none";
+ //document.getElementById("switcher-2").style.display = "";
+ //document.getElementById("switcher-0").style.display = "none";
+ document.getElementById("title-2").style.display = "none";
+ document.getElementById("title-1").style.display = "";
+ document.getElementById("title-0").style.display = "none";
+ document.getElementById("list").style.display = "none";
+ document.getElementById("expenses").style.display = "none";
+ document.getElementById("stats").style.display = "";
+}
+
+function switchToExpenses() {
+ //document.getElementById("switcher-1").style.display = "";
+ //document.getElementById("switcher-2").style.display = "none";
+ //document.getElementById("switcher-0").style.display = "none";
+ document.getElementById("title-2").style.display = "";
+ document.getElementById("title-1").style.display = "none";
+ document.getElementById("title-0").style.display = "none";
+ document.getElementById("list").style.display = "none";
+ document.getElementById("stats").style.display = "none";
+ document.getElementById("expenses").style.display = "";
+}
+
+function switchToList() {
+ //document.getElementById("switcher-2").style.display = "none";
+ //document.getElementById("switcher-1").style.display = "none";
+ //document.getElementById("switcher-0").style.display = "";
+ document.getElementById("title-2").style.display = "none";
+ document.getElementById("title-1").style.display = "none";
+ document.getElementById("title-0").style.display = "";
+ document.getElementById("list").style.display = "";
+ document.getElementById("stats").style.display = "none";
+ document.getElementById("expenses").style.display = "none";
+} \ No newline at end of file
diff --git a/app/bits/assets/trendline.js b/app/bits/static/trendline.js
index 48e2522..48e2522 100755
--- a/app/bits/assets/trendline.js
+++ b/app/bits/static/trendline.js
diff --git a/app/bits/assets/visibility.js b/app/bits/static/visibility.js
index f418195..f418195 100755
--- a/app/bits/assets/visibility.js
+++ b/app/bits/static/visibility.js