Fix some issues

This commit is contained in:
Anthony Janin 2025-07-07 14:28:32 +02:00
parent c5bf332242
commit 4b7a08534d
4 changed files with 8 additions and 16 deletions

View File

@ -257,7 +257,7 @@ export default class DepositOtherDocument extends React.Component<IProps, IState
const date: Date = new Date(); const date: Date = new Date();
const strDate: string = `${date.getDate().toString().padStart(2, '0')}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getFullYear()}`; const strDate: string = `${date.getDate().toString().padStart(2, '0')}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getFullYear()}`;
const fileName: string = `${customer.contact.last_name}-${strDate}-APCL.${file.name.split('.').pop()}`.toUpperCase(); const fileName: string = `aplc-${file.name.split('.')[0]}-${strDate}.${file.name.split('.').pop()}`;
const arrayBuffer: ArrayBuffer = event.target.result as ArrayBuffer; const arrayBuffer: ArrayBuffer = event.target.result as ArrayBuffer;
const uint8Array: Uint8Array = new Uint8Array(arrayBuffer); const uint8Array: Uint8Array = new Uint8Array(arrayBuffer);

View File

@ -208,7 +208,7 @@ function buildRows(
): IRowProps[] { ): IRowProps[] {
return documentsNotary.map((documentNotary) => ({ return documentsNotary.map((documentNotary) => ({
key: documentNotary.uid ?? "", key: documentNotary.uid ?? "",
name: formatName(documentNotary.files?.[0]?.file_name?.split(".")?.[0] ?? "") || "_", name: documentNotary.files?.[0]?.file_name?.split(".")?.[0] || "_",
sentAt: new Date(documentNotary.created_at!).toLocaleDateString(), sentAt: new Date(documentNotary.created_at!).toLocaleDateString(),
// actions: <IconButton onClick={() => onDownloadFileNotary(documentNotary)} icon={<ArrowDownTrayIcon />} />, // actions: <IconButton onClick={() => onDownloadFileNotary(documentNotary)} icon={<ArrowDownTrayIcon />} />,
actions: { actions: {
@ -228,7 +228,3 @@ function buildRows(
}, },
})); }));
} }
function formatName(text: string): string {
return text.replace(/[^a-zA-Z0-9 ]/g, "");
}

View File

@ -314,7 +314,7 @@ export default function DocumentTables(props: IProps) {
}, },
file: { file: {
sx: { width: 120 }, sx: { width: 120 },
content: document.files?.[0]?.file_name ?? "_", content: document.files?.[0]?.file_name?.split(".")?.[0] ?? "_",
}, },
actions: { actions: {
sx: { width: 76 }, sx: { width: 76 },
@ -360,7 +360,7 @@ export default function DocumentTables(props: IProps) {
}, },
file: { file: {
sx: { width: 120 }, sx: { width: 120 },
content: document.files?.[0]?.file_name ?? "_", content: document.files?.[0]?.file_name?.split(".")?.[0] ?? "_",
}, },
actions: { actions: {
sx: { width: 76 }, sx: { width: 76 },
@ -411,7 +411,7 @@ export default function DocumentTables(props: IProps) {
}, },
file: { file: {
sx: { width: 120 }, sx: { width: 120 },
content: document.files?.[0]?.file_name ?? "_", content: document.files?.[0]?.file_name?.split(".")?.[0] ?? "_",
}, },
actions: { sx: { width: 76 }, content: "" }, actions: { sx: { width: 76 }, content: "" },
}; };
@ -428,7 +428,7 @@ export default function DocumentTables(props: IProps) {
key: document.uid, key: document.uid,
document_type: { document_type: {
sx: { width: 300 }, sx: { width: 300 },
content: formatName(document.files?.[0]?.file_name?.split(".")?.[0] ?? "") || "_", content: "Autre document",
}, },
document_status: { document_status: {
sx: { width: 107 }, sx: { width: 107 },
@ -440,7 +440,7 @@ export default function DocumentTables(props: IProps) {
}, },
file: { file: {
sx: { width: 120 }, sx: { width: 120 },
content: document.files?.[0]?.file_name ?? "_", content: document.files?.[0]?.file_name?.split(".")?.[0] ?? "_",
}, },
actions: { actions: {
sx: { width: 76 }, sx: { width: 76 },
@ -539,10 +539,6 @@ function getHeader(dateColumnTitle: string, isMobile: boolean): IHead[] {
]; ];
} }
function formatName(text: string): string {
return text.replace(/[^a-zA-Z0-9 ]/g, "");
}
function getTagForSentDocument(status: EDocumentNotaryStatus) { function getTagForSentDocument(status: EDocumentNotaryStatus) {
if (status === EDocumentNotaryStatus.SENT) { if (status === EDocumentNotaryStatus.SENT) {
return ( return (

View File

@ -83,7 +83,7 @@ export default function SendDocuments() {
const date: Date = new Date(); const date: Date = new Date();
const strDate: string = `${date.getDate().toString().padStart(2, '0')}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getFullYear()}`; const strDate: string = `${date.getDate().toString().padStart(2, '0')}-${(date.getMonth() + 1).toString().padStart(2, '0')}-${date.getFullYear()}`;
const fileName: string = `${customer.contact.last_name}-${strDate}-APCL.${file.name.split('.').pop()}`.toUpperCase(); const fileName: string = `aplc-${customer.contact.last_name}-${strDate}.${file.name.split('.').pop()}`;
const arrayBuffer: ArrayBuffer = event.target.result as ArrayBuffer; const arrayBuffer: ArrayBuffer = event.target.result as ArrayBuffer;
const uint8Array: Uint8Array = new Uint8Array(arrayBuffer); const uint8Array: Uint8Array = new Uint8Array(arrayBuffer);