|
|
|
|
|
|
|
|
opendistrib_dropdown_producers(); |
|
|
opendistrib_dropdown_producers(); |
|
|
opendistrib_gridview_pagesize(); |
|
|
opendistrib_gridview_pagesize(); |
|
|
opendistrib_producers_admin(); |
|
|
opendistrib_producers_admin(); |
|
|
|
|
|
opendistrib_user_form(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
var UrlManager = { |
|
|
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() { |
|
|
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); |
|
|
var $button = $(this); |
|
|
$button.attr('disabled', 'disabled'); |
|
|
$button.attr('disabled', 'disabled'); |
|
|
axios.get($button.attr('href'), {}) |
|
|
axios.get($button.attr('href'), {}) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function opendistrib_gridview_pagesize() { |
|
|
function opendistrib_gridview_pagesize() { |
|
|
$('.gridview-pagesize select').change(function() { |
|
|
|
|
|
|
|
|
$('.gridview-pagesize select').change(function () { |
|
|
$(this).parent().parent().submit(); |
|
|
$(this).parent().parent().submit(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function opendistrib_dropdown_producers() { |
|
|
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').focus(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$('.producer-menu .search-producer').keyup(function() { |
|
|
|
|
|
|
|
|
$('.producer-menu .search-producer').keyup(function () { |
|
|
var $alertNoResults = $('.producer-menu .li-alert-no-results'); |
|
|
var $alertNoResults = $('.producer-menu .li-alert-no-results'); |
|
|
var searchWords = $(this).val().toLowerCase(); |
|
|
var searchWords = $(this).val().toLowerCase(); |
|
|
var count = 0; |
|
|
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(); |
|
|
$(this).show(); |
|
|
count ++; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
count++; |
|
|
|
|
|
} else { |
|
|
$(this).hide(); |
|
|
$(this).hide(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
if(count) { |
|
|
|
|
|
|
|
|
if (count) { |
|
|
$alertNoResults.hide(); |
|
|
$alertNoResults.hide(); |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
$alertNoResults.show(); |
|
|
$alertNoResults.show(); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
} else { |
|
|
$alertNoResults.hide(); |
|
|
$alertNoResults.hide(); |
|
|
$('.producer-menu li.producer').show(); |
|
|
$('.producer-menu li.producer').show(); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
$('#link-display-producers-offline').click(function() { |
|
|
|
|
|
|
|
|
$('#link-display-producers-offline').click(function () { |
|
|
$(this).hide(); |
|
|
$(this).hide(); |
|
|
$('.producer-menu .offline').show(); |
|
|
$('.producer-menu .offline').show(); |
|
|
return false; |
|
|
return false; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function opendistrib_product_index() { |
|
|
function opendistrib_product_index() { |
|
|
$('body.product-index .toggle input').change(function() { |
|
|
|
|
|
|
|
|
$('body.product-index .toggle input').change(function () { |
|
|
var id = $(this).data('id'); |
|
|
var id = $(this).data('id'); |
|
|
var checked = $(this).prop('checked'); |
|
|
var checked = $(this).prop('checked'); |
|
|
$.get(UrlManager.getBaseUrl() + 'product/ajax-toggle-status', { |
|
|
$.get(UrlManager.getBaseUrl() + 'product/ajax-toggle-status', { |
|
|
|
|
|
|
|
|
taxRateSelected = 0; |
|
|
taxRateSelected = 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if($('#product-price').length) { |
|
|
|
|
|
|
|
|
if ($('#product-price').length) { |
|
|
var price = $('#product-price').val().replace(',', '.'); |
|
|
var price = $('#product-price').val().replace(',', '.'); |
|
|
if (price) { |
|
|
if (price) { |
|
|
$('#product-price-with-tax').val(getPriceWithTax(price, taxRateSelected)); |
|
|
$('#product-price-with-tax').val(getPriceWithTax(price, taxRateSelected)); |
|
|
|
|
|
|
|
|
opendistrib_product_prices_event_price_with_tax(); |
|
|
opendistrib_product_prices_event_price_with_tax(); |
|
|
$('#productprice-price').change(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); |
|
|
$('#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(); |
|
|
opendistrib_product_prices_event_reduction_increase(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
opendistrib_product_prices_update_reduction_increase(); |
|
|
opendistrib_product_prices_update_reduction_increase(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function opendistrib_product_prices_update_reduction_increase() { |
|
|
function opendistrib_product_prices_update_reduction_increase() { |
|
|
var productPriceBase = $('#reduction-increase-percent').data('price-base'); |
|
|
var productPriceBase = $('#reduction-increase-percent').data('price-base'); |
|
|
var productPriceSpecific = $('#productprice-price').val().replace(',', '.'); |
|
|
var productPriceSpecific = $('#productprice-price').val().replace(',', '.'); |
|
|
|
|
|
|
|
|
function opendistrib_product_prices_event_reduction_increase() { |
|
|
function opendistrib_product_prices_event_reduction_increase() { |
|
|
var productPriceBase = $('#reduction-increase-percent').data('price-base'); |
|
|
var productPriceBase = $('#reduction-increase-percent').data('price-base'); |
|
|
var reductionIncreasePercent = $('#reduction-increase-percent').val(); |
|
|
var reductionIncreasePercent = $('#reduction-increase-percent').val(); |
|
|
if(reductionIncreasePercent) { |
|
|
|
|
|
|
|
|
if (reductionIncreasePercent) { |
|
|
var newPrice = productPriceBase + productPriceBase * (reductionIncreasePercent / 100); |
|
|
var newPrice = productPriceBase + productPriceBase * (reductionIncreasePercent / 100); |
|
|
$('#productprice-price').val(parseFloat(newPrice).toFixed(5)); |
|
|
$('#productprice-price').val(parseFloat(newPrice).toFixed(5)); |
|
|
opendistrib_product_prices_event_price_with_tax(); |
|
|
opendistrib_product_prices_event_price_with_tax(); |