Compare commits
1 commit
master
...
24-pro-spa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6094f8588 |
1 changed files with 26 additions and 18 deletions
|
|
@ -155,28 +155,36 @@
|
|||
|
||||
@push('scripts')
|
||||
<script>
|
||||
function setMpSelector() {
|
||||
var selectMP = $('select[name=mps]');
|
||||
$('.mp--bloc:visible:first').find('.mp--bloc--header .cotations--mp span').hide();
|
||||
$('.mp--bloc:visible:first').find('.mp--bloc--header .cotations--mp').append(selectMP);
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const selectMP = document.querySelector('select[name="mps"]');
|
||||
if (!selectMP) return;
|
||||
|
||||
$(document).ready(function() {
|
||||
setMpSelector();
|
||||
selectMP.addEventListener('change', function() {
|
||||
const value = this.value;
|
||||
const blocs = document.querySelectorAll('.mp--bloc');
|
||||
|
||||
$('select[name=mps]').change(function (){
|
||||
if($(this).val() == 'All') {
|
||||
$('select[name=mps]')[0].selectedIndex = 0;
|
||||
$('.mp--bloc .mp--bloc--header .cotations--mp span').show();
|
||||
$('.mp--bloc').removeClass('final');
|
||||
$('.mp--bloc').show();
|
||||
if (value === 'All') {
|
||||
this.selectedIndex = 0;
|
||||
|
||||
document.querySelectorAll('.mp--bloc .mp--bloc--header .cotations--mp span').forEach(function(span) {
|
||||
span.style.display = '';
|
||||
});
|
||||
|
||||
blocs.forEach(function(bloc) {
|
||||
bloc.classList.remove('final');
|
||||
bloc.style.display = '';
|
||||
});
|
||||
} else {
|
||||
$('.mp--bloc').hide();
|
||||
$('.mp--bloc.'+$(this).val()).addClass('final');
|
||||
$('.mp--bloc.'+$(this).val()).show();
|
||||
blocs.forEach(function(bloc) {
|
||||
bloc.style.display = 'none';
|
||||
bloc.classList.remove('final');
|
||||
});
|
||||
|
||||
document.querySelectorAll('.mp--bloc.' + CSS.escape(value)).forEach(function(bloc) {
|
||||
bloc.classList.add('final');
|
||||
bloc.style.display = '';
|
||||
});
|
||||
}
|
||||
setMpSelector();
|
||||
//restore
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue