Inline-edit the type badge directly in the table
Clicking a row's type badge swaps it for a native <select> in place; picking a new value POSTs to a new endpoint (LedgerActionsController::updateType) instead of opening the full edit modal for this one field. The endpoint goes through the normal node save() lifecycle, so figli_compta_ledger_node_presave() still forces a proper revision and still enforces the répartition invariant -- nothing here bypasses that. It also clears a stale field_entree_liee when the new type is no longer linkable (versement/achat/hébergement), mirroring the full form's #states visibility rule. CSRF-protected via core's own /session/token, scoped to CsrfRequestHeaderAccessCheck::TOKEN_KEY to match what that endpoint actually generates. Verified end-to-end via the real click flow: correct revision (user + timestamp), correct optimistic UI update, correct field_entree_liee clearing, and 400/403 on invalid type / missing CSRF respectively.
This commit is contained in:
@@ -67,6 +67,8 @@
|
||||
<span class="figli-count" v-if="!loading">{{ filteredRows.length }} / {{ rows.length }} lignes chargées{{ errorCount ? ' — ' + errorCount + ' avec écart' : '' }}</span>
|
||||
</div>
|
||||
|
||||
<p v-if="typeUpdateError" class="figli-error figli-inline-error">Erreur : {{ typeUpdateError }} <button type="button" class="figli-clear-drilldown" @click="typeUpdateError = null">✕</button></p>
|
||||
|
||||
<p v-if="loading">Chargement des données…</p>
|
||||
<p v-else-if="error" class="figli-error">Erreur de chargement : {{ error }}</p>
|
||||
<div v-else ref="tableWrap" class="figli-table-wrap">
|
||||
@@ -120,7 +122,24 @@
|
||||
</td>
|
||||
<td>{{ formatDate(item.date) }}</td>
|
||||
<td>{{ item.client || '—' }}</td>
|
||||
<td><span class="figli-badge" :class="'type-' + item.type">{{ typeLabel(item.type) }}</span></td>
|
||||
<td>
|
||||
<select
|
||||
v-if="editingTypeId === item.id"
|
||||
class="figli-type-select"
|
||||
:value="item.type"
|
||||
@change="saveType(item, $event)"
|
||||
@blur="editingTypeId = null"
|
||||
>
|
||||
<option v-for="t in allTypes" :key="t.value" :value="t.value">{{ t.label }}</option>
|
||||
</select>
|
||||
<span
|
||||
v-else
|
||||
class="figli-badge figli-badge-editable"
|
||||
:class="'type-' + item.type"
|
||||
title="Cliquer pour changer le type"
|
||||
@click="startEditType(item)"
|
||||
>{{ typeLabel(item.type) }}</span>
|
||||
</td>
|
||||
<td class="figli-libelle">
|
||||
{{ item.libelle }}
|
||||
<span
|
||||
|
||||
Reference in New Issue
Block a user