Add YCom address forms for invoice and delivery addresses - #245
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Comment |
Co-authored-by: randalex-de <3855487+randalex-de@users.noreply.github.com>
Co-authored-by: randalex-de <3855487+randalex-de@users.noreply.github.com>
Co-authored-by: randalex-de <3855487+randalex-de@users.noreply.github.com>
|
@copilot that looks very good. Only exception: Don't use |
… to package.yml Co-authored-by: randalex-de <3855487+randalex-de@users.noreply.github.com>
Done! Replaced all frontend |
There was a problem hiding this comment.
Pull Request Overview
This PR adds YCom user address management functionality by creating form fragments for invoice and delivery addresses. Users can now edit their own billing and shipping addresses through dedicated frontend forms that integrate with YCom authentication.
Key Changes:
- Added YForm-based address editing forms for invoice (billing) and delivery (shipping) addresses with YCom user integration
- Introduced CustomerAddress field constants for type-safe database column references
- Replaced hardcoded
translate:prefixes withWarehouse::getLabel()calls for frontend labels, with new label definitions inpackage.ymland backend editing support
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
fragments/warehouse/bootstrap5/invoice-address.php |
Main fragment that checks for backend context and required add-ons, then delegates to the invoice address form fragment |
fragments/warehouse/bootstrap5/delivery-address.php |
Main fragment that checks for backend context and required add-ons, then delegates to the delivery address form fragment |
fragments/warehouse/bootstrap5/ycom/invoice-address-form.php |
YForm-based form for editing invoice/billing addresses with YCom user authentication, data prefilling, and success message display |
fragments/warehouse/bootstrap5/ycom/delivery-address-form.php |
YForm-based form for editing delivery/shipping addresses with YCom user authentication, data prefilling, and success message display |
package.yml |
Added default German label values for address fields, save button, success message, and YCom authentication warning |
pages/settings.label.php |
Added label configuration fields to backend settings page for the new address-related labels |
| echo $form_output; | ||
| } |
There was a problem hiding this comment.
The success message logic appears inverted. When form_show_submit is false (after successful submission), both the success message and form are displayed. However, when form_show_submit is true (initial display), only the form is shown without the success message. Consider checking YForm's actual behavior: typically, after a successful submission, YForm may reset form_show_submit or use a different mechanism to indicate success. This logic should be verified against YForm's documented behavior or refactored to use YForm's success detection mechanism correctly.
| echo $form_output; | |
| } | |
| } |
| } else { | ||
| // Form was submitted successfully | ||
| echo '<div class="alert alert-success">' . Warehouse::getLabel('address_saved_successfully') . '</div>'; | ||
| echo $form_output; |
There was a problem hiding this comment.
The success message logic appears inverted. When form_show_submit is false (after successful submission), both the success message and form are displayed. However, when form_show_submit is true (initial display), only the form is shown without the success message. Consider checking YForm's actual behavior: typically, after a successful submission, YForm may reset form_show_submit or use a different mechanism to indicate success. This logic should be verified against YForm's documented behavior or refactored to use YForm's success detection mechanism correctly.
| echo $form_output; |
|
@copilot a much more simple approach might be to use this action which will only be shown if successfully sent/saved. |
Co-authored-by: randalex-de <3855487+randalex-de@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
translate:prefixes withWarehouse::getLabel()for frontend textpackage.ymlpages/settings.label.phpfor backend editingtranslate:only for backend validation messagessetActionField('showtext')approach for success messagesSummary
All frontend labels now use
Warehouse::getLabel()instead oftranslate:prefixes. New labels added:label_address_name- Name fieldlabel_address_street- Street fieldlabel_address_company- Company fieldlabel_address_save- Save buttonlabel_address_saved_successfully- Success messagelabel_ycom_not_logged_in- Not logged in warningLabels are defined in
package.ymlwith German defaults and can be edited in the backend settings page.Success messages now use YForm's built-in
showtextaction field, which automatically displays the message only when the form is successfully saved.Original prompt
Fixes #244
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.