From 33ed283a979e69816535ed8a7ca6d3875573e94e Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Wed, 27 Mar 2019 12:56:46 -0600 Subject: [PATCH] Finish money sending feature (close #1) --- www/img/bigcheck.svg | 14 ++++++++++++++ www/js/sendmoney.js | 27 +++++++++++++++++++++++++++ www/pages/moneysent.html | 40 ++++++++++++++++++++++++++++++++++++++++ www/pages/sendmoney.html | 37 ++++++++++++++++++++----------------- www/routes.js | 23 ++++++++++------------- 5 files changed, 111 insertions(+), 30 deletions(-) create mode 100644 www/img/bigcheck.svg create mode 100644 www/pages/moneysent.html diff --git a/www/img/bigcheck.svg b/www/img/bigcheck.svg new file mode 100644 index 0000000..7568d07 --- /dev/null +++ b/www/img/bigcheck.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/www/js/sendmoney.js b/www/js/sendmoney.js index 1afa3f8..7c610ff 100644 --- a/www/js/sendmoney.js +++ b/www/js/sendmoney.js @@ -23,6 +23,29 @@ $("#typecodebtn").on("click", function () { }); }); +function sendMoney(id, amount, name) { + if (id == "0") { + return; + } + if (amount <= 0) { + app.dialog.alert("Please specify an amount.", "Error"); + } else if (amount > 999.99) { + app.dialog.alert("Please specify an amount less than $999.99.", "Error"); + } + app.preloader.show(); + callAPI("sendmoney", { + key: localStorage.getItem("key"), + to: id, + amount: amount + }, function (data) { + app.preloader.hide(); + router.navigate("/moneysent/" + (amount * 1.0).toFixed(2) + "/" + name); + }, function (msg) { + app.preloader.hide(); + app.dialog.alert(msg, "Error"); + }); +} + function loadSendMoneyPage() { app.preloader.show(); if ($("#publicid").val() == "0") { @@ -53,4 +76,8 @@ function loadSendMoneyPage() { $(".preset-amount-button").click(function () { $($(this).data("target")).val($(this).data("amount")); +}); + +$("#sendbtn").click(function () { + sendMoney($("#publicid").val(), $("#amount-box").val(), $("#person-name").text()); }); \ No newline at end of file diff --git a/www/pages/moneysent.html b/www/pages/moneysent.html new file mode 100644 index 0000000..07bad7c --- /dev/null +++ b/www/pages/moneysent.html @@ -0,0 +1,40 @@ + + +
+ + + + +
+ +
+ +
+
+
+
+ Checkmark + +

You sent ${{this.$route.params.amount}} to {{this.$route.params.name}}

+ + Close +
+
+
+
+
+ +
+ +
\ No newline at end of file diff --git a/www/pages/sendmoney.html b/www/pages/sendmoney.html index 40dd902..989ca4e 100644 --- a/www/pages/sendmoney.html +++ b/www/pages/sendmoney.html @@ -40,23 +40,7 @@ diff --git a/www/routes.js b/www/routes.js index 479bd8c..ef7bdee 100644 --- a/www/routes.js +++ b/www/routes.js @@ -43,6 +43,11 @@ var routes = [ } } }, + { + path: '/moneysent/:amount/:name', + templateUrl: './pages/moneysent.html', + name: 'moneysent' + }, { path: '/settings', name: 'prefs', @@ -62,26 +67,18 @@ var routes = [ settings: [{ setting: "userinfo", title: ' ' + username + '', - text: ' Server: ' + serverurl + '', + text: '', onclick: "" }, { setting: "account", - title: "Sign in to a different account", + title: "Sign out", onclick: "router.navigate('/setup/0')" }, - { - setting: "editor", - title: "Use alternative editor", - text: "Turn on if you're having issues editing notes.", - toggle: true, - checked: localStorage.getItem("alternateeditor") == "true", - onclick: "" - }, { setting: "versions", - title: "NotePost app v1.2.0", - text: "Copyright © 2018-2019 Netsyms Technologies. License: Mozilla Public License 2.0.", + title: "Helping Helena app v1.0.0", + text: "Copyright © 2018-2019 Netsyms Technologies. License: Mozilla Public License 2.0.", onclick: "" }, { @@ -94,7 +91,7 @@ var routes = [ setting: "privacy", title: "Privacy Policy", text: "", - onclick: "openBrowser('https://netsyms.com/legal?pk_campaign=NotePostApp')" + onclick: "openBrowser('https://netsyms.com/legal?pk_campaign=HelpingHelenaApp')" }] } });