<div class="mb-3">
  <label class="form-label d-block">
    <?php echo $this->user->lang("Period for TLD").": &nbsp;".$this->tld;?>
  </label>
  <label class="form-label d-block">
    <?php echo $this->user->lang("Currency").": &nbsp;".$this->currency;?>
  </label>

  <select name="product-group-period" id="product-group-period"
          class="form-select w-auto" style="min-width:255px;"
          <?php if (!$this->allowchange) echo "disabled";?>>
    <?php foreach ($this->periods as $periods) { ?>
      <option value="<?php echo $periods['period'];?>"
        <?php echo ($periods['period'] == $this->period) ? "selected" : ""; ?>>
        <?php echo $periods['name'];?>
      </option>
    <?php } ?>
  </select>

  <?php if ((!$this->allowchange) && ($this->period != "")) { ?>
    <input type="hidden" name="product-group-period" value="<?php echo $this->period;?>" />
  <?php } ?>
</div>

<div class="row text-center mb-3">
  <!-- Price -->
  <div class="col-12 col-md-4 mb-3 mb-md-0">
    <label for="product-period-price" class="form-label  mb-1">
      <?php echo $this->user->lang("Price");?>
    </label>
    <input type="text"
           class="form-control form-control-sm price required text-end mx-auto"
           style="max-width: 100px;"
           id="product-period-price"
           name="product-period-price"
           value="<?php echo $this->price;?>" />
  </div>

  <!-- Transfer -->
  <div class="col-12 col-md-4 mb-3 mb-md-0">
    <label for="product-period-transfer"
           class="form-label mb-1"
           data-bs-toggle="tooltip"
           data-bs-placement="top"
           title="<?php echo $this->user->lang('You can leave this field blank to disable the transfer period'); ?>.">
      <?php echo $this->user->lang("Transfer");?>
    </label>
    <input type="text"
           class="form-control form-control-sm price text-end mx-auto"
           style="max-width: 100px;"
           id="product-period-transfer"
           name="product-period-transfer"
           value="<?php echo $this->transfer;?>" />
  </div>

  <!-- Renew -->
  <div class="col-12 col-md-4">
    <label for="product-period-renew" class="form-label  mb-1">
      <?php echo $this->user->lang("Renew");?>
    </label>
    <input type="text"
           class="form-control form-control-sm price required text-end mx-auto"
           style="max-width: 100px;"
           id="product-period-renew"
           name="product-period-renew"
           value="<?php echo $this->renew;?>" />
  </div>
</div>


<script data-cfasync="false" type="text/javascript">
  clientexec.postPageLoad('.richwindow');

  $(document).ready(function() {
    $('.price').each(function() {
      $(this).keydown(function (e) {
        // Allow: delete, backspace, tab, escape, enter, . (110, 190)
        if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
            // Allow: Ctrl+A, Ctrl+C, Ctrl+V
            ((e.keyCode == 65 || e.keyCode == 67 || e.keyCode == 86) && e.ctrlKey === true) ||
            // Allow: home, end, left, right
            (e.keyCode >= 35 && e.keyCode <= 39)) {
          return;
        }
        // Ensure numeric input
        if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) &&
            (e.keyCode < 96 || e.keyCode > 105)) {
          e.preventDefault();
        }
      });
    });
  });

    $('#product-group-period').select2({
        dropdownParent: $(".richwindow"),
        width: '100%',
    });
</script>
