2617 lines
82 KiB
JavaScript
2617 lines
82 KiB
JavaScript
/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
|
||
|
||
* Licensed under the MIT License (LICENSE.txt).
|
||
|
||
*
|
||
|
||
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
|
||
|
||
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
|
||
|
||
* Thanks to: Seamus Leahy for adding deltaX and deltaY
|
||
|
||
*
|
||
|
||
* Version: 3.0.4
|
||
|
||
*
|
||
|
||
* Requires: 1.2.2+
|
||
|
||
*/
|
||
|
||
(function(c) {
|
||
var a = ["DOMMouseScroll", "mousewheel"];
|
||
c.event.special.mousewheel = { setup: function() { if (this.addEventListener) { for (var d = a.length; d;) { this.addEventListener(a[--d], b, false) } } else { this.onmousewheel = b } }, teardown: function() { if (this.removeEventListener) { for (var d = a.length; d;) { this.removeEventListener(a[--d], b, false) } } else { this.onmousewheel = null } } };
|
||
c.fn.extend({ mousewheel: function(d) { return d ? this.bind("mousewheel", d) : this.trigger("mousewheel") }, unmousewheel: function(d) { return this.unbind("mousewheel", d) } });
|
||
|
||
function b(i) {
|
||
var g = i || window.event,
|
||
f = [].slice.call(arguments, 1),
|
||
j = 0,
|
||
h = true,
|
||
e = 0,
|
||
d = 0;
|
||
i = c.event.fix(g);
|
||
i.type = "mousewheel";
|
||
if (i.wheelDelta) { j = i.wheelDelta / 120 }
|
||
if (i.detail) { j = -i.detail / 3 }
|
||
d = j;
|
||
if (g.axis !== undefined && g.axis === g.HORIZONTAL_AXIS) {
|
||
d = 0;
|
||
e = -1 * j
|
||
}
|
||
if (g.wheelDeltaY !== undefined) { d = g.wheelDeltaY / 120 }
|
||
if (g.wheelDeltaX !== undefined) { e = -1 * g.wheelDeltaX / 120 }
|
||
f.unshift(i, j, e, d);
|
||
return c.event.handlers.apply(this, f)
|
||
}
|
||
})(jQuery);
|
||
|
||
|
||
|
||
|
||
(function($) {
|
||
|
||
$.fn.getCursorPosition = function() {
|
||
|
||
var input = this.get(0);
|
||
|
||
if (!input) return;
|
||
|
||
if ('selectionStart' in input) {
|
||
|
||
return input.selectionStart;
|
||
|
||
} else if (document.selection) {
|
||
|
||
input.focus();
|
||
|
||
var sel = document.selection.createRange();
|
||
|
||
var selLen = document.selection.createRange().text.length;
|
||
|
||
sel.moveStart('character', -input.value.length);
|
||
|
||
return sel.text.length - selLen;
|
||
|
||
}
|
||
|
||
}
|
||
|
||
$.fn.setCursorPosition = function(pos) {
|
||
|
||
if ($(this).get(0).setSelectionRange) {
|
||
|
||
$(this).get(0).setSelectionRange(pos, pos);
|
||
|
||
} else if ($(this).get(0).createTextRange) {
|
||
|
||
var range = $(this).get(0).createTextRange();
|
||
|
||
range.collapse(true);
|
||
|
||
range.moveEnd('character', pos);
|
||
|
||
range.moveStart('character', pos);
|
||
|
||
range.select();
|
||
|
||
}
|
||
|
||
}
|
||
|
||
$.fn.delSelected = function() {
|
||
|
||
var input = $(this);
|
||
|
||
var value = input.val();
|
||
|
||
var start = input[0].selectionStart;
|
||
|
||
var end = input[0].selectionEnd;
|
||
|
||
input.val(
|
||
|
||
value.substr(0, start) + value.substring(end, value.length)
|
||
|
||
);
|
||
|
||
return end - start;
|
||
|
||
};
|
||
|
||
|
||
|
||
$.fn.priceFormat = function() {
|
||
|
||
|
||
|
||
function priceFormatted(element) {
|
||
|
||
element = String(element).replace(/[^\d]/g, '');
|
||
|
||
if (!element) return '';
|
||
|
||
return (String(parseInt(element))).replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1 ');
|
||
|
||
}
|
||
|
||
|
||
|
||
$(this)
|
||
|
||
.bind('contextmenu', function(event) {
|
||
|
||
event.preventDefault();
|
||
|
||
})
|
||
|
||
.bind('drop', function(event) {
|
||
|
||
var value = $(this).val();
|
||
|
||
$(this).val('');
|
||
|
||
$(this).val(value);
|
||
|
||
event.preventDefault();
|
||
|
||
})
|
||
|
||
.keydown(function(event) {
|
||
|
||
var cursor = $(this).getCursorPosition();
|
||
|
||
var code = event.keyCode;
|
||
|
||
var startValue = $(this).val();
|
||
|
||
if ((event.ctrlKey === true && code == 86) || // Ctrl+V | Shift+insert
|
||
|
||
(event.metaKey === true && code == 86) ||
|
||
|
||
(event.shiftKey === true && code == 45)) {
|
||
|
||
return false;
|
||
|
||
} else if (
|
||
|
||
code == 9 || // tab
|
||
|
||
code == 27 || // ecs
|
||
|
||
event.ctrlKey === true || // все что вместе с ctrl
|
||
|
||
event.metaKey === true ||
|
||
|
||
event.altKey === true || // все что вместе с alt
|
||
|
||
event.shiftKey === true || // все что вместе с shift
|
||
|
||
(code >= 112 && code <= 123) || // F1 - F12
|
||
|
||
(code >= 35 && code <= 39)) // end, home, стрелки
|
||
|
||
{
|
||
|
||
return;
|
||
|
||
|
||
|
||
} else if (code == 8) { // backspace
|
||
|
||
|
||
|
||
var delCount = $(this).delSelected();
|
||
|
||
if (!delCount) {
|
||
|
||
if (startValue[cursor - 1] === ' ') {
|
||
|
||
cursor--;
|
||
|
||
}
|
||
|
||
$(this).val(startValue.substr(0, cursor - 1) + startValue.substring(cursor, startValue.length));
|
||
|
||
}
|
||
|
||
$(this).val(priceFormatted($(this).val()));
|
||
|
||
$(this).setCursorPosition(cursor - (startValue.length - $(this).val().length - delCount));
|
||
|
||
|
||
|
||
} else if (code == 46) { // delete
|
||
|
||
|
||
|
||
var delCount = $(this).delSelected();
|
||
|
||
if (!delCount) {
|
||
|
||
if (startValue[cursor] === ' ') {
|
||
|
||
cursor++;
|
||
|
||
}
|
||
|
||
$(this).val(startValue.substr(0, cursor) + startValue.substring(cursor + 1, startValue.length));
|
||
|
||
}
|
||
|
||
if (!delCount) delCount = 1;
|
||
|
||
$(this).val(priceFormatted($(this).val()));
|
||
|
||
$(this).setCursorPosition(cursor - (startValue.length - $(this).val().length - delCount));
|
||
|
||
|
||
|
||
} else {
|
||
|
||
$(this).delSelected();
|
||
|
||
startValue = $(this).val();
|
||
|
||
var key = false;
|
||
|
||
// цифровые клавиши
|
||
|
||
if ((code >= 48 && code <= 57)) {
|
||
|
||
key = (code - 48);
|
||
|
||
}
|
||
|
||
// numpad
|
||
else if ((code >= 96 && code <= 105)) {
|
||
|
||
key = (code - 96);
|
||
|
||
} else {
|
||
|
||
$(this).val(priceFormatted($(this).val()));
|
||
|
||
$(this).setCursorPosition(cursor);
|
||
|
||
return false;
|
||
|
||
}
|
||
|
||
var length = startValue.length
|
||
|
||
var value = startValue.substr(0, cursor) + key + startValue.substring(cursor, startValue.length);
|
||
|
||
$(this).val(priceFormatted(value));
|
||
|
||
$(this).setCursorPosition(cursor + $(this).val().length - startValue.length);
|
||
|
||
}
|
||
|
||
event.preventDefault();
|
||
|
||
});
|
||
|
||
};
|
||
|
||
})(jQuery);
|
||
|
||
function checkCommercSearch() {
|
||
var checkType = true;
|
||
var b = 'buil_1';
|
||
var selected = [];
|
||
|
||
$('.commercial_object_input').each(function(index, input) {
|
||
const id = $(input).attr("id").replace("commercial_object_", "").replace("typeCategory_", "");
|
||
b = 'buil_' + id
|
||
//console.log($(`#type_category_${id}`), '$(`#type_category_${b}`)');
|
||
if ($(`#type_category_${id}`).hasClass('selected')) {
|
||
selected.push(b)
|
||
}
|
||
});
|
||
|
||
$('.cottage-village-block').hide();
|
||
|
||
if (!checkType) {
|
||
$('#commercial_object_1').prop('checked', true);
|
||
$('.commercial_object_id1').addClass('selected');
|
||
}
|
||
|
||
|
||
if (selected.some(item => ['buil_1', 'buil_7', 'buil_9', 'buil_5'].includes(item))) {
|
||
$('.commerc-houseLineType').hide();
|
||
//$('.commerc-opened').hide();
|
||
|
||
|
||
} else {
|
||
$('.commerc-houseLineType').show();
|
||
//$('.commerc-opened').show();
|
||
|
||
}
|
||
|
||
if (checkType) {
|
||
if (selected.includes('buil_9')) {
|
||
$('.land-shape-type').show();
|
||
$('.land-relief-type').show();
|
||
$('.land-distance').show();
|
||
$('.etazh_form').hide();
|
||
$('.year_form').hide();
|
||
} else {
|
||
$('.land-shape-type').hide();
|
||
$('.land-relief-type').hide();
|
||
$('.land-distance').hide();
|
||
$('.etazh_form').show();
|
||
$('.year_form').show();
|
||
}
|
||
}
|
||
|
||
/*if(b == 'buil_2'){
|
||
$('.column-grid').
|
||
}*/
|
||
|
||
if (selected.some(item => ['buil_2','buil_4','buil_6', 'buil_7', 'buil_8', 'buil_9'].includes(item))) {
|
||
$('.layout-object').hide();
|
||
$('.is-occupied').hide();
|
||
$('.is-occupied-date').hide();
|
||
} else {
|
||
$('.layout-object').show();
|
||
if ($('#isOccupied').prop('checked')) {
|
||
$('.is-occupied-date').show();
|
||
} else {
|
||
$('.is-occupied-date').hide();
|
||
}
|
||
$('.is-occupied').show();
|
||
}
|
||
|
||
|
||
if (selected.some(item => ['buil_6', 'buil_7', 'buil_8', 'buil_9'].includes(item))) {
|
||
$('.legal-address').hide();
|
||
|
||
$('.number-wet-spots').hide();
|
||
$('.electricity-power').hide();
|
||
} else {
|
||
$('.legal-address').show();
|
||
|
||
$('.number-wet-spots').show();
|
||
$('.electricity-power').show();
|
||
}
|
||
|
||
if (selected.some(item => ['buil_7', 'buil_9'].includes(item))) {
|
||
console.log('hide');
|
||
$('.floors-row').hide();
|
||
} else {
|
||
if (selected.includes('buil_6')) {
|
||
$('#etaz-name').text('Всего этажей:');
|
||
$('#iz-span-name').hide();
|
||
$('#etaz').hide();
|
||
} else {
|
||
$('#etaz-name').html('Этаж: <span class="star" style="color: red; font-size: 20px;">*</span>');
|
||
$('#iz-span-name').show();
|
||
$('#etaz').show();
|
||
}
|
||
$('.floors-row').show();
|
||
}
|
||
|
||
if (selected.some(item => ['buil_6', 'buil_9'].includes(item))) {
|
||
$('.all-arrea').hide();
|
||
|
||
} else {
|
||
$('.all-arrea').show();
|
||
|
||
}
|
||
|
||
|
||
if (selected.some(item => ['buil_6', 'buil_8','buil_9'].includes(item))) {
|
||
$('.commerc-infrastructures').hide();
|
||
} else {
|
||
$('.commerc-infrastructures').show();
|
||
}
|
||
|
||
|
||
|
||
|
||
if (selected.some(item => ['buil_1', 'buil_2', 'buil_3', 'buil_4', 'buil_5', 'buil_6', 'buil_8', 'buil_9'].includes(item))) {
|
||
$('.gsk-nazv').hide();
|
||
$('.commerc-specifications').hide();
|
||
$('.garage-type').hide();
|
||
$('.commerc-infrastructure2').hide();
|
||
$('.commerc-status').hide();
|
||
$('.garage-vid').hide();
|
||
$('.boks-vid').hide();
|
||
} else {
|
||
$('.gsk-nazv').show();
|
||
$('.commerc-specifications').show();
|
||
$('.garage-type').show();
|
||
$('.commerc-infrastructure2').show();
|
||
$('.commerc-status').show();
|
||
if ($('#garage_type_select').val() == 2) {
|
||
$('.garage-vid').show();
|
||
$('.boks-vid').show();
|
||
}
|
||
if ($('#boks_vid_id').val() == 3) {
|
||
$('.boks-vid').show();
|
||
}
|
||
}
|
||
|
||
/*if(b == 'buil_4'){
|
||
$('.commerc-infrastructure').hide();
|
||
} else {
|
||
$('.commerc-infrastructure').show();
|
||
}*/
|
||
|
||
if (selected.some(item => ['buil_1', 'buil_3', 'buil_6','buil_7', 'buil_8', 'buil_9'].includes(item))) {
|
||
$('.column-grid').hide();
|
||
$('.floor-material').hide();
|
||
$('.commerc-portal').hide();
|
||
|
||
} else {
|
||
$('.column-grid').show();
|
||
$('.floor-material').show();
|
||
$('.commerc-portal').show();
|
||
}
|
||
|
||
if (selected.some(item => ['buil_7', 'buil_9'].includes(item))) {
|
||
$('.commerc-purpose').hide();
|
||
} else {
|
||
$('.commerc-purpose').show();
|
||
}
|
||
|
||
|
||
if (selected.some(item => ['buil_2', 'buil_3', 'buil_6','buil_7', 'buil_8', 'buil_9'].includes(item))) {
|
||
$('.commer-access').hide();
|
||
} else {
|
||
$('.commer-access').show();
|
||
}
|
||
|
||
if (selected.some(item => ['buil_2', 'buil_4','buil_7', 'buil_9'].includes(item))) {
|
||
$('.is-furniture').hide();
|
||
|
||
} else {
|
||
$('.is-furniture').show();
|
||
}
|
||
|
||
if (selected.some(item => ['buil_6','buil_7', 'buil_9'].includes(item))) {
|
||
$('#block_etaz_first_type').hide();
|
||
} else {
|
||
if ($('#etaz').val() == 1) {
|
||
$('#block_etaz_first_type').show();
|
||
}
|
||
}
|
||
|
||
if (selected.some(item => ['buil_7', 'buil_9'].includes(item))) {
|
||
|
||
$('.commer-condition').hide();
|
||
|
||
$('.ceiling_height').hide();
|
||
|
||
$('.commerc-year').hide();
|
||
$('.commerc-building-type-id').hide();
|
||
$('.commerc-building-class-id').hide();
|
||
$('.building-area').hide();
|
||
|
||
$('.commerc-building-category-id').hide();
|
||
$('.building-developer').hide();
|
||
$('.building-management-company').hide();
|
||
|
||
} else {
|
||
|
||
$('.commer-condition').show();
|
||
|
||
$('.ceiling_height').show();
|
||
|
||
$('.commerc-year').show();
|
||
$('.commerc-building-type-id').show();
|
||
$('.commerc-building-class-id').show();
|
||
$('.building-area').show();
|
||
|
||
$('.commerc-building-category-id').show();
|
||
$('.building-developer').show();
|
||
$('.building-management-company').show();
|
||
|
||
|
||
}
|
||
|
||
|
||
if (selected.some(item => ['buil_7', 'buil_4', 'buil_2'].includes(item))) {
|
||
$('.commerc-infrastructure').hide();
|
||
} else {
|
||
$('.commerc-infrastructure').show();
|
||
}
|
||
if (selected.includes('buil_7')) {
|
||
$('.commerc-site').hide();
|
||
$('.commerc-building-model').hide();
|
||
|
||
} else {
|
||
$('.commerc-site').show();
|
||
$('.commerc-building-model').show();
|
||
|
||
}
|
||
|
||
if (checkType) {
|
||
$('.property-type').show();
|
||
} else {
|
||
$('.property-type').hide();
|
||
}
|
||
|
||
if (selected.some(item => ['buil_7'].includes(item))) {
|
||
$('.tax-number').hide();
|
||
$('#isPartsEnabled').hide();
|
||
$('#isPartsEnabled_label').hide();
|
||
$('.vat_type').hide();
|
||
$('.parking-price').hide();
|
||
|
||
} else {
|
||
$('.tax-number').show();
|
||
$('#isPartsEnabled').show();
|
||
$('#isPartsEnabled_label').show();
|
||
$('.vat_type').show();
|
||
$('.parking-price').show();
|
||
|
||
}
|
||
|
||
if (selected.some(item => ['buil_9', 'buil_8', 'buil_4', 'buil_2'].includes(item))) {
|
||
$('.parking_type').hide();
|
||
} else {
|
||
$('.parking_type').show();
|
||
}
|
||
if (b == 'buil_9') {
|
||
|
||
$('.about-building').hide();
|
||
|
||
} else {
|
||
|
||
$('.about-building').show();
|
||
|
||
}
|
||
|
||
if (selected.some(item => ['buil_1', 'buil_3', 'buil_5', 'buil_6', 'buil_7', 'buil_8', 'buil_9'].includes(item))) {
|
||
$('.parking_type2').hide();
|
||
$('.parking_type3').hide();
|
||
$('.commerc-lifts').hide();
|
||
$('.commerc-cranes').hide();
|
||
$('.commerc-infrastructure3').hide();
|
||
$('.commerc-services').hide();
|
||
} else {
|
||
$('.parking_type2').show();
|
||
$('.parking_type3').show();
|
||
$('.commerc-lifts').show();
|
||
$('.commerc-cranes').show();
|
||
$('.commerc-infrastructure3').show();
|
||
$('.commerc-services').show();
|
||
}
|
||
|
||
if (selected.some(item => ['buil_1', 'buil_2', 'buil_3', 'buil_4', 'buil_5', 'buil_6', 'buil_7', 'buil_8'].includes(item))) {
|
||
$('.commerc-land-category').hide();
|
||
$('.commerc-permitted-use').hide();
|
||
$('.commerc-investproject').hide();
|
||
$('.is-encumbrances').hide();
|
||
$('.commerc-electricity').hide();
|
||
$('.commerc-gas').hide();
|
||
$('.commerc-water').hide();
|
||
$('.commerc-sewage').hide();
|
||
$('.commerc-driveways').hide();
|
||
} else {
|
||
$('.commerc-land-category').show();
|
||
$('.commerc-permitted-use').show();
|
||
$('.commerc-investproject').show();
|
||
$('.is-encumbrances').show();
|
||
$('.commerc-electricity').show();
|
||
$('.commerc-gas').show();
|
||
$('.commerc-water').show();
|
||
$('.commerc-sewage').show();
|
||
$('.commerc-driveways').show();
|
||
}
|
||
|
||
if (selected && !selected.some(item => ['buil_7'].includes(item))) {
|
||
$('.egrn-url-block').show();
|
||
} else {
|
||
$('.egrn-url-block').hide();
|
||
}
|
||
|
||
if(typeof reinitVillage == 'function')
|
||
reinitVillage();
|
||
|
||
}
|
||
|
||
function checkCommerc() {
|
||
var checkType = false;
|
||
var b = 'buil_1';
|
||
$('.commercial_object_input').each(function() {
|
||
|
||
if ($(this).prop('checked')) {
|
||
checkType = true;
|
||
b = 'buil_' + $(this).attr("id").replace("commercial_object_", "").replace("typeCategory_", "");
|
||
}
|
||
});
|
||
|
||
$('.cottage-village-block').hide();
|
||
|
||
if (!checkType) {
|
||
if ($('.typeCategory.selected').length == 1) {
|
||
var id = $('.typeCategory.selected').data("id");
|
||
|
||
$('#typeCategory_' + id).prop('checked', true);
|
||
}
|
||
$('#commercial_object_1').prop('checked', true);
|
||
$('.commercial_object_id1').addClass('selected');
|
||
}
|
||
|
||
if (b == 'buil_1' || b == 'buil_7' || b == 'buil_9' || b == 'buil_5') {
|
||
$('.commerc-houseLineType').hide();
|
||
//$('.commerc-opened').hide();
|
||
|
||
|
||
} else {
|
||
$('.commerc-houseLineType').show();
|
||
//$('.commerc-opened').show();
|
||
|
||
}
|
||
|
||
if (checkType) {
|
||
if (b == 'buil_9') {
|
||
$('.land-shape-type').show();
|
||
$('.land-relief-type').show();
|
||
$('.land-distance').show();
|
||
$('.etazh_form').hide();
|
||
$('.year_form').hide();
|
||
} else {
|
||
$('.land-shape-type').hide();
|
||
$('.land-relief-type').hide();
|
||
$('.land-distance').hide();
|
||
$('.etazh_form').show();
|
||
$('.year_form').show();
|
||
}
|
||
}
|
||
|
||
/*if(b == 'buil_2'){
|
||
$('.column-grid').
|
||
}*/
|
||
if (b == 'buil_6' || b == 'buil_7' || b == 'buil_8' || b == 'buil_9' || b == 'buil_4' || b == 'buil_2') {
|
||
$('.layout-object').hide();
|
||
} else {
|
||
$('.layout-object').show();
|
||
}
|
||
if (b == 'buil_1' && $('.type.selected').find('label').attr('for') == 'field_4') {
|
||
$('.layout-star').css('display', 'inline');
|
||
} else {
|
||
$('.layout-star').css('display', 'none');
|
||
$('[name="layout_id"]').removeClass('invalid');
|
||
}
|
||
if (b == 'buil_6' || b == 'buil_7' || b == 'buil_8' || b == 'buil_9' || b == 'buil_4' || b == 'buil_2') {
|
||
|
||
$('.is-occupied').hide();
|
||
$('.is-occupied-date').hide();
|
||
} else {
|
||
if ($('#isOccupied').prop('checked')) {
|
||
$('.is-occupied-date').show();
|
||
} else {
|
||
$('.is-occupied-date').hide();
|
||
}
|
||
$('.is-occupied').show();
|
||
}
|
||
|
||
if (b == 'buil_6' || b == 'buil_7' || b == 'buil_8' || b == 'buil_9') {
|
||
$('.legal-address').hide();
|
||
|
||
$('.number-wet-spots').hide();
|
||
$('.electricity-power').hide();
|
||
} else {
|
||
$('.legal-address').show();
|
||
|
||
$('.number-wet-spots').show();
|
||
$('.electricity-power').show();
|
||
}
|
||
|
||
if (b == 'buil_7' || b == 'buil_9') {
|
||
console.log('hide');
|
||
$('.floors-row').hide();
|
||
} else {
|
||
if (b == 'buil_6') {
|
||
$('#etaz-name').text('Всего этажей:');
|
||
$('#iz-span-name').hide();
|
||
$('#etaz').hide();
|
||
} else {
|
||
$('#etaz-name').html('Этаж: <span class="star" style="color: red; font-size: 20px;">*</span>');
|
||
$('#iz-span-name').show();
|
||
$('#etaz').show();
|
||
}
|
||
$('.floors-row').show();
|
||
}
|
||
|
||
if (b == 'buil_6' || b == 'buil_9') {
|
||
$('.all-arrea').hide();
|
||
|
||
} else {
|
||
$('.all-arrea').show();
|
||
|
||
}
|
||
|
||
if (b == 'buil_6' || b == 'buil_8' || b == 'buil_9') {
|
||
$('.commerc-infrastructures').hide();
|
||
} else {
|
||
$('.commerc-infrastructures').show();
|
||
}
|
||
|
||
|
||
|
||
if (b == 'buil_1' || b == 'buil_2' || b == 'buil_3' || b == 'buil_4' || b == 'buil_5' || b == 'buil_6' || b == 'buil_8' || b == 'buil_9') {
|
||
$('.gsk-nazv').hide();
|
||
$('.commerc-specifications').hide();
|
||
$('.garage-type').hide();
|
||
$('.commerc-infrastructure2').hide();
|
||
$('.commerc-status').hide();
|
||
$('.garage-vid').hide();
|
||
$('.boks-vid').hide();
|
||
} else {
|
||
$('.gsk-nazv').show();
|
||
$('.commerc-specifications').show();
|
||
$('.garage-type').show();
|
||
$('.commerc-infrastructure2').show();
|
||
$('.commerc-status').show();
|
||
if ($('#garage_type_select').val() == 2) {
|
||
$('.garage-vid').show();
|
||
$('.boks-vid').show();
|
||
}
|
||
if ($('#boks_vid_id').val() == 3) {
|
||
$('.boks-vid').show();
|
||
}
|
||
}
|
||
|
||
/*if(b == 'buil_4'){
|
||
$('.commerc-infrastructure').hide();
|
||
} else {
|
||
$('.commerc-infrastructure').show();
|
||
}*/
|
||
|
||
if (b == 'buil_6' || b == 'buil_3' || b == 'buil_1' || b == 'buil_7' || b == 'buil_8' || b == 'buil_9') {
|
||
$('.column-grid').hide();
|
||
$('.floor-material').hide();
|
||
$('.commerc-portal').hide();
|
||
|
||
} else {
|
||
$('.column-grid').show();
|
||
$('.floor-material').show();
|
||
$('.commerc-portal').show();
|
||
}
|
||
|
||
if (b == 'buil_7' || b == 'buil_9') {
|
||
$('.commerc-purpose').hide();
|
||
} else {
|
||
$('.commerc-purpose').show();
|
||
}
|
||
|
||
if (b == 'buil_6' || b == 'buil_3' || b == 'buil_7' || b == 'buil_8' || b == 'buil_9' || b == 'buil_2') {
|
||
$('.commer-access').hide();
|
||
} else {
|
||
$('.commer-access').show();
|
||
}
|
||
|
||
if (b == 'buil_7' || b == 'buil_9' || b == 'buil_4' || b == 'buil_2') {
|
||
$('.is-furniture').hide();
|
||
|
||
} else {
|
||
$('.is-furniture').show();
|
||
}
|
||
|
||
if (b == 'buil_6' || b == 'buil_7' || b == 'buil_9') {
|
||
$('#block_etaz_first_type').hide();
|
||
} else {
|
||
if ($('#etaz').val() == 1) {
|
||
$('#block_etaz_first_type').show();
|
||
}
|
||
}
|
||
|
||
if (b == 'buil_7' || b == 'buil_9') {
|
||
|
||
$('.commer-condition').hide();
|
||
|
||
$('.ceiling_height').hide();
|
||
|
||
$('.commerc-year').hide();
|
||
$('.commerc-building-type-id').hide();
|
||
$('.commerc-building-class-id').hide();
|
||
$('.building-area').hide();
|
||
|
||
$('.commerc-building-category-id').hide();
|
||
$('.building-developer').hide();
|
||
$('.building-management-company').hide();
|
||
|
||
} else {
|
||
|
||
$('.commer-condition').show();
|
||
|
||
$('.ceiling_height').show();
|
||
|
||
$('.commerc-year').show();
|
||
$('.commerc-building-type-id').show();
|
||
$('.commerc-building-class-id').show();
|
||
$('.building-area').show();
|
||
|
||
$('.commerc-building-category-id').show();
|
||
$('.building-developer').show();
|
||
$('.building-management-company').show();
|
||
|
||
|
||
}
|
||
if (b == 'buil_7' || b == 'buil_4' || b == 'buil_2') {
|
||
$('.commerc-infrastructure').hide();
|
||
} else {
|
||
$('.commerc-infrastructure').show();
|
||
}
|
||
if (b == 'buil_7') {
|
||
$('.commerc-site').hide();
|
||
$('.commerc-building-model').hide();
|
||
|
||
} else {
|
||
$('.commerc-site').show();
|
||
$('.commerc-building-model').show();
|
||
|
||
}
|
||
|
||
if (checkType) {
|
||
$('.property-type').show();
|
||
} else {
|
||
$('.property-type').hide();
|
||
}
|
||
|
||
if (b == 'buil_7') {
|
||
$('.tax-number').hide();
|
||
$('#isPartsEnabled').hide();
|
||
$('#isPartsEnabled_label').hide();
|
||
$('.vat_type').hide();
|
||
$('.parking-price').hide();
|
||
|
||
} else {
|
||
$('.tax-number').show();
|
||
$('#isPartsEnabled').show();
|
||
$('#isPartsEnabled_label').show();
|
||
$('.vat_type').show();
|
||
$('.parking-price').show();
|
||
|
||
}
|
||
|
||
if (b == 'buil_8' || b == 'buil_9' || b == 'buil_4' || b == 'buil_2') {
|
||
$('.parking_type').hide();
|
||
} else {
|
||
$('.parking_type').show();
|
||
}
|
||
if (b == 'buil_9') {
|
||
|
||
$('.about-building').hide();
|
||
|
||
} else {
|
||
|
||
$('.about-building').show();
|
||
|
||
}
|
||
|
||
if (b == 'buil_1' || b == 'buil_3' || b == 'buil_5' || b == 'buil_6' || b == 'buil_7' || b == 'buil_8' || b == 'buil_9') {
|
||
$('.parking_type2').hide();
|
||
$('.parking_type3').hide();
|
||
$('.commerc-lifts').hide();
|
||
$('.commerc-cranes').hide();
|
||
$('.commerc-infrastructure3').hide();
|
||
$('.commerc-services').hide();
|
||
} else {
|
||
$('.parking_type2').show();
|
||
$('.parking_type3').show();
|
||
$('.commerc-lifts').show();
|
||
$('.commerc-cranes').show();
|
||
$('.commerc-infrastructure3').show();
|
||
$('.commerc-services').show();
|
||
}
|
||
|
||
|
||
if (b == 'buil_1' || b == 'buil_2' || b == 'buil_3' || b == 'buil_4' || b == 'buil_5' || b == 'buil_6' || b == 'buil_7' || b == 'buil_8') {
|
||
$('.commerc-land-category').hide();
|
||
$('.commerc-permitted-use').hide();
|
||
$('.commerc-investproject').hide();
|
||
$('.is-encumbrances').hide();
|
||
$('.commerc-electricity').hide();
|
||
$('.commerc-gas').hide();
|
||
$('.commerc-water').hide();
|
||
$('.commerc-sewage').hide();
|
||
$('.commerc-driveways').hide();
|
||
} else {
|
||
$('.commerc-land-category').show();
|
||
$('.commerc-permitted-use').show();
|
||
$('.commerc-investproject').show();
|
||
$('.is-encumbrances').show();
|
||
$('.commerc-electricity').show();
|
||
$('.commerc-gas').show();
|
||
$('.commerc-water').show();
|
||
$('.commerc-sewage').show();
|
||
$('.commerc-driveways').show();
|
||
}
|
||
|
||
var selectedCommercialId = null;
|
||
$('.commercial_object_input:checked').each(function() {
|
||
selectedCommercialId = parseInt($(this).val());
|
||
});
|
||
if (selectedCommercialId === 8) {
|
||
$('.monthly_income').closest('.line').show();
|
||
} else {
|
||
$('.monthly_income').closest('.line').hide();
|
||
}
|
||
|
||
if (selectedCommercialId && selectedCommercialId != 7) {
|
||
$('.egrn-url-block').show();
|
||
} else {
|
||
$('.egrn-url-block').hide();
|
||
}
|
||
|
||
if(typeof reinitVillage == 'function')
|
||
reinitVillage();
|
||
|
||
}
|
||
|
||
$(document).ready(function() {
|
||
|
||
$('.srok').click(function() {
|
||
|
||
var thisElement = jQuery(this);
|
||
|
||
if (thisElement.hasClass('selected')) return;
|
||
|
||
$('.srok.selected').removeClass('selected');
|
||
|
||
thisElement.addClass('selected');
|
||
|
||
//return false;
|
||
|
||
});
|
||
|
||
$('.operation_type').click(function() {
|
||
|
||
let thisElement = jQuery(this);
|
||
|
||
if (thisElement.hasClass('selected'))
|
||
return;
|
||
|
||
$('.operation_type.selected').removeClass('selected');
|
||
thisElement.addClass('selected');
|
||
|
||
let opType = $(thisElement).find('label').attr('for');
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op0') {
|
||
$('#prepay-months').show();
|
||
} else {
|
||
$('#prepay-months').hide();
|
||
}
|
||
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op0') {
|
||
$('.year_form').hide();
|
||
} else {
|
||
$('.year_form').show();
|
||
}
|
||
|
||
//return false;
|
||
});
|
||
|
||
$('.house_category').click(function() {
|
||
|
||
var thisElement = jQuery(this);
|
||
|
||
if (thisElement.hasClass('selected')) return;
|
||
|
||
$('.house_category.selected').removeClass('selected');
|
||
|
||
thisElement.addClass('selected');
|
||
|
||
//return false;
|
||
|
||
});
|
||
|
||
$('.commercial_object').click(function() {
|
||
|
||
var thisElement = jQuery(this);
|
||
|
||
if (thisElement.hasClass('selected')) return;
|
||
|
||
$('.commercial_object.selected').removeClass('selected');
|
||
|
||
thisElement.addClass('selected');
|
||
|
||
// $('.commercial_object_input').prop('checked', false);
|
||
|
||
var id = thisElement.data("id");
|
||
|
||
$('#commercial_object_' + id).prop('checked', true);
|
||
|
||
$('form#f-system-search-form[action="/sale.php"]').length ? checkCommercSearch() : checkCommerc();
|
||
|
||
if(typeof reinitVillage == 'function')
|
||
reinitVillage();
|
||
|
||
//return false;
|
||
|
||
});
|
||
|
||
$('.typeCategory').click(function() {
|
||
var thisElement = jQuery(this);
|
||
// console.log('clicked!', thisElement.prop('checked'));
|
||
|
||
// if (thisElement.hasClass('selected')) return;
|
||
|
||
// $('.typeCategory.selected').removeClass('selected');
|
||
|
||
thisElement.toggleClass('selected');
|
||
|
||
var id = thisElement.data("id");
|
||
setTimeout(() => {
|
||
$('#typeCategory_' + id).prop('checked', !!thisElement.hasClass('selected'));
|
||
})
|
||
$('form#f-system-search-form[action="/sale.php"]').length ? checkCommercSearch() : checkCommerc();
|
||
});
|
||
|
||
$('.houseCategory').click(function() {
|
||
var thisElement = jQuery(this);
|
||
console.log('clicked!', thisElement.prop('checked'));
|
||
|
||
// if (thisElement.hasClass('selected')) return;
|
||
|
||
// $('.typeCategory.selected').removeClass('selected');
|
||
|
||
thisElement.toggleClass('selected');
|
||
|
||
var id = thisElement.data("id");
|
||
console.log('clicked!', id);
|
||
setTimeout(() => {
|
||
$('#house_category_' + id).prop('checked', !!thisElement.hasClass('selected'));
|
||
})
|
||
|
||
});
|
||
|
||
$('.ist').click(function() {
|
||
|
||
var thisElement = jQuery(this);
|
||
|
||
if (thisElement.hasClass('selected') || thisElement.hasClass('disabled')) return;
|
||
|
||
$('.ist.selected').removeClass('selected');
|
||
|
||
thisElement.addClass('selected');
|
||
|
||
var ist = $(this).find('label').attr('for');
|
||
var typeSel = $('.type.selected');
|
||
var typeSelVal = typeSel.find('label').attr('for');
|
||
|
||
if (thisElement.parent().hasClass("sale-row")) {
|
||
if (ist == 'ok_1') {
|
||
if (typeSelVal !== 'field_7' && typeSelVal !== 'field_4') {
|
||
$('.house-prop').show();
|
||
$('.credit-line').show();
|
||
}
|
||
} else {
|
||
$('.house-prop').hide();
|
||
$('.credit-line').hide();
|
||
}
|
||
}
|
||
|
||
$('.etazh_form').show();
|
||
$('.year_form').show();
|
||
//console.log(f);
|
||
if (ist == 'ok_1' && f != 'field_4') {
|
||
var f = $('.type.selected').find('label').attr('for');
|
||
if (f != 'field_4') {
|
||
$('.etazh_form').show();
|
||
$('.year_form').show();
|
||
} else {
|
||
$('.etazh_form').hide();
|
||
$('.year_form').hide();
|
||
}
|
||
}
|
||
if (ist == 'ok_2' || ist == 'ok_3' || ist == 'ok_1' || ist == 'ok_4' || ist == 'ok_5') {
|
||
var f = $('.type.selected').find('label').attr('for');
|
||
if (f == 'field_4') {
|
||
$('#typeCategoryBlock').show();
|
||
/*$('.typeCategoryInput').prop('checked', false);
|
||
$('.typeCategory').removeClass('selected');
|
||
$('#typeCategory_1').prop('checked', true);
|
||
$('#type_category_1').addClass('selected');*/
|
||
$('.commerc-info').show();
|
||
$('form#f-system-search-form[action="/sale.php"]').length ? checkCommercSearch() : checkCommerc();
|
||
} else {
|
||
$('#typeCategoryBlock').hide();
|
||
$('.commerc-info').hide();
|
||
}
|
||
} else {
|
||
$('#typeCategoryBlock').hide();
|
||
$('.commerc-info').hide();
|
||
}
|
||
|
||
if (ist == 'ok_5') {
|
||
$('.company-emp').show();
|
||
$('#customFieldsFilters').fadeIn();
|
||
$('#customFieldsFilters .fields').hide();
|
||
$('#customFieldsFilters .block-title').first().click();
|
||
} else {
|
||
$('.company-emp').hide();
|
||
if (!$('#compObj').prop('checked'))
|
||
$('#customFieldsFilters').fadeOut();
|
||
}
|
||
|
||
//return false;
|
||
|
||
});
|
||
|
||
$("body").on('click', '.reason', function() {
|
||
var thisElement = jQuery(this);
|
||
if (thisElement.hasClass('selected')) return;
|
||
$('.reason.selected').removeClass('selected');
|
||
thisElement.addClass('selected');
|
||
})
|
||
|
||
$('.payment').click(function() {
|
||
var thisElement = jQuery(this);
|
||
if (thisElement.hasClass('selected')) return;
|
||
$('.payment.selected').removeClass('selected');
|
||
thisElement.addClass('selected');
|
||
});
|
||
|
||
$('#f-system-search-form .operation_type').click(function() {
|
||
var thisElement = jQuery(this);
|
||
|
||
if (!thisElement.hasClass('selected')) {
|
||
|
||
$('.operation_type.selected').removeClass('selected');
|
||
|
||
thisElement.addClass('selected');
|
||
}
|
||
|
||
var f = $(this).find('label').attr('for');
|
||
|
||
var istSel = $('.ist.selected');
|
||
var typeSel = $('.type.selected');
|
||
var istSelVal = istSel.find('label').attr('for');
|
||
var typeSelVal = typeSel.find('label').attr('for');
|
||
|
||
if (f == 'field_op0') {
|
||
$('#all_val_sel').removeClass('button-right').addClass('button-center');
|
||
//$('#arch_val_sel').show();
|
||
$('.srok-block').show();
|
||
$('.emls').hide();
|
||
$('.sq-kitch').hide();
|
||
$('.house-prop').hide();
|
||
$('.credit-line').hide();
|
||
$('.address-search-label').html("Данная функция работает только по разделам Собственники и Архив собственников");
|
||
} else if (f == 'field_op1') {
|
||
//$('#arch_val_sel').hide();
|
||
$('#all_val_sel').removeClass('button-center').addClass('button-right');
|
||
$('.srok-block').hide();
|
||
$('.emls').show();
|
||
$('.address-search-label').html("Данная функция работает только по разделу Собственники");
|
||
if (istSelVal == 'ok_1') {
|
||
if (typeSelVal != 'field_7' && typeSelVal != 'field_4') {
|
||
$('.house-prop').show();
|
||
$('.credit-line').show();
|
||
}
|
||
} else {
|
||
$('.house-prop').hide();
|
||
$('.credit-line').hide();
|
||
}
|
||
}
|
||
|
||
$('#f-system-search-form .type.selected').click();
|
||
});
|
||
|
||
$('.new-object .operation_type').click(function() {
|
||
|
||
var thisElement = jQuery(this);
|
||
|
||
if (!thisElement.hasClass('selected')) {
|
||
|
||
$('.operation_type.selected').removeClass('selected');
|
||
|
||
thisElement.addClass('selected');
|
||
}
|
||
|
||
var type = $('.type.selected').find('label').attr('for');
|
||
var f = $(this).find('label').attr('for');
|
||
var dealType = $("select[name='deal_type']").val();
|
||
|
||
if (f == 'field_op0') {
|
||
$('.lease-deposit-old').hide();
|
||
$('.beds_count').hide();
|
||
$('.ddu-link').hide();
|
||
$('.srok-block').show();
|
||
if (type == 'field_7') {
|
||
$('.some-udob-block').hide();
|
||
$('.price-ky').hide();
|
||
$('.price-ky-other').hide();
|
||
$('.ky-other').hide();
|
||
$('.lease-deposit').show();
|
||
$('.lease-deposit-old').show();
|
||
$('.beds_count').show();
|
||
$('.no-pets-block').hide();
|
||
$('.no-child-block').hide();
|
||
$('.smoking-allowed-block').hide();
|
||
$('.parties-allowed-block').hide();
|
||
$('.documents-do-block').hide();
|
||
$('#stoim_prim_label').text("");
|
||
$('#stoim_prim').hide();
|
||
} else {
|
||
if (type !== 'field_4') {
|
||
$('.some-udob-block').show();
|
||
$('.lease-deposit').show();
|
||
$('.beds_count').show();
|
||
$('.no-pets-block').show();
|
||
$('.no-child-block').show();
|
||
$('.smoking-allowed-block').show();
|
||
$('.parties-allowed-block').show();
|
||
$('.documents-do-block').show();
|
||
}
|
||
|
||
if (type !== 'field_1' && type !== 'field_3' && type !== 'field_5') {
|
||
$('.lease-deposit-old').show();
|
||
}
|
||
}
|
||
$('#stoim_prim_label').text(" + КУ");
|
||
$('#stoim_prim').show();
|
||
checkKu();
|
||
$('.house-block').hide();
|
||
$('.deal-type-block').hide();
|
||
$('.is-auction-sale').hide();
|
||
if (type == 'field_1') {
|
||
$('.is-nb').show();
|
||
} else {
|
||
$('.is-nb').hide();
|
||
}
|
||
$('#commission-help').show();
|
||
$('#commission-label').text("Комиссия с арендатора:");
|
||
$('#commission-label').closest('.line.rooms').show();
|
||
$(".commission-cost-agent").show();
|
||
|
||
if (type == 'field_7' || type == 'field_4') {
|
||
$('.counters-included').hide();
|
||
$('.beds_count').hide();
|
||
} else {
|
||
$('.counters-included').show();
|
||
$('.beds_count').show();
|
||
}
|
||
|
||
} else if (f == 'field_op1') {
|
||
|
||
if (type == 'field_7' || type == 'field_4') {
|
||
$('.house-block').hide();
|
||
} else {
|
||
$('.house-block').show();
|
||
}
|
||
|
||
if (type == 'field_1' && dealType == '5') {
|
||
$('.ddu-link').show();
|
||
} else {
|
||
$('.ddu-link').hide();
|
||
}
|
||
|
||
$('.counters-included').hide();
|
||
$('#stoim_prim').show();
|
||
$('.srok-block').hide();
|
||
$('.some-udob-block').hide();
|
||
$('.price-ky').hide();
|
||
$('.price-ky-other').hide();
|
||
$('.ky-other').hide();
|
||
$('.lease-deposit').hide();
|
||
$('.lease-deposit-old').hide();
|
||
$('.beds_count').hide();
|
||
$('.no-pets-block').hide();
|
||
$('.no-child-block').hide();
|
||
$('.smoking-allowed-block').hide();
|
||
$('.parties-allowed-block').hide();
|
||
$('.documents-do-block').hide();
|
||
$('.deal-type-block').show();
|
||
$('#commission-help').hide();
|
||
$('#commission-label').text("Комиссия с арендатора:");
|
||
$('#commission-label').closest('.line.rooms').hide();
|
||
$('#stoim_prim_label').text(" Возможна ипотека");
|
||
$(".commission-cost-agent").hide();
|
||
|
||
if (type == 'field_1' && dealType == '1') {
|
||
$('.is-auction-sale').show();
|
||
}
|
||
|
||
if (type == 'field_1' && (dealType == '1' || dealType == '2')) {
|
||
$('.is-nb').show();
|
||
} else {
|
||
$('.is-nb').hide();
|
||
}
|
||
}
|
||
|
||
if (type == 'field_1') {
|
||
$('.avito-room-types').show();
|
||
} else {
|
||
$('.avito-room-types').hide();
|
||
}
|
||
|
||
if (type == 'field_2') {
|
||
$('.all-room-count').show();
|
||
} else {
|
||
$('.all-room-count').hide();
|
||
}
|
||
|
||
if (f == 'field_op0' && (type == 'field_2' || type == 'field_1')) {
|
||
$('.rent-house-type').show();
|
||
} else {
|
||
$('.rent-house-type').hide();
|
||
}
|
||
|
||
$('.part').show();
|
||
if ($('.part_check').prop('checked')) {
|
||
$(".input_part").show();
|
||
$(".ownership-block").show();
|
||
$(".layout-block").show();
|
||
} else {
|
||
$('.input_part').hide();
|
||
$(".ownership-block").hide();
|
||
$(".layout-block").hide();
|
||
}
|
||
|
||
if (f == 'field_op1') {
|
||
$(".commission-cost-agent").hide();
|
||
} else {
|
||
$(".commission-cost-agent").show();
|
||
}
|
||
|
||
if (type == 'field_2' || type == 'field_1') {
|
||
$('.apartments-block').show();
|
||
$('.balcon-count').show();
|
||
$('.loggias-count').show();
|
||
$('.separate-wcs-count').show();
|
||
$('.combined-wcs-count').show();
|
||
$('.passenger-lifts-count').show();
|
||
$('.cargo-lifts-count').show();
|
||
} else {
|
||
$('.apartments-block').hide();
|
||
$('.balcon-count').hide();
|
||
$('.loggias-count').hide();
|
||
$('.separate-wcs-count').hide();
|
||
$('.combined-wcs-count').hide();
|
||
$('.passenger-lifts-count').hide();
|
||
$('.cargo-lifts-count').hide();
|
||
}
|
||
});
|
||
|
||
$('.obj-type').click(function() {
|
||
var thisElement = jQuery(this);
|
||
|
||
if (!thisElement.hasClass('selected')) {
|
||
thisElement.addClass('selected');
|
||
} else {
|
||
thisElement.removeClass('selected');
|
||
}
|
||
});
|
||
|
||
$('#stoim_prim').click(function() {
|
||
checkKu();
|
||
});
|
||
|
||
$('#other_ku').click(function() {
|
||
var opType = $('.operation_type.selected').find('label').attr('for');
|
||
|
||
//если у нас Аренда
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op0') {
|
||
if ($('#other_ku').prop('checked')) {
|
||
$('.price-ky-other').show();
|
||
} else {
|
||
$('.price-ky-other').hide();
|
||
}
|
||
}
|
||
});
|
||
|
||
function checkKu() {
|
||
var opType = $('.operation_type.selected').find('label').attr('for');
|
||
|
||
//если у нас Аренда
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op0') {
|
||
if ($('#stoim_prim').prop('checked')) {
|
||
$('.price-ky').show();
|
||
$('.ky-other').show();
|
||
if ($('#other_ku').prop('checked')) {
|
||
$('.price-ky-other').show();
|
||
} else {
|
||
$('.price-ky-other').hide();
|
||
}
|
||
} else {
|
||
$('.price-ky').hide();
|
||
$('.ky-other').hide();
|
||
$('.price-ky-other').hide();
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
// if edit
|
||
var dealType = $("select[name='deal_type']").val();
|
||
var investorType = $("select[name='investor_type_id']").val();
|
||
var complex_id = $('#complex_id').val();
|
||
var opType = $('.operation_type.selected').find('label').attr('for');
|
||
var obType = $('.type.selected').find('label').attr('for');
|
||
|
||
if (typeof dealType !== 'undefined') {
|
||
if (dealType === '4' || dealType === '5' || dealType === '6' ||
|
||
((dealType === '1' || dealType === '2') && opType == 'field_op1' && obType == 'field_1' && $('#is_nb').prop('checked'))) {
|
||
$('.newbuildings-block').show();
|
||
|
||
if (dealType === '5') {
|
||
$('.ddu-number').show();
|
||
} else {
|
||
$('.ddu-number').hide();
|
||
}
|
||
|
||
$('.newbuildings-block .line .label span').addClass('font-bold');
|
||
$(".newbuildings-block input[name='nb_end_date']").attr("required", "required");
|
||
if (complex_id > 0) {
|
||
$(".newbuildings-block select[name='newbuilding_id']").removeAttr('required');
|
||
} else {
|
||
$(".newbuildings-block select[name='newbuilding_id']").attr("required", "required");
|
||
}
|
||
$('.is-auction-sale').hide();
|
||
$('.is-nb').hide();
|
||
} else {
|
||
$('.newbuildings-block').hide();
|
||
$('.newbuildings-block .line .label span').removeClass('font-bold');
|
||
$(".newbuildings-block input[name='nb_end_date']").removeAttr('required');
|
||
|
||
$(".newbuildings-block select[name='newbuilding_id']").removeAttr('required');
|
||
|
||
if (dealType === '1' && opType == 'field_op1' && obType == 'field_1') {
|
||
$('.is-auction-sale').show();
|
||
} else {
|
||
$('.is-auction-sale').hide();
|
||
}
|
||
|
||
if (((dealType === '1' || dealType === '2') && opType == 'field_op1' && obType == 'field_1') || (opType == 'field_op0' && obType == 'field_1')) {
|
||
$('.is-nb').show();
|
||
} else {
|
||
$('.is-nb').hide();
|
||
}
|
||
}
|
||
}
|
||
|
||
// if add new object
|
||
$("select[name='deal_type']").change(function() {
|
||
|
||
var s = this.value;
|
||
var idsVal = $("#obj-client-required").val();
|
||
var opType = $('.operation_type.selected').find('label').attr('for');
|
||
var obType = $('.type.selected').find('label').attr('for');
|
||
|
||
if (obType === 'field_1' && opType == 'field_op1' && s == '5') {
|
||
$('.ddu-link').show();
|
||
} else {
|
||
$('.ddu-link').hide();
|
||
}
|
||
|
||
if (idsVal === '1') {
|
||
if (s === '6') {
|
||
$('#object-new-client').removeAttr('required');
|
||
$('#object-new-client-vue').removeAttr('required');
|
||
} else {
|
||
$('#object-new-client').attr("required", "required");
|
||
$('#object-new-client-vue').attr("required", "required");
|
||
}
|
||
}
|
||
if (s === '4' || s === '5' || s === '6') {
|
||
$('.newbuildings-block').show();
|
||
|
||
if (s === '5') {
|
||
$('.ddu-number').show();
|
||
} else {
|
||
$('.ddu-number').hide();
|
||
}
|
||
|
||
$('.newbuildings-block .line .label span').addClass('font-bold');
|
||
$(".newbuildings-block input[name='nb_end_date']").attr("required", "required");
|
||
if (complex_id > 0) {
|
||
$(".newbuildings-block select[name='newbuilding_id']").removeAttr('required');
|
||
} else {
|
||
$(".newbuildings-block select[name='newbuilding_id']").attr("required", "required");
|
||
}
|
||
$('.is-auction-sale').hide();
|
||
$('.is-nb').hide();
|
||
} else {
|
||
$('.is-auction-sale').hide();
|
||
$('.is-nb').hide();
|
||
$('.newbuildings-block').hide();
|
||
$('.newbuildings-block .line .label span').removeClass('font-bold');
|
||
$(".newbuildings-block input[name='nb_end_date']").removeAttr('required');
|
||
$(".newbuildings-block select[name='newbuilding_id']").removeAttr('required');
|
||
|
||
if (s === '1' && opType == 'field_op1' && obType == 'field_1') {
|
||
$('.is-auction-sale').show();
|
||
} else {
|
||
$('.is-auction-sale').hide();
|
||
}
|
||
|
||
if (((s === '1' || s === '2') && opType == 'field_op1' && obType == 'field_1') || (opType == 'field_op0' && obType == 'field_1')) {
|
||
$('.is-nb').show();
|
||
} else {
|
||
$('.is-nb').hide();
|
||
}
|
||
}
|
||
});
|
||
|
||
$('.type').click(function() {
|
||
|
||
var thisElement = jQuery(this);
|
||
|
||
if (!thisElement.hasClass('selected')) {
|
||
|
||
$('.type.selected').removeClass('selected');
|
||
|
||
thisElement.addClass('selected');
|
||
}
|
||
|
||
var f = $(this).find('label').attr('for');
|
||
var opType = $('.operation_type.selected').find('label').attr('for');
|
||
var dealType = $("select[name='deal_type']").val();
|
||
// HERE IS SPAN
|
||
$('#komnat').html('Комнат: <span class="star" style="color: red; font-size: 20px;">*</span>');
|
||
$('#sq_all_name').text('Общая площадь:');
|
||
|
||
$('.cadastral-number .cadastral-number-nounique').text("").hide();
|
||
|
||
$('.all-room-count').hide();
|
||
|
||
$('.table-of-rooms').show();
|
||
$('.num-of-rooms input[name="komn_do"]').hide().val('');
|
||
|
||
if (f == 'field_3' || f == 'field_5') {
|
||
$('.sq-land-all').show();
|
||
} else {
|
||
$('.sq-land-all').hide();
|
||
}
|
||
|
||
if (f == 'field_4' || f == 'field_7') {
|
||
$('.sq-live').hide();
|
||
$('.sq-kitch').hide();
|
||
} else {
|
||
$('.sq-live').show();
|
||
$('.sq-kitch').show();
|
||
}
|
||
|
||
$('.is-nb').hide();
|
||
|
||
if (f == 'field_4') {
|
||
$('.num-of-rooms').hide();
|
||
var ist = $('.ist.selected').find('label').attr('for');
|
||
|
||
if ((ist == 'ok_2' || ist == 'ok_3' || ist == 'ok_1' || ist == 'ok_4' || ist == 'ok_5')) {
|
||
$('#typeCategoryBlock').show();
|
||
/* $('.typeCategoryInput').prop('checked', false);
|
||
$('.typeCategory').removeClass('selected');
|
||
$('#typeCategory_1').prop('checked', true);
|
||
$('#type_category_1').addClass('selected');*/
|
||
$('.commerc-info').show();
|
||
$('form#f-system-search-form[action="/sale.php"]').length ? checkCommercSearch() : checkCommerc();
|
||
} else {
|
||
$('#typeCategoryBlock').hide();
|
||
$('.commerc-info').hide();
|
||
}
|
||
} else if (f == 'field_2') {
|
||
|
||
$('.num-of-rooms').show();
|
||
$('.all-room-count').show();
|
||
$('.num-of-rooms input[name="komn_ot"]').hide().val('');
|
||
|
||
$('#komnat').html('Всего комнат в квартире: <span class="star" style="color: red; font-size: 20px;">*</span>');
|
||
$('#sq_all_name').text('Площадь комнаты:');
|
||
|
||
$('.table-of-rooms').hide();
|
||
$('.num-of-rooms #rn1').attr('data-active', 0);
|
||
$('.num-of-rooms input[name=rn1]').val("0");
|
||
$('.num-of-rooms #rn2').attr('data-active', 0);
|
||
$('.num-of-rooms input[name=rn2]').val("0");
|
||
$('.num-of-rooms #rn3').attr('data-active', 0);
|
||
$('.num-of-rooms input[name=rn3]').val("0");
|
||
$('.num-of-rooms #rn4').attr('data-active', 0);
|
||
$('.num-of-rooms input[name=rn4]').val("0");
|
||
$('.num-of-rooms #rnStudio').attr('data-active', 0);
|
||
$('.num-of-rooms input[name=rnStudio]').val("0");
|
||
$('.num-of-rooms input[name="komn_do"]').show().val('');
|
||
|
||
$('#typeCategoryBlock').hide();
|
||
$('.commerc-info').hide();
|
||
|
||
} else {
|
||
if (f == 'field_7') {
|
||
$('.num-of-rooms').hide();
|
||
} else {
|
||
|
||
$('.num-of-rooms').show();
|
||
$('.num-of-rooms input[name="komn_ot"]').show();
|
||
$('#typeCategoryBlock').hide();
|
||
$('.commerc-info').hide();
|
||
|
||
}
|
||
}
|
||
|
||
if (f === 'field_1' && opType == 'field_op1' && dealType == '1') {
|
||
$('.is-auction-sale').show();
|
||
} else {
|
||
$('.is-auction-sale').hide();
|
||
}
|
||
|
||
if (f === 'field_1' && opType == 'field_op1' && dealType == '5') {
|
||
$('.ddu-link').show();
|
||
} else {
|
||
$('.ddu-link').hide();
|
||
}
|
||
|
||
if ((f === 'field_1' && opType == 'field_op1' && (dealType == '1' || dealType == '2')) || (f === 'field_1' && opType == 'field_op0')) {
|
||
$('.is-nb').show();
|
||
if ($('#is_nb').prop('checked')) {
|
||
$(".newbuildings-block").show();
|
||
}
|
||
} else {
|
||
$('.is-nb').hide();
|
||
if ($('#is_nb').prop('checked')) {
|
||
$(".newbuildings-block").hide();
|
||
}
|
||
$('#is_nb').prop('checked', false);
|
||
}
|
||
|
||
var typeSel = $('.type.selected');
|
||
var typeSelVal = typeSel.find('label').attr('for');
|
||
|
||
if (typeSelVal === 'field_7' || typeSelVal === 'field_4') {
|
||
$('.house-prop').hide();
|
||
$('.credit-line').hide();
|
||
}
|
||
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op0') {
|
||
|
||
$('.beds_count').hide();
|
||
$('.lease-deposit-old').hide();
|
||
|
||
if (f == 'field_7') {
|
||
$('.lease-deposit-old').show();
|
||
$('.beds_count').show();
|
||
} else {
|
||
if (f !== 'field_4') {
|
||
$('.beds_count').show();
|
||
}
|
||
if (f !== 'field_1' && f !== 'field_3' && f !== 'field_5') {
|
||
$('.lease-deposit-old').show();
|
||
}
|
||
}
|
||
|
||
$('#prepay-months').show();
|
||
$(".commission-cost-agent").show();
|
||
} else {
|
||
$('.lease-deposit-old').hide();
|
||
$('#prepay-months').hide();
|
||
$(".commission-cost-agent").hide();
|
||
}
|
||
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op0' && (f == 'field_2' || f == 'field_1')) {
|
||
$('.rent-house-type').show();
|
||
} else {
|
||
$('.rent-house-type').hide();
|
||
}
|
||
|
||
if (f == 'field_1' || f == 'field_2') {
|
||
$('.etazh_not_first').show();
|
||
$('.etazh_not_last').show();
|
||
} else {
|
||
$('.etazh_not_first').hide();
|
||
$('.etazh_not_last').hide();
|
||
}
|
||
|
||
if (f == 'field_1' || f == 'field_3') {
|
||
|
||
$('#renovation_select_search').show();
|
||
} else {
|
||
|
||
$('#renovation_select_search').hide();
|
||
}
|
||
|
||
if (f == 'field_1') {
|
||
$('#studio_flag').show();
|
||
$('#studio_flag_label').show();
|
||
$('#free_plan').show();
|
||
$('#free_plan_label').show();
|
||
$('.avito-room-types').show();
|
||
$('#is_penthouse').show();
|
||
$('#is_penthouse_label').show();
|
||
} else {
|
||
$('.avito-room-types').hide();
|
||
$('#studio_flag').hide();
|
||
$('#studio_flag_label').hide();
|
||
$('#free_plan').hide();
|
||
$('#free_plan_label').hide();
|
||
$('#is_penthouse').hide();
|
||
$('#is_penthouse_label').hide();
|
||
}
|
||
|
||
$('.part').show();
|
||
if ($('.part_check').prop('checked')) {
|
||
$(".input_part").show();
|
||
$(".ownership-block").show();
|
||
$(".layout-block").show();
|
||
} else {
|
||
$('.input_part').hide();
|
||
$(".ownership-block").hide();
|
||
$(".layout-block").hide();
|
||
}
|
||
|
||
if (f == 'field_6' || f == 'field_4') {
|
||
$('.property-type').show();
|
||
} else {
|
||
$('.property-type').hide();
|
||
}
|
||
|
||
if (f == 'field_2' || f == 'field_1' || f == 'field_3' || f == 'field_5') {
|
||
if (f == 'field_2' || f == 'field_1') {
|
||
$('.apartments-block').show();
|
||
$('.passenger-lifts-count').show();
|
||
$('.cargo-lifts-count').show();
|
||
} else {
|
||
$('.apartments-block').hide();
|
||
$('.passenger-lifts-count').hide();
|
||
$('.cargo-lifts-count').hide();
|
||
}
|
||
$('.balcon-count').show();
|
||
$('.loggias-count').show();
|
||
$('.separate-wcs-count').show();
|
||
$('.combined-wcs-count').show();
|
||
$('.window_view').show();
|
||
$('.renovation').show();
|
||
$('.bath_type').show();
|
||
$('.hot_water').show();
|
||
$('.rubbish_chute').show();
|
||
|
||
$('.ceiling_height').show();
|
||
$('#flat_number_tip').show();
|
||
$('#flat_number').show();
|
||
} else {
|
||
$('.apartments-block').hide();
|
||
$('.balcon-count').hide();
|
||
$('.loggias-count').hide();
|
||
$('.separate-wcs-count').hide();
|
||
$('.combined-wcs-count').hide();
|
||
$('.passenger-lifts-count').hide();
|
||
$('.cargo-lifts-count').hide();
|
||
$('.window_view').hide();
|
||
$('.renovation').hide();
|
||
$('.bath_type').hide();
|
||
$('.hot_water').hide();
|
||
$('.rubbish_chute').hide();
|
||
$('.parking_type').hide();
|
||
$('.ceiling_height').hide();
|
||
$('#flat_number_tip').hide();
|
||
$('#flat_number').hide();
|
||
}
|
||
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op1' && f == 'field_3') {
|
||
$('.cadastral-number-land').show();
|
||
} else {
|
||
$('.cadastral-number-land').hide();
|
||
}
|
||
|
||
if (f == 'field_4') {
|
||
$('.vat_type').show();
|
||
$('.commercial-object').show();
|
||
$('.tax-number').show();
|
||
$('.ceiling_height').show();
|
||
$('.kitchen-area').hide();
|
||
$('.komnat-area').hide();
|
||
$('#isPartsEnabled').show();
|
||
$('#isPartsEnabled_label').show();
|
||
$('.legal-address').show();
|
||
$('.is-occupied').show();
|
||
$('.layout-object').show();
|
||
$('.number-wet-spots').show();
|
||
$('.electricity-power').show();
|
||
$('.commer-condition').show();
|
||
$('.is-furniture').show();
|
||
$('.commer-access').show();
|
||
$('.parking_type').show();
|
||
$('.parking_type2').show();
|
||
$('.parking_type3').show();
|
||
$('.parking-price').show();
|
||
$('#parkingIsFree').show();
|
||
$('#parkingIsFree_label').show();
|
||
$('.no-pets-block').hide();
|
||
$('.no-child-block').hide();
|
||
$('.smoking-allowed-block').hide();
|
||
$('.parties-allowed-block').hide();
|
||
$('.documents-do-block').hide();
|
||
$('.some-udob-block').hide();
|
||
$('.house-block').hide();
|
||
$('.about-building').show();
|
||
$('.commerc-infrastructures').show();
|
||
$('.column-grid').show();
|
||
$('.about-subject').show();
|
||
$('form#f-system-search-form[action="/sale.php"]').length ? checkCommercSearch() : checkCommerc();
|
||
} else {
|
||
$('.commercial_object.selected').removeClass('selected');
|
||
|
||
// $('.commercial_object_input').prop('checked', false);
|
||
$('form#f-system-search-form[action="/sale.php"]').length ? checkCommercSearch() : checkCommerc();
|
||
$('.vat_type').hide();
|
||
$('.commercial-object').hide();
|
||
$('.tax-number').hide();
|
||
if (f != 'field_2' && f != 'field_1') {
|
||
$('.ceiling_height').hide();
|
||
}
|
||
if (f != 'field_7') {
|
||
$('.kitchen-area').show();
|
||
$('.komnat-area').show();
|
||
}
|
||
$('.parking_type2').hide();
|
||
$('.parking_type3').hide();
|
||
$('#isPartsEnabled').hide();
|
||
$('#isPartsEnabled_label').hide();
|
||
$('.legal-address').hide();
|
||
$('.is-occupied').hide();
|
||
$('.layout-object').hide();
|
||
$('.number-wet-spots').hide();
|
||
$('.electricity-power').hide();
|
||
$('.commer-condition').hide();
|
||
$('.is-furniture').hide();
|
||
$('.commer-access').hide();
|
||
if (f != 'field_2' && f != 'field_1') {
|
||
$('.parking_type').hide();
|
||
}
|
||
$('.parking-price').hide();
|
||
$('#parkingIsFree').hide();
|
||
$('#parkingIsFree_label').hide();
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op0' && f != 'field_7') {
|
||
$('.no-pets-block').show();
|
||
$('.no-child-block').show();
|
||
$('.smoking-allowed-block').show();
|
||
$('.parties-allowed-block').show();
|
||
$('.documents-do-block').show();
|
||
$('.some-udob-block').show();
|
||
checkKu();
|
||
$('#stoim_prim_label').text(" + КУ");
|
||
}
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op1' && f != 'field_7') {
|
||
$('.house-block').show();
|
||
$('.price-ky').hide();
|
||
$('.price-ky-other').hide();
|
||
$('.ky-other').hide();
|
||
$('#stoim_prim_label').text(" Возможна ипотека");
|
||
}
|
||
$('.about-building').hide();
|
||
$('.commerc-infrastructures').hide();
|
||
$('.column-grid').hide();
|
||
$('.about-subject').hide();
|
||
}
|
||
|
||
if (typeof opType === 'undefined' || !opType || opType !== 'field_op0' || f == 'field_7' || f == 'field_4') {
|
||
$('.counters-included').hide();
|
||
} else {
|
||
$('.counters-included').show();
|
||
}
|
||
|
||
if (f == 'field_3') {
|
||
$('.house-category').show();
|
||
if($('#compObj').prop('checked')){
|
||
$('#typeCategoryHouse').show();
|
||
} else {
|
||
$('#typeCategoryHouse').hide();
|
||
}
|
||
} else {
|
||
$('.house-category').hide();
|
||
$('#typeCategoryHouse').hide();
|
||
$('.house-category .button-row').removeClass('invalid');
|
||
}
|
||
|
||
if (f == 'field_3' || f == 'field_5') {
|
||
$('.wall-type').show();
|
||
$('.wcs-type').show();
|
||
$('.house-wall-type').hide();
|
||
$('.house-type').hide();
|
||
} else {
|
||
$('.wall-type').hide();
|
||
$('.wcs-type').hide();
|
||
if (f == 'field_7') {
|
||
$('.house-wall-type').hide();
|
||
$('.house-type').hide();
|
||
} else {
|
||
$('.house-wall-type').show();
|
||
$('.house-type').show();
|
||
}
|
||
}
|
||
|
||
// "Ссылка на выписку ЕГРН"
|
||
if (f == 'field_1' || f == 'field_3' || f == 'field_7') {
|
||
$('.egrn-url-block').show();
|
||
} else if (f == 'field_4') {
|
||
var commercialId = $('.commercial_object_input:checked').val();
|
||
if (commercialId && commercialId != '7') {
|
||
$('.egrn-url-block').show();
|
||
} else {
|
||
$('.egrn-url-block').hide();
|
||
}
|
||
} else {
|
||
$('.egrn-url-block').hide();
|
||
}
|
||
|
||
if (f == 'field_3' || f == 'field_5') {
|
||
$('#etaz-name').html('Этажей: <span class="star" style="color: red; font-size: 20px;">*</span>');
|
||
$('#iz-span-name').hide();
|
||
$('#etaz').hide();
|
||
} else {
|
||
$('#etaz-name').html('Этаж: <span class="star" style="color: red; font-size: 20px;">*</span>');
|
||
$('#etaz').show();
|
||
if (f == 'field_4') {
|
||
$('form#f-system-search-form[action="/sale.php"]').length ? checkCommercSearch() : checkCommerc();
|
||
}
|
||
}
|
||
|
||
if (f == 'field_3' || f == 'field_5' || f == 'field_7') {
|
||
if (window.location.pathname.indexOf('add-object.php') === -1) {
|
||
$('.num-of-rooms').hide();
|
||
}
|
||
$('.land-area').show();
|
||
$('.land-purpose-type').show();
|
||
$('.land-distance').show();
|
||
$('.land-burden').show();
|
||
$('.land-shape-type').show();
|
||
$('.land-plumbing-type').show();
|
||
$('.land-gas-type').show();
|
||
$('.land-electricity-type').show();
|
||
$('.land-sewerage-type').show();
|
||
$('.land-relief-type').show();
|
||
$('.land-usage-type').show();
|
||
} else {
|
||
$('.land-area').hide();
|
||
$('.land-purpose-type').hide();
|
||
$('.land-distance').hide();
|
||
$('.land-burden').hide();
|
||
$('.land-shape-type').hide();
|
||
$('.land-plumbing-type').hide();
|
||
$('.land-gas-type').hide();
|
||
$('.land-electricity-type').hide();
|
||
$('.land-sewerage-type').hide();
|
||
$('.land-relief-type').hide();
|
||
$('.land-usage-type').hide();
|
||
if (f == 'field_4') {
|
||
$('form#f-system-search-form[action="/sale.php"]').length ? checkCommercSearch() : checkCommerc();
|
||
}
|
||
}
|
||
|
||
if (f == 'field_7') {
|
||
$('.etazh_form').hide();
|
||
$('.year_form').hide();
|
||
$('.total-area').hide();
|
||
$('.kitchen-area').hide();
|
||
$('.komnat-area').hide();
|
||
$('.floors-row').hide();
|
||
$('.no-pets-block').hide();
|
||
$('.no-child-block').hide();
|
||
$('.smoking-allowed-block').hide();
|
||
$('.parties-allowed-block').hide();
|
||
$('.documents-do-block').hide();
|
||
$('.some-udob-block').hide();
|
||
$('.house-block').hide();
|
||
$('.price-ky').hide();
|
||
$('.price-ky-other').hide();
|
||
$('.ky-other').hide();
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op1') {
|
||
$('#stoim_prim').show();
|
||
$('#stoim_prim_label').text(" Возможна ипотека");
|
||
} else {
|
||
$('#stoim_prim').hide();
|
||
$('#stoim_prim_label').text("");
|
||
}
|
||
} else {
|
||
$('.etazh_form').show();
|
||
$('.year_form').show();
|
||
$('.total-area').show();
|
||
$('#stoim_prim').show();
|
||
if (f != 'field_4') {
|
||
$('.kitchen-area').show();
|
||
$('.komnat-area').show();
|
||
$('.floors-row').show();
|
||
}
|
||
|
||
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op0') {
|
||
checkKu();
|
||
$('#stoim_prim_label').text(" + КУ");
|
||
}
|
||
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op0' && f != 'field_4') {
|
||
$('.no-pets-block').show();
|
||
$('.no-child-block').show();
|
||
$('.smoking-allowed-block').show();
|
||
$('.parties-allowed-block').show();
|
||
$('.documents-do-block').show();
|
||
$('.some-udob-block').show();
|
||
}
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op1' && f != 'field_4') {
|
||
$('.house-block').show();
|
||
$('.price-ky').hide();
|
||
$('.price-ky-other').hide();
|
||
$('.ky-other').hide();
|
||
$('#stoim_prim_label').text(" Возможна ипотека");
|
||
}
|
||
}
|
||
|
||
if (typeof opType !== 'undefined' && opType && opType == 'field_op0') {
|
||
$('.year_form').hide();
|
||
}
|
||
|
||
if(typeof reinitVillage == 'function'){
|
||
reinitVillage();
|
||
}
|
||
|
||
});
|
||
|
||
//Площадь
|
||
$("body").on("click", "#isPartsEnabled", function() {
|
||
|
||
if ($(this).prop('checked')) {
|
||
var part = ($(".part-area").length) + 1;
|
||
if (part == 1) {
|
||
var html = '<div class="area-inputs inputs part-area">' +
|
||
'<div class="inputs-group">' +
|
||
'<span class="area-label">пл. ' + part + '</span>' +
|
||
'<input id="ploshad_' + part + '" type="number" step="0.01" class="number text small-input rooms" min="0" max="100000" name="partsarea[]" placeholder="" value="">' +
|
||
'<span class="area-label-right">м. кв</span>' +
|
||
'<div class="clear"></div>' +
|
||
'</div>' +
|
||
'</div >';
|
||
$("#parts-area").append(html);
|
||
$('#parts_area_add').show();
|
||
}
|
||
} else {
|
||
$("#parts-area").html('');
|
||
$('#parts_area_add').hide();
|
||
}
|
||
});
|
||
|
||
//Дополнительная площадь
|
||
$("body").on("click", "#parts_area_add_a", function() {
|
||
|
||
|
||
var part = ($(".part-area").length) + 1;
|
||
//if (part == 1) {
|
||
var html = '<div class="area-inputs inputs part-area">' +
|
||
'<div class="inputs-group">' +
|
||
'<span class="area-label">пл. ' + part + '</span>' +
|
||
'<input id="ploshad_' + part + '" type="number" step="0.01" class="number text small-input rooms" min="0" max="100000" name="partsarea[]" placeholder="" value="">' +
|
||
'<span class="area-label-right">м. кв</span>' +
|
||
'<div class="clear"></div>' +
|
||
'</div>' +
|
||
'</div >';
|
||
$("#parts-area").append(html);
|
||
//}
|
||
|
||
});
|
||
//
|
||
$("body").on("change", "#isOccupied", function() {
|
||
if ($(this).prop('checked')) {
|
||
$(".is-occupied-date").show();
|
||
} else {
|
||
$(".is-occupied-date").hide();
|
||
}
|
||
});
|
||
//
|
||
$("body").on("change", "#is_nb", function() {
|
||
if ($(this).prop('checked')) {
|
||
$(".newbuildings-block").show();
|
||
} else {
|
||
$(".newbuildings-block").hide();
|
||
}
|
||
|
||
// if edit
|
||
var dealType = $("select[name='deal_type']").val();
|
||
var investorType = $("select[name='investor_type_id']").val();
|
||
var complex_id = $('#complex_id').val();
|
||
var opType = $('.operation_type.selected').find('label').attr('for');
|
||
var obType = $('.type.selected').find('label').attr('for');
|
||
|
||
if (typeof dealType !== 'undefined') {
|
||
if (dealType === '4' || dealType === '5' || dealType === '6' ||
|
||
((dealType === '1' || dealType === '2') && opType == 'field_op1' && obType == 'field_1' && $('#is_nb').prop('checked'))) {
|
||
$('.newbuildings-block').show();
|
||
|
||
if (dealType === '5') {
|
||
$('.ddu-number').show();
|
||
} else {
|
||
$('.ddu-number').hide();
|
||
}
|
||
|
||
$('.newbuildings-block .line .label span').addClass('font-bold');
|
||
$(".newbuildings-block input[name='nb_end_date']").attr("required", "required");
|
||
if (complex_id > 0) {
|
||
$(".newbuildings-block select[name='newbuilding_id']").removeAttr('required');
|
||
} else {
|
||
$(".newbuildings-block select[name='newbuilding_id']").attr("required", "required");
|
||
}
|
||
$('.is-auction-sale').hide();
|
||
if (((dealType === '1' || dealType === '2') && opType == 'field_op1' && obType == 'field_1') || (opType == 'field_op0' && obType == 'field_1')) {
|
||
$('.is-nb').show();
|
||
} else {
|
||
$('.is-nb').hide();
|
||
}
|
||
} else {
|
||
$('.newbuildings-block').hide();
|
||
$('.newbuildings-block .line .label span').removeClass('font-bold');
|
||
$(".newbuildings-block input[name='nb_end_date']").removeAttr('required');
|
||
|
||
$(".newbuildings-block select[name='newbuilding_id']").removeAttr('required');
|
||
|
||
if (dealType === '1' && opType == 'field_op1' && obType == 'field_1') {
|
||
$('.is-auction-sale').show();
|
||
} else {
|
||
$('.is-auction-sale').hide();
|
||
}
|
||
|
||
if (((dealType === '1' || dealType === '2') && opType == 'field_op1' && obType == 'field_1') || (opType == 'field_op0' && obType == 'field_1')) {
|
||
$('.is-nb').show();
|
||
} else {
|
||
$('.is-nb').hide();
|
||
}
|
||
}
|
||
}
|
||
|
||
});
|
||
|
||
$('body').on('change', '#parkingIsFree', function() {
|
||
if ($(this).prop('checked')) {
|
||
$('.parking_price').attr('disabled', 'disabled');
|
||
$('.parking_price').val(0);
|
||
} else {
|
||
$('.parking_price').removeAttr('disabled');
|
||
}
|
||
});
|
||
|
||
$('body').on('change', '#garage_type_select', function() {
|
||
$('.garage-vid').hide();
|
||
$('.boks-vid').hide();
|
||
if ($(this).val() == 2) {
|
||
$('.garage-vid').show();
|
||
$('.boks-vid').show();
|
||
} else if ($(this).val() == 3) {
|
||
$('.boks-vid').show();
|
||
}
|
||
});
|
||
|
||
//инициализация видимости полей
|
||
$('#f-system-search-form .type.selected').click();
|
||
$('.new-object .type.selected').click();
|
||
|
||
$('.radio').click(function() {
|
||
|
||
var thisElement = jQuery(this);
|
||
|
||
if (thisElement.hasClass('selected')) return;
|
||
|
||
$('.selected').removeClass('selected');
|
||
|
||
thisElement.addClass('selected');
|
||
|
||
});
|
||
|
||
$('#compObj').click(function() {
|
||
var typeSel = $('.type.selected');
|
||
var typeSelVal = typeSel.find('label').attr('for');
|
||
if (this.checked) {
|
||
$('#ok_1').prop('checked', true);
|
||
$('#ok_1').siblings('.ist').removeClass('selected');
|
||
$('label[for="ok_1"]').parent().addClass('selected');
|
||
|
||
$('.company-emp').show();
|
||
reinitHighwaysSearch();
|
||
reinitVillageSearch();
|
||
$('#customFieldsFilters').fadeIn();
|
||
$('#customFieldsFilters .fields').hide();
|
||
$('#customFieldsFilters .block-title').first().click();
|
||
if(typeSelVal == 'field_3'){
|
||
$('#typeCategoryHouse').show();
|
||
} else {
|
||
$('#typeCategoryHouse').hide();
|
||
}
|
||
|
||
} else {
|
||
$('.company-emp').hide();
|
||
$('.villages-search').hide();
|
||
$(".highways-search").hide();
|
||
if (!$('#ok_5[name="ok"]').prop('checked'))
|
||
$('#customFieldsFilters').fadeOut();
|
||
$('#typeCategoryHouse').hide();
|
||
}
|
||
});
|
||
|
||
$(".money-format").priceFormat();
|
||
|
||
$(".slider_newbuiding1").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 0,
|
||
min: 1,
|
||
max: 200,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "20000000";
|
||
var mnoj = 100000;
|
||
var val = '';
|
||
if (ui.value >= 200) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#stoim_ot').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".slider_newbuiding2").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 0,
|
||
min: 1,
|
||
max: 200,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "20000000";
|
||
var mnoj = 100000;
|
||
var val = '';
|
||
if (ui.value >= 200) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#stoim_do').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".slider1").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 22,
|
||
min: 1,
|
||
max: 300,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var f = $('.operation_type.selected').find('label').attr('for');
|
||
var maxVal = "300000";
|
||
var mnoj = 1000;
|
||
if (f && f == 'field_op1') {
|
||
maxVal = "30000000";
|
||
mnoj = 100000;
|
||
}
|
||
if (ui.value >= 300) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#stoim_ot').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".slider2").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 37,
|
||
min: 1,
|
||
max: 300,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var f = $('.operation_type.selected').find('label').attr('for');
|
||
var maxVal = "300000";
|
||
var mnoj = 1000;
|
||
if (f && f == 'field_op1') {
|
||
maxVal = "30000000";
|
||
mnoj = 100000;
|
||
}
|
||
var val = '';
|
||
if (ui.value >= 300) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#stoim_do').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
|
||
|
||
$(".slider3").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 37,
|
||
min: 1,
|
||
max: 300,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "300000";
|
||
var mnoj = 1000;
|
||
var val = '';
|
||
if (ui.value >= 300) {
|
||
val = maxVal;
|
||
} else val = ui.value * mnoj;
|
||
$('#stoim_ky').val(val);
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".slider5").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 37,
|
||
min: 1,
|
||
max: 300,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "300000";
|
||
var mnoj = 1000;
|
||
var val = '';
|
||
if (ui.value >= 300) {
|
||
val = maxVal;
|
||
} else val = ui.value * mnoj;
|
||
$('#other_ku_stoim').val(val);
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".slider4").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 37,
|
||
min: 1,
|
||
max: 300,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "300000";
|
||
var mnoj = 1000;
|
||
var val = '';
|
||
if (ui.value >= 300) {
|
||
val = maxVal;
|
||
} else val = ui.value * mnoj;
|
||
$('#lease').val(val);
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".priceFrom").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 1,
|
||
min: 1,
|
||
max: 300000000,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "300000000";
|
||
var mnoj = 1000;
|
||
if (ui.value >= 300) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#priceFrom').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".priceTo").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 1,
|
||
min: 1,
|
||
max: 300000000,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "300000000";
|
||
var mnoj = 1000;
|
||
if (ui.value >= 300) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#priceTo').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".sliderSquareFrom").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 1,
|
||
min: 1,
|
||
max: 1000,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "1000";
|
||
var mnoj = 1;
|
||
if (ui.value >= 1000) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#sq_all_ot').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".sliderSquareTo").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 1,
|
||
min: 1,
|
||
max: 1000,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "1000";
|
||
var mnoj = 1;
|
||
if (ui.value >= 1000) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#sq_all_do').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".sliderSquareLiveFrom").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 1,
|
||
min: 1,
|
||
max: 400,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "400";
|
||
var mnoj = 1;
|
||
if (ui.value >= 400) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#sq_live_ot').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".sliderSquareLiveTo").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 1,
|
||
min: 1,
|
||
max: 400,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "400";
|
||
var mnoj = 1;
|
||
if (ui.value >= 400) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#sq_live_do').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".sliderSquareKitchenFrom").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 1,
|
||
min: 1,
|
||
max: 200,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "200";
|
||
var mnoj = 1;
|
||
if (ui.value >= 200) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#sq_kitch_ot').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$(".sliderSquareKitchenTo").slider({
|
||
animate: true,
|
||
range: "min",
|
||
value: 1,
|
||
min: 1,
|
||
max: 100,
|
||
step: 1,
|
||
slide: function(event, ui) {
|
||
var maxVal = "100";
|
||
var mnoj = 1;
|
||
if (ui.value >= 100) val = maxVal;
|
||
else val = ui.value * mnoj;
|
||
$('#sq_kitch_do').val(val);
|
||
slider1 = ui.value;
|
||
},
|
||
change: function(event, ui) {}
|
||
});
|
||
|
||
$("#show_form").click(function() {
|
||
if ($("#show_form").is(':visible')) {
|
||
|
||
$(".main-form").slideToggle();
|
||
|
||
if ($('.main-form select[multiple]').length) {
|
||
$('.main-form select[multiple]').multiselect('reload');
|
||
}
|
||
|
||
$(".show_form").hide();
|
||
|
||
return false;
|
||
}
|
||
});
|
||
|
||
var initCommercialId = $('.commercial_object_input:checked').val();
|
||
if (initCommercialId == '8') {
|
||
$('.monthly_income').closest('.line').show();
|
||
} else {
|
||
$('.monthly_income').closest('.line').hide();
|
||
}
|
||
|
||
$('body').on('blur', 'input[name="cadastral_number"]', function(){
|
||
let cadastral_number = $(this).val();
|
||
let object_id = (!isEmpty($(this).attr("data-id"))) ? $(this).attr("data-id") : 0;
|
||
if(!isEmpty(cadastral_number)){
|
||
check_cadastral_number_unique(cadastral_number, object_id, '.cadastral-number');
|
||
|
||
}
|
||
});
|
||
|
||
$('body').on('blur', 'input[name="cadastral_number_land"]', function(){
|
||
let cadastral_number = $(this).val();
|
||
let object_id = (!isEmpty($(this).attr("data-id"))) ? $(this).attr("data-id") : 0;
|
||
if(!isEmpty(cadastral_number)){
|
||
check_cadastral_number_unique(cadastral_number, object_id, '.cadastral-number-land');
|
||
|
||
}
|
||
});
|
||
|
||
function check_cadastral_number_unique(cadastral_number, object_id, selector){
|
||
axios.post('/ajax/ajax_object_vue.php', {
|
||
request: 'check_cadastral_number_unique',
|
||
agency_id: $('#session_agency_id').val(),
|
||
cadastral_number: cadastral_number,
|
||
object_id: object_id
|
||
})
|
||
.then((response) => {
|
||
if(!isEmpty(response.data) && response.data.object_in_ads){
|
||
|
||
$(selector+' .cadastral-number-nounique').text("Такой кадастровый номер найден у объекта ID: " + response.data.object_ids.join(', ID: ')).show();
|
||
} else {
|
||
$('.cadastral-number-nounique').text("").hide();
|
||
}
|
||
})
|
||
.catch(function(error) {
|
||
console.log(error);
|
||
});
|
||
}
|
||
|
||
$('body').on('blur', '#address', function(){
|
||
$('.address-nounique').text("").hide();
|
||
let address = $(this).val();
|
||
let flat_number = $('#flat_number').val();
|
||
let object_id = (!isEmpty($(this).attr("data-id"))) ? $(this).attr("data-id") : 0;
|
||
if(!isEmpty(address) && !isEmpty(flat_number)){
|
||
|
||
check_address_unique(address, flat_number, object_id)
|
||
}
|
||
})
|
||
|
||
$('body').on('blur', '#flat_number', function(){
|
||
$('.address-nounique').text("").hide();
|
||
let flat_number = $(this).val();
|
||
let address = $('#address').val();
|
||
let object_id = (!isEmpty($(this).attr("data-id"))) ? $(this).attr("data-id") : 0;
|
||
if(!isEmpty(address) && !isEmpty(flat_number)){
|
||
|
||
check_address_unique(address, flat_number, object_id)
|
||
}
|
||
})
|
||
|
||
function check_address_unique(address, flat_number, object_id){
|
||
axios.post('/ajax/ajax_object_vue.php', {
|
||
request: 'check_address_unique',
|
||
agency_id: $('#session_agency_id').val(),
|
||
address: address,
|
||
flat_number: flat_number,
|
||
object_id: object_id
|
||
})
|
||
.then((response) => {
|
||
|
||
if(!isEmpty(response.data) && response.data.object_in_ads){
|
||
|
||
$('.address-nounique').text("Найдены объекты с таким же адресом ID: " + response.data.object_ids.join(', ID: ')).show();
|
||
} else {
|
||
$('.address-nounique').text("").hide();
|
||
}
|
||
})
|
||
.catch(function(error) {
|
||
console.log(error);
|
||
});
|
||
}
|
||
|
||
}) |