+ +
+ + + + +
+diff --git a/www/css/styles.css b/www/css/styles.css index c6d9435..9101d08 100644 --- a/www/css/styles.css +++ b/www/css/styles.css @@ -29,4 +29,40 @@ h3.display { .card-header .secondary-text { font-weight: 300; margin-left: 1em; +} + +input.money-input::-webkit-outer-spin-button, +input.money-input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} + +input.money-input { + -moz-appearance:textfield; +} + +input.money-input:focus::-moz-placeholder { + color:transparent; +} +input.money-input:focus::-webkit-input-placeholder { + color:transparent; +} +input.money-input:focus:-ms-input-placeholder { + color:transparent; +} + +.money-input-box { + font-size: 4em !important; + font-weight: 300; +} + +.money-input-box .currency { + display: inline; + width: 1em; +} + +.money-input-box input { + display: inline-block; + max-width: calc(100% - 1.1em); + text-align: center; } \ No newline at end of file diff --git a/www/index.html b/www/index.html index 38525db..9e52f71 100644 --- a/www/index.html +++ b/www/index.html @@ -30,6 +30,7 @@ + diff --git a/www/js/input_type_money.js b/www/js/input_type_money.js new file mode 100644 index 0000000..d1b0231 --- /dev/null +++ b/www/js/input_type_money.js @@ -0,0 +1,35 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + +$("body").on("keypress", "input.money-input", function (e) { + var c = String.fromCharCode(e.which); + var k = e.which; + if (/[0-9]|[\.]/.test(c)) { + // Numbers and period + } else if (k == 0 || k == 8) { + // Delete, backspace, etc + } else { + e.preventDefault(); + return false; + } +}); + +$("body").on("change", "input.money-input", function (e) { + if ($(this).attr("max")) { + if ($(this).attr("max") * 1.0 < $(this).val() * 1.0) { + $(this).val($(this).attr("max")); + } + } + if ($(this).attr("min")) { + if ($(this).attr("min") * 1.0 > $(this).val() * 1.0) { + $(this).val($(this).attr("min")); + } + } + + $(this).val(($(this).val() * 1.0).toFixed(2) + ""); + console.log(($(this).val() * 1.0).toFixed(2) + ""); +}); \ No newline at end of file diff --git a/www/js/main.js b/www/js/main.js index dee42b2..20c3379 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -8,11 +8,16 @@ var $$ = Dom7; // for Cordova, NW.js, or the browser initPlatform(); +Template7.global = { + qrenabled: (platform_type == "cordova") +}; + var app = new Framework7({ root: "#app", name: "HelpingHelena", id: "com.netsyms.HelpingHelena", theme: platform_theme, + debug: true, init: true, initOnDeviceReady: false, routes: routes diff --git a/www/js/sendmoney.js b/www/js/sendmoney.js new file mode 100644 index 0000000..1afa3f8 --- /dev/null +++ b/www/js/sendmoney.js @@ -0,0 +1,56 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + +$("#typecodebtn").on("click", function () { + app.dialog.prompt('Enter the recipient\'s code', 'Send Money', function (code) { + if (code != "") { + app.preloader.show(); + callAPI("getprofile", { + key: localStorage.getItem("key"), + id: code + }, function (data) { + $("#publicid").val(code); + loadSendMoneyPage(); + }, function (msg) { + app.preloader.hide(); + app.dialog.alert(msg, "Error"); + }); + } + }); +}); + +function loadSendMoneyPage() { + app.preloader.show(); + if ($("#publicid").val() == "0") { + app.preloader.hide(); + $("#step1").removeClass("display-none"); + $("#step2").addClass("display-none"); + } else { + $("#step1").addClass("display-none"); + $("#step2").removeClass("display-none"); + callAPI("getprofile", { + key: localStorage.getItem("key"), + id: $("#publicid").val() + }, function (data) { + app.preloader.hide(); + console.log("Profile", data.profile); + $("#person-name").text(data.profile.name); + if (data.profile.verified) { + $("#verified-badge").removeClass("display-none"); + } else { + $("#unverified-badge").removeClass("display-none"); + } + }, function (msg) { + app.preloader.hide(); + app.dialog.alert(msg, "Error"); + }); + } +} + +$(".preset-amount-button").click(function () { + $($(this).data("target")).val($(this).data("amount")); +}); \ No newline at end of file diff --git a/www/pages/home.html b/www/pages/home.html index ffa28fa..d16b0ea 100644 --- a/www/pages/home.html +++ b/www/pages/home.html @@ -26,6 +26,7 @@
+ + + + +
++ A verified receiver is a person who is confirmed in need of + assistance. +
+ They have been vetted by a case worker or other person who works + for a local organization that helps people in need. +
+ Your money will be used for essentials only, regardless of the + receiver's verification status. +