"use strict";
(function ($) {
"use strict";
/**
* Formulaire du depot d'annonce
* @param init : {}
*/
$.fn.commonSnippet = function (init) {
var form = $(this);
var prefixForm = form.attr('name');
form.find('a[data-toggle="pill"]').on('shown.bs.tab', function (e) {
var ariaControls = $(e.target).attr('aria-controls');
$('#steps-form-depot-tab a[aria-controls=' + ariaControls + ']').tab('show');
if ($(e.target).hasClass('nextBtn') || $(e.target).hasClass('prevBtn')) {
refreshActiveTab(e.target);
}
});
selectDiagnosticDpe();
function checkSelectDiagnosticDpe(valueSelect) {
if (valueSelect == '0') {
$('#' + prefixForm + '_Bien_diagnosticPartner').parent().hide();
$('#' + prefixForm + '_Bien_dpe').parent().parent().show();
$('#' + prefixForm + '_Bien_ges').parent().parent().show();
$('#' + prefixForm + '_Bien_diagnosticPartner').prop("checked", false);
$('#' + prefixForm + '_Bien_dpe').val('');
$('#' + prefixForm + '_Bien_ges').val('');
} else {
if (valueSelect == '5') {
$('#' + prefixForm + '_Bien_diagnosticPartner').parent().show();
$('#' + prefixForm + '_Bien_diagnosticPartner').prop("checked", true);
} else {
$('#' + prefixForm + '_Bien_diagnosticPartner').parent().hide();
$('#' + prefixForm + '_Bien_diagnosticPartner').prop("checked", false);
}
$('#' + prefixForm + '_Bien_dpe').parent().parent().hide();
$('#' + prefixForm + '_Bien_ges').parent().parent().hide();
$('#' + prefixForm + '_Bien_dpe').val(valueSelect);
$('#' + prefixForm + '_Bien_ges').val(valueSelect);
}
}
/**
* Refresh tab with class active for control with other btn
* @param $target selected current tab
*/
function refreshActiveTab($target) {
$($target).attr('aria-selected', 'false');
$($target).removeClass('active');
}
function selectDiagnosticDpe() {
checkSelectDiagnosticDpe($('#' + prefixForm + '_Bien_statusDiagnostic').val());
$(document).on('change', '#' + prefixForm + '_Bien_statusDiagnostic', function () {
checkSelectDiagnosticDpe($(this).val());
});
}
/* EVENT CLIC PREV NEXT FOR SCROLL TOP FORM */
$(".prevBtn, .nextBtn").click(function () {
$("body,html").animate({
scrollTop: $(".formDepotAnnonce").offset().top
}, 800 //speed
);
});
};
})(jQuery);
//# sourceMappingURL=common-compiled.js.map
"use strict";
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */
/*jshint undef:false */
/*eslint no-eval: "error"*/
(function ($) {
"use strict";
$.slug = function (val) {
return val.toLowerCase().replace(/^\s+|\s+$/g, "").replace(/[_|\s]+/g, "-").replace(/[^a-z\u0400-\u04FF0-9-]+/g, "").replace(/[-]+/g, "-").replace(/^-+|-+$/g, "");
};
})(jQuery);
//# sourceMappingURL=format-str-compiled.js.map
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */
/*jshint undef:false */
/*eslint no-eval: "error"*/
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
"object" != _typeof(window.CP) && (window.CP = {}), window.CP.PenTimer = {
programNoLongerBeingMonitored: !1,
timeOfFirstCallToShouldStopLoop: 0,
_loopExits: {},
_loopTimers: {},
START_MONITORING_AFTER: 2e3,
STOP_ALL_MONITORING_TIMEOUT: 5e3,
MAX_TIME_IN_LOOP_WO_EXIT: 2200,
exitedLoop: function exitedLoop(o) {
this._loopExits[o] = !0;
},
shouldStopLoop: function shouldStopLoop(o) {
if (this.programKilledSoStopMonitoring) return !0;
if (this.programNoLongerBeingMonitored) return !1;
if (this._loopExits[o]) return !1;
var t = this._getTime();
if (0 === this.timeOfFirstCallToShouldStopLoop) return this.timeOfFirstCallToShouldStopLoop = t, !1;
var i = t - this.timeOfFirstCallToShouldStopLoop;
if (i < this.START_MONITORING_AFTER) return !1;
if (i > this.STOP_ALL_MONITORING_TIMEOUT) return this.programNoLongerBeingMonitored = !0, !1;
try {
this._checkOnInfiniteLoop(o, t);
} catch (o) {
return this._sendErrorMessageToEditor(), this.programKilledSoStopMonitoring = !0, !0;
}
return !1;
},
_sendErrorMessageToEditor: function _sendErrorMessageToEditor() {
try {
if (this._shouldPostMessage()) {
var o = {
action: "infinite-loop",
line: this._findAroundLineNumber()
};
parent.postMessage(JSON.stringify(o), "*");
} else this._throwAnErrorToStopPen();
} catch (o) {
this._throwAnErrorToStopPen();
}
},
_shouldPostMessage: function _shouldPostMessage() {
return document.location.href.match(/boomerang/);
},
_throwAnErrorToStopPen: function _throwAnErrorToStopPen() {
throw "We found an infinite loop in your Pen. We've stopped the Pen from running. Please correct it or contact support@codepen.io.";
},
_findAroundLineNumber: function _findAroundLineNumber() {
var o = new Error(),
t = 0;
if (o.stack) {
var i = o.stack.match(/boomerang\S+:(\d+):\d+/);
i && (t = i[1]);
}
return t;
},
_checkOnInfiniteLoop: function _checkOnInfiniteLoop(o, t) {
if (!this._loopTimers[o]) return this._loopTimers[o] = t, !1;
var i = t - this._loopTimers[o];
if (i > this.MAX_TIME_IN_LOOP_WO_EXIT) throw "Infinite Loop found on loop: " + o;
},
_getTime: function _getTime() {
return +new Date();
}
}, window.CP.shouldStopExecution = function (o) {
var t = window.CP.PenTimer.shouldStopLoop(o);
return t === !0 && console.warn("[CodePen]: An infinite loop (or a loop taking too long) was detected, so we stopped its execution. Sorry!"), t;
}, window.CP.exitedLoop = function (o) {
window.CP.PenTimer.exitedLoop(o);
};
(function ($) {
"use strict";
function initImageUpload(box) {
var uploadField = box.querySelector('.image-upload');
uploadField.addEventListener('change', getFile);
function getFile(e) {
var file = e.currentTarget.files[0];
checkType(file);
}
function previewImage(file) {
var thumb = box.querySelector('.js--image-preview'),
reader = new FileReader();
reader.onload = function () {
thumb.style.backgroundImage = 'url(' + reader.result + ')';
};
reader.readAsDataURL(file);
thumb.className += ' js--no-default';
}
function checkType(file) {
var imageType = /image.*/;
if (!file.type.match(imageType)) {
throw 'Datei ist kein Bild';
} else if (!file) {
throw 'Kein Bild gewählt';
} else {
previewImage(file);
}
}
} /// drop-effect
function initDropEffect(box) {
var area, drop, areaWidth, areaHeight, maxDistance, dropWidth, dropHeight, x, y; // get clickable area for drop effect
area = box.querySelector('.js--image-preview');
area.addEventListener('click', fireRipple);
function fireRipple(e) {
area = e.currentTarget; // create drop
if (!drop) {
drop = document.createElement('span');
drop.className = 'drop';
this.appendChild(drop);
} // reset animate class
drop.className = 'drop'; // calculate dimensions of area (longest side)
areaWidth = getComputedStyle(this, null).getPropertyValue("width");
areaHeight = getComputedStyle(this, null).getPropertyValue("height");
maxDistance = Math.max(parseInt(areaWidth, 10), parseInt(areaHeight, 10)); // set drop dimensions to fill area
drop.style.width = maxDistance + 'px';
drop.style.height = maxDistance + 'px'; // calculate dimensions of drop
dropWidth = getComputedStyle(this, null).getPropertyValue("width");
dropHeight = getComputedStyle(this, null).getPropertyValue("height"); // calculate relative coordinates of click
// logic: click coordinates relative to page - parent's position relative to page - half of self height/width to make it controllable from the center
x = e.pageX - this.offsetLeft - parseInt(dropWidth, 10) / 2;
y = e.pageY - this.offsetTop - parseInt(dropHeight, 10) / 2 - 30; // position drop and animate
drop.style.top = y + 'px';
drop.style.left = x + 'px';
drop.className += ' animate';
e.stopPropagation();
}
} // initialize box-scope
var boxes = document.querySelectorAll('.boxPhoto');
for (var i = 0; i < boxes.length; i++) {
if (window.CP.shouldStopExecution(1)) {
break;
}
var box = boxes[i];
initDropEffect(box);
initImageUpload(box);
}
window.CP.exitedLoop(1);
})(jQuery);
//# sourceMappingURL=photos-compiled.js.map
"use strict";
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */
/*jshint undef:false */
/*eslint no-eval: "error"*/
(function ($) {
"use strict";
/**
* Formulaire du depot d'annonce
* @param init : {}
*/
$.fn.formDepotMandat = function (init) {
var form = $(this);
var prefixForm = form.attr('name');
var DIFFUSION_OFF = 0;
var DIFFUSION_MAX = 1;
var DIFFUSION_OFF_OR_MAX = '0|1';
var ESTIMATION_ONLINE = 2;
var ESTIMATION_VISIO = 3;
var ESTIMATION_AGENT = 4;
var choiceAction = $("#snippetbundle_depotmandatannonce_choiceAction").val();
var togglePill = $(this).find('a[data-toggle="pill"][id^="step"]');
initForm();
processOnClickUserChoice(togglePill);
checkOnSubmitDepositForm();
changeCheckboxChoiceDiffusion();
processOnClickUserChoiceAgent();
changeTypeExt();
clickNoPillsAgent();
if (isEstimation()) {
calculPlusMoinsValue();
changeTypeBienInEstimation();
changeCityInEstimation();
checkPlusMoinsValueLabel();
hideDpeGes();
}
$('#loader').addClass('hidden');
function initForm() {
setTitleForm();
setRequireEstimationField();
initPricePills();
if (choiceAction == DIFFUSION_OFF_OR_MAX) {
$('a.choiceStep1[data-diffusion=2]').parents('.cardConfiguration').parent().hide();
$("#snippetbundle_depotmandatannonce_choiceAction").val(DIFFUSION_MAX);
} else {
if (isEstimation()) {
$("#snippetbundle_depotmandatannonce_choiceAction").val(ESTIMATION_ONLINE);
$('#switchOnlyForDiffusion').hide();
$('#descriptif').hide();
}
}
checkValueTypeExt();
}
function setTitleForm() {
if (isEstimation()) {
$('.titleForm').html("J'estime mon bien rapidement
");
} else if ($.inArray(choiceAction, [DIFFUSION_OFF, DIFFUSION_MAX, DIFFUSION_OFF_OR_MAX])) {
$('.titleForm').html("Je diffuse mon bien et bénéficie du meilleur de la diffusion
");
} else {
$('.titleForm').html("J'estime ou diffuse mon bien et bénéficie du meilleur de la diffusion
");
}
}
function setRequireEstimationField() {
if (isEstimation()) {
$('#snippetbundle_depotmandatannonce_Bien_Ville').prop('required', true);
$('#snippetbundle_depotmandatannonce_Bien_surface').prop('required', true);
$('#snippetbundle_depotmandatannonce_Bien_typeExt').prop('required', true);
$('#snippetbundle_depotmandatannonce_Bien_annee').prop('required', true);
$('#snippetbundle_depotmandatannonce_Bien_typeVue').prop('false', true);
$('#snippetbundle_depotmandatannonce_Bien_typeQuartier').prop('false', true);
} else {
$('#snippetbundle_depotmandatannonce_Bien_Ville').prop('required', false);
$('#snippetbundle_depotmandatannonce_Bien_surface').prop('false', false);
$('#snippetbundle_depotmandatannonce_Bien_typeExt').prop('false', false);
$('#snippetbundle_depotmandatannonce_Bien_annee').prop('false', false);
$('#snippetbundle_depotmandatannonce_Bien_typeVue').prop('false', false);
$('#snippetbundle_depotmandatannonce_Bien_typeQuartier').prop('false', false);
}
}
function processOnClickUserChoice(togglePill) {
$(document).on('click', '.choiceStep1', function (e) {
var valChoiceEstimationOrDiffusion = $(this).data('diffusion');
$("#snippetbundle_depotmandatannonce_choiceAction").val(valChoiceEstimationOrDiffusion);
choiceAction = valChoiceEstimationOrDiffusion;
initPricePills();
setTitleForm();
changeActiveTypeFormWhenUserClick(valChoiceEstimationOrDiffusion);
setRequireEstimationField();
if (isEstimation()) {
$('#switchOnlyForDiffusion').hide();
} else {
$('#switchOnlyForDiffusion').show();
}
});
}
function checkOnSubmitDepositForm() {
$(document).on('click', '#submit-depot-mandat', function (event) {
var firstRequireFieldElt = $('input[required], select[required]', form).filter(function () {
return !this.value;
}).first();
if (isEstimation()) {
if (firstRequireFieldElt) {
var idParentNav = firstRequireFieldElt.parents("[role=tabpanel][id^=step]").attr('id');
$('#' + idParentNav + '-tab').tab('show');
}
if (!$('#snippetbundle_depotmandatannonce_Bien_Ville').val()) {
$('#snippetbundle_depotmandatannonce_Bien_Ville').parent().addClass('missingSelect2');
}
var forms = document.getElementsByClassName('needs-validation'); // Loop over them and prevent submission
var validation = Array.prototype.filter.call(forms, function (form2) {
if (form2.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
}
form2.classList.add('was-validated');
});
} else {
setPricePillsToEmptyIfPriceNotExist();
}
if (!firstRequireFieldElt.length && $('#' + prefixForm + '_Client_acceptCondition:checkbox:checked').length > 0) {
$('#loader').show();
}
});
}
function processOnClickUserChoiceAgent() {
$(document).on('click', '#agentLink', function (e) {
var agentLink = $(e.currentTarget).nextAll()[1];
$.ajax({
type: "POST",
url: Routing.generate('app_ajax_searchagent_entity'),
data: {
agentId: $(agentLink).val()
},
success: function success(response) {
var agentItem = JSON.parse(response);
var agent = agentItem.items[0];
var option = new Option(agent.select2Format, agent.id, true, true);
$('#snippetbundle_depotmandatannonce_Agent').append(option).trigger('change');
$('#pills-agentconnu-tab').tab('show');
$('html,body').animate({
scrollTop: $("#anchorAgentSellWithMe").offset().top
}, 'slow');
}
});
});
}
function initPricePills() {
if (isEstimation()) {
$('#divPrixconnu').hide();
$('#divPrixinconnu').show();
$('#snippetbundle_depotmandatannonce_Bien_prix').val("");
} else {
$('#divPrixconnu').show();
$('#divPrixinconnu').hide();
}
}
function setPricePillsToEmptyIfPriceNotExist() {
if ($('#pills-prixinconnu').hasClass('active')) {
$('#snippetbundle_depotmandatannonce_Bien_prix').val("");
}
if ($('#pills-prixconnu').hasClass('active') && !$('#snippetbundle_depotmandatannonce_Bien_prix').val()) {
$('#snippetbundle_depotmandatannonce_Bien_prixEstimation_1').prop('checked', true);
}
}
function changeActiveTypeFormWhenUserClick(typeForm) {
if (isDiffusion()) {
if (typeForm == DIFFUSION_MAX) {
$('#checkDiffusion').prop('checked', true);
$('#linkToModalChoiceDiffusion').attr('data-target', '#modalDescriptifDiffusionMax');
}
if (typeForm == DIFFUSION_OFF) {
$('#checkDiffusion').prop('checked', false);
$('#linkToModalChoiceDiffusion').attr('data-target', '#modalDescriptifDiffusionOff');
}
addClassActiveCardConfiguration(typeForm);
} else {
if (isEstimation()) {
addClassActiveCardConfigurationEstimation(typeForm);
}
}
}
function changeCheckboxChoiceDiffusion() {
$('#checkDiffusion').change(function () {
if (this.checked) {
$('#linkToModalChoiceDiffusion').attr('data-target', '#modalDescriptifDiffusionMax');
addClassActiveCardConfiguration(DIFFUSION_MAX);
$("#snippetbundle_depotmandatannonce_choiceAction").val(DIFFUSION_MAX);
} else {
$('#linkToModalChoiceDiffusion').attr('data-target', '#modalDescriptifDiffusionOff');
addClassActiveCardConfiguration(DIFFUSION_OFF);
$("#snippetbundle_depotmandatannonce_choiceAction").val(DIFFUSION_OFF);
}
});
}
function addClassActiveCardConfiguration(typeDiffusion) {
var goodChoiceStep = $('.choiceStep1[data-diffusion="' + typeDiffusion + '"]');
var cardConfiguration = goodChoiceStep.children('div.cardConfiguration.isJumbotron');
var eltCardConfiguration = $('.choiceStep1').children('div.cardConfiguration.isJumbotron.active');
if (eltCardConfiguration) {
eltCardConfiguration.removeClass('active');
}
cardConfiguration.addClass('active');
}
function addClassActiveCardConfigurationEstimation(typeEstimation) {
var activeCurrentCardConfiguration = $('div.choiceStep1.cardConfiguration.isJumbotron.active');
var cardConfiguration = $('div.choiceStep1.cardConfiguration.isJumbotron[data-diffusion="' + typeEstimation + '"]');
if (activeCurrentCardConfiguration) {
activeCurrentCardConfiguration.removeClass('active');
}
cardConfiguration.addClass('active');
}
function calculPlusMoinsValue() {
$('.custom-slider').on('change', function (e) {
var sumPlusMoinsValue = 0;
$.each($('.custom-slider'), function (index, elt) {
sumPlusMoinsValue += parseInt($(elt).val());
});
$('#valuePlusMoins').html(sumPlusMoinsValue + '€');
});
}
function checkPlusMoinsValueLabel() {
var textTypeBienPlusMoinsValue = $('#snippetbundle_depotmandatannonce_Bien_typeBien option:selected').text();
if (textTypeBienPlusMoinsValue) {
$('#typeBienPlusMoinsValue').text(textTypeBienPlusMoinsValue);
}
var textCityPlusMoinsValue = $('#snippetbundle_depotmandatannonce_Bien_Ville').text();
if (textCityPlusMoinsValue) {
$('#cityPlusMoinsValue').text('À ' + textCityPlusMoinsValue);
}
}
function changeTypeBienInEstimation() {
$('#snippetbundle_depotmandatannonce_Bien_typeBien').on('change', function () {
var textTypeBienPlusMoinsValue = $('#snippetbundle_depotmandatannonce_Bien_typeBien option:selected').text();
$('#typeBienPlusMoinsValue').text(textTypeBienPlusMoinsValue);
});
}
function changeCityInEstimation() {
$('#snippetbundle_depotmandatannonce_Bien_Ville').on('change', function (e) {
var textCityPlusMoinsValue = $(e.currentTarget).select2('data')[0].select2Format;
$('#cityPlusMoinsValue').text('À ' + textCityPlusMoinsValue);
});
}
function checkValueTypeExt() {
if ($('#snippetbundle_depotmandatannonce_Bien_typeExt').val()) {
$('#surfaceExt').show();
} else {
$('#snippetbundle_depotmandatannonce_Bien_surfaceExt').val('');
$('#surfaceExt').hide();
}
}
function changeTypeExt() {
$('#snippetbundle_depotmandatannonce_Bien_typeExt').on('change', function (e) {
checkValueTypeExt();
});
}
function clickNoPillsAgent() {
$('#pills-agentinconnu-tab').on('click', function () {
$("#snippetbundle_depotmandatannonce_Agent").val(null).trigger("change");
});
}
function isEstimation() {
var choiceAction = parseInt($("#snippetbundle_depotmandatannonce_choiceAction").val());
return $.inArray(choiceAction, [ESTIMATION_ONLINE, ESTIMATION_VISIO, ESTIMATION_AGENT]) >= 0;
}
function isDiffusion() {
var choiceAction = parseInt($("#snippetbundle_depotmandatannonce_choiceAction").val());
return $.inArray(choiceAction, [DIFFUSION_MAX, DIFFUSION_OFF]) >= 0;
}
function hideDpeGes() {
$('#snippetbundle_depotmandatannonce_Bien_statusDiagnostic').parent().hide();
$('#snippetbundle_depotmandatannonce_Bien_dpe').parent().parent().hide();
$('#snippetbundle_depotmandatannonce_Bien_ges').parent().parent().hide();
}
};
})(jQuery);
//# sourceMappingURL=depot-mandat-compiled.js.map
$('.formDepotAnnonce').commonSnippet();
$('.formDepotAnnonce').formDepotMandat();