376 lines
18 KiB
PHP
376 lines
18 KiB
PHP
<div class="wrap" >
|
|
<h2><?php echo __( 'eKomi Integration Configuration', 'ekomi-integration' ); ?></h2>
|
|
<form method="POST" class="ekomi-configuration">
|
|
<table name="ee_configuration">
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_order_statuses" ><?php echo __( 'Order Statuses', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<select multiple name="ee_order_statuses[]" id="ee_order_statuses" >
|
|
<?php foreach ( $order_statuses as $code => $label ) : ?>
|
|
<option value="<?php echo __( $code, 'ekomi-integration' ); ?>"
|
|
<?php
|
|
if ( is_array( $data['ee_order_statuses'] ) ) {
|
|
echo ( in_array( $code, $data['ee_order_statuses'], true ) ) ? "selected=''" : '';
|
|
}
|
|
?>
|
|
><?php echo esc_html( $label ); ?>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_export_method" ><?php echo __( 'Export Method', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<select name="ee_export_method" id="ee_export_method" value="<?php echo $data['ee_export_method']; ?>" >
|
|
<option value="<?php echo EKOMI_INTEGRATION\EXPORT_METHOD_STATUS; ?>" <?php echo ( EKOMI_INTEGRATION\EXPORT_METHOD_STATUS === $data['ee_export_method'] ) ? "selected=''" : ''; ?> ><?php echo __( 'Order Status Change', 'ekomi-integration' ); ?></option>
|
|
<option value="<?php echo EKOMI_INTEGRATION\EXPORT_METHOD_CRON; ?>" <?php echo ( EKOMI_INTEGRATION\EXPORT_METHOD_CRON === $data['ee_export_method'] ) ? "selected=''" : ''; ?> ><?php echo __( 'Every 24 Hours (Cron)', 'ekomi-integration' ); ?></option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_turnaround_time" ><?php echo __( 'Turnaround Time', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<select name="ee_turnaround_time" id="ee_turnaround_time" value="<?php echo $data['ee_turnaround_time']; ?>" >
|
|
<?php for ( $day = 1; $day <= EKOMI_INTEGRATION\TIMESTAMP_DAYS; $day++ ) { ?>
|
|
<option value="<?php echo $day; ?>" <?php echo ( $data['ee_turnaround_time'] == $day ) ? "selected=''" : ''; ?> ><?php echo $day; ?></option>
|
|
<?php }; ?>
|
|
</select>
|
|
<div>
|
|
<sub>
|
|
<em>How many days back the Plugin should read the matched order state from your store?</em>
|
|
</sub>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h2 class="nav-tab-wrapper">
|
|
<?php
|
|
foreach ( $languages_arr as $key => $value ) {
|
|
?>
|
|
<a class="nav-tab <?php echo ( $value === $lang_code ) ? 'nav-tab-active' : ''; ?>" href="?page=ekomi-integration-plugin&lang=<?php echo $value; ?>"><?php echo $value; ?></a>
|
|
<?php
|
|
}
|
|
?>
|
|
</h2>
|
|
<?php if ( $response['is_submited'] ) : ?>
|
|
<?php if ( 'success' === $response['status'] ) : ?>
|
|
<div class="notice notice-success is-dismissible">
|
|
<p><?php echo esc_html( $response['message'] ); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php if ( 'error' === $response['status'] ) : ?>
|
|
<div class="notice notice-error is-dismissible">
|
|
<p><?php echo esc_html( $response['message'] ); ?></p>
|
|
</div>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
<br/>
|
|
<table name="ee_configuration">
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_active" ><?php echo __( 'Status', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<select name="ee_active" id="ee_active" value="<?php echo $data['ee_active']; ?>" >
|
|
<option value="0" <?php echo ( 0 == $data['ee_active'] ) ? "selected=''" : ''; ?> ><?php echo __( 'Disable', 'ekomi-integration' ); ?></option>
|
|
<option value="1" <?php echo ( 1 == $data['ee_active'] ) ? "selected=''" : ''; ?> ><?php echo __( 'Enable', 'ekomi-integration' ); ?></option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_shop_id"><?php echo __( 'Shop ID', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<input type="text" name="ee_shop_id" id="ee_shop_id" value="<?php echo $data['ee_shop_id']; ?>">
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_shop_pw"><?php echo __( 'Shop Secret', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<input type="text" name="ee_shop_pw" id="ee_shop_pw" value="<?php echo $data['ee_shop_pw']; ?>">
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_product_reviews" ><?php echo __( 'Product Reviews', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<select name="ee_product_reviews" id="ee_product_reviews" value="<?php echo $data['ee_product_reviews']; ?>" >
|
|
<option value="0" <?php echo ( 0 == $data['ee_product_reviews'] ) ? "selected=''" : ''; ?> ><?php echo __( 'Disable', 'ekomi-integration' ); ?></option>
|
|
<option value="1" <?php echo ( 1 == $data['ee_product_reviews'] ) ? "selected=''" : ''; ?> ><?php echo __( 'Enable', 'ekomi-integration' ); ?></option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_mode" ><?php echo __( 'Mode', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<select name="ee_mode" id="ee_mode" value="<?php echo $data['ee_mode']; ?>" >
|
|
<option value="sms" <?php echo ( 'sms' === $data['ee_mode'] ) ? "selected=''" : ''; ?> ><?php echo __( 'SMS', 'ekomi-integration' ); ?></option>
|
|
<option value="email" <?php echo ( 'email' === $data['ee_mode'] ) ? "selected=''" : ''; ?> ><?php echo __( 'Email', 'ekomi-integration' ); ?></option>
|
|
<option value="fallback" <?php echo ( 'fallback' === $data['ee_mode'] ) ? "selected=''" : ''; ?> ><?php echo __( 'SMS if contact number, otherwise Email', 'ekomi-integration' ); ?></option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_product_identifier" ><?php echo __( 'Product Identifier', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<select name="ee_product_identifier" id="ee_product_identifier" value="<?php echo $data['ee_product_identifier']; ?>" >
|
|
<option value="<?php echo EKOMI_INTEGRATION\PRODUCT_IDENTIFIER_ID; ?>" <?php echo ( EKOMI_INTEGRATION\PRODUCT_IDENTIFIER_ID === $data['ee_product_identifier'] ) ? "selected=''" : ''; ?> ><?php echo __( 'Id', 'ekomi-integration' ); ?></option>
|
|
<option value="<?php echo EKOMI_INTEGRATION\PRODUCT_IDENTIFIER_SKU; ?>" <?php echo ( EKOMI_INTEGRATION\PRODUCT_IDENTIFIER_SKU === $data['ee_product_identifier'] ) ? "selected=''" : ''; ?> ><?php echo __( 'Sku', 'ekomi-integration' ); ?></option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_exclude_products"><?php echo __( 'Exclude Products', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<input type="text" name="ee_exclude_products" id="ee_exclude_products" value="<?php echo $data['ee_exclude_products']; ?>">
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<td colspan="2"><hr class="ekomi-section-divider"></td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<td colspan="2">
|
|
<h3><?php echo __( 'Widget Installation', 'ekomi-integration' ); ?></h3>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="<?php echo EKOMI_INTEGRATION\FLOATING_OPTION_ENABLE; ?>"><?php echo __( 'Enable eKomi Floating Widget', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="<?php echo EKOMI_INTEGRATION\FLOATING_OPTION_ENABLE; ?>"
|
|
id="<?php echo EKOMI_INTEGRATION\FLOATING_OPTION_ENABLE; ?>"
|
|
value="<?php echo EKOMI_INTEGRATION\ENABLE_VALUE; ?>"
|
|
<?php checked( EKOMI_INTEGRATION\ENABLE_VALUE, $data['ekomifloating_enable'] ); ?>
|
|
/>
|
|
<?php echo __( 'Show eKomi Floating Widget on your site.', 'ekomi-integration' ); ?>
|
|
</label>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top" class="ekomi-floating-row">
|
|
<th scope="row">
|
|
<label for="<?php echo EKOMI_INTEGRATION\FLOATING_OPTION_CODE; ?>"><?php echo __( 'Floating Widget Code', 'ekomi-integration' ); ?> <span class="ekomi-required">*</span></label>
|
|
</th>
|
|
<td>
|
|
<textarea name="<?php echo EKOMI_INTEGRATION\FLOATING_OPTION_CODE; ?>"
|
|
id="<?php echo EKOMI_INTEGRATION\FLOATING_OPTION_CODE; ?>"
|
|
rows="6"
|
|
cols="60"
|
|
placeholder="<div>... your eKomi Floating widget code ...</div>"
|
|
required><?php echo esc_textarea( $data['ekomifloating_code'] ?? '' ); ?></textarea>
|
|
<div>
|
|
<sub><em><?php echo __( 'Paste the HTML/JS embed code for the eKomi Floating widget. This field is required when the checkbox is enabled.', 'ekomi-integration' ); ?></em></sub>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_slider_widget_snippet"><?php echo __( 'eKomi Slider Widget Code (optional)', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<textarea name="ee_slider_widget_snippet" id="ee_slider_widget_snippet" rows="6" cols="60" placeholder="<div>... your eKomi slider HTML/JS snippet ...</div>"><?php echo esc_textarea( $data['ee_slider_widget_snippet'] ?? '' ); ?></textarea>
|
|
<div>
|
|
<sub><em><?php echo __( 'Paste the HTML/JS embed for the eKomi slider. Leave empty to disable.', 'ekomi-integration' ); ?></em></sub>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<td colspan="2"><hr class="ekomi-section-divider"></td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<td colspan="2">
|
|
<h3><?php echo __( 'IFF Form Integration', 'ekomi-integration' ); ?></h3>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="<?php echo EKOMI_INTEGRATION\SFF_OPTION_ENABLE; ?>"><?php echo __( 'Enable eKomi SFF Popup', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<label>
|
|
<input type="checkbox"
|
|
name="<?php echo EKOMI_INTEGRATION\SFF_OPTION_ENABLE; ?>"
|
|
id="<?php echo EKOMI_INTEGRATION\SFF_OPTION_ENABLE; ?>"
|
|
value="<?php echo EKOMI_INTEGRATION\ENABLE_VALUE; ?>"
|
|
<?php checked( EKOMI_INTEGRATION\ENABLE_VALUE, $data['ekomisff_enable'] ); ?>
|
|
/>
|
|
<?php echo __( 'Show eKomi Shop Feedback Form popup on the WooCommerce Thank You page.', 'ekomi-integration' ); ?>
|
|
</label>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top" class="ekomi-sff-row">
|
|
<th scope="row">
|
|
<label for="<?php echo EKOMI_INTEGRATION\SFF_OPTION_FORM_ID; ?>"><?php echo __( 'SFF Form ID', 'ekomi-integration' ); ?> <span class="ekomi-required">*</span></label>
|
|
</th>
|
|
<td>
|
|
<input type="text"
|
|
name="<?php echo EKOMI_INTEGRATION\SFF_OPTION_FORM_ID; ?>"
|
|
id="<?php echo EKOMI_INTEGRATION\SFF_OPTION_FORM_ID; ?>"
|
|
value="<?php echo esc_attr( $data['ekomisff_form_id'] ); ?>"
|
|
required />
|
|
<div>
|
|
<sub><em><?php echo __( 'This field is required when the SFF Popup is enabled.', 'ekomi-integration' ); ?></em></sub>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top" class="ekomi-sff-row">
|
|
<th scope="row">
|
|
<label for="<?php echo EKOMI_INTEGRATION\SFF_OPTION_WIDGET_WIDTH; ?>"><?php echo __( 'SFF Popup Width', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<input type="text"
|
|
name="<?php echo EKOMI_INTEGRATION\SFF_OPTION_WIDGET_WIDTH; ?>"
|
|
id="<?php echo EKOMI_INTEGRATION\SFF_OPTION_WIDGET_WIDTH; ?>"
|
|
value="<?php echo esc_attr( $data['ekomisff_widget_width'] ); ?>" />
|
|
<div>
|
|
<sub><em><?php echo __( 'Any valid CSS width value (for example: 600px or 80%).', 'ekomi-integration' ); ?></em></sub>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top" class="ekomi-sff-row">
|
|
<th scope="row">
|
|
<label for="<?php echo EKOMI_INTEGRATION\SFF_OPTION_WIDGET_HEIGHT; ?>"><?php echo __( 'SFF Popup Height', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<input type="text"
|
|
name="<?php echo EKOMI_INTEGRATION\SFF_OPTION_WIDGET_HEIGHT; ?>"
|
|
id="<?php echo EKOMI_INTEGRATION\SFF_OPTION_WIDGET_HEIGHT; ?>"
|
|
value="<?php echo esc_attr( $data['ekomisff_widget_height'] ); ?>" />
|
|
<div>
|
|
<sub><em><?php echo __( 'Any valid CSS height value (for example: 600px or 80vh).', 'ekomi-integration' ); ?></em></sub>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top" class="ekomi-sff-row">
|
|
<th scope="row">
|
|
<label for="<?php echo EKOMI_INTEGRATION\SFF_OPTION_TRANSACTION_PREF; ?>"><?php echo __( 'SFF Transaction ID Prefix', 'ekomi-integration' ); ?></label>
|
|
</th>
|
|
<td>
|
|
<input type="text"
|
|
name="<?php echo EKOMI_INTEGRATION\SFF_OPTION_TRANSACTION_PREF; ?>"
|
|
id="<?php echo EKOMI_INTEGRATION\SFF_OPTION_TRANSACTION_PREF; ?>"
|
|
value="<?php echo esc_attr( $data['ekomisff_transaction_prefix'] ); ?>" />
|
|
<div>
|
|
<sub><em><?php echo __( 'Optional prefix that will be prepended to the WooCommerce order ID when sending it as order_id to the SFF form.', 'ekomi-integration' ); ?></em></sub>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<!-- <tr valign="top">-->
|
|
<!-- <th scope="row">-->
|
|
<!-- <label for="ee_show_prc_widget" >--><?php //echo __( 'Show PRC Widget', 'ekomi-integration' ); ?><!--</label>-->
|
|
<!-- </th>-->
|
|
<!-- <td>-->
|
|
<!-- <select name="ee_show_prc_widget" id="ee_show_prc_widget" value="--><?php //echo $data['ee_show_prc_widget']; ?><!--" >-->
|
|
<!-- <option value="0" --><?php //echo ( 0 == $data['ee_show_prc_widget'] ) ? "selected=''" : ''; ?><!-- >--><?php //echo __( 'Disable', 'ekomi-integration' ); ?><!--</option>-->
|
|
<!-- <option value="1" --><?php //echo ( 1 == $data['ee_show_prc_widget'] ) ? "selected=''" : ''; ?><!-- >--><?php //echo __( 'Enable', 'ekomi-integration' ); ?><!--</option>-->
|
|
<!-- </select>-->
|
|
<!-- </td>-->
|
|
<!-- </tr>-->
|
|
<!-- <tr valign="top">-->
|
|
<!-- <th scope="row">-->
|
|
<!-- <label for="ee_prc_widget_token">--><?php //echo __( 'PRC Widget Token', 'ekomi-integration' ); ?><!--</label>-->
|
|
<!-- </th>-->
|
|
<!-- <td>-->
|
|
<!-- <input type="text" name="ee_prc_widget_token" id="ee_prc_widget_token" value="--><?php //echo $data['ee_prc_widget_token']; ?><!--">-->
|
|
<!-- </td>-->
|
|
<!-- </tr>-->
|
|
|
|
<tr valign="top">
|
|
<th scope="row">
|
|
<label for="ee_active" ><?php echo __( 'You agree with our General Conditions of Sale?', 'ekomi-integration' ); ?>
|
|
</label>
|
|
</th>
|
|
<td>
|
|
<select name="ee_t_and_c" id="ee_t_and_c" value="<?php echo $data['ee_t_and_c']; ?>" >
|
|
<option value="0" <?php echo ( 0 == $data['ee_t_and_c'] ) ? "selected=''" : ''; ?> ><?php echo __( 'I disagree', 'ekomi-integration' ); ?></option>
|
|
<option value="1" <?php echo ( 1 == $data['ee_t_and_c'] ) ? "selected=''" : ''; ?> ><?php echo __( 'I agree', 'ekomi-integration' ); ?></option>
|
|
</select>
|
|
<div>
|
|
<sub>
|
|
<em><?php echo __( 'The plugin will export orders only if you are agree with our', 'ekomi-integration' ); ?> <a target="_blank" href="https://plugins-dashboard.ekomiapps.de/terms_and_conditions"> <?php echo __( 'Terms and Conditions', 'ekomi-integration' ); ?> </a> </em>
|
|
</sub>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<th></th>
|
|
<td class="ekomi-submit">
|
|
<?php wp_nonce_field( 'ekomi-integration-nonce', 'ee_nonce_field' ); ?>
|
|
<input type="submit" value="<?php echo __( 'Save', 'ekomi-integration' ); ?>" class="button button-primary button-large">
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
(function () {
|
|
function toggleEkomiSffRows() {
|
|
var enableCheckbox = document.getElementById('<?php echo EKOMI_INTEGRATION\SFF_OPTION_ENABLE; ?>');
|
|
var rows = document.querySelectorAll('.ekomi-sff-row');
|
|
var formIdField = document.getElementById('<?php echo EKOMI_INTEGRATION\SFF_OPTION_FORM_ID; ?>');
|
|
if (!rows || !enableCheckbox || !formIdField) {
|
|
return;
|
|
}
|
|
var show = enableCheckbox.checked;
|
|
for (var i = 0; i < rows.length; i++) {
|
|
rows[i].style.display = show ? '' : 'none';
|
|
}
|
|
formIdField.required = show;
|
|
}
|
|
|
|
function toggleEkomiFloatingRows() {
|
|
var enableCheckbox = document.getElementById('<?php echo EKOMI_INTEGRATION\FLOATING_OPTION_ENABLE; ?>');
|
|
var rows = document.querySelectorAll('.ekomi-floating-row');
|
|
var codeField = document.getElementById('<?php echo EKOMI_INTEGRATION\FLOATING_OPTION_CODE; ?>');
|
|
if (!rows || !enableCheckbox || !codeField) {
|
|
return;
|
|
}
|
|
var show = enableCheckbox.checked;
|
|
for (var i = 0; i < rows.length; i++) {
|
|
rows[i].style.display = show ? '' : 'none';
|
|
}
|
|
codeField.required = show;
|
|
}
|
|
|
|
|
|
if (document.readyState === 'complete' || document.readyState === 'interactive') {
|
|
toggleEkomiSffRows();
|
|
toggleEkomiFloatingRows();
|
|
} else {
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
toggleEkomiSffRows();
|
|
toggleEkomiFloatingRows();
|
|
});
|
|
}
|
|
|
|
document.addEventListener('change', function (event) {
|
|
if (event.target && event.target.id === '<?php echo EKOMI_INTEGRATION\SFF_OPTION_ENABLE; ?>') {
|
|
toggleEkomiSffRows();
|
|
}
|
|
if (event.target && event.target.id === '<?php echo EKOMI_INTEGRATION\FLOATING_OPTION_ENABLE; ?>') {
|
|
toggleEkomiFloatingRows();
|
|
}
|
|
});
|
|
})();
|
|
</script>
|