<!-- Full Width Column -->
  <div class="content-wrapper">

    <div class="container">
      <!-- Content Header (Page header) -->
      <section class="content-header">
        <h1>
          Detail Reservasi
        </h1>
        
      </section>

      <!-- Main content -->
      <section class="content">
        <div class="row invoice-info">
        <div class="col-sm-6 invoice-col">
          Wistatawan
          <address>
            <strong><?= $detail_pelanggan['nama'] ?></strong><br>
            <?= $detail_pelanggan['alamat'] ?><br>
            Phone: <?= $detail_pelanggan['telepon'] ?><br>
            Email: <?= $detail_pelanggan['email'] ?>
          </address>
        </div>
        <!-- /.col -->

        <div class="col-sm-6 invoice-col">
          Status
          <address>
            <strong><?php if ($detail_pelanggan['transaction_status'] == 'pending') : ?>
                        <span class="badge badge-warning" style="font-size: 14px;">Belum Dibayar</span>
                     <?php else : ?>
                        <span class="badge badge-success" style="font-size: 14px;">Sudah Dibayar</span>
                     <?php endif; ?></strong><br>
               <b>Tipe pembayaran : </b><?= $detail_pelanggan['payment_type'] ?><br>

                  <?php if ($detail_pelanggan['bill_key'] == '-') : ?>
                     <?php echo ""; ?>
                  <?php elseif ($detail_pelanggan['bill_key'] == 0) : ?>
                     <?php echo ""; ?>
                  <?php else : ?>
                     <b>Bill key : </b><?= $detail_pelanggan['bill_key'] ?> <br>
                     
                  <?php endif; ?>

                  <?php if ($detail_pelanggan['biller_code'] == '-') : ?>
                     <?php echo ""; ?>
                  <?php elseif ($detail_pelanggan['biller_code'] == 0) : ?>
                     <?php echo ""; ?>
                  <?php else : ?>
                     
                     <b>Biller code : </b><?= $detail_pelanggan['biller_code'] ?> <br>
                     
                  <?php endif; ?>

                  <?php if ($detail_pelanggan['permata_va_number'] == '-') : ?>
                     
                      <b>Bank : </b><?= $detail_pelanggan['bank'] ?> <br>
                     
                  <?php else : ?>
                     
                        <b>Bank : </b><?= 'Permata bank'; ?><br>
                     
                  <?php endif; ?>

                  <?php if ($detail_pelanggan['va_number'] == '-') : ?>
                     <?php echo ""; ?>
                  <?php else : ?>
                     
                        <b>Va number :</b><?= $detail_pelanggan['va_number'] ?> <br>
                     
                  <?php endif; ?>

                  <?php if ($detail_pelanggan['bca_va_number'] == '-') : ?>
                     <?php echo ""; ?>
                  <?php else : ?>
                     
                        <b>BCA va number :</b><?= $detail_pelanggan['bca_va_number'] ?> <br>
                     
                  <?php endif; ?>

                  <?php if ($detail_pelanggan['permata_va_number'] == '-') : ?>
                     <?php echo ""; ?>
                  <?php else : ?>
                     
                        <b>Permata va number :</b><?= $detail_pelanggan['permata_va_number'] ?> 
                     
                  <?php endif; ?>
          </address>
        </div>
        <!-- /.col -->
        <div class="col-sm-4 invoice-col">
         
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->

      <!-- Table row -->
      <div class="row">
        <div class="col-xs-12 table-responsive">
          <table class="table table-striped">
            <thead>
            <tr>
              <th>#</th>
              <th>Blok</th>
              <th>Tanggal Masuk</th>
              <th>Tanggal Keluar</th>
              <th>Hari</th>
              <th class="text-right">Sewa Perhari</th>
              <th class="text-right">Subtotal</th>
            </tr>
            </thead>
            <tbody>
            <?php 
            $no=1;
            foreach ($detail_pesanan as $barang) : ?>
            <tr>
              <td><?=$no?></td>
              <td><?= $barang['blok'] ?></td>
              <td><?=date('d F Y', strtotime($barang['tgl_in'])) ?></td>
               <td><?=date('d F Y', strtotime($barang['tgl_out'])) ?></td>
              <td><?=$barang['qty']?></td>
              <td class="text-right">Rp.<?= number_format($barang['harga'])?></td>
              <td class="text-right"> Rp.<?= number_format($barang['harga']*$barang['qty'])?></td>
            </tr>
            <?php $no++;
            endforeach; ?>
            <tr>
              <th></th>
              <th></th>
              <th><th>
              <th></th>
              <th class="text-right">Total Bayar</th>
               <th class="text-right">Rp. <?= number_format($barang['total_bayar'])  ?></th>
            </tr>
            </tbody>
          </table>
        </div>
        <!-- /.col -->
      </div>
      <div class="box-body">
          <div id='printoutPanel'></div>
          
          <div id='myMap' style='position:relative;width:100%;height:700px;'></div>

          </div>
         <div class="col-md-6">
         <a class="btn btn-sm btn-danger mt-3 shadow" href="<?= base_url('snap/status_transaksi') ?>">kembali</a>

         </div>
      </div>
      </section>
      <!-- /.content -->
    </div>
    <!-- /.container -->
  </div>
  <!-- /.content-wrapper -->
<script type='text/javascript'>
    var map, infobox;

    function GetMap() {
        
        map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        /* No need to set credentials if already passed in URL */
        center: new Microsoft.Maps.Location(-7.679388, 112.598252),
        mapTypeId: Microsoft.Maps.MapTypeId.aerial,
        zoom: 20
    });

        infobox = new Microsoft.Maps.Infobox(map.getCenter(), {
            visible: false
        });

        //Assign the infobox to a map instance.
        infobox.setMap(map);

        //Create random locations in the map bounds.

        <?php
         
            foreach ($detail_pesanan as $barang) :
              $cl='red';
              $link ="Sudah direservasi";
            
         ?>
            var pin = new Microsoft.Maps.Pushpin(new Microsoft.Maps.Location(<?=$barang['latlng']?>), {text: "<?=$barang['blok']?>", color: '<?=$cl?>'});

            pin.metadata = {
                description: "<?=$link?>"
            };

            //Add a click event handler to the pushpin.
            Microsoft.Maps.Events.addHandler(pin, 'click', pushpinClicked);

            //Add pushpin to the map.
            map.entities.push(pin);
               
         <?php endforeach;  ?> 
    }

    function pushpinClicked(e) {
        //Make sure the infobox has metadata to display.
        if (e.target.metadata) {
            //Set the infobox options with the metadata of the pushpin.
            infobox.setOptions({
                location: e.target.getLocation(),
                title: e.target.metadata.title,
                description: e.target.metadata.description,
                visible: true
            });
        }
    }
    </script>
    <script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=U4VD6Xi1NuVkAaN8KvJF~dereRmfzkm5VdVorK5lmlA~Ar4MuDpGzRmqdUtbXYvjm31t06tAU-400GnsVAY8Zna23hb05WjeiHiszdHOEAXU' async defer></script>