Commit 41802610 authored by Chiara Veronica Señires's avatar Chiara Veronica Señires

Merge branch 'master' of https://github.com/chiawase/CS123-uBus

parents 6d896d0c be63528e
...@@ -6,15 +6,41 @@ $('#reload').submit(function(){ ...@@ -6,15 +6,41 @@ $('#reload').submit(function(){
event.preventDefault(); event.preventDefault();
var cell = document.getElementById("cellphone_number").value, var cell = document.getElementById("cellphone_number").value,
amt = document.getElementById("amount").value; amt = document.getElementById("amount").value,
intAmt = parseInt(amt),
row = document.getElementById("load_card");
var query = new Parse.Query(User); var accountDetailDiv = document.createElement("div"),
query.equalTo("cellphoneNumber", cell); accountName = document.createElement("p"),
accountAmt = document.createElement("p");
var query = new Parse.Query(Parse.User);
query.equalTo("cellPhone", cell);
query.find({ query.find({
success: function(results){ success: function(results){
for (var i = 0; i < results.length; i++) { for (var i = 0; i < results.length; i++) {
var object = results[i]; var object = results[i];
alert(object.get('load')); alert(object.get('load'));
accountNameText = document.createTextNode("Name: " + object.get('username'));
accountAmtText = document.createTextNode("Previous Balance: " + object.get('load'));
accountName.appendChild(accountNameText);
accountAmt.appendChild(accountAmtText);
accountDetailDiv.appendChild(accountName);
accountDetailDiv.appendChild(accountAmt);
row.appendChild(accountDetailDiv);
var intLoad = parseInt(object.get('load'));
var newLoad = intLoad+intAmt;
object.set("load", newLoad.toString());
object.save(null,{
success: function(object){
console.log("Saved.");
},
error: function(error){
console.log("Error " + error);
}
});
} }
}, },
error: function(error){ error: function(error){
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<img src="img/scheduling.png" width="40px"> <img src="img/scheduling.png" width="40px">
<h1>Search User</h1> <h1>Search User</h1>
</div> </div>
<div class="card"> <div class="card" id="load_card">
<div class="row"> <div class="row">
<img src="img/scheduling.png" width="60px"> <img src="img/scheduling.png" width="60px">
<form method="post" class="card_schedule" id="reload"> <form method="post" class="card_schedule" id="reload">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment