Skip to content

feat: added edit functionality for demand dialog#1028

Merged
tom-rm-meyer-ISST merged 13 commits intoeclipse-tractusx:feat/edit-modalsfrom
Akash-IAV:feat/demand-update
Jan 6, 2026
Merged

feat: added edit functionality for demand dialog#1028
tom-rm-meyer-ISST merged 13 commits intoeclipse-tractusx:feat/edit-modalsfrom
Akash-IAV:feat/demand-update

Conversation

@Akash-IAV
Copy link
Copy Markdown
Contributor

@Akash-IAV Akash-IAV commented Oct 17, 2025

Description

resolves #1009

Pre-review checks

Please ensure to do as many of the following checks as possible, before asking for committer review:

  • DEPENDENCIES are up-to-date. Dash license tool. Committers can open IP issues for restricted libs.
  • Copyright and license header are present on all affected files
  • If helm chart has been changed, the chart version has been bumped to either next major, minor or patch level (compared to released chart).

<FormLabel sx={{ marginBottom: '.5rem', display: 'block' }}>Day*</FormLabel>
<div className="date-picker" data-testid="demand-day-field">
<Datepicker
id="day"
Copy link
Copy Markdown
Contributor Author

@Akash-IAV Akash-IAV Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tom-rm-meyer-ISST ,
I have implemented the Edit functionality for the Demand modal, similar to how it works for the Stock modal.
All required fields are set as editable, based on the specifications mentioned in the ticket, and the functionality is working as expected.

However, I’m encountering an issue with the Day field:

  • The API response does return a value for day, but for some reason, it’s not being patched into the form when attempting to edit a specific record.
  • I’ve already collaborated with a colleague and we’ve tried multiple approaches to resolve it, but the issue persists.

If you have any suggestions or can assist in looking into this issue, it would be greatly appreciated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tom,
We are using : import { DateType, Datepicker } from '@catena-x/portal-shared-components'; for the date and time handling.
After reviewing the Catena-X Datepicker implementation, we noticed that it maintains its own internal state
and only initializes that state from the defaultvalue prop using an internal useEffect. Because of this design, the value prop passed from the parent component is ignored during the initial render.
For ex (current code):
<Datepicker value={date?.toISOString().split('T')[0]} /> does not prefill the date properly on mount, since the component never updates its internal state based onthe value prop.

During our R&D, we observed that using defaultvalue (instead of value ) allows the date to prefill correctly on initial render. It appears that the Datepicker expects defaultvalue for initialization and only becomes responsive to user changes after that.
Below are the changes we applied:
function formatDateYYYYMMDD(date: string | Date): string {
if(typeof date === "string" ){
return date.split('T')[0];
}
const d = date;
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, "0");
const day = String(d.getDate()).padStart(2, "0");
return ${year}-${month}-${day};
}

const formattedDefault = useMemo(() => {
if (!value) return undefined;
return new Date(formatDateYYYYMMDD(value));
}, [value]);

return (
    <Stack width="100%">
        <FormLabel>{props.label}</FormLabel>
        <div className="date-time-picker">
            <Box display="flex" gap=".25rem" width="100%" marginTop="auto">
                <Box display="flex" flexGrow="1" sx={{ '& .MuiFormControl-root, & .MuiBox-root': { minWidth: '100% !important' } }}>
                    <Datepicker
                        {...props}
                        error={error}
                        // value={date?.toISOString().split('T')[0]}
                        defaultValue={formattedDefault} --> new Code 
                        readOnly={false}
                        onChangeItem={(event) => handleDateChange(event)}
                    />
                </Box>

I have tested this locally, and it works fine - the date now prefills correctly on initial render and updates properly when changed.
Please review these changes and let me know if you have any additional suggestions or alternative
approaches.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the investigation! I don't see the need for the formatting. Using the defaultValue only works fine in the modal during local test.

@tom-rm-meyer-ISST tom-rm-meyer-ISST linked an issue Nov 12, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@tom-rm-meyer-ISST tom-rm-meyer-ISST left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work!

Please merge the feature branch / rebase.

Please recheck your license headers:

  • ADD IAV 2025 as copyright holder to changed files.
  • ADD only IAV, contributors to EF 2025 as copyright holder to new files.

Some other findings you can see via comments - thanks in advance!

Comment thread frontend/src/features/material-details/components/DemandCategoryCreationModal.tsx Outdated
Comment thread frontend/src/features/material-details/components/DemandCategoryCreationModal.tsx Outdated
Comment thread frontend/src/features/material-details/components/DemandCategoryCreationModal.tsx Outdated
<FormLabel sx={{ marginBottom: '.5rem', display: 'block' }}>Day*</FormLabel>
<div className="date-picker" data-testid="demand-day-field">
<Datepicker
id="day"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the investigation! I don't see the need for the formatting. Using the defaultValue only works fine in the modal during local test.

Comment thread frontend/src/contexts/dataModalContext.tsx Outdated
@Akash-IAV
Copy link
Copy Markdown
Contributor Author

Hi @tom-rm-meyer-ISST,

Thanks for the detailed review and comments. As suggested, I have made the changes and committed them in this branch. I request you to kindly review the updates and let me know if anything further is required.

Copy link
Copy Markdown
Contributor

@tom-rm-meyer-ISST tom-rm-meyer-ISST left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered comment, checked rest. If you incorporate that small change as proposed, I gonna merge.

sorry for delays. If you're out, please let me know. Then I merge and do the rest myself on the feature branch

Copy link
Copy Markdown
Contributor

@tom-rm-meyer-ISST tom-rm-meyer-ISST left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot!

@tom-rm-meyer-ISST tom-rm-meyer-ISST changed the title Implemented Edit functionality for Demand dialog feat: added edit functionality for demand dialog Jan 6, 2026
@tom-rm-meyer-ISST tom-rm-meyer-ISST merged commit dc70b36 into eclipse-tractusx:feat/edit-modals Jan 6, 2026
11 checks passed
tom-rm-meyer-ISST added a commit that referenced this pull request Jan 7, 2026
* feat: implemented update logic for deliveries (#1004)

* feat: implemented update logic for deliveries

* fix: bug in validation logic

* fix: improved feedback for invalid inputs

* fix: arrival-type validations

* feat(material details view): add edit functionality for stock modals (#1026)

* Implemented Edit functionality for Stock dialog

* updated entry in changelog

* 1022 PR (Edit stock Modal)  changes

* Removed mode from dataModal for Stock

* resolved quantity update issue for stock modal

* resolved update quantity stock issue

* feat: added edit functionality for demand dialog (#1028)

* Added Edit functionality for Demand modal

* Added entry for demand modal

* Demand modal Date patched changes

* Implemented edit functionality for Stock modal

* resolved quantity update issue for demand modal

* Revert "Implemented edit functionality for Stock modal"

This reverts commit 53b4b44.

* Revert "feat(material-details view): added material no. (#1005)"

This reverts commit 13a5488.

* PR #1028 review changes

* Fixed date patch issue

* Hide edit for reported demand

* feat: add edit functionality for production modal (#1037)

* Implemented edit functionality for Production modal

* Added entry for production modal in changelog

* Typo correction

* Made PR1037 review changes

* Hide edid for reported productions

* chore: fix merge faults

* fix: don't allow editation for reported stocks

* docs(user guide): added update modal features (#1070)

* chore: correct IAV company name in license header

---------

Co-authored-by: René Schröder <131770181+ReneSchroederLJ@users.noreply.github.com>
Co-authored-by: Akash-IAV <extern.akash.pandit@iav.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Story] Implement editing for demand information

2 participants