|
|
@@ -53,6 +53,7 @@ $(document).ready(function () { |
|
|
|
opendistrib_dropdown_producers(); |
|
|
|
opendistrib_gridview_pagesize(); |
|
|
|
opendistrib_producers_admin(); |
|
|
|
opendistrib_user_form(); |
|
|
|
}); |
|
|
|
|
|
|
|
var UrlManager = { |
|
|
@@ -65,8 +66,29 @@ var UrlManager = { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
function opendistrib_user_form() { |
|
|
|
var $fieldUserEmail = $('#app-user-form .field-user-email input'); |
|
|
|
var $fieldSendMailWelcome = $('#app-user-form .field-user-send_mail_welcome'); |
|
|
|
|
|
|
|
opendistrib_user_form_event($fieldUserEmail, $fieldSendMailWelcome); |
|
|
|
$fieldUserEmail.keyup(function () { |
|
|
|
opendistrib_user_form_event($fieldUserEmail, $fieldSendMailWelcome); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function opendistrib_user_form_event($fieldUserEmail, $fieldSendMailWelcome) { |
|
|
|
var val = $fieldUserEmail.val(); |
|
|
|
|
|
|
|
if (val.length > 0) { |
|
|
|
$fieldSendMailWelcome.show(); |
|
|
|
} |
|
|
|
else { |
|
|
|
$fieldSendMailWelcome.hide(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function opendistrib_producers_admin() { |
|
|
|
$('.producer-admin-index .btn-alwaysdata, .producer-admin-index .btn-dolibarr').click(function() { |
|
|
|
$('.producer-admin-index .btn-alwaysdata, .producer-admin-index .btn-dolibarr').click(function () { |
|
|
|
var $button = $(this); |
|
|
|
$button.attr('disabled', 'disabled'); |
|
|
|
axios.get($button.attr('href'), {}) |
|
|
@@ -79,47 +101,44 @@ function opendistrib_producers_admin() { |
|
|
|
} |
|
|
|
|
|
|
|
function opendistrib_gridview_pagesize() { |
|
|
|
$('.gridview-pagesize select').change(function() { |
|
|
|
$('.gridview-pagesize select').change(function () { |
|
|
|
$(this).parent().parent().submit(); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function opendistrib_dropdown_producers() { |
|
|
|
|
|
|
|
$('.producer-menu .dropdown-toggle').click(function() { |
|
|
|
$('.producer-menu .dropdown-toggle').click(function () { |
|
|
|
$('.producer-menu .search-producer').focus(); |
|
|
|
}); |
|
|
|
|
|
|
|
$('.producer-menu .search-producer').keyup(function() { |
|
|
|
$('.producer-menu .search-producer').keyup(function () { |
|
|
|
var $alertNoResults = $('.producer-menu .li-alert-no-results'); |
|
|
|
var searchWords = $(this).val().toLowerCase(); |
|
|
|
var count = 0; |
|
|
|
|
|
|
|
if(searchWords && searchWords.length > 0) { |
|
|
|
$('.producer-menu li.producer').each(function() { |
|
|
|
if($(this).find('a').text().toLowerCase().indexOf(searchWords) >= 0 || !searchWords) { |
|
|
|
if (searchWords && searchWords.length > 0) { |
|
|
|
$('.producer-menu li.producer').each(function () { |
|
|
|
if ($(this).find('a').text().toLowerCase().indexOf(searchWords) >= 0 || !searchWords) { |
|
|
|
$(this).show(); |
|
|
|
count ++; |
|
|
|
} |
|
|
|
else { |
|
|
|
count++; |
|
|
|
} else { |
|
|
|
$(this).hide(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
if(count) { |
|
|
|
if (count) { |
|
|
|
$alertNoResults.hide(); |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
$alertNoResults.show(); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
$alertNoResults.hide(); |
|
|
|
$('.producer-menu li.producer').show(); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
$('#link-display-producers-offline').click(function() { |
|
|
|
$('#link-display-producers-offline').click(function () { |
|
|
|
$(this).hide(); |
|
|
|
$('.producer-menu .offline').show(); |
|
|
|
return false; |
|
|
@@ -152,7 +171,7 @@ function opendistrib_menu_treeview() { |
|
|
|
} |
|
|
|
|
|
|
|
function opendistrib_product_index() { |
|
|
|
$('body.product-index .toggle input').change(function() { |
|
|
|
$('body.product-index .toggle input').change(function () { |
|
|
|
var id = $(this).data('id'); |
|
|
|
var checked = $(this).prop('checked'); |
|
|
|
$.get(UrlManager.getBaseUrl() + 'product/ajax-toggle-status', { |
|
|
@@ -207,7 +226,7 @@ function opendistrib_products_event_price_with_tax() { |
|
|
|
taxRateSelected = 0; |
|
|
|
} |
|
|
|
|
|
|
|
if($('#product-price').length) { |
|
|
|
if ($('#product-price').length) { |
|
|
|
var price = $('#product-price').val().replace(',', '.'); |
|
|
|
if (price) { |
|
|
|
$('#product-price-with-tax').val(getPriceWithTax(price, taxRateSelected)); |
|
|
@@ -276,7 +295,7 @@ function opendistrib_product_prices() { |
|
|
|
opendistrib_product_prices_event_price_with_tax(); |
|
|
|
$('#productprice-price').change(opendistrib_product_prices_event_price_with_tax); |
|
|
|
$('#productprice-price-with-tax').change(opendistrib_product_prices_event_price); |
|
|
|
$('#reduction-increase-percent').change(function() { |
|
|
|
$('#reduction-increase-percent').change(function () { |
|
|
|
opendistrib_product_prices_event_reduction_increase(); |
|
|
|
}); |
|
|
|
} |
|
|
@@ -305,6 +324,7 @@ function opendistrib_product_prices_event_price() { |
|
|
|
opendistrib_product_prices_update_reduction_increase(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function opendistrib_product_prices_update_reduction_increase() { |
|
|
|
var productPriceBase = $('#reduction-increase-percent').data('price-base'); |
|
|
|
var productPriceSpecific = $('#productprice-price').val().replace(',', '.'); |
|
|
@@ -315,7 +335,7 @@ function opendistrib_product_prices_update_reduction_increase() { |
|
|
|
function opendistrib_product_prices_event_reduction_increase() { |
|
|
|
var productPriceBase = $('#reduction-increase-percent').data('price-base'); |
|
|
|
var reductionIncreasePercent = $('#reduction-increase-percent').val(); |
|
|
|
if(reductionIncreasePercent) { |
|
|
|
if (reductionIncreasePercent) { |
|
|
|
var newPrice = productPriceBase + productPriceBase * (reductionIncreasePercent / 100); |
|
|
|
$('#productprice-price').val(parseFloat(newPrice).toFixed(5)); |
|
|
|
opendistrib_product_prices_event_price_with_tax(); |