use name datat from Inco

This commit is contained in:
Olivier Legat 2022-03-12 18:01:41 +01:00
parent 95fb67ed13
commit e191bbaae2
2 changed files with 22 additions and 3 deletions

View file

@ -25,6 +25,19 @@
<div class="form-group">
<label for="name">Nom du produit *</label>
<input type="text" id="name" name="name" class="form-control" placeholder="Nom du produit" value="{{ old('name', $product->name) }}" required>
@if ($product->product_type == "foodProduct")
@if (!empty($product->foodProduct->xmlInco))
<a class="btn btn-outline-info btn-sm" data-toggle="collapse" href="#inco_nom" aria-expanded="false" aria-controls="collapseExample">Donnée inco</a>
<div class="collapse form-row" id="inco_nom">
<div class="input-group mb-2">
<div class="input-group-prepend">
<a class="btn btn-secondary" onclick="paste('nom','name')">Reprendre cette donnée</a>
</div>
<div class="inco_data form-control alert-info" id="nom">{{ $product->foodProduct->xmlInco->nom }}</div>
</div>
</div>
@endif
@endif
</div>
<div class="form-group">
<label for="name">Tags</label>
@ -273,8 +286,11 @@
}
function paste(from,to) {
//document.getElementById(to).value = document.getElementById(from).innerHTML;
window[to+'Editor'].setData(document.getElementById(from).innerHTML);
if(window[to+'Editor']) {
window[to+'Editor'].setData(document.getElementById(from).innerHTML);
} else {
document.getElementById(to).value = document.getElementById(from).innerHTML;
}
}
var editorConfig = {

View file

@ -3,7 +3,9 @@
<div class="modal-body">
@if (!empty($hasInco))
<div class="alert alert-success">{{ $hasInco }}</div>
<div class="alert alert-info">Article : {{ $xmlInco->id }} - {{ $xmlInco->descriptif }}
<div class="alert alert-info">
Article : {{ $xmlInco->id }} - {{ $xmlInco->nom }}<br/>
{{ $xmlInco->descriptif }}
@if (!empty($xmlInco->picture))
<br/>Images :
@foreach ($preparedImages as $media)
@ -29,6 +31,7 @@
var dataInco = @json($xmlInco);
function loadInco() {
//map all data
$('[name="name"]').val(dataInco['nom'] ?? '');
$('[name="description"]').val(dataInco['descriptif'] ?? '');
window['descriptionEditor'].setData(dataInco['descriptif'] ?? '');