Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing entity type of PublicFormConfig breaks the configured fields #2770

Closed
sleidig opened this issue Jan 3, 2025 · 6 comments · Fixed by #2815
Closed

Changing entity type of PublicFormConfig breaks the configured fields #2770

sleidig opened this issue Jan 3, 2025 · 6 comments · Fixed by #2815
Assignees

Comments

@sleidig
Copy link
Member

sleidig commented Jan 3, 2025

          @sleidig @Abhinegi2 In the (child/school/notes)entity, "edit data structure," where the list of all public forms is available, the entity field should be non-editable. 
image Keeping the entity field editable, messes up the configuration of the field in public forms. image What do you think?

Originally posted by @george-neha in #2708 (comment)

@Abhinegi2
Copy link
Contributor

@sleidig and @george-neha Below are a few suggestions that come to my mind, go through these and let me know which one looks good and if you have any other approach/suggestion also let me know

1 Disable Entity Type After Creation

  • When creating a new Public Form (PF), display an explanation near the entity type selection field:
    "Once the Public form is created/saved, you cannot change the entity type later."
  • After saving, the entity type field becomes disabled in edit mode.
  • If a user wants to change the entity type later, they would need to delete the form and create a new one from scratch. This involves re-entering details like the title, description, logo, fields, and prefilled values.
    (it can be a time-consuming process for users)

2 Allow Changing Entity Type with Confirmation dialog

  • Allow users to change the entity type even after saving.
  • Display a confirmation dialog/popup when the user changes an entity type:
    "Are you sure you want to change the entity type? This action will remove all existing fields, and you will need to add new fields specific to the new entity type."
  • If the user confirms, the system removes the current fields, and the user needs to add fields for the new entity type.
    (focuses on user convenience with clear warnings about the implications of changing the entity type)

@sleidig
Copy link
Member Author

sleidig commented Jan 22, 2025

As discussed in the team, we'll go for making the "entity" type selection field read-only after it has been initially set.

@Abhinegi2 , I am not sure how you can best implement that within our EntityForm framework ... Maybe we could implement a "Validator" (similar to uniqueIdValidator) that both invalidates any changes and also, as a side effect, disables the FormControl?

@Abhinegi2 Abhinegi2 moved this from Planned (current "sprint") to In Progress in All Tasks & Issues Jan 23, 2025
@Abhinegi2 Abhinegi2 moved this from In Progress to Planned (current "sprint") in All Tasks & Issues Jan 23, 2025
@Abhinegi2 Abhinegi2 moved this from Planned (current "sprint") to In Progress in All Tasks & Issues Jan 27, 2025
@Abhinegi2
Copy link
Contributor

Thanks for the suggestion, I’ll proceed with the following:

  • Add a new "readonlyValidator" component similar to the existing uniqueIdValidator.
  • Integrate "readonlyValidator" into the DynamicValidatorsService, so it can be applied dynamically to form controls within the EntityForm framework.
  • Update the EntityForm logic to integrate the readonlyValidator for the entity type fields.

@Abhinegi2
Copy link
Contributor

@george-neha, could you please test the following on the: https://pr-2815.aam-digital.net/

  • Verify that the Entity Type field becomes disabled/read-only after a value is set.
  • Similarly, ensure that the Name and Center fields are disabled/read-only once their initial values are set in the Child entity.

@Abhinegi2 Abhinegi2 moved this from In Progress to Functional Review in All Tasks & Issues Jan 28, 2025
@george-neha
Copy link

george-neha commented Jan 28, 2025

@Abhinegi2 Can you grey out the Entity/Name/Centre field to give the impression that the fields are non-editable?

Image Image

@Abhinegi2
Copy link
Contributor

@george-neha implemented the suggestion have a look now on the: https://pr-2815.aam-digital.net/

@george-neha george-neha moved this from Functional Review to Technical Review in All Tasks & Issues Jan 29, 2025
@sleidig sleidig moved this from Technical Review to In Progress in All Tasks & Issues Jan 29, 2025
@sleidig sleidig moved this from In Progress to Done in All Tasks & Issues Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants