| Server IP : 104.21.26.206 / Your IP : 216.73.216.227 [ Web Server : Apache System : Linux frog 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64 User : web13 ( 5017) PHP Version : 8.3.31 Disable Function : NONE Domains : 41 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/clients/client12/web13/web/ahelos/resources/backend/js/ |
Upload File : |
if (checkIfExists('#reclamation-detail')) {
function calculateCredits(){
var total_products = 0;
var total_credits = 0;
var shipping = parseFloat($('input[name=shipping]').val());
var transport_type = $('.transport_type').val();
$('.product').each(function(){
var value = $(this).find('option:selected').val();
if (value > 0) {
var data_price = parseFloat($(this).data('price'));
total_products += data_price;
}
});
if (transport_type == 1) {
// Транспортните разходи са за сметка на клиента
total_credits = total_products - shipping;
}
else if(transport_type == 2){
total_credits = total_products;
}
else if(transport_type == 3){
total_credits = total_products + shipping;
}
$('.total_price span').html(total_products.toFixed(2));
$('.total_credits span').html(total_credits.toFixed(2));
}
$('.product').on('change', function(){
calculateCredits();
})
$('.transport_type').on('change', function(){
calculateCredits();
}).change();
$('input[name=shipping]').on('keyup', function(){
calculateCredits();
});
var country = $('#shipping-form').data('language');
var csrf = $('#shipping-form input[name=_token]').val();
if (country == 'bg') {
$("#city").autocomplete({
source: $("#city").data('url'),
focus: function() {
// prevent value inserted on focus
return false;
},
select: function (event, suggestion) {
var name = suggestion.item.value;
var value_input = suggestion.item.city;
var city_id = suggestion.item.city_id;
var zip = suggestion.item.zip;
setTimeout(function(){
$('#city').val(value_input);
$('#city_id').val(city_id);
$('#zip').val(zip);
if (country == 'bg') {
$("#address").autocomplete('option', 'source', "/"+admin_path+'/'+country+'/'+city_id+"/get-addresses");
var data_office = {
_token: csrf,
city_id: city_id
}
$.ajax({
url: "/"+admin_path+'/'+country+"/get-offices",
dataType: 'json',
type: 'post',
data: data_office,
success: function(data){
$('#office_select').html('');
const option = `<option value="">-Избери-</option>`;
$('#office_select').append(option);
$.each(data, function(key, value){
const option = `<option value="${value.id}|${value.type}">${value.label} - ${value.type}</option>`;
$('#office_select').append(option);
})
}
});
}
},150);
}
});
$("#address").autocomplete({
source: "/"+admin_path+'/'+country+'/'+$('#city_id').val()+"/get-addresses",
focus: function() {
// prevent value inserted on focus
return false;
},
select: function (event, suggestion) {
var name = suggestion.item.name;
var address_id = suggestion.item.id;
var type = suggestion.item.type;
$('#address_id').val(address_id);
$('#address').val(name);
$('#address_type').val(type);
return false;
}
});
}
}