From 3d2db1ef4903f228ff596c99a4e68ee727ffbd1e Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Mon, 5 May 2025 14:39:31 +0200 Subject: [PATCH] - added CLEAR button to tables; --- .../DraftApplicationsTableAsync/index.js | 27 +++++++++++++++++ .../components/LatestBandiTableAsync/index.js | 27 +++++++++++++++++ .../index.js | 27 +++++++++++++++++ .../index.js | 30 +++++++++++++++++++ .../DomandeTablePreInstructorAsync/index.js | 30 +++++++++++++++++++ .../components/AllDomandeTableAsync/index.js | 29 ++++++++++++++++++ .../index.js | 29 ++++++++++++++++++ .../SoccorsiPreInstructorTableAsync/index.js | 29 ++++++++++++++++++ 8 files changed, 228 insertions(+) diff --git a/src/pages/Dashboard/components/DraftApplicationsTableAsync/index.js b/src/pages/Dashboard/components/DraftApplicationsTableAsync/index.js index 5029f7a..98c2d59 100644 --- a/src/pages/Dashboard/components/DraftApplicationsTableAsync/index.js +++ b/src/pages/Dashboard/components/DraftApplicationsTableAsync/index.js @@ -128,6 +128,32 @@ const DraftApplicationsTableAsync = () => { } + const clearFilter = () => { + setLazyState({ + first: 0, + rows: 5, + page: 0, + sortField: null, + sortOrder: null, + filters: { + id: { value: null, matchMode: 'contains' }, + callTitle: { value: null, matchMode: 'contains' }, + companyName: { value: null, matchMode: 'contains' }, + status: { value: null, matchMode: 'contains' } + } + }); + }; + + const renderHeader = () => { + return ( +
+
+ ); + }; + + const header = renderHeader(); + return (
{ first={lazyState.first} rows={lazyState.rows} totalRecords={totalRecordsNum} onPage={onPage} onSort={onSort} sortField={lazyState.sortField} sortOrder={lazyState.sortOrder} onFilter={onFilter} filters={lazyState.filters} loading={localAsyncRequest} + header={header} emptyMessage={translationStrings.emptyMessage}> { return getFormattedDateString(rowData.endDate) + ' ' + getTimeFromISOstring(endTimeObg); }; + const clearFilter = () => { + setLazyState({ + first: 0, + rows: 5, + page: 0, + sortField: null, + sortOrder: null, + filters: { + name: { value: null, matchMode: 'contains' }, + startDate: { value: null, matchMode: 'dateIs' }, + endDate: { value: null, matchMode: 'dateIs' }, + status: { value: null, matchMode: 'equals' } + } + }); + }; + + const renderHeader = () => { + return ( +
+
+ ); + }; + + const header = renderHeader(); + useEffect(() => { setLocalAsyncRequest(true); const paginationQuery = getPaginationQuery(); @@ -181,6 +207,7 @@ const LatestBandiTableAsync = () => { first={lazyState.first} rows={lazyState.rows} totalRecords={totalRecordsNum} onPage={onPage} onSort={onSort} sortField={lazyState.sortField} sortOrder={lazyState.sortOrder} onFilter={onFilter} filters={lazyState.filters} loading={localAsyncRequest} + header={header} emptyMessage={translationStrings.emptyMessage}> { setLocalAsyncRequest(false); } + const clearFilter = () => { + setLazyState({ + first: 0, + rows: 5, + page: 0, + sortField: null, + sortOrder: null, + filters: { + name: { value: null, matchMode: 'contains' }, + startDate: { value: null, matchMode: 'dateIs' }, + endDate: { value: null, matchMode: 'dateIs' }, + status: { value: null, matchMode: 'equals' } + } + }); + }; + + const renderHeader = () => { + return ( +
+
+ ); + }; + + const header = renderHeader(); + useEffect(() => { setLocalAsyncRequest(true); const paginationQuery = getPaginationQuery(); @@ -176,6 +202,7 @@ const LatestBandiTableInstructorManagerAsync = () => { first={lazyState.first} rows={lazyState.rows} totalRecords={totalRecordsNum} onPage={onPage} onSort={onSort} sortField={lazyState.sortField} sortOrder={lazyState.sortOrder} onFilter={onFilter} filters={lazyState.filters} loading={localAsyncRequest} + header={header} emptyMessage={translationStrings.emptyMessage}> { + setLazyState({ + first: 0, + rows: 5, + page: 0, + sortField: null, + sortOrder: null, + filters: { + applicationId: { value: null, matchMode: 'equals' }, + protocolNumber: { value: null, matchMode: 'equals' }, + callName: { value: null, matchMode: 'contains' }, + companyName: { value: null, matchMode: 'contains' }, + submissionDate: { value: null, matchMode: 'dateIs' }, + evaluationEndDate: { value: null, matchMode: 'dateIs' }, + applicationStatus: { value: null, matchMode: 'equals' } + } + }); + }; + + const renderHeader = () => { + return ( +
+
+ ); + }; + + const header = renderHeader(); + useEffect(() => { setLocalAsyncRequest(true); const paginationQuery = getPaginationQuery(); @@ -191,6 +220,7 @@ const MieDomandeTableInstructorManagerAsync = ({ userId = null, statuses = [] }) first={lazyState.first} rows={lazyState.rows} totalRecords={totalRecordsNum} onPage={onPage} onSort={onSort} sortField={lazyState.sortField} sortOrder={lazyState.sortOrder} onFilter={onFilter} filters={lazyState.filters} loading={localAsyncRequest} + header={header} emptyMessage={translationStrings.emptyMessage}> { setLocalAsyncRequest(false); } + const clearFilter = () => { + setLazyState({ + first: 0, + rows: 5, + page: 0, + sortField: null, + sortOrder: null, + filters: { + applicationId: { value: null, matchMode: 'equals' }, + protocolNumber: { value: null, matchMode: 'equals' }, + callName: { value: null, matchMode: 'contains' }, + companyName: { value: null, matchMode: 'contains' }, + submissionDate: { value: null, matchMode: 'dateIs' }, + evaluationEndDate: { value: null, matchMode: 'dateIs' }, + applicationStatus: { value: null, matchMode: 'equals' } + } + }); + }; + + const renderHeader = () => { + return ( +
+
+ ); + }; + + const header = renderHeader(); + useEffect(() => { setLocalAsyncRequest(true); const paginationQuery = getPaginationQuery(); @@ -191,6 +220,7 @@ const DomandeTablePreInstructorAsync = ({ userId = null, statuses = [] }) => { first={lazyState.first} rows={lazyState.rows} totalRecords={totalRecordsNum} onPage={onPage} onSort={onSort} sortField={lazyState.sortField} sortOrder={lazyState.sortOrder} onFilter={onFilter} filters={lazyState.filters} loading={localAsyncRequest} + header={header} emptyMessage={translationStrings.emptyMessage}> { return getFormattedDateString(rowData.submissionDate); }; + const clearFilter = () => { + setLazyState({ + first: 0, + rows: 5, + page: 0, + sortField: null, + sortOrder: null, + filters: { + id: { value: null, matchMode: 'equals' }, + callTitle: { value: null, matchMode: 'contains' }, + companyName: { value: null, matchMode: 'contains' }, + submissionDate: { value: null, matchMode: 'dateIs' }, + assignedUserName: { value: null, matchMode: 'equals' }, + status: { value: null, matchMode: 'equals' } + } + }); + }; + + const renderHeader = () => { + return ( +
+
+ ); + }; + + const header = renderHeader(); + useEffect(() => { setLocalAsyncRequest(true); const paginationQuery = getPaginationQuery(); @@ -152,6 +180,7 @@ const AllDomandeTableAsync = ({ openDialogFn, updaterString = '' }) => { first={lazyState.first} rows={lazyState.rows} totalRecords={totalRecordsNum} onPage={onPage} onSort={onSort} sortField={lazyState.sortField} sortOrder={lazyState.sortOrder} onFilter={onFilter} filters={lazyState.filters} loading={localAsyncRequest} + header={header} emptyMessage={translationStrings.emptyMessage}> { return rowData.expirationDate ? getFormattedDateString(rowData.expirationDate) : ''; }; + const clearFilter = () => { + setLazyState({ + first: 0, + rows: 5, + page: 0, + sortField: null, + sortOrder: null, + filters: { + applicationId: { value: null, matchMode: 'equals' }, + callName: { value: null, matchMode: 'contains' }, + companyName: { value: null, matchMode: 'contains' }, + startDate: { value: null, matchMode: 'dateIs' }, + expirationDate: { value: null, matchMode: 'dateIs' }, + status: { value: null, matchMode: 'equals' } + } + }); + }; + + const renderHeader = () => { + return ( +
+
+ ); + }; + + const header = renderHeader(); + useEffect(() => { setLocalAsyncRequest(true); const paginationQuery = getPaginationQuery(); @@ -152,6 +180,7 @@ const SoccorsiInstructorManagerMioTableAsync = ({ userId = null }) => { first={lazyState.first} rows={lazyState.rows} totalRecords={totalRecordsNum} onPage={onPage} onSort={onSort} sortField={lazyState.sortField} sortOrder={lazyState.sortOrder} onFilter={onFilter} filters={lazyState.filters} loading={localAsyncRequest} + header={header} emptyMessage={translationStrings.emptyMessage}> { return rowData.expirationDate ? getFormattedDateString(rowData.expirationDate) : ''; }; + const clearFilter = () => { + setLazyState({ + first: 0, + rows: 5, + page: 0, + sortField: null, + sortOrder: null, + filters: { + applicationId: { value: null, matchMode: 'equals' }, + callName: { value: null, matchMode: 'contains' }, + companyName: { value: null, matchMode: 'contains' }, + startDate: { value: null, matchMode: 'dateIs' }, + expirationDate: { value: null, matchMode: 'dateIs' }, + status: { value: null, matchMode: 'equals' } + } + }); + }; + + const renderHeader = () => { + return ( +
+
+ ); + }; + + const header = renderHeader(); + useEffect(() => { setLocalAsyncRequest(true); const paginationQuery = getPaginationQuery(); @@ -152,6 +180,7 @@ const SoccorsiPreInstructorTableAsync = ({ userId = null }) => { first={lazyState.first} rows={lazyState.rows} totalRecords={totalRecordsNum} onPage={onPage} onSort={onSort} sortField={lazyState.sortField} sortOrder={lazyState.sortOrder} onFilter={onFilter} filters={lazyState.filters} loading={localAsyncRequest} + header={header} emptyMessage={translationStrings.emptyMessage}>