| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) { exit; } ?> |
| 2 |
<div class="qcformbuilder-config-group"> |
| 3 |
<label for="{{_id}}_element"><?php echo esc_html__('Element', 'qcformbuilder-forms'); ?></label> |
| 4 |
<div class="qcformbuilder-config-field"> |
| 5 |
<input id="{{_id}}_element" type="text" class="input-block field-config" name="{{_name}}[element]" value="{{element}}"> |
| 6 |
</div> |
| 7 |
</div> |
| 8 |
<div class="qcformbuilder-config-group"> |
| 9 |
<label for="{{_id}}_classes"><?php echo esc_html__('Classes', 'qcformbuilder-forms'); ?></label> |
| 10 |
<div class="qcformbuilder-config-field"> |
| 11 |
<input id="{{_id}}_classes" type="text" class="input-block field-config" name="{{_name}}[classes]" value="{{classes}}"> |
| 12 |
</div> |
| 13 |
</div> |
| 14 |
<div class="qcformbuilder-config-group"> |
| 15 |
<label for="{{_id}}_before"><?php echo esc_html__('Before', 'qcformbuilder-forms'); ?></label> |
| 16 |
<div class="qcformbuilder-config-field"> |
| 17 |
<input id="{{_id}}_before" type="text" class="input-block field-config" name="{{_name}}[before]" value="{{before}}"> |
| 18 |
</div> |
| 19 |
</div> |
| 20 |
<div class="qcformbuilder-config-group"> |
| 21 |
<label for="{{_id}}_after"><?php echo esc_html__('After', 'qcformbuilder-forms'); ?></label> |
| 22 |
<div class="qcformbuilder-config-field"> |
| 23 |
<input id="{{_id}}_after" type="text" class="input-block field-config" name="{{_name}}[after]" value="{{after}}"> |
| 24 |
</div> |
| 25 |
</div> |
| 26 |
<div class="qcformbuilder-config-group"> |
| 27 |
<div class="qcformbuilder-config-field"> |
| 28 |
<label><input id="{{_id}}_fixed" type="checkbox" class="field-config" name="{{_name}}[fixed]" value="1" {{#if fixed}}checked="checked"{{/if}}> <?php echo esc_html__('Money Format', 'qcformbuilder-forms'); ?></label> |
| 29 |
</div> |
| 30 |
</div> |
| 31 |
|
| 32 |
<div class="qcformbuilder-config-group" id="{{_id}}_thousand_separator"> |
| 33 |
<label for="{{_id}}_sep"> |
| 34 |
<?php esc_html_e('Thousands Separator', 'qcformbuilder-forms'); ?> |
| 35 |
</label> |
| 36 |
<div class="qcformbuilder-config-field"> |
| 37 |
<input id="{{_id}}_sep" type="text" class="field-config" name="{{_name}}[thousand_separator]" value="{{#if thousand_separator}}{{thousand_separator}}{{else}},{{/if}}"> |
| 38 |
</div> |
| 39 |
</div> |
| 40 |
<div class="qcformbuilder-config-group" id="{{_id}}_decimal_separator"> |
| 41 |
<label for="{{_id}}_sep_decimal"> |
| 42 |
<?php esc_html_e('Decimal Separator', 'qcformbuilder-forms'); ?> |
| 43 |
</label> |
| 44 |
<div class="qcformbuilder-config-field"> |
| 45 |
<input id="{{_id}}_sep_decimal" type="text" class="field-config" name="{{_name}}[decimal_separator]" value="{{#if decimal_separator}}{{decimal_separator}}{{else}}.{{/if}}"> |
| 46 |
</div> |
| 47 |
</div> |
| 48 |
|
| 49 |
<div class="qcformbuilder-config-group"> |
| 50 |
<div class="qcformbuilder-config-field"> |
| 51 |
<label><input id="{{_id}}_manual" type="checkbox" class="field-config" name="{{_name}}[manual]" value="1" {{#if manual}}checked="checked"{{/if}}> <?php echo esc_html__('Manual Formula', 'qcformbuilder-forms'); ?></label> |
| 52 |
</div> |
| 53 |
</div> |
| 54 |
<div id="{{_id}}_autobox"> |
| 55 |
<div class="qcformbuilder-config-group qcformbuilder-config-group-full"> |
| 56 |
<button type="button" class="button block-button add-operator-group ajax-trigger" |
| 57 |
data-template="#calculator-group-tmpl" |
| 58 |
data-target="#{{_id}}_operator_groups" |
| 59 |
data-target-insert="append" |
| 60 |
data-name="{{_name}}" |
| 61 |
data-id="{{_id}}" |
| 62 |
data-request="calc_add_group" |
| 63 |
data-callback="init_calc_group" |
| 64 |
><?php echo esc_html__('Add Operator Group', 'qcformbuilder-forms'); ?></button> |
| 65 |
</div> |
| 66 |
<br> |
| 67 |
<div id="{{_id}}_operator_groups" class="calculation-groups-wrap"></div> |
| 68 |
<input type="hidden" class="block-input field-config calculation-formular" name="{{_name}}[formular]" id="{{_id}}_formular" value="{{formular}}"> |
| 69 |
<input type="hidden" class="block-input field-config ajax-trigger" data-request="build_calc_structure" data-callback="{{_id}}_build_formula" data-init="{{_id}}_build_formula" data-event="none" data-autoload="true" data-type="json" data-template="#calculator-group-tmpl" data-target="#{{_id}}_operator_groups" name="{{_name}}[config]" id="{{_id}}_config" value="{{#if config/group}}{{json config}}{{else}}{{config}}{{/if}}"> |
| 70 |
</div> |
| 71 |
<div id="{{_id}}_manualbox" style="display:none;"> |
| 72 |
<textarea name="{{_name}}[manual_formula]" class="field-config block-input">{{manual_formula}}</textarea> |
| 73 |
<p class="description"><?php echo esc_html__('Use %field_slug% as field value variables', 'qcformbuilder-forms'); ?></p> |
| 74 |
</div> |
| 75 |
<br><br><br> |
| 76 |
{{#script}} |
| 77 |
//<script> |
| 78 |
|
| 79 |
|
| 80 |
function {{_id}}_build_formula(obj){ |
| 81 |
build_calculations_formular('{{_id}}', obj); |
| 82 |
rebind_field_bindings(); |
| 83 |
}; |
| 84 |
|
| 85 |
jQuery('#{{_id}}_operator_groups').on('change', 'select', function(e){ |
| 86 |
{{_id}}_build_formula(); |
| 87 |
}); |
| 88 |
jQuery('body').on('change', '#{{_id}}_fixed', function(e){ |
| 89 |
|
| 90 |
var checked = jQuery(this); |
| 91 |
|
| 92 |
if(checked.prop('checked')){ |
| 93 |
jQuery('#{{_id}}_thousand_separator').show(); |
| 94 |
}else{ |
| 95 |
jQuery('#{{_id}}_thousand_separator').hide(); |
| 96 |
} |
| 97 |
|
| 98 |
}); |
| 99 |
jQuery('body').on('change', '#{{_id}}_manual', function(e){ |
| 100 |
var checked = jQuery(this); |
| 101 |
|
| 102 |
if(checked.prop('checked')){ |
| 103 |
jQuery('#{{_id}}_autobox').hide(); |
| 104 |
jQuery('#{{_id}}_manualbox').show(); |
| 105 |
}else{ |
| 106 |
jQuery('#{{_id}}_autobox').show(); |
| 107 |
jQuery('#{{_id}}_manualbox').hide(); |
| 108 |
} |
| 109 |
}); |
| 110 |
|
| 111 |
jQuery('#{{_id}}_manual,#{{_id}}_fixed').trigger('change'); |
| 112 |
|
| 113 |
{{/script}} |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|