summaryrefslogtreecommitdiff
path: root/pages/money.inc
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2023-03-03 07:04:02 +0100
committerMinteck <contact@minteck.org>2023-03-03 07:04:02 +0100
commit29928887e733f3bc2c2baaf06dafd495a006753b (patch)
tree90f5fa4c5273f201cc2d26086298ad094d9dadda /pages/money.inc
parent3d77712a9ab014635c75a33ea0f491bbda6aead3 (diff)
downloadpluralconnect-29928887e733f3bc2c2baaf06dafd495a006753b.tar.gz
pluralconnect-29928887e733f3bc2c2baaf06dafd495a006753b.tar.bz2
pluralconnect-29928887e733f3bc2c2baaf06dafd495a006753b.zip
Updated 18 files and added 10 files (automated)
Diffstat (limited to 'pages/money.inc')
-rw-r--r--pages/money.inc55
1 files changed, 53 insertions, 2 deletions
diff --git a/pages/money.inc b/pages/money.inc
index b297231..257b87f 100644
--- a/pages/money.inc
+++ b/pages/money.inc
@@ -1,5 +1,8 @@
<?php
+$minimumRaindrops = 200;
+$minimumCloudburst = 500;
+
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $_PROFILE;
$parts = explode("/", $_GET["_"]);
@@ -70,7 +73,7 @@ if ((isset($_GET["create"]) || isset($_GET["delete"])) && isset($parts[2])) {
"Title: " . (getMember($myId)["display_name"] ?? getMember($myId)["name"]) . " created a transaction to " . $account["name"] . " (" . ucfirst($account["owner"]) . ")\r\n" .
"Tags: bits\r\n" .
"Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => $account["currency"] === "gbp" ? "£" : "€" . abs((float)$_GET["amount"]) . " were " . ((float)$_GET["amount"] >= 0 ? "added" : "removed") . " just now" . (trim($_GET["description"]) !== "" ? ": " . $_GET["description"] : "")
+ 'content' => ($account["currency"] === "gbp" ? "£" : "€") . abs((float)$_GET["amount"]) . " were " . ((float)$_GET["amount"] >= 0 ? "added" : "removed") . " just now" . (trim($_GET["description"]) !== "" ? ": " . $_GET["description"] : "")
]
]));
@@ -96,7 +99,7 @@ if ((isset($_GET["create"]) || isset($_GET["delete"])) && isset($parts[2])) {
"Title: " . (getMember($myId)["display_name"] ?? getMember($myId)["name"]) . " deleted a transaction from " . $account["name"] . " (" . ucfirst($account["owner"]) . ")\r\n" .
"Tags: bits\r\n" .
"Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]),
- 'content' => $account["currency"] === "gbp" ? "£" : "€" . abs((float)$account["transactions"][(int)$_GET["id"]]["amount"]) . " " . ((float)$account["transactions"][(int)$_GET["id"]]["amount"] >= 0 ? "advance" : "withdrawal") . " created by " . (getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["display_name"] ?? getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["name"]) . " " . timeAgo($account["transactions"][(int)$_GET["id"]]["date"])
+ 'content' => ($account["currency"] === "gbp" ? "£" : "€") . abs((float)$account["transactions"][(int)$_GET["id"]]["amount"]) . " " . ((float)$account["transactions"][(int)$_GET["id"]]["amount"] >= 0 ? "advance" : "withdrawal") . " created by " . (getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["display_name"] ?? getMemberWithoutSystem($account["transactions"][(int)$_GET["id"]]["author"])["name"]) . " " . timeAgo($account["transactions"][(int)$_GET["id"]]["date"])
]
]));
@@ -297,6 +300,30 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
</a>
<?php endif; endforeach; ?>
</div>
+
+ <div class="progress" style="margin-top: 20px;">
+ <?php
+
+ $part1 = 0;
+ $part2 = 1;
+ $difference = 0;
+
+ if ($allAccounts > $minimumCloudburst) {
+ $part2 = ($allAccounts - $minimumCloudburst) / $allAccounts;
+ $part1 = 1 - $part2;
+ $difference = $allAccounts - $minimumCloudburst;
+ } else {
+ $part1 = 1;
+ $part2 = 0;
+ $difference = $minimumCloudburst - $allAccounts;
+ }
+
+ ?>
+ <div class="progress-bar bg-danger" style="width:<?= $part1 * 100 ?>%"></div>
+ <div class="progress-bar bg-success" style="width:<?= $part2 * 100 ?>%"></div>
+ </div>
+ <p style="text-align: center; margin-top: 5px;" class="<?= $allAccounts > $minimumCloudburst ? "" : "bold text-danger" ?>">£<?= number_format($difference, 2, '.', ',') ?><?php if ($allAccounts > $minimumCloudburst): ?> (<?= round($part2 * 100, 2) ?>%)<?php endif; ?> <?= $allAccounts > $minimumCloudburst ? "over" : "under" ?> the minimum</p>
+
<canvas id="history-cloudburst" style="margin-top: 10px; width: 100%; height: 200px; max-height: 100%;"></canvas>
<?php
@@ -391,6 +418,30 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
</a>
<?php endif; endforeach; ?>
</div>
+
+ <div class="progress" style="margin-top: 20px;">
+ <?php
+
+ $part1 = 0;
+ $part2 = 1;
+ $difference = 0;
+
+ if ($allAccounts > $minimumRaindrops) {
+ $part2 = ($allAccounts - $minimumRaindrops) / $allAccounts;
+ $part1 = 1 - $part2;
+ $difference = $allAccounts - $minimumRaindrops;
+ } else {
+ $part1 = 1;
+ $part2 = 0;
+ $difference = $minimumRaindrops - $allAccounts;
+ }
+
+ ?>
+ <div class="progress-bar bg-danger" style="width:<?= $part1 * 100 ?>%"></div>
+ <div class="progress-bar bg-success" style="width:<?= $part2 * 100 ?>%"></div>
+ </div>
+ <p style="text-align: center; margin-top: 5px;" class="<?= $allAccounts > $minimumRaindrops ? "" : "bold text-danger" ?>">€<?= number_format($difference, 2, '.', ',') ?><?php if ($allAccounts > $minimumCloudburst): ?> (<?= round($part2 * 100, 2) ?>%)<?php endif; ?> <?= $allAccounts > $minimumRaindrops ? "over" : "under" ?> the minimum</p>
+
<canvas id="history-raindrops" style="margin-top: 10px; width: 100%; height: 200px; max-height: 100%;"></canvas>
<?php