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

Allow forms to be editable i.e. load responses given a responseID #335

Open
wants to merge 2 commits into
base: 3.x
Choose a base branch
from

Conversation

holmesadam
Copy link
Contributor

Add functionality to load responses into form

Set a config for editable forms - when editable, the form stays visible

Add config for save button position

Add functionality to load responses into form

Set a config for editable forms - when editable, the form stays visible

Add config for save button position
Copy link

what-the-diff bot commented Dec 12, 2024

PR Summary

  • Configuration Update
    This PR has added new settings in the zeus-bolt.php configuration file, which will help in managing editable_forms and form_action_position_tailwind_class. This essentially makes the forms more flexible and adaptable to different needs.

  • Form Handling Enhancement
    This update has introduced a new aspect - the responseId in FillForms.php. This development is meant to manage form responses more effectively. The PR has also updated methods that handle the creation and modification of these responses, therefore streamlining the form filling process.

  • User Interface Improvement
    A remarkable improvement in this PR is the revised method of fetching existing responses in the Designer.php file. The ui method now fetches existing responses based on the responseId, improving the user experience by making it more intuitive and user-friendly.

  • Default Field Responses
    The PR has added a significant feature that sets the default value for form fields based on past responses stored. This feature in the drawFields makes it easier for users to fill out forms, especially the ones they fill frequently.

  • Notification System
    The integration of success notification for saved forms has been done, particularly when editable_forms is enabled. This gives users instant feedback on their actions, enhancing usability and user satisfaction.

@@ -63,6 +63,10 @@

'allow_design' => false,

'editable_forms' => false,

'form_action_position_tailwind_class' => 'text-center',
Copy link
Member

Choose a reason for hiding this comment

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

kind don't like this, its means have to add a config file to the tailwind css content array. currently I recommend to publish the views and edit any needed classes. especially for the FE views.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback - personally, I think having to maintain all the views for the sake of a button position is a bit excessive. Can you think of a middle ground?

Copy link
Member

Choose a reason for hiding this comment

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

I get your point
how about make it null. by default, and add text-center to the blade:
config('....','text-center')
and add a comment to remind the users to add the config file to tailwind css.

Copy link
Member

Choose a reason for hiding this comment

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

this will also assure there is no breaking change if the user didnt update the published config file

@atmonshi
Copy link
Member

this would work only after saving the form right?

this can be an issue when there is an extension, since the extension can display some data after saving the form, but with these changes, the user wont see the details after saving the form.

@holmesadam
Copy link
Contributor Author

this would work only after saving the form right?

this can be an issue when there is an extension, since the extension can display some data after saving the form, but with these changes, the user wont see the details after saving the form.

Are you able to provide an example? I currently have this working on an embedded form which also has an extension and it works fine. Note that I'm using this by embedding the form in my own view like so:

@php
    $data = [
        'resource_id' => $this->record->id,
        'resource_type' => get_class($this->record),
    ];
@endphp

<x-filament-panels::page>
    <livewire:bolt.fill-form slug="{{$this->formSlug}}" inline="true" responseId="{{$this->getResponseId()}}" :extensionData="$data" />
</x-filament-panels::page>

@atmonshi
Copy link
Member

atmonshi commented Dec 24, 2024

for example after submitting this form you will see

https://demo.larazeus.com/bolt/printer-issues/printers-department

Screenshot 2024-12-24 at 7 58 41 PM

I was about to suggest to ignore that option if there is an extension but you need it with the extension :)

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.

2 participants