
<?php
	// ini_set('display_errors',1);
	// ini_set('display_startup_erros',1);
	// error_reporting(E_ALL);
	include $_SERVER["DOCUMENT_ROOT"].'/inc/conexao.php';
	include $_SERVER["DOCUMENT_ROOT"].'/inc/functions.php';
  $match_id = $_GET["match"];
  $teams = explode(' x ', $_GET['match_name']);
  $api = file_get_contents('http://'.$_SERVER['HTTP_HOST'].'/api/getOptionsLive/'.$match_id);
  $api = json_decode($api, true);
  $bapiId = $api['data']['bapi_id'];
  $data = explode(' ', $_GET["data"]);
  $dt = explode('/', $data[0]);
  $dt = $dt[0].'/'.$dt[1];

  $client = $_SERVER['HTTP_HOST'];
  $client = str_replace('www.', '', $client);
  $client = explode('.', $client);
  $client = $client[0];
?>
<div class="page">
  <div class="navbar" style="background: #141e28 !important;">
    <div class="navbar-inner sliding" style=" z-index: 999; ">
      <div class="left">
        <a href="#" class="link back">
          <i class="icon icon-back"></i>
          <span class="ios-only">Voltar</span>
        </a>
      </div>
      <div class="title"><?php echo $_GET['match_name']; ?></div>
    </div>
  </div>
  <div class="toolbar tabbar tabbar-scrollabl">
    <div class="toolbar-inner priceReturnBetForm" id="priceReturnBetForm">
      <a href="#notab" class="tab-link tab-link-active"><input class="text-center" name="valor" id="priceBet" type="tel" placeholder="Valor" id="priceBetReview" onfocusin="adjustPrice(this);" onfocusout="maskMoney(this); calcReturn(this.value);" onkeyup="calcReturn(this.value);" /></a>
      <a href="#notab" class="tab-link"><input class="text-center" name="return" type="text" disabled="" placeholder="Retorno" id="totalReturns" value="0,00" /></a>
      <a href="/finalizar-aposta/" data-ignore-cache="true" data-force="true" class="tab-link" style="border-radius: 0; font-size: 13px;">
        <button class="button button-fill color-green" style="height: 100%;"><span class="badge color-red couponqtd" id="coupon-qtd" style="display: initial;font-size: 12px;border-radius: 50px;"><?php echo count($_SESSION["apostas"]); ?></span> &nbsp; Finalizar</button></a>
    </div>
  </div>
  <div class="page-content hasSubnavMatc">
    <div class="tabs-swipeable-wrap">
      <div class="tabs">
        <!-- TAB -->
        <div id="tab-odds" class="page-content tab fscores-tab">
          <div class="fscores_content">
            <?php if($api['data']['transmission'] == '1'){ ?>
            <a href="http://tv.sistemafbet.com/?match=<?php echo $match_id; ?>&client=<?php echo $client; ?>" class="button button-fill button-big button-raised color-blue"><i class="material-icons">desktop_windows</i> &nbsp; Assista a partida</a><br />
            <?php } ?>
            <div id="matchOddsLive">
              <?php
                  foreach ($api["markets"] as $mkt => $b) {
                    echo '<div class="boption">'.$mkt.'</div>';

                    foreach ($b as $o) {
                      echo '<div class="ooption"><span class="option_name">'.$o["name"].'</span> <button class="col button button-fill btn-bet ';  if($_SESSION['apostas'][$match['id']]['aposta_token'] == $o["id"]){ echo 'color-green'; } elseif($o["odd"] == '--'){ echo ' disabled '; } echo '" onClick="javascript:sendBetLive(this);" id="sendBetLive" data-matchname="'.$_GET["match_name"].'" data-odd="'.$o["odd"].'" data-choice="'.$o["name"].'" data-bet="Vencedor do Encontro" data-id="'.$o["id"].'" data-match="'.$match_id.'">'.$o["odd"].'</button></div>';
                    }
                  }
              ?>
            </div>
          </div>
        </div>
        <!-- TAB -->
      </div>
    </div>
    <?php include $_SERVER["DOCUMENT_ROOT"].'/m/inc/float_menu.php'; ?>
</div>