Fixed bo inline scripts
This commit is contained in:
parent
88db8dd345
commit
d5f12af30d
7 changed files with 166 additions and 24 deletions
|
|
@ -53,7 +53,17 @@
|
|||
</label>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<a class="btn btn-primary text-white" onclick="addInput()" id="add_answer" role="button">Ajouter une réponse</a>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('add_answer').addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
addInput();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<a class="btn btn-primary text-white" id="add_answer" role="button">Ajouter une réponse</a>
|
||||
</div>
|
||||
<div>
|
||||
<table class="table text-center">
|
||||
|
|
|
|||
|
|
@ -76,7 +76,17 @@
|
|||
</label>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<a class="btn btn-primary text-white" onclick="addInput()" id="add_answer" role="button">Ajouter une réponse</a>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('add_answer').addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
addInput();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<a class="btn btn-primary text-white" id="add_answer" role="button">Ajouter une réponse</a>
|
||||
</div>
|
||||
<div>
|
||||
<table class="table text-center">
|
||||
|
|
@ -89,8 +99,18 @@
|
|||
<tbody id="answers">
|
||||
@foreach($article->answers as $answer)
|
||||
<tr id="tr_answer_{{$answer->id}}">
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('rm-tr_answer_{{$answer->id}}').addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
deleteAnswer('tr_answer_{{$answer->id}}');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<td class="w-75"><input class="form-control" name="answers[{{$answer->id}}]" placeholder="Réponse" value="{{$answer->answer}}"></td>
|
||||
<td class="w-25"><a href="#_" onclick="deleteAnswer('tr_answer_{{$answer->id}}')" class="col-form-label">Supprimer</a></td>
|
||||
<td class="w-25"><a id="rm-tr_answer_{{$answer->id}}" href="#_" class="col-form-label">Supprimer</a></td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
|
@ -158,7 +178,11 @@
|
|||
|
||||
var a = document.createElement('a');
|
||||
a.href = "#_";
|
||||
a.setAttribute("onclick", "deleteAnswer('tr_answer_" + addId + "')");
|
||||
a.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
deleteAnswer(`tr_answer_${addId}`);
|
||||
addId--;
|
||||
})
|
||||
a.className = "col-form-label";
|
||||
a.innerHTML = "Supprimer"
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,17 @@
|
|||
<button type="submit" class="btn btn-primary">
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger" onclick="$('#searchField').val('');$('#searchForm').submit();">
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('btn-search-clear').addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
$('#searchField').val('');$('#searchForm').submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<button id="btn-search-clear" type="button" class="btn btn-danger">
|
||||
<i class="fas fa-backspace"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,13 +9,35 @@
|
|||
<input id="breeder_code" class="form-control" type="text" name="breeder_code" placeholder="{{__('Code éleveur *') }}" value="{{ old('breeder_code') ?? $breeder->breeder_code ?? ''}}" required>
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<a class="btn btn-primary text-white" onclick="addInput()" id="addInuav" role="button">{{ __('Ajouter un code INUAV') }}</a>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('add-inuav-btn').addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
addInput();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<a id="add-inuav-btn" class="btn btn-primary text-white" role="button">{{ __('Ajouter un code INUAV') }}</a>
|
||||
</div>
|
||||
<div class="form-group row" id="inuavs">
|
||||
@if(isset($breeder) and $breeder->inuavs)
|
||||
@foreach($breeder->inuavs as $inuav)
|
||||
<input id="inuav_{{ $loop->index }}" class="form-control col-md-3" name="inuavs[]" placeholder="Code INUAV" value="{{ $inuav }}">
|
||||
<a href="#" id="inuav_{{ $loop->index }}_a" onclick="deleteInuav('inuav_{{ $loop->index }}')" class="col-form-label col-md-3">{{ __('Supprimer') }}</a>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('inuav_{{ $loop->index + 1}}_a').addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
deleteInuav('inuav_{{ $loop->index + 1 }}');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<input id="inuav_{{ $loop->index + 1 }}" class="form-control col-md-3" name="inuavs[]" placeholder="Code INUAV" value="{{ $inuav }}">
|
||||
<a href="#" id="inuav_{{ $loop->index + 1 }}_a" class="col-form-label col-md-3">{{ __('Supprimer') }}</a>
|
||||
@endforeach
|
||||
@endif
|
||||
</div>
|
||||
|
|
@ -85,7 +107,16 @@
|
|||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="presentation_type" class="col-form-label col-md-6">{{__('Type de présentation de l\'élevage') }}</label>
|
||||
<select id="presentation_type" class="custom-select col-md-6" name="presentation_type" onchange="changeType(this)">
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('presentation_type').addEventListener('change', (e) => {
|
||||
changeType(e.target);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<select id="presentation_type" class="custom-select col-md-6" name="presentation_type">
|
||||
@foreach(PresentationType::toArray() as $presType)
|
||||
<option value="{{ $presType->value }}" @if(isset($breeder) and $breeder->presentation_type->equals($presType)) selected @endif>{{ $presType->label }}</option>
|
||||
@endforeach
|
||||
|
|
@ -165,6 +196,7 @@
|
|||
|
||||
|
||||
function addInput() {
|
||||
addId++;
|
||||
var inuavDiv = $("#inuavs");
|
||||
|
||||
var input = document.createElement('input');
|
||||
|
|
@ -176,20 +208,23 @@
|
|||
var a = document.createElement('a');
|
||||
a.href = "javascript:void(0)";
|
||||
a.id = "inuav_" + addId + "_a";
|
||||
a.setAttribute("onclick", "deleteInuav('inuav_" + addId + "')");
|
||||
a.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
deleteInuav(`inuav_${addId}`);
|
||||
addId--;
|
||||
return false;
|
||||
})
|
||||
a.className = "col-form-label col-md-3";
|
||||
a.innerHTML = "Supprimer"
|
||||
inuavDiv.append(input);
|
||||
inuavDiv.append(a);
|
||||
|
||||
addId++;
|
||||
}
|
||||
|
||||
// Supprime un input INUAV avec son bouton supprimer, affiche le bouton ajouter un INUAV si il y a moins de 10 champs présents sur la page
|
||||
function deleteInuav(elementId) {
|
||||
var input = $("#" + elementId);
|
||||
let input = document.getElementById(elementId);
|
||||
let a = document.getElementById(`${elementId}_a`);
|
||||
input.remove();
|
||||
var a = $("#" + elementId + "_a");
|
||||
a.remove();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,19 @@
|
|||
</div>
|
||||
@if(isset($edit) and isset($p->xmlInco))
|
||||
<div class="col">
|
||||
<a href="{{ route('bo.products.copyXmlIncoPicture', $p) }}" class="btn btn-danger" onclick="return confirm('Êtes-vous sûr(e) ?')">Ecraser avec l'image de la fiche Inco</a>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('use-inco-picture').addEventListener('click', (e) => {
|
||||
if(!confirm('Êtes-vous sûr(e) ?')) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<a id="use-inco-picture" href="{{ route('bo.products.copyXmlIncoPicture', $p) }}" class="btn btn-danger">Ecraser avec l'image de la fiche Inco</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
|
@ -211,7 +223,19 @@
|
|||
</div>
|
||||
@if(isset($edit) and isset($p->xmlInco))
|
||||
<div class="row">
|
||||
<a href="{{ route('bo.products.copyXmlIncoValues', $p) }}" class="btn btn-danger" onclick="return confirm('Êtes-vous sûr(e) ?')">Copier les Valeurs nutritionelles</a>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('copy-inco-btn').addEventListener('click', (e) => {
|
||||
if(!confirm('Êtes-vous sûr(e) ?')) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<a id="copy-inco-btn" href="{{ route('bo.products.copyXmlIncoValues', $p) }}" class="btn btn-danger">Copier les Valeurs nutritionelles</a>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -25,10 +25,22 @@
|
|||
@if(request()->search)
|
||||
<input class="d-none" type="text" name="search" value="{{ request()->search }}">
|
||||
@endif
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('search-bar-input').addEventListener('change', (e) => {
|
||||
e.preventDefault();
|
||||
if ($('#rangeFilter').children('select').first().val() !== '') {
|
||||
$('#rangeFilter').submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<select
|
||||
id="search-bar-input"
|
||||
class="custom-select input-group-prepend col-md-8"
|
||||
name="rangefilter"
|
||||
onchange="if ($('#rangeFilter').children('select').first().val() !== '') $('#rangeFilter').submit();">
|
||||
name="rangefilter">
|
||||
<option value="">{{ __('Filter en choisissant une gamme') }}</option>
|
||||
@foreach ($ranges as $range)
|
||||
<option value="{{$range->id}}" @if(request()->rangefilter == $range->id)selected @endif>{{$range->name}}</option>
|
||||
|
|
|
|||
|
|
@ -23,8 +23,17 @@
|
|||
<section class="strates">
|
||||
@foreach ($moment->strates as $strate)
|
||||
<div class="strate-item">
|
||||
{{-- TODO: Remove this inline js call --}}
|
||||
<button class="scroll-button" onclick="__Gaul.scrollToContent('{{ 'strate-text-' . $loop->iteration }}', 70)"></button>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('strate-btn-{{ $loop->iteration }}').addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
__Gaul.scrollToContent('strate-text-{{ $loop->iteration }}', 70);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<button id="strate-btn-{{ $loop->iteration }}" class="scroll-button"></button>
|
||||
@if ($strate->picture)
|
||||
<figure>
|
||||
<span><img src="{{ asset($strate->picture) }}" alt="{{ $strate->title }} - Le Gaulois"></span>
|
||||
|
|
@ -42,8 +51,17 @@
|
|||
@if ($moment->featured_status === 1)
|
||||
<section class="ascent">
|
||||
<div class="ascent-content">
|
||||
{{-- TODO: Remove this inline js call --}}
|
||||
<button class="scroll-button" onclick="__Gaul.scrollToContent('title-ascent', 70)"></button>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('title-ascent-btn').addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
__Gaul.scrollToContent('title-ascent', 70);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<button id="title-ascent-btn" class="scroll-button"></button>
|
||||
<h1 id="title-ascent">{{ $moment->featured_title }}</h1>
|
||||
{!! clean($moment->featured_text) !!}
|
||||
@if ($moment->featured_type === "produits")
|
||||
|
|
@ -91,8 +109,17 @@
|
|||
@endif
|
||||
@if ($moment->voucher_status === 1)
|
||||
<section class="voucher">
|
||||
{{-- TODO: Remove this inline js call --}}
|
||||
<button class="scroll-button" onclick="__Gaul.scrollToContent('voucher-content', 70)"></button>
|
||||
@push('scripts')
|
||||
<script nonce="{{ $nonce }}">
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.getElementById('voucher-btn').addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
__Gaul.scrollToContent('voucher-content', 70);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
<button id="voucher-btn" class="scroll-button"></button>
|
||||
<div class="voucher-content">
|
||||
<figure class="voucher-picture" id="voucher-content">
|
||||
<img src="{{ asset('assets/images/moments/lebonplan-moment.png') }}" alt="{{ __('Bon plan') }} - Le Gaulois">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue