Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

abalsh / Garlix

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • Garlix
  • resources
  • views
  • currency.blade.php
Find file
BlameHistoryPermalink
  • Florian Shllaku's avatar
    Crypto api finished, design and live data done · 72187432
    Florian Shllaku committed 6 years ago
    72187432
currency.blade.php 4.33 KB
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
@extends('header')

@section('content')
  <div class="card">
    <div class="card-body">
        <h3>
            <small class="text-muted"><span id="color">Currency converter</span></small>
        </h3>
      <div class="input-group">
      <br>
      <form id="Form">
        <br>
        
        <input style="width: 250px;" type="number" placeholder="Enter Amount to Convert" step="0.01" min="0" id="Amount" class="form-control" value="1">
        
        <br>
        <div class="row" >
            <div class="col">
                <blockquote class="blockquote">
              <select  class="selectpicker" data-show-subtext="true" data-live-search="true" data-size="5" id="From">
                @foreach ($currencies as $item)
                  <option  class="form-control" value="{{ $item->iso }}">{{ $item->name }} - {{ $item->iso }}</option>
                @endforeach
              </select>
                </blockquote>
            </div>
      
      <button type="button" id="swap-button" style="background:none; border:none;"><i class="fa fa-exchange" style="font-size:36px; color: #3C1C78;"></i></button>

      <br>
      
      <div class="col">
          <select  class="selectpicker" data-show-subtext="true" data-live-search="true" data-size="5" id="To">
            @foreach ($currencies as $item)
              <option class="form-control" value="{{ $item->iso }}" selected>{{ $item->name }} - {{ $item->iso }}</option>
            @endforeach
          </select>
        </div>
      </div>
      <br> <br> 
      </form>
      <div class="row" style="padding-top: 10px;">
          <div class="col">
      <blockquote class="blockquote">
          <h2 class="mb-0" id="color"><span id="amount">1</span> <span id="from">USD</span></h2>
      </blockquote>
          </div>
          <span  class="blockquote" id="color mb-0" > = </span>
          <div class="col">
      <blockquote class="blockquote">
          <h2 class="mb-0" id="color" style="margin-left: 20px;"><span id="rezult">0.89</span> <span id="to">EUR</span></h2>
      </blockquote>
          </div>
      </div>
      
      {{-- <h1 style="padding-top: 50px;" id="color">Amount:  <span id="amount"></span><span id="from"></span>:<span id="rezult"></span><span id="to"></span></h1> --}}
      <?php
        // if( isset($_GET["From"]) && isset($_GET["Amount"]) && isset($_GET["To"])) 
        // {
        //   if (!empty($_GET["From"]) && !empty($_GET["Amount"]) && !empty($_GET["To"])){

        //     $value = $_GET['Amount']; 
                      
        //     $arrFrom = (DB::table('currency')->select('rates')->where('iso', '=', $_GET['From'])->get())->pluck('rates');
        //     $From = $arrFrom[0];

        //     $arrTo = (DB::table('currency')->select('rates')->where('iso', '=', $_GET['To'])->get())->pluck('rates');
        //     $To = $arrTo[0];
            
        //     $rez = ($value/$From) * $To;
        //     echo $rez;
        //   }
        // }
      ?>
      </div>
    </div>
  </div>

  <script>
       
  </script>

    {{-- <script>
      function swapValues(){
        var tmp = document.getElementById("From").value;
        document.getElementById("From").value = document.getElementById("To").value;
        document.getElementById("To").value = tmp;
      }

             var request = new XMLHttpRequest()

        // Open a new connection, using the GET request on the URL endpoint

        request.open('GET', 'http://127.0.0.1:8000/api', true)
        request.onload = function() {
          // Begin accessing JSON data here
          var data = JSON.parse(this.response)

          if (request.status >= 200 && request.status < 400) {
            // for(var i = 0; i < 33; i++){
            //   console.log(data[i]['iso']);
            // }
            var From = document.getElementById("From").value;
            var To = document.getElementById("To").value;
            var Fromjs = data[0]['rates'];
            var Tojs = data[1]['rates'];
            var value = document.getElementById("Amount");
            cbootstrap dropdown downonsole.log(calculate(Fromjs, Tojs, Value));
          } 
          else{
            console.log('error')
          }

          // Send request
          request.send()

        } 
          

      function calculate(one, two, thre){
        return (three/one) * two;
      }
        
    </script> --}}
 

  @include('footer')
  @endsection