|
@@ -24,6 +24,46 @@ function sphericDistance(lat1, lon1, lat2, lon2)
|
|
|
return R * c;
|
|
return R * c;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const practicesFr = {
|
|
|
|
|
+ "BIG_BAND": "Big band",
|
|
|
|
|
+ "BRASS_BAND": "Brass band",
|
|
|
|
|
+ "ORCHESTRA_CLASS": "Classe d'orchestre",
|
|
|
|
|
+ "ACCORDION_ORCHESTRA": "Orchestre d'accordéons",
|
|
|
|
|
+ "HARMONY_ORCHESTRA": "Orchestre d'harmonie",
|
|
|
|
|
+ "PHILHARMONIC_ORCHESTRA": "Orchestre philharmonique",
|
|
|
|
|
+ "SYMPHONY_ORCHESTRA": "Orchestre symphonique",
|
|
|
|
|
+ "STRING_ORCHESTRA": "Orchestre à cordes",
|
|
|
|
|
+ "PLUCKED_ORCHESTRA": "Orchestre à plectres",
|
|
|
|
|
+ "FANFARE_BAND": "Orchestre de fanfare",
|
|
|
|
|
+ "BAGAD": "Bagad",
|
|
|
|
|
+ "BANDAS": "Bandas ou Fanfare de rue",
|
|
|
|
|
+ "BATTERY_FANFARE": "Batterie fanfare",
|
|
|
|
|
+ "BATTUCADA": "Battucada",
|
|
|
|
|
+ "FOLKLORIC_BAND": "Ensemble folklorique",
|
|
|
|
|
+ "FIFE_AND_DRUM": "Fifres et tambours",
|
|
|
|
|
+ "MARCHING_BAND": "Marching band ou Show parade",
|
|
|
|
|
+ "HUNTING_HORNS": "Trompes de chasse",
|
|
|
|
|
+ "CHILDRENS_CHOIR": "Choeur d'enfants",
|
|
|
|
|
+ "FEMAL_CHOIR": "Choeur de femmes",
|
|
|
|
|
+ "MENS_CHOIR": "Choeur d'hommes",
|
|
|
|
|
+ "MIXED_CHORUS": "Choeur mixte",
|
|
|
|
|
+ "VOCAL_BAND_UP_16": "Ensemble vocal (jusqu'à 16)",
|
|
|
|
|
+ "CLARINET_CHOIR": "Ensemble de clarinettes",
|
|
|
|
|
+ "COPPER_BAND": "Ensemble de cuivres",
|
|
|
|
|
+ "FLUTE_ENSEMBLE": "Ensemble de flûtes",
|
|
|
|
|
+ "SAXOPHONES_BAND": "Ensemble de saxophones",
|
|
|
|
|
+ "VIOLIN_BAND": "Ensemble de violons",
|
|
|
|
|
+ "PERCUSSION_BAND": "Ensemble de percussions",
|
|
|
|
|
+ "CURRENT_MUSIC_GROUP": "Groupe de Musique actuelle",
|
|
|
|
|
+ "CHAMBER_MUSIC_ENSEMBLE": "Ensemble de Musique de chambre",
|
|
|
|
|
+ "TRADITIONAL_MUSIC_ENSEMBLE": "Ensemble de Musique traditionnelle",
|
|
|
|
|
+ "JAZZ_BAND": "Ensemble de Jazz",
|
|
|
|
|
+ "EDUCATION": "Enseignement",
|
|
|
|
|
+ "CHEERLEADER": "Majorettes",
|
|
|
|
|
+ "TROOP": "Troupe",
|
|
|
|
|
+ "OTHER": "Autre"
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// Specific JS used for the Structures layout
|
|
// Specific JS used for the Structures layout
|
|
|
// > Needs to be loaded after the main.js script
|
|
// > Needs to be loaded after the main.js script
|
|
|
$(document).ready(function() {
|
|
$(document).ready(function() {
|
|
@@ -55,7 +95,7 @@ $(document).ready(function() {
|
|
|
let cityInput = form.find("input[name='search-city']").first();
|
|
let cityInput = form.find("input[name='search-city']").first();
|
|
|
let latInput = form.find("input[name='lat']").first();
|
|
let latInput = form.find("input[name='lat']").first();
|
|
|
let longInput = form.find("input[name='long']").first();
|
|
let longInput = form.find("input[name='long']").first();
|
|
|
- let categorySelect = form.find("select[name='search-category']").first();
|
|
|
|
|
|
|
+ let practiceSelect = form.find("select[name='search-practice']").first();
|
|
|
let provinceSelect = form.find("select[name='search-province']").first();
|
|
let provinceSelect = form.find("select[name='search-province']").first();
|
|
|
let federationSelect = form.find("select[name='search-federation']").first();
|
|
let federationSelect = form.find("select[name='search-federation']").first();
|
|
|
let radiusSelect = form.find("select[name='search-radius']").first();
|
|
let radiusSelect = form.find("select[name='search-radius']").first();
|
|
@@ -69,24 +109,6 @@ $(document).ready(function() {
|
|
|
throw 'Missing organization-id parameter';
|
|
throw 'Missing organization-id parameter';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Translations
|
|
|
|
|
- let tr = {};
|
|
|
|
|
- $('#labels').find('span').each(function (i, elt) {
|
|
|
|
|
- tr[$(elt).attr('id')] = $(elt).text();
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- let structures_categories = {
|
|
|
|
|
- '1MC': tr['1MC'],
|
|
|
|
|
- '2TH': tr['2TH'],
|
|
|
|
|
- '3DA': tr['3DA'],
|
|
|
|
|
- '5FA': tr['5FA'],
|
|
|
|
|
- 'OTAR':tr['OTAR'],
|
|
|
|
|
- 'OTCI':tr['OTCI'],
|
|
|
|
|
- '6AR': tr['6AR'],
|
|
|
|
|
- '8CI': tr['8CI'],
|
|
|
|
|
- 'OTAU':tr['OTAU'],
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
// #### Instanciate and populate leaflet maps
|
|
// #### Instanciate and populate leaflet maps
|
|
|
let mapDiv = $('#structure-map').first();
|
|
let mapDiv = $('#structure-map').first();
|
|
|
let mapId = $(mapDiv).attr("id");
|
|
let mapId = $(mapDiv).attr("id");
|
|
@@ -141,7 +163,7 @@ $(document).ready(function() {
|
|
|
query['what'] = whatInput.val();
|
|
query['what'] = whatInput.val();
|
|
|
query['lat'] = latInput.val();
|
|
query['lat'] = latInput.val();
|
|
|
query['long'] = longInput.val();
|
|
query['long'] = longInput.val();
|
|
|
- query['category'] = categorySelect.val();
|
|
|
|
|
|
|
+ query['practice'] = practiceSelect.val();
|
|
|
query['province'] = provinceSelect.val();
|
|
query['province'] = provinceSelect.val();
|
|
|
query['federation'] = federationSelect.val();
|
|
query['federation'] = federationSelect.val();
|
|
|
query['radius'] = radiusSelect.val();
|
|
query['radius'] = radiusSelect.val();
|
|
@@ -180,8 +202,8 @@ $(document).ready(function() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // filter by category
|
|
|
|
|
- if (query['category'] && !structure.categories.includes(query['category'])) {
|
|
|
|
|
|
|
+ // filter by practice
|
|
|
|
|
+ if (query['practice'] && !structure.practices.includes(query['practice'])) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -212,6 +234,20 @@ $(document).ready(function() {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ function populatePracticeSelect() {
|
|
|
|
|
+ practiceSelect.children('option:not(:first)').remove();
|
|
|
|
|
+ let has_options = false;
|
|
|
|
|
+
|
|
|
|
|
+ for (const key in practicesFr) {
|
|
|
|
|
+ let option = '<option value="' + key + '">' + practicesFr[key] + '</option>';
|
|
|
|
|
+ practiceSelect.append(option);
|
|
|
|
|
+ has_options = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (has_options) {
|
|
|
|
|
+ practiceSelect.prop("disabled", false);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function populateFederationsSelect() {
|
|
function populateFederationsSelect() {
|
|
|
federationSelect.children('option:not(:first)').remove();
|
|
federationSelect.children('option:not(:first)').remove();
|
|
|
let has_options = false;
|
|
let has_options = false;
|
|
@@ -279,23 +315,30 @@ $(document).ready(function() {
|
|
|
results.forEach(function(structure) {
|
|
results.forEach(function(structure) {
|
|
|
if (((currentPage - 1) * itemsPerPage) <= index && index < (currentPage * itemsPerPage)) {
|
|
if (((currentPage - 1) * itemsPerPage) <= index && index < (currentPage * itemsPerPage)) {
|
|
|
let cardDiv = $(cardDivModel).clone();
|
|
let cardDiv = $(cardDivModel).clone();
|
|
|
- let categoryTagModel = cardDiv.find('.structure-category-model').first();
|
|
|
|
|
|
|
+ let practiceTagModel = cardDiv.find('.structure-practice-model').first();
|
|
|
|
|
|
|
|
cardDiv.data('id', structure.id);
|
|
cardDiv.data('id', structure.id);
|
|
|
|
|
|
|
|
- if (structure.categories !== null) {
|
|
|
|
|
- structure.categories.forEach(function (cat) {
|
|
|
|
|
- let tag = categoryTagModel.clone();
|
|
|
|
|
- tag.text(structures_categories[cat]);
|
|
|
|
|
- tag.removeClass('structure-category-model')
|
|
|
|
|
- tag.addClass('structure-category')
|
|
|
|
|
|
|
+ if (structure.practices !== null) {
|
|
|
|
|
+ structure.practices.forEach(function (practice) {
|
|
|
|
|
+ let tag = practiceTagModel.clone();
|
|
|
|
|
+ tag.text(practicesFr[practice]);
|
|
|
|
|
+ tag.removeClass('structure-practice-model')
|
|
|
|
|
+ tag.addClass('structure-practice')
|
|
|
tag.show();
|
|
tag.show();
|
|
|
- categoryTagModel.parent().append(tag);
|
|
|
|
|
|
|
+ practiceTagModel.parent().append(tag);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- cardDiv.find('.structure-poster').first().children('img').first().attr('src', structure.logoUri);
|
|
|
|
|
- cardDiv.find('.structure-name').first().text(structure.name);
|
|
|
|
|
|
|
+ if (structure.logoId) {
|
|
|
|
|
+ let poster = cardDiv.find('.structure-poster').first().children('img').first();
|
|
|
|
|
+ poster.attr('src', 'https://api.opentalent.fr/app.php/_internal/secure/files/' + structure.logoId + '/0x60');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let cardTitle = cardDiv.find('.structure-name a').first();
|
|
|
|
|
+ cardTitle.text(structure.name);
|
|
|
|
|
+ cardTitle.attr('href', structure.website);
|
|
|
|
|
+
|
|
|
cardDiv.find('.structure-details-address').first().text(
|
|
cardDiv.find('.structure-details-address').first().text(
|
|
|
[structure.streetAddress, structure.postalCode, structure.addressCity].join(" ")
|
|
[structure.streetAddress, structure.postalCode, structure.addressCity].join(" ")
|
|
|
);
|
|
);
|
|
@@ -376,6 +419,8 @@ $(document).ready(function() {
|
|
|
// #### Load structures data and refresh
|
|
// #### Load structures data and refresh
|
|
|
var structures;
|
|
var structures;
|
|
|
|
|
|
|
|
|
|
+ populatePracticeSelect();
|
|
|
|
|
+
|
|
|
function loadStructures() {
|
|
function loadStructures() {
|
|
|
structures = []
|
|
structures = []
|
|
|
|
|
|
|
@@ -395,7 +440,7 @@ $(document).ready(function() {
|
|
|
structure.n3Id = parseInt(structure.n3Id);
|
|
structure.n3Id = parseInt(structure.n3Id);
|
|
|
structure.n4Id = parseInt(structure.n4Id);
|
|
structure.n4Id = parseInt(structure.n4Id);
|
|
|
structure.n5Id = parseInt(structure.n5Id);
|
|
structure.n5Id = parseInt(structure.n5Id);
|
|
|
- structure.categories = structure.categories !== null ? structure.categories.split(",") : [];
|
|
|
|
|
|
|
+ structure.practices = structure.practices !== null ? structure.practices.split(",") : [];
|
|
|
structures.push(structure);
|
|
structures.push(structure);
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -475,6 +520,8 @@ $(document).ready(function() {
|
|
|
submitButton.appendTo(buttonsRow);
|
|
submitButton.appendTo(buttonsRow);
|
|
|
resetButton.prependTo(buttonsRow);
|
|
resetButton.prependTo(buttonsRow);
|
|
|
buttonsRow.show();
|
|
buttonsRow.show();
|
|
|
|
|
+
|
|
|
|
|
+ resizeMaps();
|
|
|
})
|
|
})
|
|
|
$('.activate-list-view').on('click', function (e) {
|
|
$('.activate-list-view').on('click', function (e) {
|
|
|
e.preventDefault();
|
|
e.preventDefault();
|
|
@@ -506,8 +553,6 @@ $(document).ready(function() {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// ### Location filter
|
|
// ### Location filter
|
|
|
- let addressApiUrl = "https://api-adresse.data.gouv.fr/search/?type=municipality&autocomplete=1&limit=5&q=";
|
|
|
|
|
-
|
|
|
|
|
let resultDropdownDiv = form.find('.city-search-dropdown').first();
|
|
let resultDropdownDiv = form.find('.city-search-dropdown').first();
|
|
|
let inputName = resultDropdownDiv.siblings("input[name='search-city']").first();
|
|
let inputName = resultDropdownDiv.siblings("input[name='search-city']").first();
|
|
|
let inputLat = resultDropdownDiv.siblings("input[name='lat']").first();
|
|
let inputLat = resultDropdownDiv.siblings("input[name='lat']").first();
|
|
@@ -523,6 +568,9 @@ $(document).ready(function() {
|
|
|
inputLat.val(lat);
|
|
inputLat.val(lat);
|
|
|
inputName.css("cursor", "pointer");
|
|
inputName.css("cursor", "pointer");
|
|
|
resultDropdownDiv.hide();
|
|
resultDropdownDiv.hide();
|
|
|
|
|
+ if (radiusSelect.val() === '') {
|
|
|
|
|
+ radiusSelect.val('10')
|
|
|
|
|
+ }
|
|
|
form.submit();
|
|
form.submit();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -564,7 +612,11 @@ $(document).ready(function() {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ // gouv.fr REST geocoding api
|
|
|
|
|
+ const addressApiUrl = "https://api-adresse.data.gouv.fr/search/?type=municipality&autocomplete=1&limit=5&q=";
|
|
|
|
|
+
|
|
|
function populateCitySearchResults() {
|
|
function populateCitySearchResults() {
|
|
|
|
|
+
|
|
|
let query = inputName.val();
|
|
let query = inputName.val();
|
|
|
let url = addressApiUrl + encodeURI(query);
|
|
let url = addressApiUrl + encodeURI(query);
|
|
|
|
|
|
|
@@ -587,6 +639,7 @@ $(document).ready(function() {
|
|
|
contentType: "application/json; charset=utf-8"
|
|
contentType: "application/json; charset=utf-8"
|
|
|
})
|
|
})
|
|
|
.done(function(res) {
|
|
.done(function(res) {
|
|
|
|
|
+ console.log(res);
|
|
|
let features = res.features;
|
|
let features = res.features;
|
|
|
if (!features.length > 0) {
|
|
if (!features.length > 0) {
|
|
|
noResultDiv.show();
|
|
noResultDiv.show();
|
|
@@ -635,7 +688,6 @@ $(document).ready(function() {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
// Structure details
|
|
// Structure details
|
|
|
-
|
|
|
|
|
function formatFrenchPhoneNumber(number) {
|
|
function formatFrenchPhoneNumber(number) {
|
|
|
const regexPhoneNumber = /\+33([1-9])(\d{2})(\d{2})(\d{2})(\d{2})$/;
|
|
const regexPhoneNumber = /\+33([1-9])(\d{2})(\d{2})(\d{2})(\d{2})$/;
|
|
|
|
|
|
|
@@ -647,22 +699,90 @@ $(document).ready(function() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function populateDetailsView(structure) {
|
|
function populateDetailsView(structure) {
|
|
|
- console.log(structure);
|
|
|
|
|
- let logo = structureFrameDetails.find('.structure-header .logo').first();
|
|
|
|
|
- logo.attr('src', structure.logoUri);
|
|
|
|
|
|
|
|
|
|
- let title = structureFrameDetails.find('.structure-header .name').first();
|
|
|
|
|
- title.text(structure.name)
|
|
|
|
|
|
|
+ const structureHeader = structureFrameDetails.find('.structure-header').first();
|
|
|
|
|
+
|
|
|
|
|
+ let logo = structureHeader.find('img.logo').first();
|
|
|
|
|
+ let defaultLogo = structureHeader.find('img.default-logo').first();
|
|
|
|
|
+ if (structure.logoId) {
|
|
|
|
|
+ logo.attr('src', 'https://api.opentalent.fr/app.php/_internal/secure/files/' + structure.logoId + '/0x60');
|
|
|
|
|
+ logo.show();
|
|
|
|
|
+ defaultLogo.hide();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ defaultLogo.show();
|
|
|
|
|
+ logo.hide();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let title = structureHeader.find('.structure-name').first();
|
|
|
|
|
+ title.text(structure.name);
|
|
|
|
|
+
|
|
|
|
|
+ let fbLink = structureHeader.find('a.facebook').first();
|
|
|
|
|
+ if (structure.facebook) {
|
|
|
|
|
+ fbLink.attr('href', structure.facebook);
|
|
|
|
|
+ fbLink.show();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ fbLink.attr('href', '');
|
|
|
|
|
+ fbLink.hide();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let twitterLink = structureHeader.find('a.twitter').first();
|
|
|
|
|
+ if (structure.twitter) {
|
|
|
|
|
+ twitterLink.attr('href', structure.twitter);
|
|
|
|
|
+ twitterLink.show();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ twitterLink.attr('href', '');
|
|
|
|
|
+ twitterLink.hide();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let instagramLink = structureHeader.find('a.instagram').first();
|
|
|
|
|
+ if (structure.instagram) {
|
|
|
|
|
+ instagramLink.attr('href', structure.instagram);
|
|
|
|
|
+ instagramLink.show();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ instagramLink.attr('href', '');
|
|
|
|
|
+ instagramLink.hide();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
let contact = structureFrameDetails.find('.contact').first();
|
|
let contact = structureFrameDetails.find('.contact').first();
|
|
|
contact.find('.address').first().text(
|
|
contact.find('.address').first().text(
|
|
|
[structure.streetAddress, structure.postalCode, structure.addressCity].join(" ")
|
|
[structure.streetAddress, structure.postalCode, structure.addressCity].join(" ")
|
|
|
);
|
|
);
|
|
|
- contact.find('.phone').first().text(formatFrenchPhoneNumber(structure.telphone));
|
|
|
|
|
- contact.find('.mail').first().text(structure.email);
|
|
|
|
|
- contact.find('.website').first().text(structure.website);
|
|
|
|
|
- contact.find('.province').first().text('...');
|
|
|
|
|
- contact.find('.network').first().text(structure.n1Name);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let phoneLink = contact.find('.phone a').first();
|
|
|
|
|
+ if (structure.telphone) {
|
|
|
|
|
+ phoneLink.text(formatFrenchPhoneNumber(structure.telphone));
|
|
|
|
|
+ phoneLink.attr('href', 'tel:' + structure.telphone);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ phoneLink.text('');
|
|
|
|
|
+ phoneLink.attr('href', '');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let mailLink = contact.find('.mail a').first();
|
|
|
|
|
+ if (structure.email) {
|
|
|
|
|
+ mailLink.text(structure.email);
|
|
|
|
|
+ mailLink.attr('href', 'mailto:' + structure.email);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ mailLink.text('');
|
|
|
|
|
+ mailLink.attr('href', '');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ let websiteLink = contact.find('.website a').first();
|
|
|
|
|
+ if (structure.website) {
|
|
|
|
|
+ websiteLink.text(structure.website);
|
|
|
|
|
+ websiteLink.attr('href', structure.website);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ websiteLink.text('');
|
|
|
|
|
+ websiteLink.attr('href', '');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // contact.find('.province').first().text('...');
|
|
|
|
|
+
|
|
|
|
|
+ let networkName = contact.find('.network').first();
|
|
|
|
|
+ if (structure.n1Name) {
|
|
|
|
|
+ networkName.text(structure.n1Name);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ networkName.text('');
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if (structure.longitude && structure.latitude) {
|
|
if (structure.longitude && structure.latitude) {
|
|
|
// clear previous markers
|
|
// clear previous markers
|
|
@@ -699,13 +819,12 @@ $(document).ready(function() {
|
|
|
contentType: "application/json; charset=utf-8",
|
|
contentType: "application/json; charset=utf-8",
|
|
|
timeout : 5000
|
|
timeout : 5000
|
|
|
})
|
|
})
|
|
|
- .done(function(res) {
|
|
|
|
|
- structure = res;
|
|
|
|
|
|
|
+ .done(function(structure) {
|
|
|
populateDetailsView(structure)
|
|
populateDetailsView(structure)
|
|
|
|
|
|
|
|
structureFrameDetails.find('.please-wait').first().hide();
|
|
structureFrameDetails.find('.please-wait').first().hide();
|
|
|
structureFrameDetails.find('.content').first().show();
|
|
structureFrameDetails.find('.content').first().show();
|
|
|
- resizeMaps()
|
|
|
|
|
|
|
+ resizeMaps();
|
|
|
})
|
|
})
|
|
|
.fail(function(xhr, textStatus, errorThrown) {
|
|
.fail(function(xhr, textStatus, errorThrown) {
|
|
|
pleaseWaitSpan.hide();
|
|
pleaseWaitSpan.hide();
|