68 lines
2.3 KiB
PHP
68 lines
2.3 KiB
PHP
<table class="st_record_list" cellspacing="0">
|
|
<thead>
|
|
<tr>
|
|
<th><?php echo __('Waluta') ?></th>
|
|
<th><?php echo st_admin_checkbox_tag('product[has_fixed_currency_exchange]', true, $product->getHasFixedCurrency(), array('disabled' => $product->getCurrency()->getIsSystemCurrency(), 'label' => __('Zablokuj kurs'))) ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><?php echo select_tag('product[edit_currency]', options_for_select($currency['select_options'], $product->getCurrency()->getId())) ?></td>
|
|
<td><?php echo input_tag('product[fixed_currency_exchange]', $product->getHasFixedCurrency() ? $product->getFixedCurrencyExchangeBackend() : $product->getCurrency()->getExchangeBackend() , array('disabled' => !$product->getHasFixedCurrency(), 'size' => 6)) ?></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<script type="text/javascript">
|
|
jQuery(function($) {
|
|
var currency_exchange = <?php echo $currency['exchange_rates'] ?>;
|
|
|
|
var fixed_currency_exchange = $('#product_fixed_currency_exchange');
|
|
|
|
var currency_fixed = $('#product_has_fixed_currency_exchange');
|
|
|
|
var currency = $('#product_edit_currency');
|
|
|
|
var prev_selected = currency.val();
|
|
|
|
currency.change(function()
|
|
{
|
|
var selected = $(this).val();
|
|
|
|
if (selected == '<?php echo $currency['system_currency_id'] ?>')
|
|
{
|
|
stPriceTaxManagment.instance.enablePriceFields();
|
|
|
|
currency_fixed.prop('disabled', true);
|
|
|
|
fixed_currency_exchange.prop('disabled', true);
|
|
|
|
stPriceTaxManagment.instance.refreshPriceFields();
|
|
}
|
|
else
|
|
{
|
|
stPriceTaxManagment.instance.disablePriceFields();
|
|
|
|
$.each(stPriceTaxManagment.instance.priceFields, function () {
|
|
this.price.value = '';
|
|
});
|
|
|
|
currency_fixed.prop('disabled', false);
|
|
|
|
fixed_currency_exchange.prop('disabled', !currency_fixed.prop('checked'));
|
|
}
|
|
|
|
fixed_currency_exchange.val(currency_exchange[selected]);
|
|
});
|
|
|
|
currency_fixed.change(function() {
|
|
fixed_currency_exchange.prop('disabled', !currency_fixed.prop('checked'));
|
|
});
|
|
|
|
fixed_currency_exchange.change(function() {
|
|
$(this).val(stPrice.fixNumberFormat($(this).val(), 4));
|
|
});
|
|
});
|
|
|
|
</script>
|