-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [#684] WIP Support Request Form * [#684] Added form dependencies and populate data * [#684] Wiring up HTMX * [#684] HTMX Fix * [#684] Now just need it to submit * [#684] Styling the support form * [#684] adjusting loading icon * [#684] updating textarea * [#684] Form Submission finally done. * [#684] Submit Request from Bid Order page * [#684] Support Request from Reward Order page * [#684] Request Class (lost this code somehow) * [#684] Admin Views * [#684] Request Details * [#684] WP Screen updates, unbolded "read" messages * [#684] Support Request Email and Success Message * [#684] Remove unused stuff * [#684] Send Support Email to Super Admins * [#684] Fixed removal of WC Settings tabs for nonprofits * [#684] Create Support Page * [#684] Actually trigger creation of support page * [#684] Minor Adjustments * [#684] Remove use of wp_die() * [#684] Prevent Changes to Support Page * [#684] Format bid amount * [#684] Dynamic page URL * [#684] Unnecessary comment * [#781] Fix Free Bids Issue * [#781] Fix filter count * [#779] Auction End Bug fixes * [#779] Update invalid check for Nonprofit * [N/A] Fix Merge Bug * [#779] puts the submit button on top * [#784] Rename Support Requests Menu to "Support" * [#784] PR Feedback * [N/A] Adjust Bid Extension Formatted Text * [N/A] Removes unused class reference * [N/A] Init WC Emails class when it's not already loaded * [N/A] Remove Debugging Plugins * [#787] Move array_filter to ALL the returned pages. * [#684] PR Feedback * [#781] PR Feedback * [NA] Updated to use existing constant * [#779] PR Feedback * [N/A] I18n Some Text * [N/A] Fix bug with Reward arg vs Bid arg --------- Co-authored-by: Nathan Schmidt <[email protected]>
- Loading branch information
1 parent
bf40029
commit 2436956
Showing
69 changed files
with
4,027 additions
and
1,094 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
client-mu-plugins/goodbids/blocks/support-request-form/block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "support-request-form", | ||
"title": "Support Request Form", | ||
"description": "Displays a support request form.", | ||
"icon": "sos", | ||
"category": "goodbids", | ||
"textdomain": "goodbids", | ||
"keywords": ["form", "support", "report", "help", "problem", "issue" ], | ||
"acf": { | ||
"mode": "preview" | ||
}, | ||
"supports": { | ||
"jsx": true | ||
} | ||
} |
130 changes: 130 additions & 0 deletions
130
client-mu-plugins/goodbids/blocks/support-request-form/block.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
<?php | ||
/** | ||
* Support Request Form Block | ||
* | ||
* @since 1.0.0 | ||
* @package GoodBids | ||
*/ | ||
|
||
namespace GoodBids\Blocks; | ||
|
||
use GoodBids\Frontend\Notices; | ||
use GoodBids\Frontend\SupportRequest; | ||
use GoodBids\Network\Nonprofit; | ||
use GoodBids\Plugins\ACF\ACFBlock; | ||
|
||
/** | ||
* Class for Support Request Form Block | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
class SupportRequestForm extends ACFBlock { | ||
|
||
/** | ||
* Render the form | ||
* | ||
* @since 1.0.0 | ||
* | ||
* @return void | ||
*/ | ||
public function render(): void { | ||
$form_data = []; | ||
|
||
if ( goodbids()->support->submission_processed() ) { | ||
goodbids()->notices->display_notice( Notices::REQUEST_SUBMITTED ); | ||
} else { | ||
$form_data = goodbids()->support->get_form_data(); | ||
} | ||
|
||
$button_class = 'btn-fill-secondary text-md'; | ||
|
||
if ( is_admin() ) { | ||
$button_class .= ' pointer-events-none'; | ||
} | ||
?> | ||
<form method="post" action="" class="px-8 pt-4 pb-12 rounded-sm bg-contrast relative group opacity-100 group-[.htmx-request]:opacity-50 transition-opacity" data-form-spinner> | ||
<?php if ( ! is_admin() ) : ?> | ||
<div class="absolute inset-x-0 flex justify-center w-full -translate-y-full -bottom-2.5 text-base-2"> | ||
<svg xmlns="http://www.w3.org/2000/svg" class="relative inset-0 htmx-indicator w-14 h-14 animate-spin" viewBox="0 0 24 24" fill="currentColor"><path d="M12 3C16.9706 3 21 7.02944 21 12H19C19 8.13401 15.866 5 12 5V3Z"></path></svg> | ||
</div> | ||
<?php endif; ?> | ||
|
||
<?php | ||
if ( ! is_admin() ) : | ||
wp_nonce_field( SupportRequest::FORM_NONCE_ACTION, SupportRequest::FORM_NONCE_ACTION . '_nonce' ); | ||
endif; | ||
?> | ||
|
||
<?php $this->inner_blocks(); ?> | ||
|
||
<div id="gb-support-form-target" class="relative z-10"> | ||
<?php | ||
$this->render_error(); | ||
|
||
foreach ( goodbids()->support->get_fields() as $key => $field ) : | ||
goodbids()->forms->render_field( $key, $field, '', $form_data ); | ||
endforeach; | ||
?> | ||
<button | ||
type="submit" | ||
class="<?php echo esc_attr( $button_class ); ?>" | ||
> | ||
<?php esc_attr_e( 'Submit Request', 'goodbids' ); ?> | ||
</button> | ||
</div> | ||
</form> | ||
<?php | ||
} | ||
|
||
/** | ||
* Render the error message if exists. | ||
* | ||
* @since 1.0.0 | ||
* | ||
* @return void | ||
*/ | ||
private function render_error(): void { | ||
if ( ! goodbids()->support->get_error() ) { | ||
return; | ||
} | ||
?> | ||
<div class="p-4 mb-4 rounded bg-error-bg"> | ||
<p class="text-error-text"> | ||
<?php echo esc_html( goodbids()->support->get_error() ); ?> | ||
</p> | ||
</div> | ||
<?php | ||
} | ||
|
||
/** | ||
* Render the Inner Blocks tag | ||
* | ||
* @since 1.0.0 | ||
* | ||
* @return void | ||
*/ | ||
public function inner_blocks(): void { | ||
$nonprofit = new Nonprofit( get_current_blog_id() ); | ||
$template = [ | ||
[ | ||
'core/heading', | ||
[ | ||
'textColor' => 'base-2', | ||
'content' => __( 'Request Support from', 'goodbids' ) . ' ' . $nonprofit->get_name(), | ||
], | ||
], | ||
[ | ||
'core/paragraph', | ||
[ | ||
'content' => __( 'Use the form below to submit a support request to this Nonprofit. Your submission will be visible to administrators for this Nonprofit site as well as the GOODBIDS support team. We will respond as soon as we can.', 'goodbids' ), | ||
'textColor' => 'base-2', | ||
], | ||
], | ||
]; | ||
|
||
printf( | ||
'<InnerBlocks template="%s" />', | ||
esc_attr( wp_json_encode( $template ) ) | ||
); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
client-mu-plugins/goodbids/blocks/support-request-form/render.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* Block: Support Request Form | ||
* | ||
* @var array $block | ||
* | ||
* @since 1.0.0 | ||
* @package GoodBids | ||
*/ | ||
|
||
use GoodBids\Blocks\SupportRequestForm; | ||
|
||
$support_form = new SupportRequestForm( $block ); | ||
?> | ||
<section <?php block_attr( $block, 'max-w-xl m-auto' ); ?>> | ||
<?php $support_form->render(); ?> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.