You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.8 KiB
JavaScript
56 lines
1.8 KiB
JavaScript
5 years ago
|
/*
|
||
|
* 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"));
|
||
|
});
|