Merge branch 'master' into resseler-to-customer

This commit is contained in:
Almira Krdzic
2018-10-17 13:44:15 +02:00
17 changed files with 411 additions and 321 deletions

View File

@@ -1,43 +0,0 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<style>
table.wp-list-table .column-thumb {
width: 52px;
text-align: center;
white-space: nowrap;
}
table.wp-list-table td.column-thumb img {
margin: 0;
width: auto;
height: auto;
max-width: 40px;
max-height: 40px;
vertical-align: middle;
}
</style>
<div class="wrap">
<h2><?php esc_html_e( 'Products', 'wiaas' ); ?>
<?php
if ( ! empty( $_REQUEST['s'] ) ) {
echo '<span class="subtitle">' . esc_html__( 'Search results for', 'wiaas' ) . ' "' . sanitize_text_field( $_REQUEST['s'] ) . '"</span>';
}
?>
</h2>
<ul class="subsubsub"><?php $packages_list->views(); ?></ul>
<form id="wiaas_products" action="" method="get">
<input type="hidden" name="page" value="wiaas-cl-packages" />
<?php $packages_list->search_box( __( 'Search Products', 'wiaas' ), 'wiaas_packages_search_id' ); ?>
<?php $packages_list->display(); ?>
</form>
</div>

View File

@@ -78,72 +78,7 @@ if ( ! defined( 'ABSPATH' ) ) {
</style>
<script>
jQuery(document).ready(function ($) {
$( "#tabs" ).tabs({
disabled: <?php echo $has_default_cl_extras ? '[ ]' : '[ 1 ]' ; ?>
});
$('#wiaas_add_cl_customer_extras').click(function(e) {
e.preventDefault();
var customer_id = $('#wiaas_cl_customers').val();
if (!customer_id || customer_id === '0') {
return;
}
$.post(window.ajaxurl, {
action: 'wiaas_create_cl_customer_extras',
_ajax_nonce: '<?php echo wp_create_nonce('wiaas_create_cl_customer_extras') ?>',
customer_id: customer_id,
package_id: <?php echo esc_attr($package->get_id()) ?>
}).done( function (result) {
$('#tabs-2').append(result);
$('#wiaas_cl_customer_' + customer_id).prop( 'disabled', true );
});
$('#wiaas_cl_customers').val('0');
});
$('#wiaas_package_extras').delegate('.wiaas_remove_cl_extras', 'click', function(e) {
e.preventDefault();
var customer_id = $( this ).data('customer_id');
$('#extras_customer_' + customer_id).remove();
$('#wiaas_cl_customer_' + customer_id).prop( 'disabled', false );
$('#wiaas_cl_customers').val('0');
});
$('#wiaas_package_extras').delegate('.wiaas-cl-extra-input', 'change', function(e) {
e.preventDefault();
var val = parseFloat($( this ).val());
var target = '#' + $( this).data('target');
if (isNaN(val)) {
$(target).val('Invalid!');
return;
}
var type = $( this).data('type');
if (type === 'fixed') {
$(target).text( $(target).data('base') + val);
}
if (type === 'recurrent' || type === 'services') {
$(target).data(type, val);
$(target).text( $(target).data('base') + $(target).data('recurrent') + $(target).data('services'));
}
});
});
</script>
<div class="wrap">
@@ -233,15 +168,15 @@ if ( ! defined( 'ABSPATH' ) ) {
</div>
</div>
<div id="tabs">
<div id="tabs" data-disabled="<?php echo $has_default_cl_extras ? '' : '1' ; ?>">
<ul id="tabs-navigation">
<li><a href="#tabs-1"><?php esc_html_e('Default prices', 'wiaas') ?></a> | </li>
<li><a href="#tabs-2"><?php esc_html_e('Customer specific prices', 'wiaas') ?></a></li>
</ul>
<form id="wiaas_package_extras" action="" method="post">
<input type="hidden" name="page" value="wiaas-cl-product"/>
<input type="hidden" name="id" value="<?php echo esc_attr($package->get_id()) ?>"/>
<input type="hidden" name="page" value="wiaas-cl-package"/>
<input type="hidden" id="wiaas_cl_package_id" name="cl_package_id" value="<?php echo esc_attr($package->get_id()) ?>"/>
<div id="tabs-1">
@@ -273,6 +208,7 @@ if ( ! defined( 'ABSPATH' ) ) {
}
?>
</select>
<?php wp_nonce_field( 'wiaas_create_cl_customer_extras', 'wiaas_create_cl_customer_extras_nonce' ); ?>
<button id="wiaas_add_cl_customer_extras" class="button">Add</button>
</div>