37 lines
1.8 KiB
JavaScript
37 lines
1.8 KiB
JavaScript
|
|
|
||
|
|
$(document).ready(function() {
|
||
|
|
$("#cost_analice_form_submit-edit").click(function(event){
|
||
|
|
event.preventDefault();
|
||
|
|
var formdata = $("#cost_analice_form").serialize();
|
||
|
|
var cost;
|
||
|
|
$.ajax({
|
||
|
|
method: "POST",
|
||
|
|
url: "/engine/classes/WebAppRaiser/ajax/cost_analise.php",
|
||
|
|
data: formdata,
|
||
|
|
success: function(data) {
|
||
|
|
const response = JSON.parse(data);
|
||
|
|
console.log(response);
|
||
|
|
if(response.status == 'error'){
|
||
|
|
alert(response.msg);
|
||
|
|
$("#cost_analice_form_submit-edit").html('Расчитать стоимость');
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
$("#cost_analice_form_submit-edit").html('Расчитать стоимость');
|
||
|
|
var calculated = response.result['calculatedObjectValue'];
|
||
|
|
var calculated_text = new Intl.NumberFormat("ru-RU", { style: "currency", currency: "RUB" }).format(calculated,);
|
||
|
|
$("#cost_analice_button").parent().parent().append('<br style="clear:both;"><div class="col col-12" style="border: 1px solid rgb(67, 160, 71);padding: 8px;margin: 12px;">Рекомендованная стоимость: '+ calculated_text +'</div>');
|
||
|
|
$("#cost_analice_form_modal__bg").hide();
|
||
|
|
$("#cost_analice_form_modal").hide();
|
||
|
|
}
|
||
|
|
},
|
||
|
|
beforeSend: function() {
|
||
|
|
$("#cost_analice_form_submit-edit").addClass('loading');
|
||
|
|
$("#cost_analice_form_submit-edit").html('Загрузка...');
|
||
|
|
},
|
||
|
|
complete: function() {
|
||
|
|
$("#cost_analice_form_submit-edit").removeClass('loading');
|
||
|
|
/*$("#cost_analice_link").html('7000000');*/
|
||
|
|
},
|
||
|
|
});
|
||
|
|
});
|
||
|
|
});
|