123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- var HttpClient = function() {
- this.get = function(aUrl, aCallback) {
- var anHttpRequest = new XMLHttpRequest();
- anHttpRequest.onreadystatechange = function() {
- if (anHttpRequest.readyState == 4 && anHttpRequest.status == 200)
- aCallback(anHttpRequest.responseText);
- }
- anHttpRequest.open( "GET", aUrl, true );
- anHttpRequest.send( null );
- }
- }
- var client = new HttpClient();
- client.get('http://bufk.antandros.com.tr:9998/gosteriler', function(response) {
- // do something with response
- var gosteri_listesi = JSON.parse(response);
- for (var i = 0; i < gosteri_listesi.length; i++) {
- console.log(gosteri_listesi[i])
- var x = document.getElementById("gosteriler");
- var option = document.createElement("option");
- var tarih = gosteri_listesi[i]["tarih"];
- var saat = gosteri_listesi[i]["saat"];
- var yer = gosteri_listesi[i]["yer"];
- var tarih_pretty = tarih.slice(0,2) + "." + tarih.slice(2,4) + "." + tarih.slice(4,6);
- var saat_pretty = saat.slice(0,2) + ":" + saat.slice(2,4);
- var gosteri = tarih_pretty + " " + saat_pretty + " " + yer;
- option.text = gosteri;
- option.value = tarih;
- x.add(option);
- }
- });
- var sira = 'ABCDEFGHIJKLMNOPRST';
- var x = document.getElementById("sira");
- for(var harf in sira) {
- var option = document.createElement("option");
- option.text = sira[harf];
- option.value = sira[harf];
- x.add(option);
- }
- function numaraYukle(select){
- var selection = document.getElementById("sira");
- if(selection.value==='A'){
- for (var i = 1; i < 21; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- } else if(select.value == 'B') {
- for (var i = 1; i < 24; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- } else if(select.value == 'C') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- } else if(select.value == 'D') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'E') {
- for (var i = 1; i < 29; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'F') {
- for (var i = 1; i < 29; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'G') {
- for (var i = 1; i < 29; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'H') {
- for (var i = 1; i < 29; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'I') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'J') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'K') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'L') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'M') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'N') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'O') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'P') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'R') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'S') {
- for (var i = 1; i < 27; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- }else if(select.value == 'T') {
- for (var i = 1; i < 21; i++) {
- var x = document.getElementById('numara');
- var option = document.createElement("option");
- option.text = i;
- option.value = i;
- x.add(option);
- }
- } else{
- console.log("error");
- }
- }
- function satisYap() {
- var values = {};
- var x = document.getElementById("form");
- var inputs = x.elements;
- var gosteri = inputs[0].value;
- var sira = inputs[1].value;
- var numara = inputs[2].value;
- var kategori = inputs[3].value;
- var isim = inputs[4].value;
- var eposta = inputs[5].value;
- var telefon = inputs[6].value;
- var query = "/satis/" + gosteri + "/" + sira.toLowerCase() + numara + "/" + kategori + "/" + isim + "/" + eposta + "/" + telefon;
- var client = new HttpClient();
- client.get('http://bufk.antandros.com.tr:9998' + query, function(response) {
- document.getElementById("uyari").innerHTML = response;
- });
- }
- function rezerveEt() {
- var values = {};
- var x = document.getElementById("form");
- var inputs = x.elements;
- var gosteri = inputs[0].value;
- var sira = inputs[1].value;
- var numara = inputs[2].value;
- var kategori = inputs[3].value;
- var isim = inputs[4].value;
- var eposta = inputs[5].value;
- var telefon = inputs[6].value;
- var query = "/rezervasyon/" + gosteri + "/" + sira.toLowerCase() + numara + "/" + kategori + "/" + isim + "/" + eposta + "/" + telefon;
- var client = new HttpClient();
- client.get('http://bufk.antandros.com.tr:9998' + query, function(response) {
- document.getElementById("uyari").innerHTML = response;
- });
- }
- function satilanlar() {
- var donus = "";
- var gosteri_tarihi = document.getElementById("gosteriler").value;
- console.log(gosteri_tarihi);
- var client = new HttpClient();
- client.get('http://bufk.antandros.com.tr:9998/satilanlar/' + gosteri_tarihi, function(response) {
- // do something with response
- var satilan_biletler = JSON.parse(response);
- console.log(satilan_biletler);
- var col = [];
- for (var i = 0; i < satilan_biletler.length; i++) {
- for (var key in satilan_biletler[i]) {
- if (col.indexOf(key) === -1) {
- col.push(key);
- }
- }
- }
- var table = document.createElement("table");
- table.className = "table table-striped table-sm"
- var tr = table.insertRow(-1); // TABLE ROW.
- for (var i = 0; i < col.length; i++) {
- var th = document.createElement("th"); // TABLE HEADER.
- th.innerHTML = col[i];
- tr.appendChild(th);
- }
- for (var i = 0; i < satilan_biletler.length; i++) {
- tr = table.insertRow(-1);
- for (var j = 0; j < col.length; j++) {
- var tabCell = tr.insertCell(-1);
- tabCell.innerHTML = satilan_biletler[i][col[j]];
- }
- }
- var divContainer = document.getElementById("showData");
- divContainer.innerHTML = "";
- divContainer.appendChild(table);
- }
- );
- console.log(donus);
- }
- function rezervasyonlar() {
- var donus = "";
- var gosteri_tarihi = document.getElementById("gosteriler").value;
- console.log(gosteri_tarihi);
- var client = new HttpClient();
- client.get('http://bufk.antandros.com.tr:9998/rezervasyonlar/' + gosteri_tarihi, function(response) {
- // do something with response
- var rezerve_biletler = JSON.parse(response);
- console.log(rezerve_biletler);
- var col = [];
- for (var i = 0; i < rezerve_biletler.length; i++) {
- for (var key in rezerve_biletler[i]) {
- if (col.indexOf(key) === -1) {
- col.push(key);
- }
- }
- }
- var table = document.createElement("table");
- table.className = "table table-striped table-sm"
- var tr = table.insertRow(-1); // TABLE ROW.
- for (var i = 0; i < col.length; i++) {
- var th = document.createElement("th"); // TABLE HEADER.
- th.innerHTML = col[i];
- tr.appendChild(th);
- }
- for (var i = 0; i < rezerve_biletler.length; i++) {
- tr = table.insertRow(-1);
- for (var j = 0; j < col.length; j++) {
- var tabCell = tr.insertCell(-1);
- tabCell.innerHTML = rezerve_biletler[i][col[j]];
- }
- }
- var divContainer = document.getElementById("showData");
- divContainer.innerHTML = "";
- divContainer.appendChild(table);
- }
- );
- console.log(donus);
- }
|