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

Implement setting pdfLayoutName for a layoutSet #12829

Closed
3 tasks
Tracked by #10759
nkylstad opened this issue May 21, 2024 · 17 comments · Fixed by #13512 or Altinn/altinn-studio-docs#1814
Closed
3 tasks
Tracked by #10759

Implement setting pdfLayoutName for a layoutSet #12829

nkylstad opened this issue May 21, 2024 · 17 comments · Fixed by #13512 or Altinn/altinn-studio-docs#1814
Labels
kind/user-story Used for issues that describes functionality for our users. ux UX help needed

Comments

@nkylstad
Copy link
Member

nkylstad commented May 21, 2024

Description

Default PDF print layout uses the summary-mode for all existing layout-files. However, it is possible to define a custom PDF layout for a given layoutset.
To do this, an app developer must set the pdfLayoutName property in Settings.json for the layoutset to the desired layout-name.
This is something we should support setting in Studio.

Additional Information

Suggested approach is to add a new config panel section "PDF", as already specified in the latest sketches for the forms editor config panel. And then add a switch to that panel for page/layout settings, allowing user to set the selected layout as pdfLayoutName. See acceptance criteria section for more details on suggested solution.
@Annikenkbrathen can you take a look?

Tasks

Tasks

Preview Give feedback

Acceptance Criterias

  • A "PDF" section is available for layouts, containing a switch that allows app developer to set the selected layout to pdfLayoutName.
  • Turning on the switch for the selected layout should set the pdfLayoutName in the current layoutset's Setting.json file to the selected layout name.
  • Turning off the switch for a layout that is set as pdfLayoutName should remove the pdfLayoutName property from the Settings.json file
  • It should not be possible to set the pdfLayoutName property for multiple layouts.
  • If the pdfLayoutName property is set for a layout that is not the selected layout, the switch should be disabled, and app developer should be informed of which layout has been set as pdfLayoutName.
@nkylstad nkylstad added kind/user-story Used for issues that describes functionality for our users. status/draft Status: When you create an issue before you have enough info to properly describe the issue. labels May 21, 2024
@Ildest
Copy link
Contributor

Ildest commented May 28, 2024

Reviewed this case - will ask for more information tomorrow in refinement before we proceed.

@nkylstad nkylstad added the status/ready-for-specification Status: Used for issues that are ready for functional decription og detailed design. label May 29, 2024
@wrt95 wrt95 added ux UX help needed and removed status/ready-for-specification Status: Used for issues that are ready for functional decription og detailed design. status/draft Status: When you create an issue before you have enough info to properly describe the issue. labels Jun 12, 2024
@standeren standeren moved this to 📈 Todo in Team Studio Jun 17, 2024
@standeren
Copy link
Contributor

After a short discussion with Team Apps a suggestion is to only move (and not duplicate) the layout from order to pdfLayoutName in the settings file when setting a layout as the PDF. Also, we should consider adding the component InstanceInformation at the top of the layout automatically when the layout is transformed to a PDF.

Open question; should there be a create PDF-layout button instead of setting a predefined layout as the PDF? Feels more natural? If we still wish to support setting a predefined layout as the PDF, maybe the button for creating a PDF should be an option in addition? @ux @Annikenkbrathen

@Annikenkbrathen
Copy link

Not sure if I understood this correctly. Are you suggesting that it should be possible to chose predefined layoutset as PDF? Is this something you can do in the Process level, when creating a new layout? Could this be something you dragged in the BPMN? Or should you have the opportunity to chose a layoutset and then add as PDF in the settings with a button for example?

I'm not entirely sure which settings you need to configure and where, I notice.

@standeren
Copy link
Contributor

There is only a single layout from a layoutset that can be set as a PDF for that particular layoutset. This is the case since the apps are generating separate PDFs for each data task in the process.
So in my suggestion I imagine a PDF accordion being visible in the process config-panel for those tasks that have connected layoutsets to them. And inside the PDF accordion there is maybe som information on what will be the autogenerated PDF if you not wish to make your own. And a button to add a dedicated PDF layout (which will create a new, empty layout in the lage-page that is listed below the other layouts and maybe in a different color or with a PDF icon as @framitdavid suggested and with a auto-added InstanceInformation component). Below that button I imagine a text that tells you to assign one of your existing layouts as a PDF and a select dropdown with all the layouts to select from. Doing this will move the layoutname from order to pdfLayoutName in Settings file and visualize the layout in the same way in Lage-page as when adding a new, empty one, except in this case the PDF-layout will contain all the components as the layout originally did including the InstanceInformation component at the top.

We will also need to display different options after assigning a layout as the PDF;

  1. Delete the PDF-layout completely --> which will delete the layout from the layouts folder and remove the pdfLayoutName property in the Settings file
  2. Convert the PDF layout back to a regular layout --> which will not delete the layout from the layouts folder, but only remove the pdfLayoutName property in the Settings file and move the layout-name back to order in the settings file

Hope it make sense 😅 And again, not sure that process is the best place to have this setting, but my intuition says so for now 😅

@standeren
Copy link
Contributor

@nkylstad
@Annikenkbrathen and I also discussed wether the PDF-configs on component-level should be disabled for all other layouts than the designated PDF-layout if there is a designated PDF-layout. Any thoughts about that? 😊

@standeren
Copy link
Contributor

New suggestion is to separate all these pdf-related actions.

The add new, empty designated PDF is suggested to be a button below the Legg til ny side in Lage-siden for a layoutset.

  • when pressing it you see a input tex field to assign a name and information of what this means; default PDF genereated from ALL layouts in the set will no longer be generated, and potential layouts that are added to the excludeFromPdf will be meaningless.
  • Include options when deleting the PDF layout --> 1 og 2 mentioned above

While the excludeFromPdf and Assign existing layout as only designated PDF kan be switches in the page config panel under a PDF accordion. Setting the particular layout as pdf will move it visually to a PDF at the bottom of the layouts and the excludefromPDF will be disabled. Also, all other layouts will now show disabled excludeFromPdf switches and information that selecting this layout as a PDF will disable a current PDF layout (delete the current or convert it back to layout?)

This section can also include what components from the layout to exclude from pdf. These will ba added to the array of all components from the layoutset in the settingsfile to exclude from pdf.

@standeren standeren self-assigned this Jun 20, 2024
@standeren standeren moved this from 📈 Todo to 👷 In Progress in Team Studio Jun 21, 2024
@standeren standeren moved this from 👷 In Progress to ⚠️ Blocked in Team Studio Jun 26, 2024
@Annikenkbrathen
Copy link

Annikenkbrathen commented Jul 2, 2024

(Disussion points since we cancelled the meeting @framitdavid @nkylstad @bjosttveit @Edavda @RonnyB71 @Magnusrm @standeren )

After looking deeper into the issue, we got some questions that need to be discussed:

  • Is it desired to be able to create an empty PDF page where you can add your own content independently of what you have in the layout set? If so, why is this desired?
    Skjermbilde 2024-07-02 kl  12 26 58

  • We were also a bit uncertain about the need to "convert" a page from a regular form page to a PDF. Is there a point when we have the option to create an empty PDF page from the start? (It might be useful if someone started in the wrong place, but is that the only reason?)
    Skjermbilde 2024-07-02 kl  12 25 12

Skjermbilde 2024-07-02 kl  12 25 23

  • Can we implement a feature to copy the content from the layout set (the components from the pages) and choose which ones should be displayed/not displayed in the new custom PDF, then convert it to a PDF and continue adding new components? Here we believe there might be a need to display some content from the layout set in the PDF, but also add custom content, for example.

Skjermbilde 2024-07-02 kl  12 24 18

  • How do the users know that they want to create a custom PDF without having seen what is auto-generated by us?
    We see that it is possible to preview the PDF in the iframe under the tool panel for app preview. Is this a function we can get in Studio as well? That we can add a button that does the same, or opens their preview?
    Skjermbilde 2024-07-02 kl  12 22 50

Skjermbilde 2024-07-02 kl  12 28 16

From our side, we see two ways to solve custom PDF:

We believe that the first one will be the most user-friendly and useful based on the advantages we can see and the cases we can think of. You might have different insights🤔

  1. PDF settings is a dedicated area at the layoutset level where you set up what you want to include before you convert it to a new PDF page.
    Skjermbilde 2024-07-02 kl  12 26 10

  2. Ability to set up everything at the page level. You can either convert an existing page to a PDF, that is a copy of all the components, then edit it as you want by removing and adding new components like a regular page. Should you then be able to convert more than one page to the same PDF to have full flexibility?
    And can you chose too add a PDF page that is empty instead?

Skjermbilde 2024-07-02 kl  12 34 51
Skjermbilde 2024-07-02 kl  12 34 40

Both solutions should include the possibility to see the auto-generated PDF.

@Annikenkbrathen Annikenkbrathen moved this to På vent⌛ in Design Altinn 3 Jul 2, 2024
@nkylstad
Copy link
Member Author

nkylstad commented Aug 6, 2024

Is it desired to be able to create an empty PDF page where you can add your own content independently of what you have in the layout set? If so, why is this desired?

Probably not, although there might be a wish for some informative texts in the receipt PDF that are not there in the form pages. I'm sure someone from team apps might have some more insight here, but my understanding is that most of the content will still be summary-components referring to components within the layoutset. So the only addition I see is informative texts, and possibly having a different order/grouping of components. Apart from this, setting components/pages to be excluded from PDF might be enough.

We were also a bit uncertain about the need to "convert" a page from a regular form page to a PDF. Is there a point when we have the option to create an empty PDF page from the start? (It might be useful if someone started in the wrong place, but is that the only reason?)

Again probably not. I think this "need" came from the payment task layout. But being able to copy content into the PDF layout as suggested would cover that nicely.

Can we implement a feature to copy the content from the layout set (the components from the pages) and choose which ones should be displayed/not displayed in the new custom PDF, then convert it to a PDF and continue adding new components? Here we believe there might be a need to display some content from the layout set in the PDF, but also add custom content, for example.

That would be cool! Maybe something we could delay to a second iteration of this, depending on how far Team Apps have come with the new summary component - my understanding is that that component could take over some of this functionality. Someone from team apps would need to comment on that.

How do the users know that they want to create a custom PDF without having seen what is auto-generated by us?
We see that it is possible to preview the PDF in the iframe under the tool panel for app preview. Is this a function we can get in Studio as well? That we can add a button that does the same, or opens their preview?

Agreed. Some button to open it directly, or at the very least a shortcut to open it in preview, would be a great feature!

From our side, we see two ways to solve custom PDF:

I definitely prefer option 1 here as well!

@Annikenkbrathen
Copy link

We're waiting for a demo of Summary 2.0 from the apps team before we decide how to solve it.

@framitdavid
Copy link
Collaborator

framitdavid commented Sep 9, 2024

@standeren I suggest we meet later this week to split this issue into multiple parts and clarify our needs, to simplify the implementation process (implement it more step-by-step). We talk short about it on sprint plan today.

@framitdavid
Copy link
Collaborator

framitdavid commented Sep 9, 2024

Let's keep it simple and stupid for now. Let's just make it possible to mark a page within a layout set as a PDF page. When the user opens another page and clicks on the "use as pdf", then we can display f.ex "Page 3 is already added as PDF page, do you want to change to this page". 😊 Suggest that we add a pdf-icon to the page accordion if the page is marked as pdf-page.

If our user needs more features, let's implement that when we know more about the use cases.

@framitdavid framitdavid moved this from ⚠️ Blocked to 👷 In Progress in Team Studio Sep 9, 2024
@standeren standeren linked a pull request Sep 9, 2024 that will close this issue
3 tasks
@standeren standeren removed their assignment Sep 13, 2024
@Annikenkbrathen
Copy link

Good suggestion @framitdavid !👏🏻In addition, can we open an issue to look into the preview button? I still think it's important to allow users to see how the PDF will look, both for the general PDF and when a page is added as a PDF

@standeren standeren removed their assignment Sep 19, 2024
@nkylstad nkylstad self-assigned this Sep 19, 2024
@nkylstad
Copy link
Member Author

Tested OK:

  • Converting an existing form page to PDF, with no previous PDF set.
  • Converting an existing PDF page back to form page.
  • Converting an existing form page to PDF when another PDF is already set

Tested not OK:

  • Deleting the page that is set as PDF layout results in an error message (looks like a missing null handling):
    Screenshot 2024-09-23 at 08 23 23
    Screenshot 2024-09-23 at 08 23 45

    • Deleting regular form pages works as expected.
  • Adding a new page, then converting that page to PDF.

    • Visually nothing happens, though it seems like the settings are set correctly. Reloading the page updates the visual changes as expected.
Screen.Recording.2024-09-23.at.08.28.47.mov
  • This also happens after making changes to the added layout, like adding and configuring components.
  • Reloading after adding the new page, before making in into PDF, solves the problem.

One other feedback I have is that I would have liked more information about what setting this setting means. Perhaps just a description or something explaining what the button does. That is something we could create a separate issue to follow up on.

@nkylstad nkylstad assigned standeren and unassigned nkylstad Sep 23, 2024
@Annikenkbrathen
Copy link

After just watching the video, I felt that the interaction with a button and button text wasn’t very clear in terms of understanding the functionality. This is typically a case where it would make more sense to use a toggle switch, since you're turning a setting on or off. Gørild and I once looked at how we could place such a switch inside a card in a task in the settings modal. That way, we have the opportunity to provide more description of what happens when you toggle it on or off.
Skjermbilde 2024-09-24 kl  09 00 37

Should I create a UX/text-content issue for this?

@standeren
Copy link
Contributor

Should I implement that new design in this PR then? 🙈
Functionalitywise the PR should be good to be retested now, btw @nkylstad

@standeren standeren assigned nkylstad and unassigned standeren Sep 24, 2024
@nkylstad
Copy link
Member Author

Should I implement that new design in this PR then? 🙈

Let's follow our own guidelines and do that in a separate PR, to avoid large and long reviews 😄
I guess you could re-open this issue once we merge the PR and move it back to in progress and attach a new PR to it,
Will re-test functionality once dev is available!

@nkylstad
Copy link
Member Author

Re-tested all points:

Still tested OK:

  • Converting an existing form page to PDF, with no previous PDF set.
  • Converting an existing PDF page back to form page.
  • Converting an existing form page to PDF when another PDF is already set

This is now tested OK, works as expected with no error messages:

  • Deleting the page that is set as PDF layout [...]

This is still an issue, nothing happens visually when adding a new page and then converting it to PDF.

  • Adding a new page, then converting that page to PDF.

    • Visually nothing happens, though it seems like the settings are set correctly. Reloading the page updates the visual changes as expected.

Functionally this is not super critical, as the settings are set correctly, and the text on the button is in fact updated, even though the page is not moved to the bottom as I would expect. I suggest we merge this feature now, and create a follow-up issue to fix this visual problem 😊 Do you agree @standeren?

@github-project-automation github-project-automation bot moved this from 🧪 Test to Documentation in Team Studio Oct 2, 2024
@nkylstad nkylstad removed their assignment Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/user-story Used for issues that describes functionality for our users. ux UX help needed
Projects
Status: På vent⌛
Archived in project
7 participants