<script data-cfasync="false" type="text/javascript">
    $(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
                    (e.keyCode == 65 && e.ctrlKey === true) ||
                    // Allow: Ctrl+C
                    (e.keyCode == 67 && e.ctrlKey === true) ||
                     // Allow: Ctrl+V
                    (e.keyCode == 86 && e.ctrlKey === true) ||
                     // Allow: home, end, left, right
                    (e.keyCode >= 35 && e.keyCode <= 39)) {
                         // let it happen, don't do anything
                         return;
                }
                // Ensure that it is a number and stop the keypress
                if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
                    e.preventDefault();
                }
            });
        });
    });

    //Code for prices in different currencies
    function productPricingFilterBy (el,filter)
    {
        $(el).closest('.nav-pills').find('li').removeClass('active')
        $(el).closest('li').addClass('active');

        $('.currencyprice').hide();
        $('.currencyCode'+filter).show();
    }
    //Code for prices in different currencies
</script>

<?php
    //Code for prices in different currencies
    include_once 'modules/billing/models/CurrencyGateway.php';

    $gateway = new CurrencyGateway($this->user);
    $currencies = $gateway->GetCurrencies();

    if ($currencies['totalcount'] > 1) {
?>
        <ul class="nav nav-pills">
<?php
        foreach ($currencies['currencies'] as $currencyValues) {
?>
            <li <?php if ($currencyValues['isdefault']) { echo 'class="active"'; } ?> >
                <a <?php if ($currencyValues['isdefault']) { echo 'class="default-language-tab"'; } ?> href="javascript:void(0)" onclick="productPricingFilterBy(this,'<?php echo $currencyValues['abrv']; ?>')"><?php echo $currencyValues['name']; ?></a>
            </li>
<?php
        }
?>
        </ul>
<?php
    }
    //Code for prices in different currencies
?>

<div class="fieldwrapper">

    <form id="pricingtab">
        <table class="table table-striped" cellpadding="5" cellspacing="5" style="width:100%">
            <thead>
            <tr>
                <td width="150">
                </td>
                <td width="50">
                    <label style="text-align:center;font-weight:bold;" class="fieldlabel"><?php echo $this->user->lang("Price");?></label>
                </td>
                <td width="50">
                    <label style="text-align:center;font-weight:bold;" class="fieldlabel"><?php echo $this->user->lang("Setup");?></label>
                </td>
                <td width="100">
                    <label style="text-align:center;font-weight:bold;" class="fieldlabel"><?php echo $this->user->lang("Allow in signup?");?></label>
                </td>
                <td><!-- THIS ADDITIONAL CELL IS TO AVOID EXPANDING THE PREVIOUS CELLS -->
                </td>
            </tr>
            </thead>
            <tbody>

            <?php foreach ($this->priceExtraData as $cycle => $extraDataValues) {
                if ($cycle == 0) {
                    continue;
                } ?>

                <tr>
                    <td>
                        <?php echo $this->user->lang($this->priceExtraData[$cycle]['price_name']);?>
                    </td>
                    <td>
<!-- CODE FOR PRICES IN DIFFERENT CURRENCIES -->
<?php
    if ($currencies['totalcount'] > 1) {
        foreach ($currencies['currencies'] as $currencyValues) {
?>
                        <span class="currencyprice currencyCode<?php echo $currencyValues['abrv']; ?>" <?php if (!$currencyValues['isdefault']) { echo 'style="display: none"'; } ?> ><input class="price" type="text" value="<?php echo $this->priceExtraDataCurrencies[$currencyValues['abrv']][$cycle]['price'];?>" name="<?php echo $currencyValues['abrv']; ?>_price<?php echo $cycle; ?>" <?php if ($currencyValues['isdefault']) { echo 'id="maincurrencyprice'.$cycle.'"'; } ?> style="width:50px;"/></span>
<?php
        }
    } else {
?>
                        <input class="price" type="text" value="<?php echo $this->priceExtraData[$cycle]['price'];?>" name="price<?php echo $cycle; ?>" id="maincurrencyprice<?php echo $cycle; ?>" style="width:50px;"/>
<?php
    }
?>
<!-- /CODE FOR PRICES IN DIFFERENT CURRENCIES -->
                    </td>
                    <td>
<!-- CODE FOR PRICES IN DIFFERENT CURRENCIES -->
<?php
    if ($currencies['totalcount'] > 1) {
        foreach ($currencies['currencies'] as $currencyValues) {
?>
                        <span class="currencyprice currencyCode<?php echo $currencyValues['abrv']; ?>" <?php if (!$currencyValues['isdefault']) { echo 'style="display: none"'; } ?> ><input class="price" type="text" value="<?php echo $this->priceExtraDataCurrencies[$currencyValues['abrv']][$cycle]['setup'];?>" name="<?php echo $currencyValues['abrv']; ?>_setup<?php echo $cycle; ?>" <?php if ($currencyValues['isdefault']) { echo 'id="maincurrencysetup'.$cycle.'"'; } ?> style="width:50px;"/></span>
<?php
        }
    } else {
?>
                        <input class="price" type="text" value="<?php echo $this->priceExtraData[$cycle]['setup'];?>" name="setup<?php echo $cycle; ?>" id="maincurrencysetup<?php echo $cycle; ?>" style="width:50px;"/>
<?php
    }
?>
<!-- /CODE FOR PRICES IN DIFFERENT CURRENCIES -->
                    </td>
                    <td style="text-align:center;">
<!-- CODE FOR PRICES IN DIFFERENT CURRENCIES -->
<?php
    if ($currencies['totalcount'] > 1) {
        foreach ($currencies['currencies'] as $currencyValues) {
?>
                        <span class="currencyprice currencyCode<?php echo $currencyValues['abrv']; ?>" <?php if (!$currencyValues['isdefault']) { echo 'style="display: none"'; } ?> ><input type="checkbox" name="<?php echo $currencyValues['abrv']; ?>_price<?php echo $cycle; ?>_checked" <?php if ($currencyValues['isdefault']) { echo 'id="maincurrencyprice'.$cycle.'_checked"'; } ?> value="1" <?php if ($this->priceExtraDataCurrencies[$currencyValues['abrv']][$cycle]['price_checked'] == 1) echo "checked";?> /></span>
<?php
        }
    } else {
?>
                        <input type="checkbox" name="price<?php echo $cycle; ?>_checked" id="maincurrencyprice<?php echo $cycle; ?>_checked" value="1" <?php if ($this->priceExtraData[$cycle]['price_checked'] == 1) echo "checked";?> />
<?php
    }
?>
<!-- /CODE FOR PRICES IN DIFFERENT CURRENCIES -->
                    </td>
                    <td>
                    </td>
                </tr>
            <?php } ?>

            <tr>
                <td>
                    <?php echo $this->user->lang($this->priceExtraData[0]['price_name']);?>
                </td>
                <td colspan="2">
<!-- CODE FOR PRICES IN DIFFERENT CURRENCIES -->
<?php
    if ($currencies['totalcount'] > 1) {
        foreach ($currencies['currencies'] as $currencyValues) {
?>
                    <span class="currencyprice currencyCode<?php echo $currencyValues['abrv']; ?>" <?php if (!$currencyValues['isdefault']) { echo 'style="display: none"'; } ?> ><input class="price" type="text" value="<?php echo $this->priceExtraDataCurrencies[$currencyValues['abrv']][0]['price'];?>" name="<?php echo $currencyValues['abrv']; ?>_price0" <?php if ($currencyValues['isdefault']) { echo 'id="maincurrencyprice0"'; } ?> style="width:50px;"/></span>
<?php
        }
    } else {
?>
                    <input class="price" type="text" value="<?php echo $this->priceExtraData[0]['price'];?>" name="price0" id="maincurrencyprice0" style="width:50px;"/>
<?php
    }
?>
<!-- /CODE FOR PRICES IN DIFFERENT CURRENCIES -->
                </td>
                <td style="text-align:center;">
<!-- CODE FOR PRICES IN DIFFERENT CURRENCIES -->
<?php
    if ($currencies['totalcount'] > 1) {
        foreach ($currencies['currencies'] as $currencyValues) {
?>
                    <span class="currencyprice currencyCode<?php echo $currencyValues['abrv']; ?>" <?php if (!$currencyValues['isdefault']) { echo 'style="display: none"'; } ?> ><input type="checkbox" name="<?php echo $currencyValues['abrv']; ?>_price0_checked" <?php if ($currencyValues['isdefault']) { echo 'id="maincurrencyprice0_checked"'; } ?> value="1" <?php if ($this->priceExtraDataCurrencies[$currencyValues['abrv']][0]['price_checked'] == 1) echo "checked";?> /></span>
<?php
        }
    } else {
?>
                    <input type="checkbox" name="price0_checked" id="maincurrencyprice0_checked" value="1" <?php if ($this->priceExtraData[0]['price_checked'] == 1) echo "checked";?> />
<?php
    }
?>
<!-- /CODE FOR PRICES IN DIFFERENT CURRENCIES -->
                </td>
                <td>
                </td>
            </tr>

            <tr>
                <td>
                    <?php echo $this->user->lang("Late Fee");?>
                </td>
                <td colspan="4">
<!-- CODE FOR PRICES IN DIFFERENT CURRENCIES -->
<?php
    if ($currencies['totalcount'] > 1) {
        foreach ($currencies['currencies'] as $currencyValues) {
?>
                    <span class="currencyprice currencyCode<?php echo $currencyValues['abrv']; ?>" <?php if (!$currencyValues['isdefault']) { echo 'style="display: none"'; } ?> ><input class="price" type="text" value="<?php echo $this->priceMoreDataCurrencies[$currencyValues['abrv']]['latefee'];?>" name="<?php echo $currencyValues['abrv']; ?>_latefee" <?php if ($currencyValues['isdefault']) { echo 'id="maincurrencylatefee"'; } ?> style="width:50px;"/></span>
<?php
        }
    } else {
?>
                    <input class="price" type="text" value="<?php echo $this->latefee;?>" name="latefee" id="maincurrencylatefee" style="width:50px;"/>
<?php
    }
?>
<!-- /CODE FOR PRICES IN DIFFERENT CURRENCIES -->
                </td>
            </tr>
            <tr>
                <td colspan="5">
<!-- CODE FOR PRICES IN DIFFERENT CURRENCIES -->
<?php
    if ($currencies['totalcount'] > 1) {
        foreach ($currencies['currencies'] as $currencyValues) {
?>
                    <span class="currencyprice currencyCode<?php echo $currencyValues['abrv']; ?>" <?php if (!$currencyValues['isdefault']) { echo 'style="display: none"'; } ?> ><label class="checkbox inline"><input type="checkbox" name="<?php echo $currencyValues['abrv']; ?>_taxable" <?php if ($currencyValues['isdefault']) { echo 'id="maincurrencytaxable"'; } ?> value="1" <?php if ($this->priceMoreDataCurrencies[$currencyValues['abrv']]['taxable'] == 1) echo "checked";?> /><?php echo $this->user->lang("Product is Taxable?");?></label></span>
<?php
        }
    } else {
?>
                    <label class="checkbox inline"><input type="checkbox" name="taxable" id="maincurrencytaxable" value="1" <?php if ($this->taxable == 1) echo "checked";?> /><?php echo $this->user->lang("Product is Taxable?");?></label>
<?php
    }
?>
<!-- /CODE FOR PRICES IN DIFFERENT CURRENCIES -->
                </td>
            </tr>
            </tbody>
            <tfoot>
            <tr>
                <td colspan="5" style="border-top: 0px;">

                    <div class="alert alert-block">
                        <?php echo $this->user->lang('Addon prices for billing cycles not used in this product will not be available to the client, unless you select the force show option in the addon setup screen.');?>
                    </div>

                    <div class="form-actions">
                        <div class="pull-right">
                          <button type="submit" class="submit-pricing btn btn-primary"><?php echo $this->user->lang("Save Changes");?></button>
                        </div>
                    </div>
                </td>
            </tr>
            </tfoot>
        </table>
    </form>

</div>