From 632673541712806684b5d99467bd9c98964c0485 Mon Sep 17 00:00:00 2001 From: Vitalii Kiiko Date: Wed, 26 Feb 2025 09:27:33 +0100 Subject: [PATCH 1/2] - added pec usage data; - added stats for instructor manager dashboard; - fixed dispalying 0 in tables in numeric inputs; --- src/assets/scss/components/appPage.scss | 11 ++ .../components/NumericFormulaCell/index.js | 2 +- .../components/CriteriaTable/index.js | 14 +- .../components/NumericFormulaCell/index.js | 2 +- .../FormField/components/Table/index.js | 15 +- src/components/NotificationsSidebar/index.js | 4 +- src/helpers/getTimeFromISOstring.js | 9 ++ src/pages/BandoApplication/index.js | 8 + .../DraftApplicationsTable/index.js | 2 +- .../components/LatestBandiTable/index.js | 8 +- src/pages/Dashboard/index.js | 15 ++ .../index.js | 137 ++++++++++++++++++ src/pages/DashboardInstructorManager/index.js | 102 +++++++++---- 13 files changed, 283 insertions(+), 46 deletions(-) create mode 100644 src/helpers/getTimeFromISOstring.js create mode 100644 src/pages/DashboardInstructorManager/components/LatestBandiTableInstructorManager/index.js diff --git a/src/assets/scss/components/appPage.scss b/src/assets/scss/components/appPage.scss index 4ed00a3..a07df79 100644 --- a/src/assets/scss/components/appPage.scss +++ b/src/assets/scss/components/appPage.scss @@ -159,6 +159,11 @@ opacity: 0.8; } + &.danger { + border-color: var(--message-error-color); + background-color: #ffd0d0; + } + h2 { color: var(--global-textColor); font-size: 21px; @@ -168,6 +173,12 @@ margin: 0; } + &.danger { + p, span { + color: var(--message-error-color); + } + } + .row { display: flex; gap: 1rem; diff --git a/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js b/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js index 75f3b3a..7ededbe 100644 --- a/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js +++ b/src/components/FormField/components/CriteriaTable/RenderTable/components/NumericFormulaCell/index.js @@ -15,7 +15,7 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) return ( onChange(e.value)} onFocus={onFocus} minFractionDigits={0} diff --git a/src/components/FormField/components/CriteriaTable/index.js b/src/components/FormField/components/CriteriaTable/index.js index f965321..0b34a78 100644 --- a/src/components/FormField/components/CriteriaTable/index.js +++ b/src/components/FormField/components/CriteriaTable/index.js @@ -120,12 +120,14 @@ const Table = ({ ? * : null} {tableValue - ? : null} + ?
+ +
: null} ) } diff --git a/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js b/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js index 75f3b3a..7ededbe 100644 --- a/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js +++ b/src/components/FormField/components/Table/RenderTable/components/NumericFormulaCell/index.js @@ -15,7 +15,7 @@ const NumericFormulaCell = ({ getValue, row: { index }, column: { id }, table }) return ( onChange(e.value)} onFocus={onFocus} minFractionDigits={0} diff --git a/src/components/FormField/components/Table/index.js b/src/components/FormField/components/Table/index.js index 62d71de..8edd2d7 100644 --- a/src/components/FormField/components/Table/index.js +++ b/src/components/FormField/components/Table/index.js @@ -170,12 +170,15 @@ const Table = ({ ? * : null} {rows - ? : null} + ?
+ +
+ : null} {!isEmpty(columns) && !shouldDisableNewRows ?
{__('Aggiungi una riga', 'gepafin')} diff --git a/src/components/NotificationsSidebar/index.js b/src/components/NotificationsSidebar/index.js index 8d5e7b3..52dc69a 100644 --- a/src/components/NotificationsSidebar/index.js +++ b/src/components/NotificationsSidebar/index.js @@ -257,7 +257,9 @@ const NotificationsSidebar = () => { }; useEffect(() => { - fetchMessages(); + if (userData && userData.id) { + fetchMessages(); + } }, [chosenCompanyId, userData.id, isConnected]); useEffect(() => { diff --git a/src/helpers/getTimeFromISOstring.js b/src/helpers/getTimeFromISOstring.js new file mode 100644 index 0000000..ea08f7d --- /dev/null +++ b/src/helpers/getTimeFromISOstring.js @@ -0,0 +1,9 @@ +const getTimeFromISOstring = ( + value, + options = { + hour: 'numeric', minute: 'numeric' + }) => { + return value ? Intl.DateTimeFormat('it-IT', options).format(new Date(value)) : value; +} + +export default getTimeFromISOstring; \ No newline at end of file diff --git a/src/pages/BandoApplication/index.js b/src/pages/BandoApplication/index.js index 6f5cf0f..cdf52c3 100644 --- a/src/pages/BandoApplication/index.js +++ b/src/pages/BandoApplication/index.js @@ -64,6 +64,7 @@ const BandoApplication = () => { const [signedPdfFile, setSignedPdfFile] = useState([]); const [isRequestForApplData, setIsRequestForApplData] = useState(false); const isAsyncRequest = useStore().main.isAsyncRequest(); + const previousStatus = useRef(''); const toast = useRef(null); const formMsgs = useRef(null); const { @@ -578,6 +579,13 @@ const BandoApplication = () => { }, [formValues]); useEffect(() => { + if (previousStatus.current === applicationStatus || (previousStatus.current !== applicationStatus && isEmpty(previousStatus.current))) { + previousStatus.current = applicationStatus; + return; + } else { + previousStatus.current = applicationStatus; + } + if ('DRAFT' === applicationStatus && !isRequestForApplData) { const applId = getApplicationId(); diff --git a/src/pages/Dashboard/components/DraftApplicationsTable/index.js b/src/pages/Dashboard/components/DraftApplicationsTable/index.js index 629106c..24b093f 100644 --- a/src/pages/Dashboard/components/DraftApplicationsTable/index.js +++ b/src/pages/Dashboard/components/DraftApplicationsTable/index.js @@ -126,7 +126,7 @@ const DraftApplicationsTable = () => { }; const actionsBodyTemplate = (rowData) => { - return + return
+ ); + }; + + const dateStartBodyTemplate = (rowData) => { + const startTimeObj = getTimeParsedFromString(rowData.startTime); + return formatDate(rowData.start_date) + ' ' + getTimeFromISOstring(startTimeObj); + }; + + const dateEndBodyTemplate = (rowData) => { + const endTimeObg = getTimeParsedFromString(rowData.endTime); + return formatDate(rowData.end_date) + ' ' + getTimeFromISOstring(endTimeObg); + }; + + const dateFilterTemplate = (options) => { + return options.filterCallback(e.value, options.index)} dateFormat="mm/dd/yy" placeholder="mm/dd/yyyy" mask="99/99/9999" />; + }; + + const statusBodyTemplate = (rowData) => { + return ; + }; + + const actionsBodyTemplate = (rowData) => { + return +