feat(documents): per-document custom-field print picker on offer/issued-order/invoice detail
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,7 @@ import SectionsEditor, {
|
||||
type DocumentSection,
|
||||
} from "../components/document/SectionsEditor";
|
||||
import LockBanner from "../components/document/LockBanner";
|
||||
import CustomFieldsPrintPicker from "../components/document/CustomFieldsPrintPicker";
|
||||
import { useDocumentLock } from "../hooks/useDocumentLock";
|
||||
import { useUnsavedChangesGuard } from "../hooks/useUnsavedChangesGuard";
|
||||
import { useDocumentPdf } from "../hooks/useDocumentPdf";
|
||||
@@ -114,6 +115,7 @@ interface OfferSavePayload {
|
||||
language: string;
|
||||
items: OfferItemPayload[];
|
||||
sections: OfferSectionPayload[];
|
||||
selected_custom_fields: number[];
|
||||
status?: string;
|
||||
}
|
||||
|
||||
@@ -178,6 +180,9 @@ export default function OfferDetail() {
|
||||
emptyDocumentItem(),
|
||||
]);
|
||||
const [sections, setSections] = useState<DocumentSection[]>([]);
|
||||
const [selectedCustomFields, setSelectedCustomFields] = useState<number[]>(
|
||||
[],
|
||||
);
|
||||
const [orderInfo, setOrderInfo] = useState<OfferOrderInfo | null>(null);
|
||||
const [offerStatus, setOfferStatus] = useState<string>("");
|
||||
const [quotationNumber, setQuotationNumber] = useState("");
|
||||
@@ -318,6 +323,7 @@ export default function OfferDetail() {
|
||||
}))
|
||||
: [];
|
||||
setSections(mappedSections);
|
||||
setSelectedCustomFields(d.selected_custom_fields ?? []);
|
||||
markClean({ form: formData, items: mappedItems, sections: mappedSections });
|
||||
setOfferStatus(d.status || "");
|
||||
setOrderInfo(d.order ?? null);
|
||||
@@ -445,6 +451,7 @@ export default function OfferDetail() {
|
||||
content: s.content,
|
||||
position: i,
|
||||
})),
|
||||
selected_custom_fields: selectedCustomFields,
|
||||
};
|
||||
// Only set status when a target is given (create-as-draft / create-as-live
|
||||
// / finalize). Editing a live offer sends no status — the backend keeps
|
||||
@@ -929,6 +936,15 @@ export default function OfferDetail() {
|
||||
/>
|
||||
</Field>
|
||||
</Box>
|
||||
|
||||
<Box sx={{ mt: 2 }}>
|
||||
<CustomFieldsPrintPicker
|
||||
fields={companySettings?.custom_fields ?? []}
|
||||
selected={selectedCustomFields}
|
||||
disabled={readOnly}
|
||||
onChange={setSelectedCustomFields}
|
||||
/>
|
||||
</Box>
|
||||
</Card>
|
||||
|
||||
{/* Items (drag-and-drop, offers carry the "V ceně" column) */}
|
||||
|
||||
Reference in New Issue
Block a user