Handle commercial lead prices
This commit is contained in:
@@ -0,0 +1,296 @@
|
||||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<style>
|
||||
#tabs-navigation {
|
||||
height: 30px;
|
||||
}
|
||||
#tabs-navigation > li {
|
||||
float: left;
|
||||
line-height: 30px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#tabs-navigation > li.ui-state-active > a {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#tabs-navigation > li.ui-state-disabled > a {
|
||||
color: #ccc;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
#tabs-navigation > li > a {
|
||||
text-decoration: none;
|
||||
padding: .5em;
|
||||
}
|
||||
|
||||
.wiaas-configured-prices > thead {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
.wiaas-configured-prices > thead td {
|
||||
vertical-align: middle;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wiaas-configured-prices > thead i {
|
||||
position: absolute;
|
||||
vertical-align: top;
|
||||
right: -8px;
|
||||
top: -8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.wiaas-configured-prices > tbody > tr > td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.wiaas-configured-prices > tbody > tr > td:first-child {
|
||||
max-width: 100px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.wiaas-configured-prices > tbody > tr > td:nth-child(2) label {
|
||||
float: left;;
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.wiaas-configured-prices input[type='text'] {
|
||||
width: 100px;
|
||||
}
|
||||
|
||||
#managed_36 > td:nth-child(2) > div:last-child {
|
||||
position: relative;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
#managed_36 > td:nth-child(2) > div:last-child > span {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 70px;
|
||||
}
|
||||
</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">
|
||||
<div id="poststuff">
|
||||
<div id="post-body" class="metabox-holder columns-2">
|
||||
<div id="postbox-container-1" class="postbox-container">
|
||||
<div class="postbox">
|
||||
<div class="inside">
|
||||
<div class="panel-wrap">
|
||||
<div class="panel">
|
||||
<div>
|
||||
<?php
|
||||
foreach ($bundled_items_per_category as $category => $category_bundled_items) {
|
||||
echo sprintf(
|
||||
'<strong style="text-transform: uppercase;" class="text-uppercase">%s (%s)</strong>',
|
||||
esc_attr( $category ),
|
||||
esc_attr(count($category_bundled_items)) );
|
||||
foreach ($category_bundled_items as $bundled_item) {
|
||||
$title = $bundled_item->product->get_title();
|
||||
echo sprintf( '<p>%s x %s</p>', esc_attr($bundled_item->get_quantity('max')), esc_attr( $title ) );
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="postbox-container-2" class="postbox-container">
|
||||
|
||||
<div class="postbox">
|
||||
<div class="inside">
|
||||
<div class="panel-wrap">
|
||||
<div class="panel">
|
||||
<h1 style="padding: 0;"><?php echo $package->get_name(); ?></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (! empty($package->get_short_description())) {
|
||||
?>
|
||||
<div class="postbox">
|
||||
<?php wp_editor( $package->get_short_description(), 'content', array(
|
||||
'_content_editor_dfw' => $_content_editor_dfw,
|
||||
'drag_drop_upload' => false,
|
||||
'media_buttons' => false,
|
||||
'quicktags' => false,
|
||||
'tabfocus_elements' => 'content-html',
|
||||
'tinymce' => array(
|
||||
'resize' => false,
|
||||
'wp_autoresize_on' => true,
|
||||
'add_unload_trigger' => false,
|
||||
'wp_keep_scroll_position' => ! $is_IE,
|
||||
'readonly'=> true,
|
||||
'toolbar' => false,
|
||||
),
|
||||
) ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="postbox">
|
||||
<div class="inside">
|
||||
<div class="panel-wrap">
|
||||
<div class="panel">
|
||||
|
||||
<div class="wrap">
|
||||
<div>
|
||||
<i style="vertical-align: middle;" class="dashicons dashicons-info"></i>
|
||||
<strong><?php esc_html_e('EPR') ?></strong>
|
||||
<span><?php esc_html_e('= Extra package recurrent commission') ?></span>
|
||||
</div>
|
||||
<div>
|
||||
<i style="vertical-align: middle;" class="dashicons dashicons-info"></i>
|
||||
<strong><?php esc_html_e('ESR') ?></strong>
|
||||
<span><?php esc_html_e('= Extra services and support recurrent commission') ?></span>
|
||||
</div>
|
||||
<div>
|
||||
<i style="vertical-align: middle;" class="dashicons dashicons-info"></i>
|
||||
<strong><?php esc_html_e('Extra commission') ?></strong>
|
||||
<span><?php esc_html_e('= EPR + ESR') ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tabs">
|
||||
<ul id="tabs-navigation">
|
||||
<li><a href="#tabs-1">Default prices</a> | </li>
|
||||
<li><a href="#tabs-2">Customer specific prices</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()) ?>"/>
|
||||
|
||||
<div id="tabs-1">
|
||||
|
||||
<?php require 'html-cl-package-prices.php'; ?>
|
||||
|
||||
</div>
|
||||
<div id="tabs-2">
|
||||
|
||||
<div class="form-group">
|
||||
<select id="wiaas_cl_customers" class="form-control">
|
||||
<option selected value="0" disabled> Select customer ...</option>
|
||||
<?php
|
||||
$customers = wiaas_get_customers();
|
||||
foreach ($customers as $id => $name) {
|
||||
?>
|
||||
<option
|
||||
<?php disabled(in_array($id, $customer_ids_with_extras), true, true) ?>
|
||||
id="wiaas_cl_customer_<?php esc_attr_e($id, 'wiaas') ?>"
|
||||
value="<?php esc_attr_e($id, 'wiaas') ?>"
|
||||
>
|
||||
<?php esc_html_e($name, 'wiaas') ?>
|
||||
</option>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<button id="wiaas_add_cl_customer_extras" class="button">Add</button>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Render customer specific prices if any
|
||||
foreach ($customer_ids_with_extras as $customer_id) {
|
||||
require 'html-cl-package-prices.php';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php wp_nonce_field( 'wiaas_save_cl_extras', 'wiaas_save_cl_extras_nonce' ); ?>
|
||||
<?php submit_button( __( 'Save', 'wiaas' ), 'primary', 'submit' ); ?>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user