-
Notifications
You must be signed in to change notification settings - Fork 0
/
phone.js
51 lines (39 loc) · 1.44 KB
/
phone.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
function appendDigit(id){
//Get the text from the textbox
var numberString = document.getElementById("numberBox").value;
//Get the next digit from the button click and append to the string
numberString += id;
//Store the new string back in the text box
document.getElementById("numberBox").value = numberString;
}
function deleteDigit(){
//Get the text from the textbox
var numberString = document.getElementById("numberBox").value;
if(numberString.length > 0){
var newString = numberString.slice(0,-1);
//Store the new string back in the text box
document.getElementById("numberBox").value = newString;
}
}
function clearNumber(){
var numberString = document.getElementById("numberBox");
numberString.value = "";
}
function makeCall(){
$("#callArea").hide(500);
$("#currentlyInCall").show(500);
var numberString = document.getElementById("numberBox").value;
document.getElementById("callingText").innerHTML = "Calling " + numberString + "...";
}
function endCall(){
}
function addPhoneOrder(method){
//Get the latest database information and save it in local storage
var JSONObject = localStorage.getItem("foodOrder"); //JSONObject is a string
var JSObject = JSON.parse(JSONObject); //parse converts strings back to key-values
JSObject["method"] = method;
// other info here
JSObject["totalCost"] = 2.00;
// JSObject["ID"] = make id
localStorage.setItem("foodOrder", JSON.stringify(JSObject));
}