<?php
  $Position   = '../';
  require_once($Position.'config/config.php');
  require_once($Position.'config/conexion.php');
  require_once($Position.'funciones/funciones.php');
  $PagNum = $_POST['PagNum'];
?>
<div class="card CardPago">
  <div class="card-body">

    <!-- Btn DelMet -->
    <button
      type="button"
      class="btn btn-danger btn-sm Btn-DelCardPago"
      style="
        position: absolute;
        top: 0px;
        right: 0px;
      "
    >
      <i class="fa fa-times"></i>
    </button>
    <!-- End Btn DelMet -->

    <input type="hidden" name="Pagos[]" value="<?php echo $PagNum; ?>" />

    <div>
      <label>Método de Pago</label>
      <select
        name="Pago[<?php echo $PagNum; ?>][Metodo]"
        class="demo-default chosen-select SelMetodo"
        placeholder="Selecciona un cliente"
        data-required="true"
      >
        <option value="0">Selecciona una opción</option>
        <?php
          //Usos CFDI
          $Query = "
            SELECT
              met.Id,
              met.Metodo
            FROM KB_PagosMetodos met
            WHERE met.Activo = '1'
            ORDER BY met.Id ASC
          ";
          $Metodos = $mysqli->query($Query);
          mysqli_data_seek($Metodos, 0);
          while($Metodo = mysqli_fetch_array($Metodos)) {
        ?>
          <option
            value="<?php echo $Metodo['Id']; ?>"
          ><?php echo $Metodo['Metodo']; ?></option>
        <?php } ?>
      </select>
    </div>

    <div>
      <hr>
      <label>Pago</label>
      <input
        autocomplete="off"
        data-type="number"
        class="form-control PagoIn"
        name="Pago[<?php echo $PagNum; ?>][Pago]"
        data-type="number"
        data-required="true"
        <?php if( $iPhone && $iPad ){ ?>
          inputmode="text"
          type="text"
        <?php }else{ ?>
          inputmode="text"
        <?php } ?>
        oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*?)\..*/g, '$1');"
      />
    </div>

  </div>
</div>
