Unify category autocomplete fields
All checks were successful
Deploy Sokko G / deploy (push) Successful in 17s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 17s
This commit is contained in:
parent
e3d823d0b1
commit
055fb78d60
21 changed files with 739 additions and 168 deletions
|
|
@ -1,5 +1,6 @@
|
|||
// Rôle : rend les sections et items de checklist avec édition inline et quantités.
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { CategoryAutocompleteInput } from "../../../components/CategoryAutocompleteInput.jsx";
|
||||
import { Icon } from "../../../components/Icon.jsx";
|
||||
import { useInlineEdit } from "../../../hooks/useInlineEdit.js";
|
||||
import {
|
||||
|
|
@ -8,7 +9,7 @@ import {
|
|||
keepChecklistSection
|
||||
} from "./checklistUtils.js";
|
||||
|
||||
export function ChecklistSection({ section, context, data, reorder, onRenameSection, onUpdateSection, onSaveSections, onUpdateItem, onMoveItemToCategory, onDeleteItem }) {
|
||||
export function ChecklistSection({ section, context, data, reorder, onRenameSection, onUpdateSection, onSaveSections, onUpdateItem, onMoveItemToCategory, onDeleteItem, categoryOptions = [] }) {
|
||||
const showTitle = Boolean(section.title);
|
||||
const sectionComplete = showTitle && isSectionComplete(section, context);
|
||||
const hideWhenComplete = getSectionHideWhenComplete(section, data.hideCompletedSections);
|
||||
|
|
@ -117,6 +118,7 @@ export function ChecklistSection({ section, context, data, reorder, onRenameSect
|
|||
onUpdateItem={onUpdateItem}
|
||||
onMoveItemToCategory={onMoveItemToCategory}
|
||||
onDeleteItem={onDeleteItem}
|
||||
categoryOptions={categoryOptions}
|
||||
editing={editingItemId === item.id}
|
||||
onToggleEditing={() => setEditingItemId(editingItemId === item.id ? "" : item.id)}
|
||||
onCloseEditing={() => setEditingItemId("")}
|
||||
|
|
@ -128,7 +130,7 @@ export function ChecklistSection({ section, context, data, reorder, onRenameSect
|
|||
);
|
||||
}
|
||||
|
||||
function ChecklistItem({ item, section, context, reorder, items, save, onUpdateItem, onMoveItemToCategory, onDeleteItem, editing, onToggleEditing, onCloseEditing }) {
|
||||
function ChecklistItem({ item, section, context, reorder, items, save, onUpdateItem, onMoveItemToCategory, onDeleteItem, categoryOptions, editing, onToggleEditing, onCloseEditing }) {
|
||||
const itemRef = useRef(null);
|
||||
const done = context.clampQty(item.qtyCurrent, item.qtyTarget) >= item.qtyTarget;
|
||||
const textContent = context.moduleText?.checklist || {};
|
||||
|
|
@ -221,13 +223,13 @@ function ChecklistItem({ item, section, context, reorder, items, save, onUpdateI
|
|||
"aria-label": textContent.itemEditLabel || "Libellé"
|
||||
})}
|
||||
/>
|
||||
<input
|
||||
<CategoryAutocompleteInput
|
||||
{...categoryEdit.getInputProps({
|
||||
className: "checklist-category-input nds-inline-input",
|
||||
type: "text",
|
||||
placeholder: textContent.sectionPlaceholder || "Catégorie",
|
||||
"aria-label": textContent.categoryEditLabel || "Catégorie"
|
||||
})}
|
||||
options={categoryOptions}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue