class-wc-settings-rest-api.php
5 years ago
html-admin-page-shipping-classes.php
1 month ago
html-admin-page-shipping-providers.php
1 month ago
html-admin-page-shipping-zone-methods.php
1 month ago
html-admin-page-shipping-zones-instance.php
8 years ago
html-admin-page-shipping-zones.php
1 month ago
html-keys-edit.php
1 month ago
html-settings-tax.php
1 year ago
html-webhooks-edit.php
1 month ago
settings-tax.php
2 months ago
html-admin-page-shipping-providers.php
184 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Shipping providers admin |
| 4 | * |
| 5 | * @package WooCommerce\Admin\Shipping |
| 6 | */ |
| 7 | |
| 8 | declare( strict_types = 1 ); |
| 9 | |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; |
| 12 | } |
| 13 | |
| 14 | ?> |
| 15 | |
| 16 | <h2 class="wc-shipping-zones-heading"> |
| 17 | <span><?php esc_html_e( 'Shipping providers', 'woocommerce' ); ?></span> |
| 18 | <a class="page-title-action wc-shipping-provider-add-new" href="#"><?php esc_html_e( 'Add shipping provider', 'woocommerce' ); ?></a> |
| 19 | </h2> |
| 20 | |
| 21 | <p class="wc-shipping-zone-help-text"> |
| 22 | <?php esc_html_e( 'Add custom shipping providers so they appear in the fulfillment form when creating shipments. Use the tracking URL template to auto-generate tracking links.', 'woocommerce' ); ?> |
| 23 | </p> |
| 24 | |
| 25 | <table class="wc-shipping-classes widefat"> |
| 26 | <thead> |
| 27 | <tr> |
| 28 | <?php foreach ( $shipping_provider_columns as $class => $heading ) : // @phpstan-ignore variable.undefined ?> |
| 29 | <th class="<?php echo esc_attr( $class ); ?>"><?php echo esc_html( $heading ); ?></th> |
| 30 | <?php endforeach; ?> |
| 31 | <th /> |
| 32 | </tr> |
| 33 | </thead> |
| 34 | <tbody class="wc-shipping-provider-rows wc-shipping-tables-tbody"></tbody> |
| 35 | </table> |
| 36 | |
| 37 | <script type="text/html" id="tmpl-wc-shipping-provider-row-blank"> |
| 38 | <tr> |
| 39 | <td class="wc-shipping-classes-blank-state" colspan="<?php echo absint( count( $shipping_provider_columns ) + 1 ); ?>"><p><?php esc_html_e( 'No custom shipping providers have been created.', 'woocommerce' ); ?></p></td> |
| 40 | </tr> |
| 41 | </script> |
| 42 | |
| 43 | <script type="text/html" id="tmpl-wc-shipping-provider-configure"> |
| 44 | <div class="wc-backbone-modal wc-shipping-class-modal"> |
| 45 | <div class="wc-backbone-modal-content" data-id="{{ data.term_id }}"> |
| 46 | <section class="wc-backbone-modal-main" role="main"> |
| 47 | <header class="wc-backbone-modal-header"> |
| 48 | <h1><?php esc_html_e( 'Add shipping provider', 'woocommerce' ); ?></h1> |
| 49 | <button class="modal-close modal-close-link dashicons dashicons-no-alt"> |
| 50 | <span class="screen-reader-text"><?php esc_html_e( 'Close modal panel', 'woocommerce' ); ?></span> |
| 51 | </button> |
| 52 | </header> |
| 53 | <article> |
| 54 | <form action="" method="post"> |
| 55 | <input type="hidden" name="term_id" value="{{{ data.term_id }}}" /> |
| 56 | <?php |
| 57 | foreach ( $shipping_provider_columns as $class => $heading ) { |
| 58 | echo '<div class="wc-shipping-class-modal-input ' . esc_attr( $class ) . '">'; |
| 59 | switch ( $class ) { |
| 60 | case 'wc-shipping-provider-name': |
| 61 | ?> |
| 62 | <div class="view"> |
| 63 | <?php echo esc_html( $heading ); ?> * |
| 64 | </div> |
| 65 | <div class="edit"> |
| 66 | <input type="text" name="name" data-attribute="name" value="{{ data.name }}" placeholder="<?php esc_attr_e( 'e.g. My Local Courier', 'woocommerce' ); ?>" /> |
| 67 | </div> |
| 68 | <div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'The display name for this shipping provider.', 'woocommerce' ); ?></div> |
| 69 | <?php |
| 70 | break; |
| 71 | case 'wc-shipping-provider-slug': |
| 72 | ?> |
| 73 | <div class="view"> |
| 74 | <?php echo esc_html( $heading ); ?> |
| 75 | </div> |
| 76 | <div class="edit"> |
| 77 | <input type="text" name="slug" data-attribute="slug" value="{{ data.slug }}" placeholder="<?php esc_attr_e( 'e.g. my-local-courier', 'woocommerce' ); ?>" /> |
| 78 | </div> |
| 79 | <div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Unique identifier (auto-generated if left blank).', 'woocommerce' ); ?></div> |
| 80 | <?php |
| 81 | break; |
| 82 | case 'wc-shipping-provider-tracking-url-template': |
| 83 | ?> |
| 84 | <div class="view"> |
| 85 | <?php echo esc_html( $heading ); ?> |
| 86 | </div> |
| 87 | <div class="edit"> |
| 88 | <input type="text" name="tracking_url_template" data-attribute="tracking_url_template" value="{{ data.tracking_url_template }}" placeholder="<?php esc_attr_e( 'e.g. https://example.com/track?id=__PLACEHOLDER__', 'woocommerce' ); ?>" /> |
| 89 | </div> |
| 90 | <div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Use __PLACEHOLDER__ where the tracking number should appear in the URL.', 'woocommerce' ); ?></div> |
| 91 | <?php |
| 92 | break; |
| 93 | case 'wc-shipping-provider-icon': |
| 94 | ?> |
| 95 | <div class="view"> |
| 96 | <?php echo esc_html( $heading ); ?> |
| 97 | </div> |
| 98 | <div class="edit"> |
| 99 | <input type="text" name="icon" data-attribute="icon" value="{{ data.icon }}" placeholder="<?php esc_attr_e( 'e.g. https://example.com/icon.png', 'woocommerce' ); ?>" /> |
| 100 | </div> |
| 101 | <div class="wc-shipping-class-modal-help-text"><?php esc_html_e( 'Optional URL for the provider icon.', 'woocommerce' ); ?></div> |
| 102 | <?php |
| 103 | break; |
| 104 | default: |
| 105 | ?> |
| 106 | <div class="view wc-shipping-class-hide-sibling-view"> |
| 107 | <?php echo esc_html( $heading ); ?> |
| 108 | </div> |
| 109 | <?php |
| 110 | /** |
| 111 | * Fires for custom columns in the shipping providers configure modal. |
| 112 | * |
| 113 | * @since 10.7.0 |
| 114 | */ |
| 115 | do_action( 'woocommerce_shipping_providers_column_' . $class ); |
| 116 | break; |
| 117 | } |
| 118 | echo '</div>'; |
| 119 | } |
| 120 | ?> |
| 121 | </form> |
| 122 | </article> |
| 123 | <footer> |
| 124 | <div class="wc-backbone-modal-buttons"> |
| 125 | <button id="btn-ok" disabled class="button button-primary button-large disabled"> |
| 126 | <div class="wc-backbone-modal-action-{{ data.action === 'create' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Create', 'woocommerce' ); ?></div> |
| 127 | <div class="wc-backbone-modal-action-{{ data.action === 'edit' ? 'active' : 'inactive' }}"><?php esc_html_e( 'Save', 'woocommerce' ); ?></div> |
| 128 | </button> |
| 129 | </div> |
| 130 | </footer> |
| 131 | </section> |
| 132 | </div> |
| 133 | </div> |
| 134 | <div class="wc-backbone-modal-backdrop modal-close"></div> |
| 135 | </script> |
| 136 | |
| 137 | <script type="text/html" id="tmpl-wc-shipping-provider-row"> |
| 138 | <tr data-id="{{ data.term_id }}"> |
| 139 | <?php |
| 140 | foreach ( $shipping_provider_columns as $class => $heading ) { |
| 141 | echo '<td class="' . esc_attr( $class ) . '">'; |
| 142 | switch ( $class ) { |
| 143 | case 'wc-shipping-provider-name': |
| 144 | ?> |
| 145 | <div class="view"> |
| 146 | {{ data.name }} |
| 147 | </div> |
| 148 | <?php |
| 149 | break; |
| 150 | case 'wc-shipping-provider-slug': |
| 151 | ?> |
| 152 | <div class="view">{{ data.slug }}</div> |
| 153 | <?php |
| 154 | break; |
| 155 | case 'wc-shipping-provider-tracking-url-template': |
| 156 | ?> |
| 157 | <div class="view">{{ data.tracking_url_template }}</div> |
| 158 | <?php |
| 159 | break; |
| 160 | case 'wc-shipping-provider-icon': |
| 161 | ?> |
| 162 | <div class="view">{{ data.icon }}</div> |
| 163 | <?php |
| 164 | break; |
| 165 | default: |
| 166 | /** |
| 167 | * Fires for custom columns in the shipping providers table row. |
| 168 | * |
| 169 | * @since 10.7.0 |
| 170 | */ |
| 171 | do_action( 'woocommerce_shipping_providers_column_' . $class ); |
| 172 | break; |
| 173 | } |
| 174 | echo '</td>'; |
| 175 | } |
| 176 | ?> |
| 177 | <td class="wc-shipping-zone-actions"> |
| 178 | <div> |
| 179 | <a class="wc-shipping-provider-edit wc-shipping-zone-action-edit" href="#"><?php esc_html_e( 'Edit', 'woocommerce' ); ?></a> | <a href="#" class="wc-shipping-provider-delete wc-shipping-zone-actions"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a> |
| 180 | </div> |
| 181 | </td> |
| 182 | </tr> |
| 183 | </script> |
| 184 |