Fixed build

This commit is contained in:
Vins 2025-04-15 09:23:10 +02:00
parent f54797493a
commit 1b98adc052
7 changed files with 33 additions and 33 deletions

View File

@ -44,7 +44,7 @@ export const FormContext = React.createContext<IFormContext>({
export default class Form extends React.Component<IProps, IState> { export default class Form extends React.Component<IProps, IState> {
protected fields: IFields = {}; protected fields: IFields = {};
private formRef: React.RefObject<HTMLFormElement>; public formRef: React.RefObject<HTMLFormElement>;
constructor(props: IProps) { constructor(props: IProps) {
super(props); super(props);

View File

@ -59,7 +59,7 @@ export default function DepositDocumentComponent(props: IProps) {
if (!refused_reason) return; if (!refused_reason) return;
setRefusedReason(refused_reason); setRefusedReason(refused_reason);
setIsModalOpen(true); setIsModalOpen(true);
}, []); }, [document.document_history]);
const closeModal = useCallback(() => { const closeModal = useCallback(() => {
setIsModalOpen(false); setIsModalOpen(false);

View File

@ -85,7 +85,7 @@ export default function ReceivedDocuments() {
DocumentsNotary.getInstance() DocumentsNotary.getInstance()
.get({ where: { folder: { uid: folderUid }, customer: { uid: customerUid } }, include: { files: true } }) .get({ where: { folder: { uid: folderUid }, customer: { uid: customerUid } }, include: { files: true } })
.then((documentsNotary) => setDocumentsNotary(documentsNotary)); .then((documentsNotary) => setDocumentsNotary(documentsNotary));
}, [folderUid, customer]); }, [folderUid, customer, fetchFolderAndCustomer]);
const onDownload = useCallback((doc: DocumentNotary) => { const onDownload = useCallback((doc: DocumentNotary) => {
const file = doc.files?.[0]; const file = doc.files?.[0];

View File

@ -144,7 +144,7 @@ export default function ClientDashboard(props: IProps) {
})} })}
/> />
); );
}, [customer, folderUid, isAddDocumentModalVisible, onCloseModalAddDocument]); }, [customer, folderUid, isAddDocumentModalVisible, onCloseModalAddDocument, folder]);
return ( return (
<DefaultCustomerDashboard> <DefaultCustomerDashboard>

View File

@ -36,16 +36,15 @@ export default function AskDocuments() {
const getSelectedDocumentTypes = () => { const getSelectedDocumentTypes = () => {
// Get all checked checkboxes // Get all checked checkboxes
if (!formRef.current) return []; if (!formRef.current) return [];
const formElement = formRef.current.formRef.current; const formElement = formRef.current.formRef.current;
if (!formElement) return []; if (!formElement) return [];
const checkboxes = Array.from(formElement.elements) const checkboxes = Array.from(formElement.elements).filter(
.filter(elem => elem.getAttribute("type") === "checkbox" && elem.getAttribute("name") === "document_types") as HTMLInputElement[]; (elem) => elem.getAttribute("type") === "checkbox" && elem.getAttribute("name") === "document_types",
) as HTMLInputElement[];
return checkboxes
.filter(checkbox => checkbox.checked) return checkboxes.filter((checkbox) => checkbox.checked).map((checkbox) => checkbox.value);
.map(checkbox => checkbox.value);
}; };
const onFormSubmit = useCallback( const onFormSubmit = useCallback(
@ -147,19 +146,20 @@ export default function AskDocuments() {
// Update checkboxes after data has been refreshed // Update checkboxes after data has been refreshed
const updateCheckedState = useCallback(() => { const updateCheckedState = useCallback(() => {
if (!formRef.current || selectedDocumentTypes.length === 0) return; if (!formRef.current || selectedDocumentTypes.length === 0) return;
const formElement = formRef.current.formRef.current; const formElement = formRef.current.formRef.current;
if (!formElement) return; if (!formElement) return;
// Check all checkboxes that were previously selected // Check all checkboxes that were previously selected
const checkboxes = Array.from(formElement.elements) const checkboxes = Array.from(formElement.elements).filter(
.filter(elem => elem.getAttribute("type") === "checkbox" && elem.getAttribute("name") === "document_types") as HTMLInputElement[]; (elem) => elem.getAttribute("type") === "checkbox" && elem.getAttribute("name") === "document_types",
) as HTMLInputElement[];
checkboxes.forEach(checkbox => {
checkboxes.forEach((checkbox) => {
if (selectedDocumentTypes.includes(checkbox.value)) { if (selectedDocumentTypes.includes(checkbox.value)) {
checkbox.checked = true; checkbox.checked = true;
// Trigger change to update the internal state of CheckBox component // Trigger change to update the internal state of CheckBox component
const event = new Event('change', { bubbles: true }); const event = new Event("change", { bubbles: true });
checkbox.dispatchEvent(event); checkbox.dispatchEvent(event);
} }
}); });
@ -180,16 +180,16 @@ export default function AskDocuments() {
const backUrl = Module.getInstance() const backUrl = Module.getInstance()
.get() .get()
.modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", folderUid as string); .modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", folderUid as string);
const handleDocumentsUpdated = async (newDocumentTypes: IOption[]) => { const handleDocumentsUpdated = async (newDocumentTypes: IOption[]) => {
// Store existing selections // Store existing selections
const existingSelections = getSelectedDocumentTypes(); const existingSelections = getSelectedDocumentTypes();
// Update document types with new ones // Update document types with new ones
setDocumentTypes([...documentTypes, ...newDocumentTypes]); setDocumentTypes([...documentTypes, ...newDocumentTypes]);
// Set these as selected // Set these as selected
setSelectedDocumentTypes([...existingSelections, ...newDocumentTypes.map(dt => dt.value as string)]); setSelectedDocumentTypes([...existingSelections, ...newDocumentTypes.map((dt) => dt.value as string)]);
}; };
return ( return (
@ -215,10 +215,10 @@ export default function AskDocuments() {
); );
} }
return ( return (
<CheckBox <CheckBox
name="document_types" name="document_types"
option={documentType} option={documentType}
key={documentType.value as string} key={documentType.value as string}
checked={selectedDocumentTypes.includes(documentType.value as string)} checked={selectedDocumentTypes.includes(documentType.value as string)}
/> />
); );
@ -246,9 +246,9 @@ export default function AskDocuments() {
</Form> </Form>
</div> </div>
{folder && ( {folder && (
<ParameterDocuments <ParameterDocuments
folder={folder} folder={folder}
closeModal={closeModal} closeModal={closeModal}
isCreateDocumentModalVisible={isCreateDocumentModalVisible} isCreateDocumentModalVisible={isCreateDocumentModalVisible}
onDocumentsUpdated={handleDocumentsUpdated} onDocumentsUpdated={handleDocumentsUpdated}
/> />

View File

@ -74,7 +74,7 @@ export default function DocumentsReminderHistory(props: IProps) {
setTotalPages(totalPages); setTotalPages(totalPages);
}) })
.catch((e) => console.warn(e)); .catch((e) => console.warn(e));
}, [pageSize]); }, [pageSize, folderUid]);
const fetchReminders = useCallback(() => { const fetchReminders = useCallback(() => {
DocumentReminders.getInstance() DocumentReminders.getInstance()
@ -109,7 +109,7 @@ export default function DocumentsReminderHistory(props: IProps) {
setReminders(response); // Set the reminders setReminders(response); // Set the reminders
}) })
.catch((e) => console.warn(e)); .catch((e) => console.warn(e));
}, [customerOption, page, pageSize]); // Update on page change }, [customerOption, page, pageSize, folderUid]); // Update on page change
const fetchCustomers = useCallback(async () => { const fetchCustomers = useCallback(async () => {
if (!folderUid) return; if (!folderUid) return;

View File

@ -41,7 +41,7 @@ export default function ClientBox(props: IProps) {
} }
props.onDelete(customerUid); props.onDelete(customerUid);
}, },
[closeDeleteModal, customer.documents, openErrorModal, props], [closeDeleteModal, customer.documents, openErrorModal, props, customer, folderUid],
); );
let createOrUpdateNotePath = Module.getInstance() let createOrUpdateNotePath = Module.getInstance()