"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 "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"; /** * Genrere un select 2 en remote asynchrone pour la récupération des villes * @param init : { * callbackSelect : "Callback call au moment de la sélection si défini" * } */ $.fn.selectVille = function (init) { $('#city_select2_city').on('change', function (e) { if (init.callbackSelect) { init.callbackSelect(); } }); }; })(jQuery); //# sourceMappingURL=search-ville-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"; /** * Génere un selct2 en remote async pour la récupération des aggences * @param init : { * callbackSelect : "Callback call au moment de la sélection si défini" * } */ $.fn.selectAgence = function (init) { $(this).select2({ ajax: { url: Routing.generate('api_agence_index'), data: function data(params) { var queryParameters = { query_string: params.term, nb_result: 20, isOnlyPremium: init.isOnlyPremium }; return queryParameters; }, delay: 150, processResults: function processResults(data) { var res = $.map(data.agences, function (obj) { return { id: obj.agence_id, text: obj.agence_enseigne + ' ' + obj.ville_nom + ' (' + obj.ville_cp + ')', url: Routing.generate('mandatdiffusion_agence_agence', { 'id': obj.agence_id, 'agencyCity': $.slug(obj.agence_enseigne) + '-' + $.slug(obj.ville_nom) }) }; }); return { results: res }; }, cache: true } }).on("select2:select", function (e) { if (init.callbackSelect) { init.callbackSelect(e.params.data); } }); }; })(jQuery); //# sourceMappingURL=search-agence-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 ($, Routing) { "use strict"; var page = 1; var nb_agence_by_listing = 9; /** * Recharge du listing en fonction du form * @param data : { * text : corresppond au text du select (ville sélectionnée) * } */ function refreshListing(data) { if (page === 1) { $('#content-listing-agence').empty(); $('#loader-listing').show(); } $.ajax({ type: "POST", url: Routing.generate('api_agence_index'), data: { route_link: 'mandatdiffusion_agence_agence', html: true, page: 1, isOnlyPremium: true, villeId: $('#city_select2_city').val() }, success: function success(response) { if (response.html) { if (page === 1) { $('#pictureDefault').hide(); $('#content-listing-agence').html(response.html); $('#titre-listing-agence').empty(); $('#textNbAgencySearch').show(); } else { $('#content-listing-agence').append(response.html); } } if (response.total) { if (page * nb_agence_by_listing < response.total) { $('#show-plus-listing-agence').show(); } else { $('#show-plus-listing-agence').hide(); } } else { $('#show-plus-listing-agence').hide(); } }, done: function done(response) { $('#loader-listing').hide(); $("#show-plus-listing-agence").button('reset'); } }); } $(document).ready(function () { $('#villeAgence').selectVille({ callbackSelect: function callbackSelect() { refreshListing(); } }); }); $('#show-plus-listing-agence').on('click', function (e) { $(this).button('loading'); page = page + 1; refreshListing(); }); })(jQuery, Routing); //# sourceMappingURL=listing-agence-compiled.js.map