From e9738253a8dbf658287c89f2411cbbda9053484b Mon Sep 17 00:00:00 2001 From: layobright Date: Fri, 13 Aug 2021 07:49:28 +0100 Subject: [PATCH 1/3] git checkout -b ayodeji-USSD_assignment --- result.css | 88 ++ result.js | 2233 ++++++++++++++++++++++++++++++++++++++++++++++++++ results.html | 30 + 3 files changed, 2351 insertions(+) create mode 100644 result.css create mode 100644 result.js create mode 100644 results.html diff --git a/result.css b/result.css new file mode 100644 index 0000000..b92c41f --- /dev/null +++ b/result.css @@ -0,0 +1,88 @@ +* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +body { + background: rgb(6, 6, 49); +} + + +:root { + --primary-color: red; + --white: #fff; + --secondary-color: green; + --tetiary-color: orange; +} + +/* =================================== */ +/* The section of the container */ +.container { + height: 100vh; + display: flex; + align-items: center; + justify-content: center; +} + + +/* ======================================= */ +/* The section */ +section { + width: 50%; + background: var(--white); + text-align: center; + padding: 20px; + line-height: 40px; + overflow: auto; +} + +section h4 { + color: var(--primary-color); + font-family: monospace; + font-size: 20px; +} + +section p { + font-size: 20px; + color: var(--tetiary-color); + font-family: cursive; +} + +section h2 { + color: var(--secondary-color); + font-weight: 900; + font-size: 35px; + font-family: Georgia, 'Times New Roman', Times, serif; + letter-spacing: 10px; + text-transform: uppercase; +} + +section h5 { + color: var(--primary-color); + font-size: 18px; + font-family: cursive; +} + +section button { + padding: 12px 25px; + background: var(--primary-color); + color: var(--white); + border: none; + outline: none; + cursor: pointer; + margin-top: 20px; +} + +/* ================================= */ +/* The section of the media query */ + +@media screen and (max-width:768px) { + section { + width: 95%; + } + + section h2 { + font-size: 25px; + } +} \ No newline at end of file diff --git a/result.js b/result.js new file mode 100644 index 0000000..68ba0af --- /dev/null +++ b/result.js @@ -0,0 +1,2233 @@ +const start = document.querySelector(".start") + +// Declaring the bank codes +var access = 901; +var eco = 326; +var first = 894; +var wema = 945; +var skyle = 833; +var fidelity = 770; +var gtb = 737; + + +// adding an onclick event to the start button +start.addEventListener('click', () => { + const banking = () => { + + + + // Prompt the user to enter their bank codes + var transaction = prompt("Enter your bank codes"); + + // ================================================= + // checking if the bank is skyle bank + if (transaction == `*${skyle}#`) { + alert("welcome to Polaris Bank."); + + //prompting the user to perform transaction + var select = prompt(` + WHAT DO YOU WANT TO DO TODAY ? + 1. Airtime Self + 2. Airtime Others + 3. Data + 4. Transfer + `); + + // if the user select airtime for self, prompt user to choose the amount + if (select == 1) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS AIRTIME FOR OTHERS + else if (select == 2) { + var card = prompt(` + CHOOSE RECIPIENT NETWORK + 1. mtn + 2. Airtel + 3. Etisalat + 4. Glo + + `); + let number = prompt("Enter Recipient Number"); + if (isNaN(number)) { + alert("wrong input"); + } + + // If the user selects preferred card, prompt user to select amount + if (card) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS DATA + else if (select == 3) { + var data = prompt(` + 1. self + 2. Third Party + `); + + if (data == 1) { + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // If the user selects Third party + if (data == 2) { + // Prompt user to enter Recipient number + var number = prompt("Enter Recipient Number"); + + // checking if the input number is a Number + if (isNaN(number)) { + alert("wrong Input"); + } + + // If the user enters recipient number , prompt user to select amount + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // If the user selects Transfer + else if (select == 4) { + // Prompt user to enter Recipient account number + var number = prompt("Enter Recipient Account Number"); + if (isNaN(number)) { + alert("wrong input"); + } else { + alert(`You entered ${number}`); + } + + var amount = prompt("Enter Amount"); + if (isNaN(amount)) { + alert("wrong input"); + } else { + alert(`you entered ${amount}`); + } + + // Prompt the user to select the bank + var bank = prompt(`Select Bank + 1. Access Bank Plc + 2. Ecobank Nigeria Plc + 3. Fidelity Bank Plc + 4. FIRST BANK NIGERIA LIMITED + 5. Guaranty Trust Bank Plc + `); + + // If the user selects any bank, proceeed + if (bank) { + var pin = prompt("Provide your 4 digit pin"); + + if (isNaN(pin)) { + alert("wrong input"); + } + + // Validating the pin to 4 numbers only + else if (pin.length != 4) { + alert("Error!!! Invalid pin"); + } + + // alert the pin entered + else { + alert(`you entered ${pin}`); + + // confirm if the user wants to continue the transaction + let confirms = confirm( + `You are Transferring ${amount} to ${number}, Do you want to proceed?` + ); + + // if the user chooses "OK", proceed with the transaction + if (confirms == true) { + alert("Transaction successful"); + } + + // If the user chooses "cancel", terminate the transaction + else { + alert("Transaction cancelled"); + } + } + } else { + alert("No input selected"); + } + } + + // if the user doesnt select anything or cancel trasaction + else { + alert("No input selected"); + } + } + + // ================================================== + // checking if the bank is Eco bank + else if (transaction == `*${eco}#`) { + alert("welcome to Eco Bank."); + + //prompting the user to perform transaction + var select = prompt(` + WHAT DO YOU WANT TO DO TODAY ? + 1. Airtime Self + 2. Airtime Others + 3. Data + 4. Transfer + `); + + // if the user select airtime for self, prompt user to choose the amount + if (select == 1) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS AIRTIME FOR OTHERS + else if (select == 2) { + var card = prompt(` + CHOOSE RECIPIENT NETWORK + 1. mtn + 2. Airtel + 3. Etisalat + 4. Glo + + `); + let number = prompt("Enter Recipient Number"); + if (isNaN(number)) { + alert("wrong input"); + } + + // If the user selects preferred card, prompt user to select amount + if (card) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS DATA + else if (select == 3) { + var data = prompt(` + 1. self + 2. Third Party + `); + + if (data == 1) { + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // If the user selects Third party + if (data == 2) { + // Prompt user to enter Recipient number + var number = prompt("Enter Recipient Number"); + + // checking if the input number is a Number + if (isNaN(number)) { + alert("wrong Input"); + } + + // If the user enters recipient number , prompt user to select amount + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // If the user selects Transfer + else if (select == 4) { + // Prompt user to enter Recipient account number + var number = prompt("Enter Recipient Account Number"); + if (isNaN(number)) { + alert("wrong input"); + } else { + alert(`You entered ${number}`); + } + + var amount = prompt("Enter Amount"); + if (isNaN(amount)) { + alert("wrong input"); + } else { + alert(`you entered ${amount}`); + } + + // Prompt the user to select the bank + var bank = prompt(`Select Bank + 1. Access Bank Plc + 2. Ecobank Nigeria Plc + 3. Fidelity Bank Plc + 4. FIRST BANK NIGERIA LIMITED + 5. Guaranty Trust Bank Plc + `); + + // If the user selects any bank, proceeed + if (bank) { + var pin = prompt("Provide your 4 digit pin"); + + if (isNaN(pin)) { + alert("wrong input"); + } + + // Validating the pin to 4 numbers only + else if (pin.length != 4) { + alert("Error!!! Invalid pin"); + } + + // alert the pin entered + else { + alert(`you entered ${pin}`); + + // confirm if the user wants to continue the transaction + let confirms = confirm( + `You are Transferring ${amount} to ${number}, Do you want to proceed?` + ); + + // if the user chooses "OK", proceed with the transaction + if (confirms == true) { + alert("Transaction successful"); + } + + // If the user chooses "cancel", terminate the transaction + else { + alert("Transaction cancelled"); + } + } + } else { + alert("No input selected"); + } + } + + // if the user doesnt select anything or cancel trasaction + else { + alert("No input selected"); + } + } + + // ================================================== + // checking if the bank is First bank + else if (transaction == `*${first}#`) { + alert("welcome to First Bank."); + + //prompting the user to perform transaction + var select = prompt(` + WHAT DO YOU WANT TO DO TODAY ? + 1. Airtime Self + 2. Airtime Others + 3. Data + 4. Transfer + `); + + // if the user select airtime for self, prompt user to choose the amount + if (select == 1) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS AIRTIME FOR OTHERS + else if (select == 2) { + var card = prompt(` + CHOOSE RECIPIENT NETWORK + 1. mtn + 2. Airtel + 3. Etisalat + 4. Glo + + `); + let number = prompt("Enter Recipient Number"); + if (isNaN(number)) { + alert("wrong input"); + } + + // If the user selects preferred card, prompt user to select amount + if (card) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS DATA + else if (select == 3) { + var data = prompt(` + 1. self + 2. Third Party + `); + + if (data == 1) { + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // If the user selects Third party + if (data == 2) { + // Prompt user to enter Recipient number + var number = prompt("Enter Recipient Number"); + + // checking if the input number is a Number + if (isNaN(number)) { + alert("wrong Input"); + } + + // If the user enters recipient number , prompt user to select amount + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // If the user selects Transfer + else if (select == 4) { + // Prompt user to enter Recipient account number + var number = prompt("Enter Recipient Account Number"); + if (isNaN(number)) { + alert("wrong input"); + } else { + alert(`You entered ${number}`); + } + + var amount = prompt("Enter Amount"); + if (isNaN(amount)) { + alert("wrong input"); + } else { + alert(`you entered ${amount}`); + } + + // Prompt the user to select the bank + var bank = prompt(`Select Bank + 1. Access Bank Plc + 2. Ecobank Nigeria Plc + 3. Fidelity Bank Plc + 4. FIRST BANK NIGERIA LIMITED + 5. Guaranty Trust Bank Plc + `); + + // If the user selects any bank, proceeed + if (bank) { + var pin = prompt("Provide your 4 digit pin"); + + if (isNaN(pin)) { + alert("wrong input"); + } + + // Validating the pin to 4 numbers only + else if (pin.length != 4) { + alert("Error!!! Invalid pin"); + } + + // alert the pin entered + else { + alert(`you entered ${pin}`); + + // confirm if the user wants to continue the transaction + let confirms = confirm( + `You are Transferring ${amount} to ${number}, Do you want to proceed?` + ); + + // if the user chooses "OK", proceed with the transaction + if (confirms == true) { + alert("Transaction successful"); + } + + // If the user chooses "cancel", terminate the transaction + else { + alert("Transaction cancelled"); + } + } + } else { + alert("No input selected"); + } + } + + // if the user doesnt select anything or cancel trasaction + else { + alert("No input selected"); + } + } + + // ================================================== + // checking if the bank is Wema bank + else if (transaction == `*${wema}#`) { + alert("welcome to Wema Bank."); + + //prompting the user to perform transaction + var select = prompt(` + WHAT DO YOU WANT TO DO TODAY ? + 1. Airtime Self + 2. Airtime Others + 3. Data + 4. Transfer + `); + + // if the user select airtime for self, prompt user to choose the amount + if (select == 1) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS AIRTIME FOR OTHERS + else if (select == 2) { + var card = prompt(` + CHOOSE RECIPIENT NETWORK + 1. mtn + 2. Airtel + 3. Etisalat + 4. Glo + + `); + let number = prompt("Enter Recipient Number"); + if (isNaN(number)) { + alert("wrong input"); + } + + // If the user selects preferred card, prompt user to select amount + if (card) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS DATA + else if (select == 3) { + var data = prompt(` + 1. self + 2. Third Party + `); + + if (data == 1) { + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // If the user selects Third party + if (data == 2) { + // Prompt user to enter Recipient number + var number = prompt("Enter Recipient Number"); + + // checking if the input number is a Number + if (isNaN(number)) { + alert("wrong Input"); + } + + // If the user enters recipient number , prompt user to select amount + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // If the user selects Transfer + else if (select == 4) { + // Prompt user to enter Recipient account number + var number = prompt("Enter Recipient Account Number"); + if (isNaN(number)) { + alert("wrong input"); + } else { + alert(`You entered ${number}`); + } + + var amount = prompt("Enter Amount"); + if (isNaN(amount)) { + alert("wrong input"); + } else { + alert(`you entered ${amount}`); + } + + // Prompt the user to select the bank + var bank = prompt(`Select Bank + 1. Access Bank Plc + 2. Ecobank Nigeria Plc + 3. Fidelity Bank Plc + 4. FIRST BANK NIGERIA LIMITED + 5. Guaranty Trust Bank Plc + `); + + // If the user selects any bank, proceeed + if (bank) { + var pin = prompt("Provide your 4 digit pin"); + + if (isNaN(pin)) { + alert("wrong input"); + } + + // Validating the pin to 4 numbers only + else if (pin.length != 4) { + alert("Error!!! Invalid pin"); + } + + // alert the pin entered + else { + alert(`you entered ${pin}`); + + // confirm if the user wants to continue the transaction + let confirms = confirm( + `You are Transferring ${amount} to ${number}, Do you want to proceed?` + ); + + // if the user chooses "OK", proceed with the transaction + if (confirms == true) { + alert("Transaction successful"); + } + + // If the user chooses "cancel", terminate the transaction + else { + alert("Transaction cancelled"); + } + } + } else { + alert("No input selected"); + } + } + + // if the user doesnt select anything or cancel trasaction + else { + alert("No input selected"); + } + } + + // ================================================== + // checking if the bank is Fidelity bank + else if (transaction == `*${fidelity}#`) { + alert("welcome to Fidelity Bank."); + + //prompting the user to perform transaction + var select = prompt(` + WHAT DO YOU WANT TO DO TODAY ? + 1. Airtime Self + 2. Airtime Others + 3. Data + 4. Transfer + `); + + // if the user select airtime for self, prompt user to choose the amount + if (select == 1) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS AIRTIME FOR OTHERS + else if (select == 2) { + var card = prompt(` + CHOOSE RECIPIENT NETWORK + 1. mtn + 2. Airtel + 3. Etisalat + 4. Glo + + `); + let number = prompt("Enter Recipient Number"); + if (isNaN(number)) { + alert("wrong input"); + } + + // If the user selects preferred card, prompt user to select amount + if (card) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS DATA + else if (select == 3) { + var data = prompt(` + 1. self + 2. Third Party + `); + + if (data == 1) { + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // If the user selects Third party + if (data == 2) { + // Prompt user to enter Recipient number + var number = prompt("Enter Recipient Number"); + + // checking if the input number is a Number + if (isNaN(number)) { + alert("wrong Input"); + } + + // If the user enters recipient number , prompt user to select amount + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // If the user selects Transfer + else if (select == 4) { + // Prompt user to enter Recipient account number + var number = prompt("Enter Recipient Account Number"); + if (isNaN(number)) { + alert("wrong input"); + } else { + alert(`You entered ${number}`); + } + + var amount = prompt("Enter Amount"); + if (isNaN(amount)) { + alert("wrong input"); + } else { + alert(`you entered ${amount}`); + } + + // Prompt the user to select the bank + var bank = prompt(`Select Bank + 1. Access Bank Plc + 2. Ecobank Nigeria Plc + 3. Fidelity Bank Plc + 4. FIRST BANK NIGERIA LIMITED + 5. Guaranty Trust Bank Plc + `); + + // If the user selects any bank, proceeed + if (bank) { + var pin = prompt("Provide your 4 digit pin"); + + if (isNaN(pin)) { + alert("wrong input"); + } + + // Validating the pin to 4 numbers only + else if (pin.length != 4) { + alert("Error!!! Invalid pin"); + } + + // alert the pin entered + else { + alert(`you entered ${pin}`); + + // confirm if the user wants to continue the transaction + let confirms = confirm( + `You are Transferring ${amount} to ${number}, Do you want to proceed?` + ); + + // if the user chooses "OK", proceed with the transaction + if (confirms == true) { + alert("Transaction successful"); + } + + // If the user chooses "cancel", terminate the transaction + else { + alert("Transaction cancelled"); + } + } + } else { + alert("No input selected"); + } + } + + // if the user doesnt select anything or cancel trasaction + else { + alert("No input selected"); + } + } + + // ================================================== + // checking if the bank is Guarantee Trust bank + else if (transaction == `*${gtb}#`) { + alert("welcome to Guarantee Trust Bank."); + + //prompting the user to perform transaction + var select = prompt(` + WHAT DO YOU WANT TO DO TODAY ? + 1. Airtime Self + 2. Airtime Others + 3. Data + 4. Transfer + `); + + // if the user select airtime for self, prompt user to choose the amount + if (select == 1) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS AIRTIME FOR OTHERS + else if (select == 2) { + var card = prompt(` + CHOOSE RECIPIENT NETWORK + 1. mtn + 2. Airtel + 3. Etisalat + 4. Glo + + `); + let number = prompt("Enter Recipient Number"); + if (isNaN(number)) { + alert("wrong input"); + } + + // If the user selects preferred card, prompt user to select amount + if (card) { + var amount = prompt(` + CHOOSE AMOUNT + 1. #500 + 2. #400 + 3. #300 + 4. #200 + + `); + + // if the user select the #500, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm( + "Are You sure you want to buy a #500 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#500 Transaction successful"); + } + } + + // if the user select the #400, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm( + "Are You sure you want to buy a #400 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#400 Transaction successful"); + } + } + + // if the user select the #300, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a #300 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#300 Transaction successful"); + } + } + + // if the user select the #200, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a #200 recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("#200 Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // -------------------------------------------------------- + // IF THE USER SELECTS DATA + else if (select == 3) { + var data = prompt(` + 1. self + 2. Third Party + `); + + if (data == 1) { + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + + // If the user selects Third party + if (data == 2) { + // Prompt user to enter Recipient number + var number = prompt("Enter Recipient Number"); + + // checking if the input number is a Number + if (isNaN(number)) { + alert("wrong Input"); + } + + // If the user enters recipient number , prompt user to select amount + var amount = prompt(` + SELECT PREFERED DATA + 1. 2GB 30Days N1200 + 2. 12GB 30Days N3500 + 3. 25GB 30Days N6000 + 4. 2.5GB 2Days N500 + `); + + // if the user select the 1, confirm if the user wants to proceed with the transaction + if (amount == 1) { + var check = confirm("Are You sure you want to buy a 2GB DATA ?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2GB DATA Transaction successful"); + } + } + + // if the user select the 2, confirm if the user wants to proceed with the transaction + else if (amount == 2) { + var check = confirm("Are You sure you want to buy a 12GB DATA?"); + + // if user replies with "OK", allow transation + if (check == true) { + alert("12GB Transaction successful"); + } + } + + // if the user select the 3, confirm if the user wants to proceed with the transaction + else if (amount == 3) { + var check = confirm( + "Are You sure you want to buy a 25GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("25GB Transaction successful"); + } + } + + // if the user select the 4, confirm if the user wants to proceed with the transaction + else if (amount == 4) { + var check = confirm( + "Are You sure you want to buy a 2.5GB recharge card ?" + ); + + // if user replies with "OK", allow transation + if (check == true) { + alert("2.5GB Transaction successful"); + } + } + + // if the user replies with "Cancel", stop transaction + else { + alert("No input selected"); + } + } + } + + // If the user selects Transfer + else if (select == 4) { + // Prompt user to enter Recipient account number + var number = prompt("Enter Recipient Account Number"); + if (isNaN(number)) { + alert("wrong input"); + } else { + alert(`You entered ${number}`); + } + + var amount = prompt("Enter Amount"); + if (isNaN(amount)) { + alert("wrong input"); + } else { + alert(`you entered ${amount}`); + } + + // Prompt the user to select the bank + var bank = prompt(`Select Bank + 1. Access Bank Plc + 2. Ecobank Nigeria Plc + 3. Fidelity Bank Plc + 4. FIRST BANK NIGERIA LIMITED + 5. Guaranty Trust Bank Plc + `); + + // If the user selects any bank, proceeed + if (bank) { + var pin = prompt("Provide your 4 digit pin"); + + if (isNaN(pin)) { + alert("wrong input"); + } + + // Validating the pin to 4 numbers only + else if (pin.length != 4) { + alert("Error!!! Invalid pin"); + } + + // alert the pin entered + else { + alert(`you entered ${pin}`); + + // confirm if the user wants to continue the transaction + let confirms = confirm( + `You are Transferring ${amount} to ${number}, Do you want to proceed?` + ); + + // if the user chooses "OK", proceed with the transaction + if (confirms == true) { + alert("Transaction successful"); + } + + // If the user chooses "cancel", terminate the transaction + else { + alert("Transaction cancelled"); + } + } + } else { + alert("No input selected"); + } + } + + // if the user doesnt select anything or cancel trasaction + else { + alert("No input selected"); + } + } + + // ======================================================== + // if user enters no input + else { + alert("provide your bank USSD code"); + } + + + } + banking() +}) \ No newline at end of file diff --git a/results.html b/results.html new file mode 100644 index 0000000..53a34bb --- /dev/null +++ b/results.html @@ -0,0 +1,30 @@ + + + + + + + JAVASCRIPT ASSIGNMENT + + + + +
+
+

A USSD Banking App

+

Created By :

+

Layobright

+ +
TiideLab Cohort3 Assignment
+
+ + This app works for 7 different banks for now :
+ Polaris -- Wema -- Gtb -- First Bank -- Fidelity -- Eco -- Bank Access +
+

Don't panic ๐Ÿ˜Œ, the app is not real, it's just a test๐Ÿ˜ƒ

+
+
+ + + + From e87bad392137d3aa13be1c2d7c8b3e69ff1220e2 Mon Sep 17 00:00:00 2001 From: layobright Date: Fri, 13 Aug 2021 08:02:58 +0100 Subject: [PATCH 2/3] changed the root file name --- results.html => index.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename results.html => index.html (100%) diff --git a/results.html b/index.html similarity index 100% rename from results.html rename to index.html From 95302b0a14b25ad4f251343b079d17bc0cb2539c Mon Sep 17 00:00:00 2001 From: layobright Date: Sun, 15 Aug 2021 16:34:29 +0100 Subject: [PATCH 3/3] added bubbles --- index.html | 6 +++ particles.js | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++ result.css | 44 +++++++++++++++-- 3 files changed, 178 insertions(+), 5 deletions(-) create mode 100755 particles.js diff --git a/index.html b/index.html index 53a34bb..6d1585d 100644 --- a/index.html +++ b/index.html @@ -26,5 +26,11 @@
TiideLab Cohort3 Assignment
+ +
+ + + + diff --git a/particles.js b/particles.js new file mode 100755 index 0000000..1404e2a --- /dev/null +++ b/particles.js @@ -0,0 +1,133 @@ +// LOADING THE PARTICLES ON WINDOWS LOAD + +window.addEventListener('DOMContentLoaded', (event) => { + particlesJS("particles-js", + { + "particles":{ + "number":{ + "value":95, + "density":{ + "enable":true, + "value_area":800 + } + }, + "color":{ + "value":"#151c58" + }, + "shape":{ + "type":"circle", + "stroke":{ + "width":3, + "color":"#00ff00" + }, + "polygon":{ + "nb_sides":6 + }, + "image":{ + "src":"img/github.svg", + "width":100, + "height":100 + } + }, + "opacity":{ + "value":0.13415509907748635, + "random":true, + "anim":{ + "enable":false, + "speed":1, + "opacity_min":0.1, + "sync":false + } + + }, + "size":{ + "value":19.728691040806815, + "random":true, + "anim":{ + "enable":true, + "speed":10, + "size_min":40, + "sync":false + } + }, + "line_linked":{ + "enable":false, + "distance":200, + "color":"#ffffff", + "opacity":1, + "width":2 + }, + "move":{ + "enable":true, + "speed":20, + "direction":"none", + "random":false, + "straight":false, + "out_mode":"out", + "bounce":false, + "attract":{ + "enable":false, + "rotateX":600, + "rotateY":1200 + } + } + }, + "interactivity":{ + "detect_on":"canvas", + "events":{ + "onhover":{ + "enable":false, + "mode":"grab" + }, + "onclick":{ + "enable":false, + "mode":"push" + }, + "resize":true + }, + "modes":{ + "grab":{ + "distance":400, + "line_linked":{ + "opacity":1 + } + }, + "bubble":{ + "distance":400, + "size":40, + "duration":2, + "opacity":8, + "speed":3 + }, + "repulse":{ + "distance":200, + "duration":0.4 + }, + "push":{ + "particles_nb":4 + }, + "remove":{ + "particles_nb":2 + } + } + }, + "retina_detect":true + }); + var count_particles, stats, update; + stats = new Stats; + stats.setMode(0); + stats.domElement.style.position = 'absolute'; + stats.domElement.style.left = '0px'; + stats.domElement.style.top = '0px'; + document.body.appendChild(stats.domElement); + count_particles = document.querySelector('.js-count-particles'); + update = function() { stats.begin(); stats.end(); + if (window.pJSDom[0].pJS.particles && window.pJSDom[0].pJS.particles.array){ + count_particles.innerText = window.pJSDom[0].pJS.particles.array.length; + } + requestAnimationFrame(update); + }; + requestAnimationFrame(update); +}); + + \ No newline at end of file diff --git a/result.css b/result.css index b92c41f..d5f1ab3 100644 --- a/result.css +++ b/result.css @@ -18,11 +18,17 @@ body { /* =================================== */ /* The section of the container */ -.container { - height: 100vh; - display: flex; +/* .container { */ +/* height: 100vh; */ +/* display: flex; align-items: center; - justify-content: center; + justify-content: center; */ +/* position: relative; */ + +/* } */ + +#particles-js { + height: 100vh; } @@ -35,6 +41,11 @@ section { padding: 20px; line-height: 40px; overflow: auto; + position: absolute; + top: 5%; + left: 25%; + + /* transform: translate(10%); */ } section h4 { @@ -74,15 +85,38 @@ section button { margin-top: 20px; } + + + + /* ================================= */ /* The section of the media query */ +@media screen and (min-width:1000px) { + section { + top: 20%; + left: 25%; + } +} + + + @media screen and (max-width:768px) { section { - width: 95%; + width: 85%; + top: 10%; + left: 5%; } section h2 { font-size: 25px; } +} + + +@media screen and (max-width:425px) { + section { + width: 95%; + left: 2.5%; + } } \ No newline at end of file