Actualiser assets/js/app.js
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
This commit is contained in:
+29
-2
@@ -15188,7 +15188,7 @@ function renderRecipeLibraryList(recipes) {
|
||||
|
||||
function openRecipeLibraryForm(id = null) {
|
||||
const existing = id ? _recipeLibraryCache.find(e => e.id === id) : null;
|
||||
const r = existing ? existing.recipe : { title: '', ingredients: [{ name: '', qty: '' }], steps: [''] };
|
||||
const r = existing ? existing.recipe : { title: '', ingredients: [{ name: '', qty: '' }], equipment: [], steps: [''] };
|
||||
|
||||
document.getElementById('modal-content').innerHTML = `
|
||||
<div class="modal-header">
|
||||
@@ -15213,6 +15213,18 @@ function openRecipeLibraryForm(id = null) {
|
||||
</div>
|
||||
<button type="button" class="btn btn-small btn-secondary" onclick="addRecipeLibraryRow('rl-ingredients-list', 'ingredient')">➕ Ingrédient</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Matériel</label>
|
||||
<div id="rl-equipment-list">
|
||||
${(r.equipment || []).map(eq => `
|
||||
<div class="barcode-input-row" style="margin-bottom:6px">
|
||||
<input type="text" class="form-input rl-equipment-text" placeholder="Es: Shaker, Verre à cocktail, Pilon..." value="${escapeHtml(eq || '')}">
|
||||
<button type="button" class="btn btn-small btn-secondary" onclick="this.closest('.barcode-input-row').remove()">🗑️</button>
|
||||
</div>
|
||||
`).join('')}
|
||||
</div>
|
||||
<button type="button" class="btn btn-small btn-secondary" onclick="addRecipeLibraryRow('rl-equipment-list', 'equipment')">➕ Matériel</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Étapes</label>
|
||||
<div id="rl-steps-list">
|
||||
@@ -15252,6 +15264,11 @@ function addRecipeLibraryRow(containerId, type) {
|
||||
<input type="text" class="form-input rl-ing-qty" style="max-width:90px" placeholder="Qté (ex: 5cl)">
|
||||
<button type="button" class="btn btn-small btn-secondary" onclick="this.closest('.barcode-input-row').remove()">🗑️</button>
|
||||
`;
|
||||
} else if (type === 'equipment') {
|
||||
row.innerHTML = `
|
||||
<input type="text" class="form-input rl-equipment-text" placeholder="Es: Shaker, Verre à cocktail, Pilon...">
|
||||
<button type="button" class="btn btn-small btn-secondary" onclick="this.closest('.barcode-input-row').remove()">🗑️</button>
|
||||
`;
|
||||
} else {
|
||||
row.innerHTML = `
|
||||
<input type="text" class="form-input rl-step-text" placeholder="Étape">
|
||||
@@ -15271,11 +15288,13 @@ async function submitRecipeLibraryForm(e, id) {
|
||||
qty: row.querySelector('.rl-ing-qty')?.value.trim() || '',
|
||||
})).filter(ing => ing.name);
|
||||
|
||||
const equipment = Array.from(document.querySelectorAll('#rl-equipment-list .rl-equipment-text')).map(input => input.value.trim()).filter(Boolean);
|
||||
|
||||
const steps = Array.from(document.querySelectorAll('#rl-steps-list .rl-step-text')).map(input => input.value.trim()).filter(Boolean);
|
||||
|
||||
const tags = Array.from(document.querySelectorAll('#rl-tags-picker .rl-tag-chip.btn-primary')).map(b => b.dataset.tag);
|
||||
|
||||
const recipe = { title, ingredients, steps, tags, persons: 1 };
|
||||
const recipe = { title, ingredients, equipment, steps, tags, persons: 1 };
|
||||
|
||||
showLoading(true);
|
||||
try {
|
||||
@@ -15309,6 +15328,14 @@ function viewRecipeLibraryItem(id) {
|
||||
${(r.ingredients || []).map(ing => `<li>${escapeHtml(ing.name)}${ing.qty ? ' — ' + escapeHtml(ing.qty) : ''}</li>`).join('')}
|
||||
</ul>
|
||||
</div>
|
||||
${(r.equipment && r.equipment.length) ? `
|
||||
<div class="form-group">
|
||||
<label>Matériel</label>
|
||||
<ul style="margin:0;padding-left:20px">
|
||||
${r.equipment.map(eq => `<li>${escapeHtml(eq)}</li>`).join('')}
|
||||
</ul>
|
||||
</div>
|
||||
` : ''}
|
||||
<div class="form-group">
|
||||
<label>Étapes</label>
|
||||
<ol style="margin:0;padding-left:20px">
|
||||
|
||||
Reference in New Issue
Block a user