| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Request a Quote Modal Template. |
| 5 |
* |
| 6 |
* This template can be overridden by copying it to yourtheme/tiered-pricing-table/quote-modal.php. |
| 7 |
* |
| 8 |
* @var RequestQuoteForm $form |
| 9 |
* @var int $productId |
| 10 |
* @var WC_Product $product |
| 11 |
* @var QuoteFormDisplay $formDisplay |
| 12 |
*/ |
| 13 |
use TierPricingTable\Addons\RequestAQuote\Frontend\QuoteFormDisplay; |
| 14 |
use TierPricingTable\Addons\RequestAQuote\Models\RequestQuoteForm; |
| 15 |
if ( !defined( 'ABSPATH' ) ) { |
| 16 |
exit; |
| 17 |
} |
| 18 |
?> |
| 19 |
<div id="tpt-quote-modal-<?php |
| 20 |
echo esc_attr( $productId ); |
| 21 |
?>" class="tpt-quote-modal" |
| 22 |
style="display:none;"> |
| 23 |
<div class="tpt-quote-modal-content"> |
| 24 |
<div class="tpt-quote-modal-header" |
| 25 |
style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;"> |
| 26 |
<h3 class="tpt-quote-modal-title" style="margin: 0; font-size: 22px; line-height: 1.2;"> |
| 27 |
<?php |
| 28 |
$modalTitle = $form->toArray()['modal_title'] ?? ''; |
| 29 |
echo esc_html( ( $modalTitle ?: __( 'Request a Quote', 'tier-pricing-table' ) ) ); |
| 30 |
?> |
| 31 |
</h3> |
| 32 |
<span class="tpt-quote-modal-close" style="line-height: 1; cursor: pointer;">×</span> |
| 33 |
</div> |
| 34 |
<form class="tpt-quote-form-element" style="margin: 0"> |
| 35 |
<?php |
| 36 |
?> |
| 37 |
<div style="background-color: #fdf2cd; border: 1px solid #f0b849; padding: 10px; margin-bottom: 15px; font-size: 13px; border-radius: 4px;"> |
| 38 |
<strong><?php |
| 39 |
esc_html_e( 'Preview Mode', 'tier-pricing-table' ); |
| 40 |
?>:</strong> <?php |
| 41 |
esc_html_e( 'Request a Quote on the frontend is a premium feature. This popup is only visible to administrators.', 'tier-pricing-table' ); |
| 42 |
?> |
| 43 |
<br><a href="<?php |
| 44 |
echo esc_url( tpt_fs()->get_upgrade_url() ); |
| 45 |
?>" target="_blank" style="color: #000; font-weight: 500; text-decoration: underline;"><?php |
| 46 |
esc_html_e( 'Upgrade to Premium', 'tier-pricing-table' ); |
| 47 |
?></a> |
| 48 |
</div> |
| 49 |
<?php |
| 50 |
?> |
| 51 |
<input type="hidden" name="form_id" class="tpt-quote-form-id" |
| 52 |
value="<?php |
| 53 |
echo esc_attr( $form->getId() ); |
| 54 |
?>"> |
| 55 |
<input type="hidden" name="product_id" class="tpt-quote-product-id" |
| 56 |
value="<?php |
| 57 |
echo esc_attr( $productId ); |
| 58 |
?>"> |
| 59 |
|
| 60 |
<div class="tpt-quote-product-info" |
| 61 |
style="display: flex; align-items: center; gap: 15px; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #e5e5e5;"> |
| 62 |
<?php |
| 63 |
if ( $image_id = $product->get_image_id() ) { |
| 64 |
?> |
| 65 |
<img src="<?php |
| 66 |
echo esc_url( wp_get_attachment_image_url( $image_id, 'thumbnail' ) ); |
| 67 |
?>" alt="" |
| 68 |
style="width: 60px; height: 60px; object-fit: cover; border-radius: 4px;" |
| 69 |
class="tpt-quote-product-image"> |
| 70 |
<?php |
| 71 |
} |
| 72 |
?> |
| 73 |
<div> |
| 74 |
<strong class="tpt-quote-product-name" |
| 75 |
style="display: block; font-size: 16px;"><?php |
| 76 |
echo esc_html( $product->get_name() ); |
| 77 |
?></strong> |
| 78 |
<div class="price" style="font-size: 14px; opacity: 0.8; margin-top: 4px;"> |
| 79 |
<?php |
| 80 |
echo wp_kses_post( $product->get_price_html() ); |
| 81 |
?> |
| 82 |
</div> |
| 83 |
<div class="tpt-quote-variation-attributes" |
| 84 |
style="font-size: 13px; opacity: 0.7; margin-top: 4px; display: none;"></div> |
| 85 |
</div> |
| 86 |
</div> |
| 87 |
|
| 88 |
<div class="tpt-quote-fields-container"> |
| 89 |
<?php |
| 90 |
$formDisplay->renderFormFields( $form, $productId ); |
| 91 |
?> |
| 92 |
</div> |
| 93 |
|
| 94 |
<div class="tpt-quote-form-message"></div> |
| 95 |
<button type="submit" class="button alt wp-element-button" |
| 96 |
style="width: 100%; margin-top: 10px;"> |
| 97 |
<?php |
| 98 |
$btnText = $form->toArray()['submit_button_text'] ?? ''; |
| 99 |
echo esc_html( ( $btnText ?: __( 'Submit Request', 'tier-pricing-table' ) ) ); |
| 100 |
?> |
| 101 |
</button> |
| 102 |
</form> |
| 103 |
</div> |
| 104 |
</div> |
| 105 |
|