From 91a09fe30c51da9db5009ae40b5b9869d4c3d0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Pi=C4=85tkowski?= Date: Mon, 11 Jul 2022 23:05:19 +0200 Subject: [PATCH 01/14] 1.3.4 --- assets/css/admin.css | 2 +- assets/css/admin.min.css | 2 +- assets/css/admin.sass | 2 +- assets/css/price.css | 2 +- assets/css/price.min.css | 2 +- assets/js/admin.js | 3 ++- assets/js/admin.min.js | 2 +- docs/.retype/404.html | 8 ++++---- docs/.retype/changelog/index.html | 8 ++++---- docs/.retype/index.html | 8 ++++---- docs/.retype/news/index.html | 8 ++++---- docs/.retype/resources/js/config.js | 2 +- docs/.retype/resources/js/config.min.js | 2 +- docs/.retype/sitemap.xml.gz | Bin 452 -> 457 bytes docs/.retype/usermanual/about/index.html | 8 ++++---- .../usermanual/advanced_usage/index.html | 8 ++++---- .../usermanual/calculation-types/index.html | 8 ++++---- .../usermanual/example-expressions/index.html | 8 ++++---- .../usermanual/expression-syntax/index.html | 8 ++++---- docs/.retype/usermanual/fields/index.html | 10 +++++----- .../.retype/usermanual/import_export/index.html | 8 ++++---- docs/.retype/usermanual/installation/index.html | 8 ++++---- docs/.retype/usermanual/templates/index.html | 8 ++++---- docs/.retype/usermanual/uninstall/index.html | 8 ++++---- docs/.retype/usermanual/usage/index.html | 8 ++++---- docs/.retype/usermanual/videos/index.html | 8 ++++---- src/FieldsetProduct.php | 6 +++++- src/View.php | 5 ++++- views/admin/expression.php | 5 +++++ wc-kalkulator.php | 4 ++-- 30 files changed, 91 insertions(+), 78 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index cc036d0..f884ced 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -222,7 +222,7 @@ width: 100%; } .wc-kalkulator-wrapper span.formula-field { - padding-right: 6px; + padding-left: 6px; cursor: pointer; font-weight: 700; } diff --git a/assets/css/admin.min.css b/assets/css/admin.min.css index bd43edf..7b1c12b 100644 --- a/assets/css/admin.min.css +++ b/assets/css/admin.min.css @@ -1 +1 @@ -.wc-kalkulator-wrapper html{scroll-padding-top:100px}.wc-kalkulator-wrapper p.add-buttons{line-height:36px}.wc-kalkulator-wrapper a.button.action-add-image{margin-bottom:20px;margin-top:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper a.button.action-add-attachment{margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list{width:100%}.wc-kalkulator-wrapper ul#f-field-list *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li{box-shadow:0 5px 10px #ccc;margin-bottom:5px}.wc-kalkulator-wrapper ul#f-field-list li .field{border:1px solid #aaa;background-color:#fff}.wc-kalkulator-wrapper ul#f-field-list li .field .header{padding:8px}.wc-kalkulator-wrapper ul#f-field-list li .field .header .text{font-size:14px;color:#000;padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .body{padding:20px;border-top:1px solid #aaa}.wc-kalkulator-wrapper ul#f-field-list li .field .body .half{float:left;width:50%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .second{padding-left:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .first{padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .fu-allowed-extensions{margin-top:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body label{font-size:12px;margin-bottom:3px;font-weight:700}.wc-kalkulator-wrapper ul#f-field-list li .field .body label.error{background-color:#e30000;color:#fff;padding:6px;margin:6px 0;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair{margin-bottom:10px;display:flex;align-items:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair span.dashicons-no-alt{cursor:pointer;font-size:28px;color:red}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs{margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs button{margin-right:6px;margin-bottom:6px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer{display:none;margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer textarea{display:block;width:100%;min-height:200px;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column{float:left}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1{width:40%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-half{width:20%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2{width:40%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2-half{text-align:center;width:20%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-2{width:80%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-3{width:10%;padding-left:20px;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-4{width:10%;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .clear{clear:both}.wc-kalkulator-wrapper .input-group .dashicons,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons{padding:3px;margin-left:2px;margin-right:2px;cursor:pointer;color:#555}.wc-kalkulator-wrapper .input-group .left,.wc-kalkulator-wrapper ul#f-field-list li .field .header .left{float:left}.wc-kalkulator-wrapper .input-group .right,.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{float:right}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]),.wc-kalkulator-wrapper ul#f-field-list li .field .body label{display:block;width:100%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]).inline,.wc-kalkulator-wrapper ul#f-field-list li .field .body label.inline{display:inline;margin-right:10px;width:auto}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.f-required,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.fdp-disallow-past-date,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param[type=checkbox]{margin:10px 15px 14px 3px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text],.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=number].param,.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=text].param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text]{width:100%}.wc-kalkulator-wrapper .clearfix,.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair:after{content:"";display:block;clear:both}.wc-kalkulator-wrapper .pr-20{padding-right:20px}.wc-kalkulator-wrapper .input-icon{position:relative;font-family:monospace;width:100%;margin:10px 0}.wc-kalkulator-wrapper .input-icon i{font-family:monospace;font-size:15px;position:absolute;display:block;top:10px;pointer-events:none;width:45px;text-align:right;font-style:normal;color:#00f}.wc-kalkulator-wrapper .input-icon input{border:1px solid #aaa;border-radius:0;padding:5px 10px 5px 55px;width:100%}.wc-kalkulator-wrapper .input-if i::after{content:"if"}.wc-kalkulator-wrapper .input-equation i::after{content:"="}.wc-kalkulator-wrapper #addon-inputs .input-equation i::after{content:"add"}.wc-kalkulator-wrapper .input-else i::after{content:"else"}.wc-kalkulator-wrapper .input-group{padding:12px;border:1px solid #aaa;background-color:#fff;margin-bottom:5px}.wc-kalkulator-wrapper .ui-autocomplete-loading{background-image:none!important}.wc-kalkulator-wrapper .wc-category-search,.wc-kalkulator-wrapper .wc-enhanced-select,.wc-kalkulator-wrapper .wc-page-search,.wc-kalkulator-wrapper .wc-product-search{width:100%}.wc-kalkulator-wrapper span.formula-field{padding-right:6px;cursor:pointer;font-weight:700}.wc-kalkulator-wrapper span.formula-field:hover{text-decoration:underline}.wc-kalkulator-wrapper .wp-media-image-preview{max-width:80px;max-height:80px;cursor:pointer}.wc-kalkulator-wrapper .wp-media-image-preview:hover{transform:scale(1.2);-moz-transform:scale(1.2);-webkit-transform:scale(1.2)}.wc-kalkulator-wrapper select.param{margin-bottom:20px}.wc-kalkulator-wrapper .iris-picker{position:absolute;z-index:9999}.wc-kalkulator-wrapper .fields-section{text-align:center;padding:50px;margin:0 auto;max-width:500px}.wc-kalkulator-wrapper .fields-section button,.wc-kalkulator-wrapper .fields-section select{font-size:16px}.wc-kalkulator-wrapper .fields-section select{width:300px;padding:5px 10px}.wc-kalkulator-wrapper .fields-section button{width:50px;padding:3px 8px}.wc-kalkulator-wrapper .fields-section button span{line-height:2} \ No newline at end of file +.wc-kalkulator-wrapper html{scroll-padding-top:100px}.wc-kalkulator-wrapper p.add-buttons{line-height:36px}.wc-kalkulator-wrapper a.button.action-add-image{margin-bottom:20px;margin-top:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper a.button.action-add-attachment{margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list{width:100%}.wc-kalkulator-wrapper ul#f-field-list *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li{box-shadow:0 5px 10px #ccc;margin-bottom:5px}.wc-kalkulator-wrapper ul#f-field-list li .field{border:1px solid #aaa;background-color:#fff}.wc-kalkulator-wrapper ul#f-field-list li .field .header{padding:8px}.wc-kalkulator-wrapper ul#f-field-list li .field .header .text{font-size:14px;color:#000;padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .body{padding:20px;border-top:1px solid #aaa}.wc-kalkulator-wrapper ul#f-field-list li .field .body .half{float:left;width:50%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .second{padding-left:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .first{padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .fu-allowed-extensions{margin-top:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body label{font-size:12px;margin-bottom:3px;font-weight:700}.wc-kalkulator-wrapper ul#f-field-list li .field .body label.error{background-color:#e30000;color:#fff;padding:6px;margin:6px 0;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair{margin-bottom:10px;display:flex;align-items:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair span.dashicons-no-alt{cursor:pointer;font-size:28px;color:red}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs{margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs button{margin-right:6px;margin-bottom:6px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer{display:none;margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer textarea{display:block;width:100%;min-height:200px;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column{float:left}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1{width:40%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-half{width:20%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2{width:40%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2-half{text-align:center;width:20%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-2{width:80%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-3{width:10%;padding-left:20px;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-4{width:10%;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .clear{clear:both}.wc-kalkulator-wrapper .input-group .dashicons,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons{padding:3px;margin-left:2px;margin-right:2px;cursor:pointer;color:#555}.wc-kalkulator-wrapper .input-group .left,.wc-kalkulator-wrapper ul#f-field-list li .field .header .left{float:left}.wc-kalkulator-wrapper .input-group .right,.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{float:right}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]),.wc-kalkulator-wrapper ul#f-field-list li .field .body label{display:block;width:100%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]).inline,.wc-kalkulator-wrapper ul#f-field-list li .field .body label.inline{display:inline;margin-right:10px;width:auto}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.f-required,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.fdp-disallow-past-date,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param[type=checkbox]{margin:10px 15px 14px 3px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text],.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=number].param,.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=text].param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text]{width:100%}.wc-kalkulator-wrapper .clearfix,.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair:after{content:"";display:block;clear:both}.wc-kalkulator-wrapper .pr-20{padding-right:20px}.wc-kalkulator-wrapper .input-icon{position:relative;font-family:monospace;width:100%;margin:10px 0}.wc-kalkulator-wrapper .input-icon i{font-family:monospace;font-size:15px;position:absolute;display:block;top:10px;pointer-events:none;width:45px;text-align:right;font-style:normal;color:#00f}.wc-kalkulator-wrapper .input-icon input{border:1px solid #aaa;border-radius:0;padding:5px 10px 5px 55px;width:100%}.wc-kalkulator-wrapper .input-if i::after{content:"if"}.wc-kalkulator-wrapper .input-equation i::after{content:"="}.wc-kalkulator-wrapper #addon-inputs .input-equation i::after{content:"add"}.wc-kalkulator-wrapper .input-else i::after{content:"else"}.wc-kalkulator-wrapper .input-group{padding:12px;border:1px solid #aaa;background-color:#fff;margin-bottom:5px}.wc-kalkulator-wrapper .ui-autocomplete-loading{background-image:none!important}.wc-kalkulator-wrapper .wc-category-search,.wc-kalkulator-wrapper .wc-enhanced-select,.wc-kalkulator-wrapper .wc-page-search,.wc-kalkulator-wrapper .wc-product-search{width:100%}.wc-kalkulator-wrapper span.formula-field{padding-left:6px;cursor:pointer;font-weight:700}.wc-kalkulator-wrapper span.formula-field:hover{text-decoration:underline}.wc-kalkulator-wrapper .wp-media-image-preview{max-width:80px;max-height:80px;cursor:pointer}.wc-kalkulator-wrapper .wp-media-image-preview:hover{transform:scale(1.2);-moz-transform:scale(1.2);-webkit-transform:scale(1.2)}.wc-kalkulator-wrapper select.param{margin-bottom:20px}.wc-kalkulator-wrapper .iris-picker{position:absolute;z-index:9999}.wc-kalkulator-wrapper .fields-section{text-align:center;padding:50px;margin:0 auto;max-width:500px}.wc-kalkulator-wrapper .fields-section button,.wc-kalkulator-wrapper .fields-section select{font-size:16px}.wc-kalkulator-wrapper .fields-section select{width:300px;padding:5px 10px}.wc-kalkulator-wrapper .fields-section button{width:50px;padding:3px 8px}.wc-kalkulator-wrapper .fields-section button span{line-height:2} \ No newline at end of file diff --git a/assets/css/admin.sass b/assets/css/admin.sass index eb54e7d..11aac7a 100644 --- a/assets/css/admin.sass +++ b/assets/css/admin.sass @@ -182,7 +182,7 @@ width: 100% span &.formula-field - padding-right: 6px + padding-left: 6px cursor: pointer font-weight: 700 &:hover diff --git a/assets/css/price.css b/assets/css/price.css index c03b27d..86aff0b 100644 --- a/assets/css/price.css +++ b/assets/css/price.css @@ -3,6 +3,6 @@ p.wckalkulator-price { padding-top: 20px } -.summary p.price, .summary span.price, .summary .woocommerce-Price-amount, .summary .reset_variations { +.summary p.price, .summary span.price, .summary .woocommerce-Price-amount, .summary .reset_variations, .woocommerce-variation-price { display: none !important; } \ No newline at end of file diff --git a/assets/css/price.min.css b/assets/css/price.min.css index 03dbf4c..135b8e9 100644 --- a/assets/css/price.min.css +++ b/assets/css/price.min.css @@ -1 +1 @@ -p.wckalkulator-price{font-size:20px;padding-top:20px}.summary .reset_variations,.summary .woocommerce-Price-amount,.summary p.price,.summary span.price{display:none!important} \ No newline at end of file +p.wckalkulator-price{font-size:20px;padding-top:20px}.summary .reset_variations,.summary .woocommerce-Price-amount,.summary p.price,.summary span.price,.woocommerce-variation-price{display:none!important} \ No newline at end of file diff --git a/assets/js/admin.js b/assets/js/admin.js index 882e6e0..7db58e2 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -234,7 +234,7 @@ $WK.changeAssignType(); $("form#post").attr("novalidate", ""); $WK.buildTooltips(""); - $WK.appendGlobalParameters(); + //$WK.appendGlobalParameters(); }; $WK.buildTooltips = function (selector) { @@ -283,6 +283,7 @@ $("label.error").remove(); $WK.saved = false; $("#formula_fields").html(" ‐ "); + $WK.appendGlobalParameters(); if (error) { alert("Please add at least one field before saving."); diff --git a/assets/js/admin.min.js b/assets/js/admin.min.js index 8c0c6d7..f03de1f 100644 --- a/assets/js/admin.min.js +++ b/assets/js/admin.min.js @@ -1 +1 @@ -(function($){"use strict";var $WK={};$(document).ready(function($){var suggest=[];var input_key_pressed={};$("#f-field-list").sortable({handle:".action-drag"});$("#extra-inputs, #addon-inputs").sortable({handle:".action-drag"});$("a.savefields").on("click",function(e){e.preventDefault();$WK.saveFields()});$('').insertBefore("#wpwrap");$WK.colorpicker=$("input.wck-global-color-picker");$WK.colorpicker.iris();$WK.expressionLastFocusedInput=null;$WK.wpMediaFrame=null;$WK.wpMediaTarget=null;$WK.iconPreloader="data:image/gif;base64,R0lGODlhEAAQAPUVAHt7e729vf///4R7e+/v762trZSUlKWlpZycnPf39+bm5t7e3tbW1s7OzoSEhMXFxc7FzpSMjJyUlP/397WtraWlnM7FxbW1tb21tebe3tbOzqWcnIyEhHNzc3tzc4yMjK2lpbWttcW9vffv76Wtpa2lra2tpb21vcXFzt7e1qWlrdbe1pScnO/v5gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBwAVACwAAAAAEAAQAEAGt8CKsGLZfDyez8YyrAAekAdA09R0GoLGE8BgLDQIhwORSSQIDqYxELhcCoXDARHeCBmRSGOh6BMICxIRDBUOAQ0NBiBNIBsTAgscGwgPDxcABYgFHnQSSkMFAAYHcAgRHQVNQgUDmX0NFA6pQxsGC7d9Cn8ECRt2GwddDwMgiCAOC2YYGwCIWlRDGgACAgkADhiVEYtDIAMGAQYcUmxtHwDXc3QdDxV4DhRucHIIAIOqRRxIkkxDQQAh+QQFBwAQACwAAAAAEAAQAAAGr0CIEGLZfDyez8YybBYAh8diYSkMCk1G5PNgrKYKBcMQYQg3hgZjDQ4TEBvIA/BoNCySgQMBIRAUDkVRDQEDIHYgDgx+FxsOFw8PBiBNIAgJCQscAAGRABpNGgCYBACcAQGfoaMJpQ4hqB+UQyAbAgKaGwgXF08FdgUdF7cBG3O8vQ6meypiAw8QRr0FBwcI1wgHDnEQWg4H1NbXBgBlTh4G2dYfHVhNQkUcSBxLTUEAIfkECQcAEAAsAQABAA4ADgAABnBAiFAYYDAeoKEy0GgYF4uG8vN4NJ9QxTBQfQgHQoViMUAEAhiAMqygFM6ftZBAYFzu8jlBcb/kISN0IAUFHHIICQkMBoQHHkoOGYkXHgUkBwdKCgIJBA4QDpgHCAgGFwICE5lfpKQGRQsIch+tBmtBACH5BAUHABQALAEAAQAOAA4AAAaaQAqlAEBcHo3AAVAQMiKO4wPSaDAsnwhj8wkEHuAqg7EwbAAXbyAyGBgaiwVjILlcQgBQFTSALwoHdh8gQkIgEgoKDQWMABqFFBoAiQsHjB6PhZKJChUHBw6EhSAIBAQMBp8IHgVVBQ4UphceBwi2AwAOBwoJBAoOGw62CG8CEwnIGxtPRRIBAtAJCghaQgUdHwYMAgsXDk0UQQAh+QQFBwAQACwBAAEADgAOAAAGcECIECIpBB4XxHBZuASOD5RoyblYn49HYyv0FL4XCECoZTTGhwJoSWYwQIjDwcEWMhYP+cFThywWDAiCfX5/gkp9CgoNH4IGiQoFEHEFDxt0GwsECgtCAxAECQIJpASmiBAeDQKjpQsSbAMYC6QMbEEAIfkEBQcAEAAsAQABAA4ADgAABnZAiNAjOVwCBaFSCDgUCpdjAMNZHpzQU0D0eESEVycHAIgEuo8yAgHxLAGBRkO4Xi7lIoSBbRcyGA0SCB99fn8GD3N9EgsLDxwEAhkOdg2NBQAjAgIKSggMCo0DEAcTCacjBAQKrEsICqeqqwx9DhgMqgwUo0JBACH5BAkHAAAALAEAAQAOAA4AAAVjICACEVIUhzGuyHGc10WtANK+RRwEo92ulx0PIKnRAJfHY2MIGAbHiBLTEDSOogfkkRAIoMdG47EQTDZYcQCTSBwHDwbj4AC0MwgAVLOQi9AEgQqDC4UqIwuChFdHFBqDjCMhACH5BAUHABMALAEAAQAOAA4AAAaTwMmk0PlIDgeEwVMQMiIAA2KKLBwGEcbGkZwiqoULZzNgEC4IBwDAKYQvgIBA8OiAGg0Q4I1YzA8gQkIgHwEBIQmJAxqCExoehgEEioyCGgAPDwELiQiBgiAGmRgXBAQMDgV4BQMiDRAHDgqmEwgDAwYQeBYAGwgECsELCwzFDQYbTxIMwsMMDxFZQqyqww8He0JBACH5BAUHAAMALAEAAQAOAA4AAAZzwIEQYBggEIaPcGlUKBqG4xGw3CQEgkAUcTiYhA7CVcHskgqeSyKRcTA9h0LBwFhvmEJO6FIi+PFLF4IKflR4HgGCDH+AHwEBBQNOGngAGA8BCAMLTgMSSw+hIksKC6YMDA0NoRFMDaepDQGAAyAPqLNMQQAh+QQFBwAYACwBAAEADgAOAAAFZSAmOtciMGKaSlgivAGrIm0yCY2B7KlCJJiDQ7RDHEQEgiplPGKStGXwUFFYAVJMoXBYWLPabcMqW14uh8JigRksKWfJgLHOYQCRgP4ikiwYDA0ND4R6SxaBDRCEfEtYAYIXUSIhACH5BAkHABAALAEAAQAOAA4AAAZyQIhQyEgkFhjHcLggGBMCAcOzbBEII6PAeBhABgsFYbGBOA6iwgEBKSgUjKXQwEJ8Gm/5EMFf+PVCfAgMf4AHhw8LcXpnayAMDA96IAUFQg0MDZIAQheVBVQQDaMPDwEBF6kcQx8ipaaoBUpyGxemlktBACH5BAUHABAALAEAAQAOAA4AAAaRQAikMCg0CATGxVEQMiIGhgJJSCQUiAhjI1F4p1Vr4rAZLBYKBsLh2CgEggSgcG44QI0GyAFJED4PKQsSIEJCewEBUQwMABqGEBodHwgSDYyOkJIInAF5BoWGe5wIB3kBc3kFHgcHWQAPsQEfAAAcBa0HHhsGsokXBcEHbU8fF78XwMNaQgUACAUBFwcGHk0QQQA7";$("body").on("focus","#wck_expression input",function(){$WK.expressionLastFocusedInput=$(this)}).on("click","span.formula-field",function(){var $focused=$WK.expressionLastFocusedInput;if($focused&&$focused.length){var cursorPos=$focused[0].selectionStart;var x=$focused.val();$focused.val(x.slice(0,cursorPos)+$(this).text()+x.slice(cursorPos));$focused.focus();cursorPos+=$(this).text().length;$focused[0].setSelectionRange(cursorPos,cursorPos)}}).on("click",".field .pairs .action-add",function(){var $clone=$(this).prev(".pair").clone().insertBefore($(this));$clone.children("input").val("")}).on("click",".field .pairs .action-showimport",function(){$(this).parent().find("div.importer").toggle()}).on("click",".field .pairs .action-import",function(){var $this=$(this);var input=$this.parent().find("textarea").val().trim().split("\n");if(Array.isArray(input)){input.forEach(function(el){var columns=el.trim().split(";");var $last_pair=$this.parent().parent().find(".pair").last();var $clone=$last_pair.clone().insertAfter($last_pair);if(columns.length===2){$clone.find("input.fs-name").val(columns[0]);$clone.find("input.fs-title").val(columns[1])}else if(columns.length===1){$clone.find("input.fs-title").val(columns[0])}})}}).on("click",".field .pairs .action-removeall",function(){if(confirm("Are you sure?")){$(this).parent().find(".pair").slice(1).remove()}}).on("click",".field .pair .action-delete",function(){var $pairs=$(this).closest(".pairs");if($pairs.children(".pair").length>1){if(confirm("Are you sure?")){$(this).closest(".pair").remove()}}else{alert("You cannot remove the last item!")}}).on("click",".field .header .action-delete",function(){if(confirm("Are you sure?")){var $target=$(this).closest("li");$target.hide("slow",function(){$target.remove()})}}).on("click",".field .header .action-toggle",function(){$(this).closest(".field").find(".body").slideToggle(300);$(this).toggleClass("dashicons-arrow-up-alt2");$(this).toggleClass("dashicons-arrow-down-alt2")}).on("click","#add-field-button",function(e){e.preventDefault();var fieldType=$("#select-field").val();var id=$WK.addField(fieldType);$("html, body").animate({scrollTop:$("#"+id).offset().top-50},1e3)}).on("click",".expression_conditional .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#extra-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last condition!")}}).on("click",".expression_addon .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#addon-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last addon!")}}).on("click",".action-add-image",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this image"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();if($WK.wpMediaTarget.prop("tagName")==="A"){$WK.wpMediaTarget.next("img.wp-media-image-preview").attr("src",attachment.url);$WK.wpMediaTarget.next().next("input.wp-media-image-id").attr("value",attachment.id);$WK.wpMediaTarget.hide()}else{$WK.wpMediaTarget.attr("src",attachment.url);$WK.wpMediaTarget.next("input.wp-media-image-id").attr("value",attachment.id)}});$WK.wpMediaFrame.open()}).on("click",".action-add-attachment",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this file"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();$WK.wpMediaTarget.next("input.wp-media-attachment-id").val(attachment.id);$WK.wpMediaTarget.next().next("a.wp-media-attachment-preview").attr("href",attachment.url).text(attachment.url)});$WK.wpMediaFrame.open()}).on("focus",'[data-type="colorswatches"] input.fs-title',function(e){e.preventDefault();var _target=$(this);$WK.colorpicker.iris("show");$(".iris-picker").css({top:_target.offset().top+40,left:_target.offset().left});$WK.colorpicker.iris("option","change",function(event,ui){_target.val(ui.color.toString());var color=ui.color.toRgb();var t=(color.r+color.g+color.b)/2;var textColor=t<200?"#FFFFFF":"#000000";_target.css({"background-color":ui.color.toString(),color:textColor})});$WK.colorpicker.iris("color",$(this).val())}).on("click","input.allowed-extensions",function(){var field_id="#"+$(this).closest("li").attr("id");var ext=[];$(field_id+" input.allowed-extensions:checked").each(function(){console.log($(this).data("extension"));ext.push($(this).data("extension"))});$(field_id+" input.fu-allowed-extensions").val(ext.join("|"))});$(".iris-square-value").on("click",function(e){e.preventDefault()});$(document).click(function(e){if(!$(e.target).closest('.iris-picker, [data-type="colorswatches"] input.fs-title').length){if($(".iris-picker").is(":visible")){$WK.colorpicker.iris("hide")}}});$("form#post").submit(function(e){$WK.saveFields();if(!$WK.saved){e.preventDefault();return false}$WK.saveExpression();if(!$WK.expr_saved&&$WK.expression.mode!=="off"){e.preventDefault();alert("Expression is required. Fill in required fields and try again!");return false}return true});$WK.init=function(){$WK.fieldList=$("#f-field-list");$WK.html=wck_fields_html;$WK.fields={};$WK.saved=false;$WK.expr_saved=false;$WK.counter=0;$WK.expression={mode:$("input.expression_type:checked").val()};$WK.loadJSONdata();$WK.showExpressionEditor();$WK.changeAssignType();$("form#post").attr("novalidate","");$WK.buildTooltips("");$WK.appendGlobalParameters()};$WK.buildTooltips=function(selector){$(selector+"span.wck-field-tip").tipTip({attribute:"title",defaultPosition:"left"})};$WK.changeAssignType=function(){var disabled=$("#assign_type").val()==="1";$("#assign_products, #assign_categories, #assign_tags").prop("disabled",disabled)};$("#assign_type").on("change",$WK.changeAssignType);$WK.preloadMedia=function(id,callback){wp.media.attachment(id).fetch().then(function(){callback(wp.media.attachment(id))});return};$WK.addField=function(type){$WK.counter+=1;var id="wkfield-"+$WK.counter;$("li.welcome",$WK.fieldList).remove();$WK.fieldList.append($("
  • ",{"data-type":type,class:"form-invalid",id:id}).append($WK.html[type].replace("{id}",id)));$WK.buildTooltips("#"+id+" ");return id};$(window).on("beforeunload",function(){if($WK.saved===false){return""}});$WK.saveFields=function(){$WK.fields={};suggest=[];var error=$("li .field",$WK.fieldList).length===0;$("label.error").remove();$WK.saved=false;$("#formula_fields").html(" ‐ ");if(error){alert("Please add at least one field before saving.");return false}$("li .field",$WK.fieldList).each(function(){var $row=$(this);var input_fname=$row.find("input.f-name");var input_ftitle=$row.find("input.f-title");var input_fhint=$row.find("input.f-hint");var input_default_value=$row.find("input.f-default-value");var input_css_class=$row.find("input.f-css-class");var field={type:$row.data("type"),use_expression:$row.data("use-expression")===true,name:input_fname.val(),title:input_ftitle.val(),hint:input_fhint.val(),default_value:input_default_value.val(),css_class:input_css_class.val(),required:$row.find("input.f-required").length>0?$row.find("input.f-required").is(":checked"):true};var input_fprice=$row.find("input.f-price");if(input_fprice.length>0){field.price=input_fprice.val();if(field.price!==""){field.use_expression=true}}var input_fimgwidth=$row.find("input.fimg-width");if(input_fimgwidth.length>0){field.image_size=input_fimgwidth.val()}var $fs_options;switch(field.type){case"select":case"radio":case"imageselect":case"imageswatches":case"colorswatches":case"radiogroup":case"checkboxgroup":field.options_name=[];field.options_title=[];if(field.type==="imageselect"||field.type==="imageswatches"){field.options_image=[]}if(field.type==="checkboxgroup"){field.select_limit=$row.find("input.fcbg-limit").val()}$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var fs_name=$(this).find("input.fs-name");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_name.val()+":"+fs_title.val()}field.options_name.push(fs_name.val()+":"+fs_title.val());field.options_title.push(fs_title.val());if(field.type==="imageselect"||field.type==="imageswatches"){var fs_image=$(this).find("input.fs-image");field.options_image.push(fs_image.val())}});break;case"dropdown":field.options_title=[];$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_title.val()}field.options_title.push(fs_title.val())});break;case"number":var input_fnmin=$row.find("input.fn-min-value");field.min=input_fnmin.val();var input_fnmax=$row.find("input.fn-max-value");field.max=input_fnmax.val();break;case"checkbox":var input_fcb_default_state=$row.find("input.fcb-default-state");field.default_state=input_fcb_default_state.is(":checked");break;case"text":case"textarea":case"email":var input_ftminlen=$row.find("input.ft-min-length");var input_ftmaxlen=$row.find("input.ft-max-length");var input_ftpattern=$row.find("input.ft-pattern");field.min=input_ftminlen.val();field.max=input_ftmaxlen.val();if(input_ftpattern.length>0){field.pattern=input_ftpattern.val()}break;case"colorpicker":case"datepicker":case"rangedatepicker":var input_fdpdisallow_past_date=$row.find("input.fdp-disallow-past-date");field.disallow_past_date=input_fdpdisallow_past_date.is(":checked");break;case"imageupload":field.max_file_size=$row.find("input.fu-max-file-size").val();field.allowed_extensions=$row.find("input.fu-allowed-extensions").val();break;case"html":case"paragraph":case"hidden":case"attachment":field.content=$row.find(".fst-content").val();break;case"link":field.content=$row.find(".fst-content").val();field.target=$row.find(".fst-target").val();break;case"heading":field.content=$row.find(".fst-content").val();field.level=$row.find(".fst-level").val();break}if(field.name!==""&&field.name in $WK.fields){error=true;alert("Field names must be unique! The '"+field.name+"' name is used more than once.")}if(!error){$WK.appendFormulaVars(field)}});var wkform=$("form#post");if(!wkform[0].checkValidity()){error=true;$("input:invalid").parent().show();$("input:invalid").each(function(){$('").insertBefore($(this))})}if(error&&$("label.error").length){$("html, body").animate({scrollTop:$("label.error").first().offset().top-160},1e3)}$WK.saveJSONdata();$WK.saved=!error};$WK.appendGlobalParameters=function(){if(typeof wck_global_parameters!==undefined){$.each(wck_global_parameters,function(name,value){var name="global:"+name;suggest.push(name);$("#formula_fields").append('{'+name+"} ")})}};$WK.appendFormulaVars=function(field){$WK.fields[field.name]=field;if(field.use_expression){if(field.type!=="checkboxgroup"){suggest.push(field.name);$("#formula_fields").append('{'+field.name+"} ")}else{suggest.push(field.name+":sum");$("#formula_fields").append('{'+field.name+":sum} ");suggest.push(field.name+":min");$("#formula_fields").append('{'+field.name+":min} ");suggest.push(field.name+":max");$("#formula_fields").append('{'+field.name+":max} ")}if(field.type==="text"||field.type==="textarea"){suggest.push(field.name+":text");$("#formula_fields").append('{'+field.name+":text} ")}if(field.type==="rangedatepicker"){suggest.push(field.name+":date_from");$("#formula_fields").append('{'+field.name+":date_from} ");suggest.push(field.name+":date_to");$("#formula_fields").append('{'+field.name+":date_to} ");suggest.push(field.name+":days");$("#formula_fields").append('{'+field.name+":days} ")}else if(field.type==="datepicker"){suggest.push(field.name+":date");$("#formula_fields").append('{'+field.name+":date} ")}else if(field.type==="imageupload"){suggest.push(field.name+":size");$("#formula_fields").append('{'+field.name+":size} ")}}};$WK.saveJSONdata=function(){if(Object.keys($WK.fields).length>0){$("input[name=_wck_fieldset]").val(JSON.stringify($WK.fields))}};$WK.loadJSONdata=function(){if(typeof wck_load_fieldset==="object"){$.each(wck_load_fieldset,function(){var field_id=$WK.addField(this.type);var $field=$("#"+field_id+" .field");$("#"+field_id+" .f-name").val(this.name);$("#"+field_id+" .f-title").val(this.title);$("#"+field_id+" .f-hint").val(this.hint);$("#"+field_id+" .f-css-class").val(this.css_class);if($("#"+field_id+" .f-required").length>0){$("#"+field_id+" .f-required").prop("checked",this.required)}var fprice=$("#"+field_id+" .f-price");if(fprice.length>0){fprice.val(this.price)}var fimgwidth=$("#"+field_id+" .fimg-width");if(fimgwidth.length>0){fimgwidth.val(this.image_size)}var options_title,options_name,options_image,default_value,first,$checked;if(this.type==="dropdown"){options_title=this.options_title;default_value=this.default_value;first=true;$checked=null;$.each(options_title,function(i,option_title){if(first){var $first=$field.find(".fs-option");$first.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(["select","radio","imageselect","radiogroup","checkboxgroup","imageswatches","colorswatches"].indexOf(this.type)>=0){options_name=this.options_name;options_title=this.options_title;default_value=this.default_value;if(this.type==="imageselect"||this.type==="imageswatches"){options_image=this.options_image;wp.media.attachment(options_image).fetch()}if(this.type==="checkboxgroup"){$("#"+field_id+" .fcbg-limit").val(this.select_limit)}first=true;$checked=null;$.each(options_name,function(i,option_name){if(option_name.indexOf(":")>=0){option_name=option_name.slice(0,option_name.indexOf(":"))}if(first){var $first=$field.find(".fs-option");$first.find("input.fs-name").val(option_name);$first.find("input.fs-title").val(options_title[i]);var fs_image=$first.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$first.find("a.action-add-image").hide();$first.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$first.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-name").val(option_name);$clone.find("input.fs-title").val(options_title[i]);fs_image=$clone.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$clone.find("a.action-add-image").hide();$clone.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$clone.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(this.type==="number"){$("#"+field_id+" .fn-min-value").val(this.min);$("#"+field_id+" .fn-max-value").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value)}else if(this.type==="checkbox"){$("#"+field_id+" .fcb-default-state").prop("checked",this.default_state)}else if(this.type==="text"||this.type==="textarea"||this.type==="email"){$("#"+field_id+" .ft-min-length").val(this.min);$("#"+field_id+" .ft-max-length").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value);if(this.type==="text"){$("#"+field_id+" .ft-pattern").val(this.pattern)}}else if(this.type==="colorpicker"||this.type==="datepicker"||this.type==="rangedatepicker"){$("#"+field_id+" .fdp-disallow-past-date").prop("checked",this.disallow_past_date)}else if(this.type==="imageupload"){$("#"+field_id+" .fu-max-file-size").val(this.max_file_size);$("#"+field_id+" .fu-allowed-extensions").val(this.allowed_extensions);var ext=this.allowed_extensions.split("|");ext.forEach(function(e){$("#"+field_id+" .allowed-extensions.ext-"+e).prop("checked",true)})}else if(["html","paragraph","heading","hidden","link","attachment"].indexOf(this.type)>=0){$("#"+field_id+" .fst-content").val(this.content);if(this.type==="heading"){$("#"+field_id+" .fst-level").val(this.level)}else if(this.type==="link"){$("#"+field_id+" .fst-target").val(this.target)}else if(this.type==="attachment"){$WK.preloadMedia(this.content,function(attachment){console.log(field_id,attachment.get("url"));$("#"+field_id+" .wp-media-attachment-preview").attr("href",attachment.get("url")).text(attachment.get("url"))})}}});$WK.saveFields()}};$WK.showExpressionEditor=function(){$("div.expression_oneline, div.expression_conditional, div.expression_off, div.expression_addon").hide();$("div.expression_"+$WK.expression.mode).show();if($WK.expression.mode==="off"){$(".off-hide").hide()}else{$(".off-hide").show()}};$("input.expression_type").on("change",function(){$WK.expression.mode=$(this).val();$WK.showExpressionEditor()});$WK.addCondition=function(if_value,then_value,addon=false){var $html=$('
    '+''+''+'
    '+'
    '+''+"
    "+'
    '+''+"
    ");$(".input-if input",$html).val(if_value);$(".input-equation input",$html).val(then_value);if(addon===true){$("div#addon-inputs").append($html)}else{$("div#extra-inputs").append($html)}$WK.autocomplete()};$("button.add-condition").on("click",function(){$WK.addCondition()});$("button.add-addon").on("click",function(){$WK.addCondition("","",true)});$WK.autocomplete=function(){$(".input-icon input").bind("keydown",function(e){if(e.keyCode===16||e.keyCode===219){input_key_pressed[e.keyCode]=true}}).autocomplete({minLength:0,source:function(request,response){if(input_key_pressed[16]===true&&input_key_pressed[219]===true){response(suggest)}},focus:function(){return false},select:function(event,ui){delete input_key_pressed[16];delete input_key_pressed[219];this.value+=ui.item.value+"}";return false}})};$WK.saveExpression=function(){var mode=$WK.expression.mode;$WK.expr_saved=false;if(mode==="oneline"){$WK.expression.expr=$(".expression_oneline input").val();if($WK.expression.expr!==""){$WK.expr_saved=true}}if(mode==="conditional"){var data=[];$(".expression_conditional .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});var input_else=$(".expression_conditional .input-else input").val();data.push({type:"else",if:"true",then:input_else});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="addon"){var data=[];$(".expression_addon .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="off"){$("input[name=_wck_expression]").val("off")}else{$("input[name=_wck_expression]").val(JSON.stringify($WK.expression))}};$WK.loadExpression=function(){if(typeof wck_load_expression==="object"){$WK.expression=wck_load_expression;if($WK.expression.mode==="oneline"){$(".expression_oneline input").val($WK.expression.expr);$("input[name=_wck_choose_expression_type].expression_oneline").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}else if($WK.expression.mode==="conditional"){$.each($WK.expression.expr,function(){if(this.type==="condition"){$WK.addCondition(this.if,this.then)}else if(this.type==="else"){$(".input-else input").val(this.then)}});$("input[name=_wck_choose_expression_type].expression_conditional").prop("checked",true);$WK.showExpressionEditor()}else if($WK.expression.mode==="addon"){$.each($WK.expression.expr,function(){$WK.addCondition(this.if,this.then,true)});$("input[name=_wck_choose_expression_type].expression_addon").prop("checked",true);$WK.showExpressionEditor()}}else{$WK.expression.mode="off";$("input[name=_wck_choose_expression_type].expression_off").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}};$("button.test-expression").on("click",function(){$WK.saveExpression()});$WK.init();$WK.loadExpression();$WK.autocomplete()})})(jQuery); \ No newline at end of file +(function($){"use strict";var $WK={};$(document).ready(function($){var suggest=[];var input_key_pressed={};$("#f-field-list").sortable({handle:".action-drag"});$("#extra-inputs, #addon-inputs").sortable({handle:".action-drag"});$("a.savefields").on("click",function(e){e.preventDefault();$WK.saveFields()});$('').insertBefore("#wpwrap");$WK.colorpicker=$("input.wck-global-color-picker");$WK.colorpicker.iris();$WK.expressionLastFocusedInput=null;$WK.wpMediaFrame=null;$WK.wpMediaTarget=null;$WK.iconPreloader="data:image/gif;base64,R0lGODlhEAAQAPUVAHt7e729vf///4R7e+/v762trZSUlKWlpZycnPf39+bm5t7e3tbW1s7OzoSEhMXFxc7FzpSMjJyUlP/397WtraWlnM7FxbW1tb21tebe3tbOzqWcnIyEhHNzc3tzc4yMjK2lpbWttcW9vffv76Wtpa2lra2tpb21vcXFzt7e1qWlrdbe1pScnO/v5gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBwAVACwAAAAAEAAQAEAGt8CKsGLZfDyez8YyrAAekAdA09R0GoLGE8BgLDQIhwORSSQIDqYxELhcCoXDARHeCBmRSGOh6BMICxIRDBUOAQ0NBiBNIBsTAgscGwgPDxcABYgFHnQSSkMFAAYHcAgRHQVNQgUDmX0NFA6pQxsGC7d9Cn8ECRt2GwddDwMgiCAOC2YYGwCIWlRDGgACAgkADhiVEYtDIAMGAQYcUmxtHwDXc3QdDxV4DhRucHIIAIOqRRxIkkxDQQAh+QQFBwAQACwAAAAAEAAQAAAGr0CIEGLZfDyez8YybBYAh8diYSkMCk1G5PNgrKYKBcMQYQg3hgZjDQ4TEBvIA/BoNCySgQMBIRAUDkVRDQEDIHYgDgx+FxsOFw8PBiBNIAgJCQscAAGRABpNGgCYBACcAQGfoaMJpQ4hqB+UQyAbAgKaGwgXF08FdgUdF7cBG3O8vQ6meypiAw8QRr0FBwcI1wgHDnEQWg4H1NbXBgBlTh4G2dYfHVhNQkUcSBxLTUEAIfkECQcAEAAsAQABAA4ADgAABnBAiFAYYDAeoKEy0GgYF4uG8vN4NJ9QxTBQfQgHQoViMUAEAhiAMqygFM6ftZBAYFzu8jlBcb/kISN0IAUFHHIICQkMBoQHHkoOGYkXHgUkBwdKCgIJBA4QDpgHCAgGFwICE5lfpKQGRQsIch+tBmtBACH5BAUHABQALAEAAQAOAA4AAAaaQAqlAEBcHo3AAVAQMiKO4wPSaDAsnwhj8wkEHuAqg7EwbAAXbyAyGBgaiwVjILlcQgBQFTSALwoHdh8gQkIgEgoKDQWMABqFFBoAiQsHjB6PhZKJChUHBw6EhSAIBAQMBp8IHgVVBQ4UphceBwi2AwAOBwoJBAoOGw62CG8CEwnIGxtPRRIBAtAJCghaQgUdHwYMAgsXDk0UQQAh+QQFBwAQACwBAAEADgAOAAAGcECIECIpBB4XxHBZuASOD5RoyblYn49HYyv0FL4XCECoZTTGhwJoSWYwQIjDwcEWMhYP+cFThywWDAiCfX5/gkp9CgoNH4IGiQoFEHEFDxt0GwsECgtCAxAECQIJpASmiBAeDQKjpQsSbAMYC6QMbEEAIfkEBQcAEAAsAQABAA4ADgAABnZAiNAjOVwCBaFSCDgUCpdjAMNZHpzQU0D0eESEVycHAIgEuo8yAgHxLAGBRkO4Xi7lIoSBbRcyGA0SCB99fn8GD3N9EgsLDxwEAhkOdg2NBQAjAgIKSggMCo0DEAcTCacjBAQKrEsICqeqqwx9DhgMqgwUo0JBACH5BAkHAAAALAEAAQAOAA4AAAVjICACEVIUhzGuyHGc10WtANK+RRwEo92ulx0PIKnRAJfHY2MIGAbHiBLTEDSOogfkkRAIoMdG47EQTDZYcQCTSBwHDwbj4AC0MwgAVLOQi9AEgQqDC4UqIwuChFdHFBqDjCMhACH5BAUHABMALAEAAQAOAA4AAAaTwMmk0PlIDgeEwVMQMiIAA2KKLBwGEcbGkZwiqoULZzNgEC4IBwDAKYQvgIBA8OiAGg0Q4I1YzA8gQkIgHwEBIQmJAxqCExoehgEEioyCGgAPDwELiQiBgiAGmRgXBAQMDgV4BQMiDRAHDgqmEwgDAwYQeBYAGwgECsELCwzFDQYbTxIMwsMMDxFZQqyqww8He0JBACH5BAUHAAMALAEAAQAOAA4AAAZzwIEQYBggEIaPcGlUKBqG4xGw3CQEgkAUcTiYhA7CVcHskgqeSyKRcTA9h0LBwFhvmEJO6FIi+PFLF4IKflR4HgGCDH+AHwEBBQNOGngAGA8BCAMLTgMSSw+hIksKC6YMDA0NoRFMDaepDQGAAyAPqLNMQQAh+QQFBwAYACwBAAEADgAOAAAFZSAmOtciMGKaSlgivAGrIm0yCY2B7KlCJJiDQ7RDHEQEgiplPGKStGXwUFFYAVJMoXBYWLPabcMqW14uh8JigRksKWfJgLHOYQCRgP4ikiwYDA0ND4R6SxaBDRCEfEtYAYIXUSIhACH5BAkHABAALAEAAQAOAA4AAAZyQIhQyEgkFhjHcLggGBMCAcOzbBEII6PAeBhABgsFYbGBOA6iwgEBKSgUjKXQwEJ8Gm/5EMFf+PVCfAgMf4AHhw8LcXpnayAMDA96IAUFQg0MDZIAQheVBVQQDaMPDwEBF6kcQx8ipaaoBUpyGxemlktBACH5BAUHABAALAEAAQAOAA4AAAaRQAikMCg0CATGxVEQMiIGhgJJSCQUiAhjI1F4p1Vr4rAZLBYKBsLh2CgEggSgcG44QI0GyAFJED4PKQsSIEJCewEBUQwMABqGEBodHwgSDYyOkJIInAF5BoWGe5wIB3kBc3kFHgcHWQAPsQEfAAAcBa0HHhsGsokXBcEHbU8fF78XwMNaQgUACAUBFwcGHk0QQQA7";$("body").on("focus","#wck_expression input",function(){$WK.expressionLastFocusedInput=$(this)}).on("click","span.formula-field",function(){var $focused=$WK.expressionLastFocusedInput;if($focused&&$focused.length){var cursorPos=$focused[0].selectionStart;var x=$focused.val();$focused.val(x.slice(0,cursorPos)+$(this).text()+x.slice(cursorPos));$focused.focus();cursorPos+=$(this).text().length;$focused[0].setSelectionRange(cursorPos,cursorPos)}}).on("click",".field .pairs .action-add",function(){var $clone=$(this).prev(".pair").clone().insertBefore($(this));$clone.children("input").val("")}).on("click",".field .pairs .action-showimport",function(){$(this).parent().find("div.importer").toggle()}).on("click",".field .pairs .action-import",function(){var $this=$(this);var input=$this.parent().find("textarea").val().trim().split("\n");if(Array.isArray(input)){input.forEach(function(el){var columns=el.trim().split(";");var $last_pair=$this.parent().parent().find(".pair").last();var $clone=$last_pair.clone().insertAfter($last_pair);if(columns.length===2){$clone.find("input.fs-name").val(columns[0]);$clone.find("input.fs-title").val(columns[1])}else if(columns.length===1){$clone.find("input.fs-title").val(columns[0])}})}}).on("click",".field .pairs .action-removeall",function(){if(confirm("Are you sure?")){$(this).parent().find(".pair").slice(1).remove()}}).on("click",".field .pair .action-delete",function(){var $pairs=$(this).closest(".pairs");if($pairs.children(".pair").length>1){if(confirm("Are you sure?")){$(this).closest(".pair").remove()}}else{alert("You cannot remove the last item!")}}).on("click",".field .header .action-delete",function(){if(confirm("Are you sure?")){var $target=$(this).closest("li");$target.hide("slow",function(){$target.remove()})}}).on("click",".field .header .action-toggle",function(){$(this).closest(".field").find(".body").slideToggle(300);$(this).toggleClass("dashicons-arrow-up-alt2");$(this).toggleClass("dashicons-arrow-down-alt2")}).on("click","#add-field-button",function(e){e.preventDefault();var fieldType=$("#select-field").val();var id=$WK.addField(fieldType);$("html, body").animate({scrollTop:$("#"+id).offset().top-50},1e3)}).on("click",".expression_conditional .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#extra-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last condition!")}}).on("click",".expression_addon .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#addon-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last addon!")}}).on("click",".action-add-image",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this image"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();if($WK.wpMediaTarget.prop("tagName")==="A"){$WK.wpMediaTarget.next("img.wp-media-image-preview").attr("src",attachment.url);$WK.wpMediaTarget.next().next("input.wp-media-image-id").attr("value",attachment.id);$WK.wpMediaTarget.hide()}else{$WK.wpMediaTarget.attr("src",attachment.url);$WK.wpMediaTarget.next("input.wp-media-image-id").attr("value",attachment.id)}});$WK.wpMediaFrame.open()}).on("click",".action-add-attachment",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this file"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();$WK.wpMediaTarget.next("input.wp-media-attachment-id").val(attachment.id);$WK.wpMediaTarget.next().next("a.wp-media-attachment-preview").attr("href",attachment.url).text(attachment.url)});$WK.wpMediaFrame.open()}).on("focus",'[data-type="colorswatches"] input.fs-title',function(e){e.preventDefault();var _target=$(this);$WK.colorpicker.iris("show");$(".iris-picker").css({top:_target.offset().top+40,left:_target.offset().left});$WK.colorpicker.iris("option","change",function(event,ui){_target.val(ui.color.toString());var color=ui.color.toRgb();var t=(color.r+color.g+color.b)/2;var textColor=t<200?"#FFFFFF":"#000000";_target.css({"background-color":ui.color.toString(),color:textColor})});$WK.colorpicker.iris("color",$(this).val())}).on("click","input.allowed-extensions",function(){var field_id="#"+$(this).closest("li").attr("id");var ext=[];$(field_id+" input.allowed-extensions:checked").each(function(){console.log($(this).data("extension"));ext.push($(this).data("extension"))});$(field_id+" input.fu-allowed-extensions").val(ext.join("|"))});$(".iris-square-value").on("click",function(e){e.preventDefault()});$(document).click(function(e){if(!$(e.target).closest('.iris-picker, [data-type="colorswatches"] input.fs-title').length){if($(".iris-picker").is(":visible")){$WK.colorpicker.iris("hide")}}});$("form#post").submit(function(e){$WK.saveFields();if(!$WK.saved){e.preventDefault();return false}$WK.saveExpression();if(!$WK.expr_saved&&$WK.expression.mode!=="off"){e.preventDefault();alert("Expression is required. Fill in required fields and try again!");return false}return true});$WK.init=function(){$WK.fieldList=$("#f-field-list");$WK.html=wck_fields_html;$WK.fields={};$WK.saved=false;$WK.expr_saved=false;$WK.counter=0;$WK.expression={mode:$("input.expression_type:checked").val()};$WK.loadJSONdata();$WK.showExpressionEditor();$WK.changeAssignType();$("form#post").attr("novalidate","");$WK.buildTooltips("")};$WK.buildTooltips=function(selector){$(selector+"span.wck-field-tip").tipTip({attribute:"title",defaultPosition:"left"})};$WK.changeAssignType=function(){var disabled=$("#assign_type").val()==="1";$("#assign_products, #assign_categories, #assign_tags").prop("disabled",disabled)};$("#assign_type").on("change",$WK.changeAssignType);$WK.preloadMedia=function(id,callback){wp.media.attachment(id).fetch().then(function(){callback(wp.media.attachment(id))});return};$WK.addField=function(type){$WK.counter+=1;var id="wkfield-"+$WK.counter;$("li.welcome",$WK.fieldList).remove();$WK.fieldList.append($("
  • ",{"data-type":type,class:"form-invalid",id:id}).append($WK.html[type].replace("{id}",id)));$WK.buildTooltips("#"+id+" ");return id};$(window).on("beforeunload",function(){if($WK.saved===false){return""}});$WK.saveFields=function(){$WK.fields={};suggest=[];var error=$("li .field",$WK.fieldList).length===0;$("label.error").remove();$WK.saved=false;$("#formula_fields").html(" ‐ ");$WK.appendGlobalParameters();if(error){alert("Please add at least one field before saving.");return false}$("li .field",$WK.fieldList).each(function(){var $row=$(this);var input_fname=$row.find("input.f-name");var input_ftitle=$row.find("input.f-title");var input_fhint=$row.find("input.f-hint");var input_default_value=$row.find("input.f-default-value");var input_css_class=$row.find("input.f-css-class");var field={type:$row.data("type"),use_expression:$row.data("use-expression")===true,name:input_fname.val(),title:input_ftitle.val(),hint:input_fhint.val(),default_value:input_default_value.val(),css_class:input_css_class.val(),required:$row.find("input.f-required").length>0?$row.find("input.f-required").is(":checked"):true};var input_fprice=$row.find("input.f-price");if(input_fprice.length>0){field.price=input_fprice.val();if(field.price!==""){field.use_expression=true}}var input_fimgwidth=$row.find("input.fimg-width");if(input_fimgwidth.length>0){field.image_size=input_fimgwidth.val()}var $fs_options;switch(field.type){case"select":case"radio":case"imageselect":case"imageswatches":case"colorswatches":case"radiogroup":case"checkboxgroup":field.options_name=[];field.options_title=[];if(field.type==="imageselect"||field.type==="imageswatches"){field.options_image=[]}if(field.type==="checkboxgroup"){field.select_limit=$row.find("input.fcbg-limit").val()}$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var fs_name=$(this).find("input.fs-name");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_name.val()+":"+fs_title.val()}field.options_name.push(fs_name.val()+":"+fs_title.val());field.options_title.push(fs_title.val());if(field.type==="imageselect"||field.type==="imageswatches"){var fs_image=$(this).find("input.fs-image");field.options_image.push(fs_image.val())}});break;case"dropdown":field.options_title=[];$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_title.val()}field.options_title.push(fs_title.val())});break;case"number":var input_fnmin=$row.find("input.fn-min-value");field.min=input_fnmin.val();var input_fnmax=$row.find("input.fn-max-value");field.max=input_fnmax.val();break;case"checkbox":var input_fcb_default_state=$row.find("input.fcb-default-state");field.default_state=input_fcb_default_state.is(":checked");break;case"text":case"textarea":case"email":var input_ftminlen=$row.find("input.ft-min-length");var input_ftmaxlen=$row.find("input.ft-max-length");var input_ftpattern=$row.find("input.ft-pattern");field.min=input_ftminlen.val();field.max=input_ftmaxlen.val();if(input_ftpattern.length>0){field.pattern=input_ftpattern.val()}break;case"colorpicker":case"datepicker":case"rangedatepicker":var input_fdpdisallow_past_date=$row.find("input.fdp-disallow-past-date");field.disallow_past_date=input_fdpdisallow_past_date.is(":checked");break;case"imageupload":field.max_file_size=$row.find("input.fu-max-file-size").val();field.allowed_extensions=$row.find("input.fu-allowed-extensions").val();break;case"html":case"paragraph":case"hidden":case"attachment":field.content=$row.find(".fst-content").val();break;case"link":field.content=$row.find(".fst-content").val();field.target=$row.find(".fst-target").val();break;case"heading":field.content=$row.find(".fst-content").val();field.level=$row.find(".fst-level").val();break}if(field.name!==""&&field.name in $WK.fields){error=true;alert("Field names must be unique! The '"+field.name+"' name is used more than once.")}if(!error){$WK.appendFormulaVars(field)}});var wkform=$("form#post");if(!wkform[0].checkValidity()){error=true;$("input:invalid").parent().show();$("input:invalid").each(function(){$('").insertBefore($(this))})}if(error&&$("label.error").length){$("html, body").animate({scrollTop:$("label.error").first().offset().top-160},1e3)}$WK.saveJSONdata();$WK.saved=!error};$WK.appendGlobalParameters=function(){if(typeof wck_global_parameters!==undefined){$.each(wck_global_parameters,function(name,value){var name="global:"+name;suggest.push(name);$("#formula_fields").append('{'+name+"} ")})}};$WK.appendFormulaVars=function(field){$WK.fields[field.name]=field;if(field.use_expression){if(field.type!=="checkboxgroup"){suggest.push(field.name);$("#formula_fields").append('{'+field.name+"} ")}else{suggest.push(field.name+":sum");$("#formula_fields").append('{'+field.name+":sum} ");suggest.push(field.name+":min");$("#formula_fields").append('{'+field.name+":min} ");suggest.push(field.name+":max");$("#formula_fields").append('{'+field.name+":max} ")}if(field.type==="text"||field.type==="textarea"){suggest.push(field.name+":text");$("#formula_fields").append('{'+field.name+":text} ")}if(field.type==="rangedatepicker"){suggest.push(field.name+":date_from");$("#formula_fields").append('{'+field.name+":date_from} ");suggest.push(field.name+":date_to");$("#formula_fields").append('{'+field.name+":date_to} ");suggest.push(field.name+":days");$("#formula_fields").append('{'+field.name+":days} ")}else if(field.type==="datepicker"){suggest.push(field.name+":date");$("#formula_fields").append('{'+field.name+":date} ")}else if(field.type==="imageupload"){suggest.push(field.name+":size");$("#formula_fields").append('{'+field.name+":size} ")}}};$WK.saveJSONdata=function(){if(Object.keys($WK.fields).length>0){$("input[name=_wck_fieldset]").val(JSON.stringify($WK.fields))}};$WK.loadJSONdata=function(){if(typeof wck_load_fieldset==="object"){$.each(wck_load_fieldset,function(){var field_id=$WK.addField(this.type);var $field=$("#"+field_id+" .field");$("#"+field_id+" .f-name").val(this.name);$("#"+field_id+" .f-title").val(this.title);$("#"+field_id+" .f-hint").val(this.hint);$("#"+field_id+" .f-css-class").val(this.css_class);if($("#"+field_id+" .f-required").length>0){$("#"+field_id+" .f-required").prop("checked",this.required)}var fprice=$("#"+field_id+" .f-price");if(fprice.length>0){fprice.val(this.price)}var fimgwidth=$("#"+field_id+" .fimg-width");if(fimgwidth.length>0){fimgwidth.val(this.image_size)}var options_title,options_name,options_image,default_value,first,$checked;if(this.type==="dropdown"){options_title=this.options_title;default_value=this.default_value;first=true;$checked=null;$.each(options_title,function(i,option_title){if(first){var $first=$field.find(".fs-option");$first.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(["select","radio","imageselect","radiogroup","checkboxgroup","imageswatches","colorswatches"].indexOf(this.type)>=0){options_name=this.options_name;options_title=this.options_title;default_value=this.default_value;if(this.type==="imageselect"||this.type==="imageswatches"){options_image=this.options_image;wp.media.attachment(options_image).fetch()}if(this.type==="checkboxgroup"){$("#"+field_id+" .fcbg-limit").val(this.select_limit)}first=true;$checked=null;$.each(options_name,function(i,option_name){if(option_name.indexOf(":")>=0){option_name=option_name.slice(0,option_name.indexOf(":"))}if(first){var $first=$field.find(".fs-option");$first.find("input.fs-name").val(option_name);$first.find("input.fs-title").val(options_title[i]);var fs_image=$first.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$first.find("a.action-add-image").hide();$first.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$first.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-name").val(option_name);$clone.find("input.fs-title").val(options_title[i]);fs_image=$clone.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$clone.find("a.action-add-image").hide();$clone.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$clone.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(this.type==="number"){$("#"+field_id+" .fn-min-value").val(this.min);$("#"+field_id+" .fn-max-value").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value)}else if(this.type==="checkbox"){$("#"+field_id+" .fcb-default-state").prop("checked",this.default_state)}else if(this.type==="text"||this.type==="textarea"||this.type==="email"){$("#"+field_id+" .ft-min-length").val(this.min);$("#"+field_id+" .ft-max-length").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value);if(this.type==="text"){$("#"+field_id+" .ft-pattern").val(this.pattern)}}else if(this.type==="colorpicker"||this.type==="datepicker"||this.type==="rangedatepicker"){$("#"+field_id+" .fdp-disallow-past-date").prop("checked",this.disallow_past_date)}else if(this.type==="imageupload"){$("#"+field_id+" .fu-max-file-size").val(this.max_file_size);$("#"+field_id+" .fu-allowed-extensions").val(this.allowed_extensions);var ext=this.allowed_extensions.split("|");ext.forEach(function(e){$("#"+field_id+" .allowed-extensions.ext-"+e).prop("checked",true)})}else if(["html","paragraph","heading","hidden","link","attachment"].indexOf(this.type)>=0){$("#"+field_id+" .fst-content").val(this.content);if(this.type==="heading"){$("#"+field_id+" .fst-level").val(this.level)}else if(this.type==="link"){$("#"+field_id+" .fst-target").val(this.target)}else if(this.type==="attachment"){$WK.preloadMedia(this.content,function(attachment){console.log(field_id,attachment.get("url"));$("#"+field_id+" .wp-media-attachment-preview").attr("href",attachment.get("url")).text(attachment.get("url"))})}}});$WK.saveFields()}};$WK.showExpressionEditor=function(){$("div.expression_oneline, div.expression_conditional, div.expression_off, div.expression_addon").hide();$("div.expression_"+$WK.expression.mode).show();if($WK.expression.mode==="off"){$(".off-hide").hide()}else{$(".off-hide").show()}};$("input.expression_type").on("change",function(){$WK.expression.mode=$(this).val();$WK.showExpressionEditor()});$WK.addCondition=function(if_value,then_value,addon=false){var $html=$('
    '+''+''+'
    '+'
    '+''+"
    "+'
    '+''+"
    ");$(".input-if input",$html).val(if_value);$(".input-equation input",$html).val(then_value);if(addon===true){$("div#addon-inputs").append($html)}else{$("div#extra-inputs").append($html)}$WK.autocomplete()};$("button.add-condition").on("click",function(){$WK.addCondition()});$("button.add-addon").on("click",function(){$WK.addCondition("","",true)});$WK.autocomplete=function(){$(".input-icon input").bind("keydown",function(e){if(e.keyCode===16||e.keyCode===219){input_key_pressed[e.keyCode]=true}}).autocomplete({minLength:0,source:function(request,response){if(input_key_pressed[16]===true&&input_key_pressed[219]===true){response(suggest)}},focus:function(){return false},select:function(event,ui){delete input_key_pressed[16];delete input_key_pressed[219];this.value+=ui.item.value+"}";return false}})};$WK.saveExpression=function(){var mode=$WK.expression.mode;$WK.expr_saved=false;if(mode==="oneline"){$WK.expression.expr=$(".expression_oneline input").val();if($WK.expression.expr!==""){$WK.expr_saved=true}}if(mode==="conditional"){var data=[];$(".expression_conditional .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});var input_else=$(".expression_conditional .input-else input").val();data.push({type:"else",if:"true",then:input_else});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="addon"){var data=[];$(".expression_addon .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="off"){$("input[name=_wck_expression]").val("off")}else{$("input[name=_wck_expression]").val(JSON.stringify($WK.expression))}};$WK.loadExpression=function(){if(typeof wck_load_expression==="object"){$WK.expression=wck_load_expression;if($WK.expression.mode==="oneline"){$(".expression_oneline input").val($WK.expression.expr);$("input[name=_wck_choose_expression_type].expression_oneline").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}else if($WK.expression.mode==="conditional"){$.each($WK.expression.expr,function(){if(this.type==="condition"){$WK.addCondition(this.if,this.then)}else if(this.type==="else"){$(".input-else input").val(this.then)}});$("input[name=_wck_choose_expression_type].expression_conditional").prop("checked",true);$WK.showExpressionEditor()}else if($WK.expression.mode==="addon"){$.each($WK.expression.expr,function(){$WK.addCondition(this.if,this.then,true)});$("input[name=_wck_choose_expression_type].expression_addon").prop("checked",true);$WK.showExpressionEditor()}}else{$WK.expression.mode="off";$("input[name=_wck_choose_expression_type].expression_off").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}};$("button.test-expression").on("click",function(){$WK.saveExpression()});$WK.init();$WK.loadExpression();$WK.autocomplete()})})(jQuery); \ No newline at end of file diff --git a/docs/.retype/404.html b/docs/.retype/404.html index 9ba2558..f45acbc 100644 --- a/docs/.retype/404.html +++ b/docs/.retype/404.html @@ -3,7 +3,7 @@ - + @@ -27,11 +27,11 @@ - + - + - +
    diff --git a/docs/.retype/changelog/index.html b/docs/.retype/changelog/index.html index 35080a1..5bb36b6 100644 --- a/docs/.retype/changelog/index.html +++ b/docs/.retype/changelog/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/index.html b/docs/.retype/index.html index 658937b..d1307c6 100644 --- a/docs/.retype/index.html +++ b/docs/.retype/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/news/index.html b/docs/.retype/news/index.html index 9421527..ff9657e 100644 --- a/docs/.retype/news/index.html +++ b/docs/.retype/news/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/resources/js/config.js b/docs/.retype/resources/js/config.js index 2ecd2af..10d71c3 100644 --- a/docs/.retype/resources/js/config.js +++ b/docs/.retype/resources/js/config.js @@ -1 +1 @@ -var __DOCS_CONFIG__ = {"id":"dQBJyT243EqVut2hhQhAm3ZRfgITnPbcO4E","key":"zQPqraJltFsteyURE46JXCz4e40ALy/Ig38E52+AJtY.KJqz0oSx3v1p0otGvqmeVpH4d9n+RuYk0LyEWUP8U2i0w53MW4uWVxA0BoFuX36LhRUic5W988E/edx/eo1mlw.94","base":"/","host":"wckalkulator.com","version":"1.0.0","useRelativePaths":true,"documentName":"index.html","appendDocumentName":false,"trailingSlash":true,"preloadSearch":false,"cacheBustingToken":"2.3.0.710849618662","cacheBustingStrategy":"query","sidebarFilterPlaceholder":"Filter","toolbarFilterPlaceholder":"Filter","showSidebarFilter":true,"filterNotFoundMsg":"No member names found containing the query \"{query}\"","maxHistoryItems":15,"homeIcon":"","access":[{"value":"public","label":"Public"},{"value":"protected","label":"Protected"}],"toolbarLinks":[{"id":"fields","label":"Fields"},{"id":"properties","label":"Properties","shortLabel":"Props"},{"id":"methods","label":"Methods"},{"id":"events","label":"Events"}],"sidebar":[{"n":"/","l":"WC Kalkulator","s":""},{"n":"news","l":"News","s":""},{"n":"usermanual","l":"User Manual","c":false,"o":true,"i":[{"n":"about","l":"About the Plugin","s":""},{"n":"installation","l":"Installation","s":""},{"n":"fields","l":"Field Types","s":""},{"n":"calculation-types","l":"Calculation Modes","s":""},{"n":"expression-syntax","l":"Expression Syntax","s":""},{"n":"example-expressions","l":"Formula Examples","s":""},{"n":"usage","l":"Usage","s":""},{"n":"advanced_usage","l":"Advanced Usage","s":""},{"n":"templates","l":"Templates","s":""},{"n":"import_export","l":"Import/Export","s":""},{"n":"uninstall","l":"Uninstallation","s":""},{"n":"videos","l":"Video Tutorials","s":""}],"s":""},{"n":"changelog","l":"CHANGELOG","s":""}],"search":{"mode":0,"minChars":2,"maxResults":20,"placeholder":"Search","hotkeys":["/"],"noResultsFoundMsg":"Sorry, no results found.","recognizeLanguages":true,"languages":[0],"preload":false}}; +var __DOCS_CONFIG__ = {"id":"FEstZRyIFLAF/243N5MQpoDuCkEs0AHPfUj","key":"fzd6jicsBkTKWIha++ZfvEembs5Unb7D4fUjG2rJRRc.e12CKaZVRSZmjmfhFJoMA+bMZMY2PV/SZnwSZY81OOHv4wPG9fv282SR0AOuhiq/VBXgxgATTYH74D/MPRfxRQ.57","base":"/","host":"wckalkulator.com","version":"1.0.0","useRelativePaths":true,"documentName":"index.html","appendDocumentName":false,"trailingSlash":true,"preloadSearch":false,"cacheBustingToken":"2.3.0.710887224971","cacheBustingStrategy":"query","sidebarFilterPlaceholder":"Filter","toolbarFilterPlaceholder":"Filter","showSidebarFilter":true,"filterNotFoundMsg":"No member names found containing the query \"{query}\"","maxHistoryItems":15,"homeIcon":"","access":[{"value":"public","label":"Public"},{"value":"protected","label":"Protected"}],"toolbarLinks":[{"id":"fields","label":"Fields"},{"id":"properties","label":"Properties","shortLabel":"Props"},{"id":"methods","label":"Methods"},{"id":"events","label":"Events"}],"sidebar":[{"n":"/","l":"WC Kalkulator","s":""},{"n":"news","l":"News","s":""},{"n":"usermanual","l":"User Manual","c":false,"o":true,"i":[{"n":"about","l":"About the Plugin","s":""},{"n":"installation","l":"Installation","s":""},{"n":"fields","l":"Field Types","s":""},{"n":"calculation-types","l":"Calculation Modes","s":""},{"n":"expression-syntax","l":"Expression Syntax","s":""},{"n":"example-expressions","l":"Formula Examples","s":""},{"n":"usage","l":"Usage","s":""},{"n":"advanced_usage","l":"Advanced Usage","s":""},{"n":"templates","l":"Templates","s":""},{"n":"import_export","l":"Import/Export","s":""},{"n":"uninstall","l":"Uninstallation","s":""},{"n":"videos","l":"Video Tutorials","s":""}],"s":""},{"n":"changelog","l":"CHANGELOG","s":""}],"search":{"mode":0,"minChars":2,"maxResults":20,"placeholder":"Search","hotkeys":["/"],"noResultsFoundMsg":"Sorry, no results found.","recognizeLanguages":true,"languages":[0],"preload":false}}; diff --git a/docs/.retype/resources/js/config.min.js b/docs/.retype/resources/js/config.min.js index b7b8f8d..a4e44de 100644 --- a/docs/.retype/resources/js/config.min.js +++ b/docs/.retype/resources/js/config.min.js @@ -1 +1 @@ -var __DOCS_CONFIG__={id:"dGXkbad2i243bJsFyE3U9gAbtEP5Znb7Ff8",key:"HhAILedLNKHfUtw70nWtRe2MqmC2LLs4SQOhLDQwfCA.CNDng4QuJlXL3ff0taEhYk46BfBpKcDn29Jab6bpW9ydJGRjF70UDlWGVaMc6fubkvw71TSF9DcxAwA2ZM+BbQ.73",base:"/",host:"wckalkulator.com",version:"1.0.0",useRelativePaths:true,documentName:"index.html",appendDocumentName:false,trailingSlash:true,preloadSearch:false,cacheBustingToken:"2.3.0.710635205193",cacheBustingStrategy:"query",sidebarFilterPlaceholder:"Filter",toolbarFilterPlaceholder:"Filter",showSidebarFilter:true,filterNotFoundMsg:'No member names found containing the query "{query}"',maxHistoryItems:15,homeIcon:'',access:[{value:"public",label:"Public"},{value:"protected",label:"Protected"}],toolbarLinks:[{id:"fields",label:"Fields"},{id:"properties",label:"Properties",shortLabel:"Props"},{id:"methods",label:"Methods"},{id:"events",label:"Events"}],sidebar:[{n:"/",l:"WC Kalkulator",s:''},{n:"news",l:"News",s:''},{n:"usermanual",l:"User Manual",c:false,o:true,i:[{n:"about",l:"About the Plugin",s:''},{n:"installation",l:"Installation",s:''},{n:"fields",l:"Field Types",s:''},{n:"calculation-types",l:"Calculation Modes",s:''},{n:"expression-syntax",l:"Expression Syntax",s:''},{n:"example-expressions",l:"Formula Examples",s:''},{n:"usage",l:"Usage",s:''},{n:"advanced_usage",l:"Advanced Usage",s:''},{n:"templates",l:"Templates",s:''},{n:"import_export",l:"Import/Export",s:''},{n:"uninstall",l:"Uninstallation",s:''},{n:"videos",l:"Video Tutorials",s:''}],s:''},{n:"changelog",l:"CHANGELOG",s:''}],search:{mode:0,minChars:2,maxResults:20,placeholder:"Search",hotkeys:["/"],noResultsFoundMsg:"Sorry, no results found.",recognizeLanguages:true,languages:[0],preload:false}}; \ No newline at end of file +var __DOCS_CONFIG__={id:"FEstZRyIFLAF/243N5MQpoDuCkEs0AHPfUj",key:"fzd6jicsBkTKWIha++ZfvEembs5Unb7D4fUjG2rJRRc.e12CKaZVRSZmjmfhFJoMA+bMZMY2PV/SZnwSZY81OOHv4wPG9fv282SR0AOuhiq/VBXgxgATTYH74D/MPRfxRQ.57",base:"/",host:"wckalkulator.com",version:"1.0.0",useRelativePaths:true,documentName:"index.html",appendDocumentName:false,trailingSlash:true,preloadSearch:false,cacheBustingToken:"2.3.0.710887224971",cacheBustingStrategy:"query",sidebarFilterPlaceholder:"Filter",toolbarFilterPlaceholder:"Filter",showSidebarFilter:true,filterNotFoundMsg:'No member names found containing the query "{query}"',maxHistoryItems:15,homeIcon:'',access:[{value:"public",label:"Public"},{value:"protected",label:"Protected"}],toolbarLinks:[{id:"fields",label:"Fields"},{id:"properties",label:"Properties",shortLabel:"Props"},{id:"methods",label:"Methods"},{id:"events",label:"Events"}],sidebar:[{n:"/",l:"WC Kalkulator",s:''},{n:"news",l:"News",s:''},{n:"usermanual",l:"User Manual",c:false,o:true,i:[{n:"about",l:"About the Plugin",s:''},{n:"installation",l:"Installation",s:''},{n:"fields",l:"Field Types",s:''},{n:"calculation-types",l:"Calculation Modes",s:''},{n:"expression-syntax",l:"Expression Syntax",s:''},{n:"example-expressions",l:"Formula Examples",s:''},{n:"usage",l:"Usage",s:''},{n:"advanced_usage",l:"Advanced Usage",s:''},{n:"templates",l:"Templates",s:''},{n:"import_export",l:"Import/Export",s:''},{n:"uninstall",l:"Uninstallation",s:''},{n:"videos",l:"Video Tutorials",s:''}],s:''},{n:"changelog",l:"CHANGELOG",s:''}],search:{mode:0,minChars:2,maxResults:20,placeholder:"Search",hotkeys:["/"],noResultsFoundMsg:"Sorry, no results found.",recognizeLanguages:true,languages:[0],preload:false}}; \ No newline at end of file diff --git a/docs/.retype/sitemap.xml.gz b/docs/.retype/sitemap.xml.gz index 52ae2a25d4740cd1ef2bcfa65067c72a132be467..b2abfb35d9c26212bc1a08b0988f269ee43662d4 100644 GIT binary patch literal 457 zcmV;)0XF_0iwFP!000006SS7ia)Tfc$M1Ox$Gd{~6`91|`UL5vmkvd0oFX`YF?st! z;`C#tHJJ%Lt+>0x&)xM8n}=i1g9B5#lVTetF$@DHsBAjXZo{YDW3&z*>eXgcTr(5c zV4=6+-k1RcFilgeJHvW1=vb;2Xu7ux4d#~s##MO9!ND}aY<_zuU!ItC;WZn#7GrW*@F#m?m3WX)61qt5TOW`5zKc8;RNEOe7143_Yym( zPO8qFYWt}h@VRn3gL&&)5d@p`4IHq-8T^|A#_RGkS@UuOUE!K)>C$46 z&SO{YsWMo{mER#rb_n9M!f3f{_bMFS6VWm*+iNuLBuX(t|4Q>+Z~H+i^I~V;8ZQ&( zQE*2w9|vB*JZkQtYnZ&E5*HmSaJsA#zYFcz*jrS+`Tzg`|NjF3wR*?sb_oCgR&Lbh literal 452 zcmV;#0XzO5iwFP!000006SS7ij+-zL$M1Ox#2swRSFjTH)+b0Wy{ug0C1{O}Y!i~V zubrTNNG%&_r>DWpjQnF}_}hn<>nNj(Fm}-D7-uPtBcZtN2Gt+quct4`K7MI;huKIg zT;zk5J;rC}CW_FqEU6uw7};b~ZF*$+*)J?wUm~0~@gs*`&u)}|WG?wVCu^Dp-Mw+U zi=wbou>MJE-iCM^68Jll@3Ul1o0RJj9Z+zufy}y5cP+t$B)Cp+c_M^nm}d1iAGdlR zv6C6J8QiV)pL#$)S7B$gZv8BR5{rF;12?q5|K`ByzWyZ0Y=s$_nwdoGyPh2cR8_)3 z4azzuz01!S2wM)v_BIIFfwZwAa8#U0K0gYUxZ5OP05dp1ah;5?K{OJ3Q;uD?0qavn zXi?K5-vor@W8)-6@{99>67E9@i=39l7Gb%EL!2$^1w>y4;`y$zO52}7uvh=x2Sga0{{U3{{sM+KMe482><|kb=Cd= diff --git a/docs/.retype/usermanual/about/index.html b/docs/.retype/usermanual/about/index.html index e7df2ba..e1c6e9c 100644 --- a/docs/.retype/usermanual/about/index.html +++ b/docs/.retype/usermanual/about/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/usermanual/advanced_usage/index.html b/docs/.retype/usermanual/advanced_usage/index.html index 3b14224..783be16 100644 --- a/docs/.retype/usermanual/advanced_usage/index.html +++ b/docs/.retype/usermanual/advanced_usage/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/usermanual/calculation-types/index.html b/docs/.retype/usermanual/calculation-types/index.html index 9d8fdba..a506397 100644 --- a/docs/.retype/usermanual/calculation-types/index.html +++ b/docs/.retype/usermanual/calculation-types/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/usermanual/example-expressions/index.html b/docs/.retype/usermanual/example-expressions/index.html index 6d7d6ed..5179e91 100644 --- a/docs/.retype/usermanual/example-expressions/index.html +++ b/docs/.retype/usermanual/example-expressions/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/usermanual/expression-syntax/index.html b/docs/.retype/usermanual/expression-syntax/index.html index 6df0d71..9f7a778 100644 --- a/docs/.retype/usermanual/expression-syntax/index.html +++ b/docs/.retype/usermanual/expression-syntax/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/usermanual/fields/index.html b/docs/.retype/usermanual/fields/index.html index 34a8af9..3e5cecb 100644 --- a/docs/.retype/usermanual/fields/index.html +++ b/docs/.retype/usermanual/fields/index.html @@ -3,7 +3,7 @@ - + @@ -30,12 +30,12 @@ - + - + - - + +
    diff --git a/docs/.retype/usermanual/import_export/index.html b/docs/.retype/usermanual/import_export/index.html index 34e4645..4eb21cf 100644 --- a/docs/.retype/usermanual/import_export/index.html +++ b/docs/.retype/usermanual/import_export/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/usermanual/installation/index.html b/docs/.retype/usermanual/installation/index.html index 3760211..f90671b 100644 --- a/docs/.retype/usermanual/installation/index.html +++ b/docs/.retype/usermanual/installation/index.html @@ -3,7 +3,7 @@ - + @@ -32,11 +32,11 @@ - + - + - +
    diff --git a/docs/.retype/usermanual/templates/index.html b/docs/.retype/usermanual/templates/index.html index 675c229..3694200 100644 --- a/docs/.retype/usermanual/templates/index.html +++ b/docs/.retype/usermanual/templates/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/usermanual/uninstall/index.html b/docs/.retype/usermanual/uninstall/index.html index 8493b59..f021423 100644 --- a/docs/.retype/usermanual/uninstall/index.html +++ b/docs/.retype/usermanual/uninstall/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/docs/.retype/usermanual/usage/index.html b/docs/.retype/usermanual/usage/index.html index 9673cf8..7ff2f24 100644 --- a/docs/.retype/usermanual/usage/index.html +++ b/docs/.retype/usermanual/usage/index.html @@ -3,7 +3,7 @@ - + @@ -32,11 +32,11 @@ - + - + - +
    diff --git a/docs/.retype/usermanual/videos/index.html b/docs/.retype/usermanual/videos/index.html index 090fa3d..190f522 100644 --- a/docs/.retype/usermanual/videos/index.html +++ b/docs/.retype/usermanual/videos/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    diff --git a/src/FieldsetProduct.php b/src/FieldsetProduct.php index e608cdd..c4cbfc4 100644 --- a/src/FieldsetProduct.php +++ b/src/FieldsetProduct.php @@ -662,7 +662,11 @@ public function calculate() $this->user_input["product_height"] = $product_helper->get_height(); $this->user_input["product_length"] = $product_helper->get_length(); $this->user_input["product_regular_price"] = $product_helper->regular_price(); - $this->user_input["is_user_logged"] = (int) is_user_logged_in(); + $this->user_input["is_user_logged"] = (int)is_user_logged_in(); + $this->user_input["current_month"] = absint(current_time("n")); + $this->user_input["day_of_month"] = absint(current_time("j")); + $this->user_input["day_of_week"] = absint(current_time("w")); + $this->user_input["current_hour"] = absint(current_time("G")); $this->user_input["quantity"] = absint($_POST["quantity"]); } else { return Ajax::response('error', __("Select variation options first!", "wc-kalkulator")); diff --git a/src/View.php b/src/View.php index 60383da..3bd5df8 100644 --- a/src/View.php +++ b/src/View.php @@ -46,7 +46,10 @@ public static function render($template, $view = array()) private static function override_file($template) { - return get_template_directory() . '/' . Plugin::NAME . '/' . $template . '.php'; + /* + * Using get_stylesheet_directory() to support child themes + */ + return get_stylesheet_directory() . '/' . Plugin::NAME . '/' . $template . '.php'; } } \ No newline at end of file diff --git a/views/admin/expression.php b/views/admin/expression.php index bc05359..e73322c 100644 --- a/views/admin/expression.php +++ b/views/admin/expression.php @@ -54,6 +54,11 @@ class="expression_type expression_addon" {product_length} {is_user_logged} {quantity} + {current_month} (1-12) + {day_of_month} (1-31) + {day_of_week} (0-6) + {current_hour} (0-23) + Update list

    diff --git a/wc-kalkulator.php b/wc-kalkulator.php index f417e40..0848553 100644 --- a/wc-kalkulator.php +++ b/wc-kalkulator.php @@ -3,7 +3,7 @@ /** * Plugin Name: WC Kalkulator * Description: Description: Store Manager can add fieldsets to Products and Orders. WC Kalkulator allows to order and calculate the price of the product based on the values of the fields selected by the Customer. - * Version: 1.3.2 + * Version: 1.3.3 * Author: Krzysztof PiÄ…tkowski * Author URI: https://wckalkulator.com * Text Domain: wc-kalkulator @@ -31,7 +31,7 @@ */ class Plugin { - const VERSION = "1.3.2"; + const VERSION = "1.3.3"; const NAME = "wc-kalkulator"; From a0ac6b5f2623affc85e05e5293e0b5c279ca4ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Pi=C4=85tkowski?= Date: Mon, 11 Jul 2022 23:09:24 +0200 Subject: [PATCH 02/14] String to Float fixed --- src/FieldsetProduct.php | 1 + src/ProductHelper.php | 40 ++++++++++++++++++++-------------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/FieldsetProduct.php b/src/FieldsetProduct.php index c4cbfc4..2ed3194 100644 --- a/src/FieldsetProduct.php +++ b/src/FieldsetProduct.php @@ -668,6 +668,7 @@ public function calculate() $this->user_input["day_of_week"] = absint(current_time("w")); $this->user_input["current_hour"] = absint(current_time("G")); $this->user_input["quantity"] = absint($_POST["quantity"]); + var_dump($this->user_input); } else { return Ajax::response('error', __("Select variation options first!", "wc-kalkulator")); } diff --git a/src/ProductHelper.php b/src/ProductHelper.php index 8b8b275..acc998c 100644 --- a/src/ProductHelper.php +++ b/src/ProductHelper.php @@ -16,23 +16,23 @@ final class ProductHelper * @var \WC_Product */ protected $product; - + /** * @var int */ protected $product_id; - + /** * @var int */ protected $variation_id; - + /** * @deprecated from 1.1.0 * @var bool * private $can_add_price; */ - + /** * ProductHelper constructor. * @@ -45,7 +45,7 @@ function __construct($product_id, $variation_id = 0) $this->product_id = absint($product_id); $this->variation_id = absint($variation_id); $this->product = wc_get_product($this->product_id); - + /** * Removed in 1.1.0 * @@ -60,7 +60,7 @@ function __construct($product_id, $variation_id = 0) } } } - + /** * If property "product" is valid * @@ -74,7 +74,7 @@ public function is_valid() } return false; } - + /** * Get actual price, regular or sale * @@ -88,7 +88,7 @@ public function price() } return $this->regular_price(); } - + /** * Get sale price of the product or variation * @@ -97,9 +97,9 @@ public function price() */ public function sale_price() { - return $this->product->get_sale_price(); + return floatval($this->product->get_sale_price()); } - + /** * Get regular price of the product or variation * @@ -108,9 +108,9 @@ public function sale_price() */ public function regular_price() { - return $this->product->get_regular_price(); + return floatval($this->product->get_regular_price()); } - + /** * Check if the product is on sale * @@ -121,12 +121,12 @@ public function is_on_sale() { return $this->product->is_on_sale(); } - + /** * Get discount price * - * @since 1.0.0 * @return mixed + * @since 1.0.0 */ public function discount_price() { @@ -141,7 +141,7 @@ public function discount_price() */ public function get_weight() { - return $this->product->get_weight(); + return floatval($this->product->get_weight()); } /** @@ -152,7 +152,7 @@ public function get_weight() */ public function get_length() { - return $this->product->get_length(); + return floatval($this->product->get_length()); } /** @@ -163,7 +163,7 @@ public function get_length() */ public function get_width() { - return $this->product->get_width(); + return floatval($this->product->get_width()); } /** @@ -174,9 +174,9 @@ public function get_width() */ public function get_height() { - return $this->product->get_height(); + return floatval($this->product->get_height()); } - + /** * * [DEPRECATED] @@ -191,5 +191,5 @@ public function can_add_price() { return false; //$this->can_add_price; } - + } \ No newline at end of file From 89947aa2b5438fa8db13b4d515eb79468af9f3a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Pi=C4=85tkowski?= Date: Tue, 12 Jul 2022 01:32:12 +0200 Subject: [PATCH 03/14] New expression builder --- assets/css/admin.css | 3 ++ assets/css/admin.css.map | 2 +- assets/css/admin.min.css | 2 +- assets/css/admin.sass | 2 + assets/js/admin.js | 66 +++++++++++++++++------- assets/js/admin.min.js | 2 +- src/FieldsetProduct.php | 1 - views/admin/expression.php | 101 ++++++++++++++++++++++++++++++------- 8 files changed, 140 insertions(+), 39 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index f884ced..17610a3 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -221,6 +221,9 @@ .wc-kalkulator-wrapper .wc-product-search, .wc-kalkulator-wrapper .wc-category-search, .wc-kalkulator-wrapper .wc-enhanced-select, .wc-kalkulator-wrapper .wc-page-search { width: 100%; } +.wc-kalkulator-wrapper button.add-operator { + margin-right: 3px; +} .wc-kalkulator-wrapper span.formula-field { padding-left: 6px; cursor: pointer; diff --git a/assets/css/admin.css.map b/assets/css/admin.css.map index 1422a6f..62b7ebd 100644 --- a/assets/css/admin.css.map +++ b/assets/css/admin.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["admin.sass"],"names":[],"mappings":"AACE;EACE;;AAEA;EACE;;AAGA;EACE;EACA;EACA;EACA;EACA;;AACF;EACE;;AACN;EACE;;AACA;EACE;EACA;EACA;;AACF;EACE;EACA;;AACA;EACE;EACA;;AACA;EACE;;AACA;EACE;EACA;EACA;;AACJ;EACE;EACA;;AACA;EACE;EACA;;AACF;EACE;;AACF;EACE;;AACF;EACE;;AACF;EACE;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;;AACJ;EACE;EACA;EACA;;AAEE;EACE;EACA;EACA;;AACN;EACE;;AACA;EACE;EACA;;AACF;EACE;EACA;;AACA;EACE;EACA;EACA;EACA;;AACN;EACE;;AACF;EACE;EACA;;AACF;EACE;EACA;;AACF;EACE;;AACF;EACE;EACA;;AACF;EACE;;AACF;EACE;EACA;EACA;;AACF;EACE;EACA;;AACN;EACE;;AACN;EACE;EACA;EACA;EACA;EACA;;AACF;EACE;;AACF;EACE;;AACF;EACE;EACA;;AACA;EACE;EACA;EACA;;AACJ;EACE;;AACF;AAAA;AAAA;AAAA;EAIE;EACA;EACA;EACA;;AACF;AAAA;EAEE;;AACF;EACE;EACA;EACA;;AACF;EACE;;AACF;EACE;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;EACA;;AAGA;EACE;;AAGF;EACE;;AACN;EACE;;AAGE;EACE;;AACN;EACE;EACA;EACA;EACA;;AACF;EACE;;AACF;EACE;;AAEA;EACE;EACA;EACA;;AACA;EACE;;AACN;EACE;EACA;EACA;;AACA;EACE;EACA;EACA;;AACJ;EACE;;AACF;EACE;EACA;;AACF;EACE;EACA;EACA;EACA;;AACA;EACE;;AACF;EACE;EACA;;AACF;EACE;EACA;;AACA;EACE","file":"admin.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["admin.sass"],"names":[],"mappings":"AACE;EACE;;AAEA;EACE;;AAGA;EACE;EACA;EACA;EACA;EACA;;AACF;EACE;;AACN;EACE;;AACA;EACE;EACA;EACA;;AACF;EACE;EACA;;AACA;EACE;EACA;;AACA;EACE;;AACA;EACE;EACA;EACA;;AACJ;EACE;EACA;;AACA;EACE;EACA;;AACF;EACE;;AACF;EACE;;AACF;EACE;;AACF;EACE;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;;AACJ;EACE;EACA;EACA;;AAEE;EACE;EACA;EACA;;AACN;EACE;;AACA;EACE;EACA;;AACF;EACE;EACA;;AACA;EACE;EACA;EACA;EACA;;AACN;EACE;;AACF;EACE;EACA;;AACF;EACE;EACA;;AACF;EACE;;AACF;EACE;EACA;;AACF;EACE;;AACF;EACE;EACA;EACA;;AACF;EACE;EACA;;AACN;EACE;;AACN;EACE;EACA;EACA;EACA;EACA;;AACF;EACE;;AACF;EACE;;AACF;EACE;EACA;;AACA;EACE;EACA;EACA;;AACJ;EACE;;AACF;AAAA;AAAA;AAAA;EAIE;EACA;EACA;EACA;;AACF;AAAA;EAEE;;AACF;EACE;EACA;EACA;;AACF;EACE;;AACF;EACE;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACF;EACE;EACA;EACA;EACA;;AAGA;EACE;;AAGF;EACE;;AACN;EACE;;AAGE;EACE;;AACN;EACE;EACA;EACA;EACA;;AACF;EACE;;AACF;EACE;;AACF;EACE;;AAEA;EACE;EACA;EACA;;AACA;EACE;;AACN;EACE;EACA;EACA;;AACA;EACE;EACA;EACA;;AACJ;EACE;;AACF;EACE;EACA;;AACF;EACE;EACA;EACA;EACA;;AACA;EACE;;AACF;EACE;EACA;;AACF;EACE;EACA;;AACA;EACE","file":"admin.css"} \ No newline at end of file diff --git a/assets/css/admin.min.css b/assets/css/admin.min.css index 7b1c12b..a198d9c 100644 --- a/assets/css/admin.min.css +++ b/assets/css/admin.min.css @@ -1 +1 @@ -.wc-kalkulator-wrapper html{scroll-padding-top:100px}.wc-kalkulator-wrapper p.add-buttons{line-height:36px}.wc-kalkulator-wrapper a.button.action-add-image{margin-bottom:20px;margin-top:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper a.button.action-add-attachment{margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list{width:100%}.wc-kalkulator-wrapper ul#f-field-list *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li{box-shadow:0 5px 10px #ccc;margin-bottom:5px}.wc-kalkulator-wrapper ul#f-field-list li .field{border:1px solid #aaa;background-color:#fff}.wc-kalkulator-wrapper ul#f-field-list li .field .header{padding:8px}.wc-kalkulator-wrapper ul#f-field-list li .field .header .text{font-size:14px;color:#000;padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .body{padding:20px;border-top:1px solid #aaa}.wc-kalkulator-wrapper ul#f-field-list li .field .body .half{float:left;width:50%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .second{padding-left:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .first{padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .fu-allowed-extensions{margin-top:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body label{font-size:12px;margin-bottom:3px;font-weight:700}.wc-kalkulator-wrapper ul#f-field-list li .field .body label.error{background-color:#e30000;color:#fff;padding:6px;margin:6px 0;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair{margin-bottom:10px;display:flex;align-items:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair span.dashicons-no-alt{cursor:pointer;font-size:28px;color:red}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs{margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs button{margin-right:6px;margin-bottom:6px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer{display:none;margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer textarea{display:block;width:100%;min-height:200px;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column{float:left}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1{width:40%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-half{width:20%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2{width:40%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2-half{text-align:center;width:20%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-2{width:80%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-3{width:10%;padding-left:20px;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-4{width:10%;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .clear{clear:both}.wc-kalkulator-wrapper .input-group .dashicons,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons{padding:3px;margin-left:2px;margin-right:2px;cursor:pointer;color:#555}.wc-kalkulator-wrapper .input-group .left,.wc-kalkulator-wrapper ul#f-field-list li .field .header .left{float:left}.wc-kalkulator-wrapper .input-group .right,.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{float:right}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]),.wc-kalkulator-wrapper ul#f-field-list li .field .body label{display:block;width:100%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]).inline,.wc-kalkulator-wrapper ul#f-field-list li .field .body label.inline{display:inline;margin-right:10px;width:auto}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.f-required,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.fdp-disallow-past-date,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param[type=checkbox]{margin:10px 15px 14px 3px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text],.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=number].param,.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=text].param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text]{width:100%}.wc-kalkulator-wrapper .clearfix,.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair:after{content:"";display:block;clear:both}.wc-kalkulator-wrapper .pr-20{padding-right:20px}.wc-kalkulator-wrapper .input-icon{position:relative;font-family:monospace;width:100%;margin:10px 0}.wc-kalkulator-wrapper .input-icon i{font-family:monospace;font-size:15px;position:absolute;display:block;top:10px;pointer-events:none;width:45px;text-align:right;font-style:normal;color:#00f}.wc-kalkulator-wrapper .input-icon input{border:1px solid #aaa;border-radius:0;padding:5px 10px 5px 55px;width:100%}.wc-kalkulator-wrapper .input-if i::after{content:"if"}.wc-kalkulator-wrapper .input-equation i::after{content:"="}.wc-kalkulator-wrapper #addon-inputs .input-equation i::after{content:"add"}.wc-kalkulator-wrapper .input-else i::after{content:"else"}.wc-kalkulator-wrapper .input-group{padding:12px;border:1px solid #aaa;background-color:#fff;margin-bottom:5px}.wc-kalkulator-wrapper .ui-autocomplete-loading{background-image:none!important}.wc-kalkulator-wrapper .wc-category-search,.wc-kalkulator-wrapper .wc-enhanced-select,.wc-kalkulator-wrapper .wc-page-search,.wc-kalkulator-wrapper .wc-product-search{width:100%}.wc-kalkulator-wrapper span.formula-field{padding-left:6px;cursor:pointer;font-weight:700}.wc-kalkulator-wrapper span.formula-field:hover{text-decoration:underline}.wc-kalkulator-wrapper .wp-media-image-preview{max-width:80px;max-height:80px;cursor:pointer}.wc-kalkulator-wrapper .wp-media-image-preview:hover{transform:scale(1.2);-moz-transform:scale(1.2);-webkit-transform:scale(1.2)}.wc-kalkulator-wrapper select.param{margin-bottom:20px}.wc-kalkulator-wrapper .iris-picker{position:absolute;z-index:9999}.wc-kalkulator-wrapper .fields-section{text-align:center;padding:50px;margin:0 auto;max-width:500px}.wc-kalkulator-wrapper .fields-section button,.wc-kalkulator-wrapper .fields-section select{font-size:16px}.wc-kalkulator-wrapper .fields-section select{width:300px;padding:5px 10px}.wc-kalkulator-wrapper .fields-section button{width:50px;padding:3px 8px}.wc-kalkulator-wrapper .fields-section button span{line-height:2} \ No newline at end of file +.wc-kalkulator-wrapper html{scroll-padding-top:100px}.wc-kalkulator-wrapper p.add-buttons{line-height:36px}.wc-kalkulator-wrapper a.button.action-add-image{margin-bottom:20px;margin-top:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper a.button.action-add-attachment{margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list{width:100%}.wc-kalkulator-wrapper ul#f-field-list *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li{box-shadow:0 5px 10px #ccc;margin-bottom:5px}.wc-kalkulator-wrapper ul#f-field-list li .field{border:1px solid #aaa;background-color:#fff}.wc-kalkulator-wrapper ul#f-field-list li .field .header{padding:8px}.wc-kalkulator-wrapper ul#f-field-list li .field .header .text{font-size:14px;color:#000;padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .body{padding:20px;border-top:1px solid #aaa}.wc-kalkulator-wrapper ul#f-field-list li .field .body .half{float:left;width:50%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .second{padding-left:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .first{padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .fu-allowed-extensions{margin-top:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body label{font-size:12px;margin-bottom:3px;font-weight:700}.wc-kalkulator-wrapper ul#f-field-list li .field .body label.error{background-color:#e30000;color:#fff;padding:6px;margin:6px 0;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair{margin-bottom:10px;display:flex;align-items:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair span.dashicons-no-alt{cursor:pointer;font-size:28px;color:red}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs{margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs button{margin-right:6px;margin-bottom:6px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer{display:none;margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer textarea{display:block;width:100%;min-height:200px;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column{float:left}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1{width:40%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-half{width:20%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2{width:40%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2-half{text-align:center;width:20%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-2{width:80%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-3{width:10%;padding-left:20px;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-4{width:10%;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .clear{clear:both}.wc-kalkulator-wrapper .input-group .dashicons,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons{padding:3px;margin-left:2px;margin-right:2px;cursor:pointer;color:#555}.wc-kalkulator-wrapper .input-group .left,.wc-kalkulator-wrapper ul#f-field-list li .field .header .left{float:left}.wc-kalkulator-wrapper .input-group .right,.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{float:right}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]),.wc-kalkulator-wrapper ul#f-field-list li .field .body label{display:block;width:100%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]).inline,.wc-kalkulator-wrapper ul#f-field-list li .field .body label.inline{display:inline;margin-right:10px;width:auto}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.f-required,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.fdp-disallow-past-date,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param[type=checkbox]{margin:10px 15px 14px 3px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text],.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=number].param,.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=text].param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text]{width:100%}.wc-kalkulator-wrapper .clearfix,.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair:after{content:"";display:block;clear:both}.wc-kalkulator-wrapper .pr-20{padding-right:20px}.wc-kalkulator-wrapper .input-icon{position:relative;font-family:monospace;width:100%;margin:10px 0}.wc-kalkulator-wrapper .input-icon i{font-family:monospace;font-size:15px;position:absolute;display:block;top:10px;pointer-events:none;width:45px;text-align:right;font-style:normal;color:#00f}.wc-kalkulator-wrapper .input-icon input{border:1px solid #aaa;border-radius:0;padding:5px 10px 5px 55px;width:100%}.wc-kalkulator-wrapper .input-if i::after{content:"if"}.wc-kalkulator-wrapper .input-equation i::after{content:"="}.wc-kalkulator-wrapper #addon-inputs .input-equation i::after{content:"add"}.wc-kalkulator-wrapper .input-else i::after{content:"else"}.wc-kalkulator-wrapper .input-group{padding:12px;border:1px solid #aaa;background-color:#fff;margin-bottom:5px}.wc-kalkulator-wrapper .ui-autocomplete-loading{background-image:none!important}.wc-kalkulator-wrapper .wc-category-search,.wc-kalkulator-wrapper .wc-enhanced-select,.wc-kalkulator-wrapper .wc-page-search,.wc-kalkulator-wrapper .wc-product-search{width:100%}.wc-kalkulator-wrapper button.add-operator{margin-right:3px}.wc-kalkulator-wrapper span.formula-field{padding-left:6px;cursor:pointer;font-weight:700}.wc-kalkulator-wrapper span.formula-field:hover{text-decoration:underline}.wc-kalkulator-wrapper .wp-media-image-preview{max-width:80px;max-height:80px;cursor:pointer}.wc-kalkulator-wrapper .wp-media-image-preview:hover{transform:scale(1.2);-moz-transform:scale(1.2);-webkit-transform:scale(1.2)}.wc-kalkulator-wrapper select.param{margin-bottom:20px}.wc-kalkulator-wrapper .iris-picker{position:absolute;z-index:9999}.wc-kalkulator-wrapper .fields-section{text-align:center;padding:50px;margin:0 auto;max-width:500px}.wc-kalkulator-wrapper .fields-section button,.wc-kalkulator-wrapper .fields-section select{font-size:16px}.wc-kalkulator-wrapper .fields-section select{width:300px;padding:5px 10px}.wc-kalkulator-wrapper .fields-section button{width:50px;padding:3px 8px}.wc-kalkulator-wrapper .fields-section button span{line-height:2} \ No newline at end of file diff --git a/assets/css/admin.sass b/assets/css/admin.sass index 11aac7a..93b8a83 100644 --- a/assets/css/admin.sass +++ b/assets/css/admin.sass @@ -180,6 +180,8 @@ background-image: none !important .wc-product-search, .wc-category-search, .wc-enhanced-select, .wc-page-search width: 100% + button.add-operator + margin-right: 3px span &.formula-field padding-left: 6px diff --git a/assets/js/admin.js b/assets/js/admin.js index 7db58e2..b045c4f 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -12,8 +12,8 @@ "handle": ".action-drag" }); - $("a.savefields").on("click", function (e) { - e.preventDefault(); + $("#wck-parameters").on("focus", function (e) { + //e.preventDefault(); $WK.saveFields(); }); $('').insertBefore("#wpwrap"); @@ -27,14 +27,20 @@ $("body").on("focus", "#wck_expression input", function () { $WK.expressionLastFocusedInput = $(this); - }).on("click", "span.formula-field", function () { + }).on("click", "button.add-field-to-formula, button.add-operator", function (e) { + e.preventDefault(); var $focused = $WK.expressionLastFocusedInput; + if (!$focused) { + $focused = $(".input-icon").find("input:visible").first(); + $focused.focus(); + } if ($focused && $focused.length) { + var value = $(this).hasClass("add-operator") ? $(this).val() : $("#wck-parameters").val(); var cursorPos = $focused[0].selectionStart; var x = $focused.val(); - $focused.val(x.slice(0, cursorPos) + $(this).text() + x.slice(cursorPos)); + $focused.val(x.slice(0, cursorPos) + value + x.slice(cursorPos)); $focused.focus(); - cursorPos += $(this).text().length; + cursorPos += value.length; $focused[0].setSelectionRange(cursorPos, cursorPos); } }).on("click", ".field .pairs .action-add", function () { @@ -282,7 +288,8 @@ var error = $("li .field", $WK.fieldList).length === 0; $("label.error").remove(); $WK.saved = false; - $("#formula_fields").html(" ‐ "); + //$("#formula_fields").html(" ‐ "); + $("#wck-parameters .defined-fields").html(""); $WK.appendGlobalParameters(); if (error) { @@ -471,10 +478,24 @@ $WK.appendGlobalParameters = function () { if (typeof wck_global_parameters !== undefined) { + $("#wck-parameters .global-parameters").html(""); $.each(wck_global_parameters, function (name, value) { var name = "global:" + name; + var appendChildren = ""; suggest.push(name); - $("#formula_fields").append('{' + name + '} '); + //$("#formula_fields").append('{' + name + '} '); + if (typeof value === 'object') { + $.each(value, function (k, v) { + var suffix = "['" + k + "']"; + console.log(suffix); + appendChildren = appendChildren + ''; + }); + value = ""; + } else { + value = " = " + value; + } + $("#wck-parameters .global-parameters").append(''); + $("#wck-parameters .global-parameters").append(appendChildren); }); } } @@ -484,32 +505,42 @@ if (field.use_expression) { if (field.type !== 'checkboxgroup') { suggest.push(field.name); - $("#formula_fields").append('{' + field.name + '} '); + //$("#formula_fields").append('{' + field.name + '} '); + $("#wck-parameters .defined-fields").append(''); } else { suggest.push(field.name + ":sum"); - $("#formula_fields").append('{' + field.name + ':sum} '); + //$("#formula_fields").append('{' + field.name + ':sum} '); + $("#wck-parameters .defined-fields").append(''); suggest.push(field.name + ":min"); - $("#formula_fields").append('{' + field.name + ':min} '); + //$("#formula_fields").append('{' + field.name + ':min} '); + $("#wck-parameters .defined-fields").append(''); suggest.push(field.name + ":max"); - $("#formula_fields").append('{' + field.name + ':max} '); + //$("#formula_fields").append('{' + field.name + ':max} '); + $("#wck-parameters .defined-fields").append(''); } if (field.type === "text" || field.type === "textarea") { suggest.push(field.name + ":text"); - $("#formula_fields").append('{' + field.name + ':text} '); + //$("#formula_fields").append('{' + field.name + ':text} '); + $("#wck-parameters .defined-fields").append(''); } if (field.type === "rangedatepicker") { suggest.push(field.name + ":date_from"); - $("#formula_fields").append('{' + field.name + ':date_from} '); + //$("#formula_fields").append('{' + field.name + ':date_from} '); + $("#wck-parameters .defined-fields").append(''); suggest.push(field.name + ":date_to"); - $("#formula_fields").append('{' + field.name + ':date_to} '); + // $("#formula_fields").append('{' + field.name + ':date_to} '); + $("#wck-parameters .defined-fields").append(''); suggest.push(field.name + ":days"); - $("#formula_fields").append('{' + field.name + ':days} '); + // $("#formula_fields").append('{' + field.name + ':days} '); + $("#wck-parameters .defined-fields").append(''); } else if (field.type === "datepicker") { suggest.push(field.name + ":date"); - $("#formula_fields").append('{' + field.name + ':date} '); + // $("#formula_fields").append('{' + field.name + ':date} '); + $("#wck-parameters .defined-fields").append(''); } else if (field.type === "imageupload") { suggest.push(field.name + ":size"); - $("#formula_fields").append('{' + field.name + ':size} '); + //$("#formula_fields").append('{' + field.name + ':size} '); + $("#wck-parameters .defined-fields").append(''); } } }; @@ -686,6 +717,7 @@ $("input.expression_type").on("change", function () { $WK.expression.mode = $(this).val(); + $WK.expressionLastFocusedInput = null; $WK.showExpressionEditor(); }); diff --git a/assets/js/admin.min.js b/assets/js/admin.min.js index f03de1f..961ba29 100644 --- a/assets/js/admin.min.js +++ b/assets/js/admin.min.js @@ -1 +1 @@ -(function($){"use strict";var $WK={};$(document).ready(function($){var suggest=[];var input_key_pressed={};$("#f-field-list").sortable({handle:".action-drag"});$("#extra-inputs, #addon-inputs").sortable({handle:".action-drag"});$("a.savefields").on("click",function(e){e.preventDefault();$WK.saveFields()});$('').insertBefore("#wpwrap");$WK.colorpicker=$("input.wck-global-color-picker");$WK.colorpicker.iris();$WK.expressionLastFocusedInput=null;$WK.wpMediaFrame=null;$WK.wpMediaTarget=null;$WK.iconPreloader="data:image/gif;base64,R0lGODlhEAAQAPUVAHt7e729vf///4R7e+/v762trZSUlKWlpZycnPf39+bm5t7e3tbW1s7OzoSEhMXFxc7FzpSMjJyUlP/397WtraWlnM7FxbW1tb21tebe3tbOzqWcnIyEhHNzc3tzc4yMjK2lpbWttcW9vffv76Wtpa2lra2tpb21vcXFzt7e1qWlrdbe1pScnO/v5gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBwAVACwAAAAAEAAQAEAGt8CKsGLZfDyez8YyrAAekAdA09R0GoLGE8BgLDQIhwORSSQIDqYxELhcCoXDARHeCBmRSGOh6BMICxIRDBUOAQ0NBiBNIBsTAgscGwgPDxcABYgFHnQSSkMFAAYHcAgRHQVNQgUDmX0NFA6pQxsGC7d9Cn8ECRt2GwddDwMgiCAOC2YYGwCIWlRDGgACAgkADhiVEYtDIAMGAQYcUmxtHwDXc3QdDxV4DhRucHIIAIOqRRxIkkxDQQAh+QQFBwAQACwAAAAAEAAQAAAGr0CIEGLZfDyez8YybBYAh8diYSkMCk1G5PNgrKYKBcMQYQg3hgZjDQ4TEBvIA/BoNCySgQMBIRAUDkVRDQEDIHYgDgx+FxsOFw8PBiBNIAgJCQscAAGRABpNGgCYBACcAQGfoaMJpQ4hqB+UQyAbAgKaGwgXF08FdgUdF7cBG3O8vQ6meypiAw8QRr0FBwcI1wgHDnEQWg4H1NbXBgBlTh4G2dYfHVhNQkUcSBxLTUEAIfkECQcAEAAsAQABAA4ADgAABnBAiFAYYDAeoKEy0GgYF4uG8vN4NJ9QxTBQfQgHQoViMUAEAhiAMqygFM6ftZBAYFzu8jlBcb/kISN0IAUFHHIICQkMBoQHHkoOGYkXHgUkBwdKCgIJBA4QDpgHCAgGFwICE5lfpKQGRQsIch+tBmtBACH5BAUHABQALAEAAQAOAA4AAAaaQAqlAEBcHo3AAVAQMiKO4wPSaDAsnwhj8wkEHuAqg7EwbAAXbyAyGBgaiwVjILlcQgBQFTSALwoHdh8gQkIgEgoKDQWMABqFFBoAiQsHjB6PhZKJChUHBw6EhSAIBAQMBp8IHgVVBQ4UphceBwi2AwAOBwoJBAoOGw62CG8CEwnIGxtPRRIBAtAJCghaQgUdHwYMAgsXDk0UQQAh+QQFBwAQACwBAAEADgAOAAAGcECIECIpBB4XxHBZuASOD5RoyblYn49HYyv0FL4XCECoZTTGhwJoSWYwQIjDwcEWMhYP+cFThywWDAiCfX5/gkp9CgoNH4IGiQoFEHEFDxt0GwsECgtCAxAECQIJpASmiBAeDQKjpQsSbAMYC6QMbEEAIfkEBQcAEAAsAQABAA4ADgAABnZAiNAjOVwCBaFSCDgUCpdjAMNZHpzQU0D0eESEVycHAIgEuo8yAgHxLAGBRkO4Xi7lIoSBbRcyGA0SCB99fn8GD3N9EgsLDxwEAhkOdg2NBQAjAgIKSggMCo0DEAcTCacjBAQKrEsICqeqqwx9DhgMqgwUo0JBACH5BAkHAAAALAEAAQAOAA4AAAVjICACEVIUhzGuyHGc10WtANK+RRwEo92ulx0PIKnRAJfHY2MIGAbHiBLTEDSOogfkkRAIoMdG47EQTDZYcQCTSBwHDwbj4AC0MwgAVLOQi9AEgQqDC4UqIwuChFdHFBqDjCMhACH5BAUHABMALAEAAQAOAA4AAAaTwMmk0PlIDgeEwVMQMiIAA2KKLBwGEcbGkZwiqoULZzNgEC4IBwDAKYQvgIBA8OiAGg0Q4I1YzA8gQkIgHwEBIQmJAxqCExoehgEEioyCGgAPDwELiQiBgiAGmRgXBAQMDgV4BQMiDRAHDgqmEwgDAwYQeBYAGwgECsELCwzFDQYbTxIMwsMMDxFZQqyqww8He0JBACH5BAUHAAMALAEAAQAOAA4AAAZzwIEQYBggEIaPcGlUKBqG4xGw3CQEgkAUcTiYhA7CVcHskgqeSyKRcTA9h0LBwFhvmEJO6FIi+PFLF4IKflR4HgGCDH+AHwEBBQNOGngAGA8BCAMLTgMSSw+hIksKC6YMDA0NoRFMDaepDQGAAyAPqLNMQQAh+QQFBwAYACwBAAEADgAOAAAFZSAmOtciMGKaSlgivAGrIm0yCY2B7KlCJJiDQ7RDHEQEgiplPGKStGXwUFFYAVJMoXBYWLPabcMqW14uh8JigRksKWfJgLHOYQCRgP4ikiwYDA0ND4R6SxaBDRCEfEtYAYIXUSIhACH5BAkHABAALAEAAQAOAA4AAAZyQIhQyEgkFhjHcLggGBMCAcOzbBEII6PAeBhABgsFYbGBOA6iwgEBKSgUjKXQwEJ8Gm/5EMFf+PVCfAgMf4AHhw8LcXpnayAMDA96IAUFQg0MDZIAQheVBVQQDaMPDwEBF6kcQx8ipaaoBUpyGxemlktBACH5BAUHABAALAEAAQAOAA4AAAaRQAikMCg0CATGxVEQMiIGhgJJSCQUiAhjI1F4p1Vr4rAZLBYKBsLh2CgEggSgcG44QI0GyAFJED4PKQsSIEJCewEBUQwMABqGEBodHwgSDYyOkJIInAF5BoWGe5wIB3kBc3kFHgcHWQAPsQEfAAAcBa0HHhsGsokXBcEHbU8fF78XwMNaQgUACAUBFwcGHk0QQQA7";$("body").on("focus","#wck_expression input",function(){$WK.expressionLastFocusedInput=$(this)}).on("click","span.formula-field",function(){var $focused=$WK.expressionLastFocusedInput;if($focused&&$focused.length){var cursorPos=$focused[0].selectionStart;var x=$focused.val();$focused.val(x.slice(0,cursorPos)+$(this).text()+x.slice(cursorPos));$focused.focus();cursorPos+=$(this).text().length;$focused[0].setSelectionRange(cursorPos,cursorPos)}}).on("click",".field .pairs .action-add",function(){var $clone=$(this).prev(".pair").clone().insertBefore($(this));$clone.children("input").val("")}).on("click",".field .pairs .action-showimport",function(){$(this).parent().find("div.importer").toggle()}).on("click",".field .pairs .action-import",function(){var $this=$(this);var input=$this.parent().find("textarea").val().trim().split("\n");if(Array.isArray(input)){input.forEach(function(el){var columns=el.trim().split(";");var $last_pair=$this.parent().parent().find(".pair").last();var $clone=$last_pair.clone().insertAfter($last_pair);if(columns.length===2){$clone.find("input.fs-name").val(columns[0]);$clone.find("input.fs-title").val(columns[1])}else if(columns.length===1){$clone.find("input.fs-title").val(columns[0])}})}}).on("click",".field .pairs .action-removeall",function(){if(confirm("Are you sure?")){$(this).parent().find(".pair").slice(1).remove()}}).on("click",".field .pair .action-delete",function(){var $pairs=$(this).closest(".pairs");if($pairs.children(".pair").length>1){if(confirm("Are you sure?")){$(this).closest(".pair").remove()}}else{alert("You cannot remove the last item!")}}).on("click",".field .header .action-delete",function(){if(confirm("Are you sure?")){var $target=$(this).closest("li");$target.hide("slow",function(){$target.remove()})}}).on("click",".field .header .action-toggle",function(){$(this).closest(".field").find(".body").slideToggle(300);$(this).toggleClass("dashicons-arrow-up-alt2");$(this).toggleClass("dashicons-arrow-down-alt2")}).on("click","#add-field-button",function(e){e.preventDefault();var fieldType=$("#select-field").val();var id=$WK.addField(fieldType);$("html, body").animate({scrollTop:$("#"+id).offset().top-50},1e3)}).on("click",".expression_conditional .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#extra-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last condition!")}}).on("click",".expression_addon .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#addon-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last addon!")}}).on("click",".action-add-image",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this image"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();if($WK.wpMediaTarget.prop("tagName")==="A"){$WK.wpMediaTarget.next("img.wp-media-image-preview").attr("src",attachment.url);$WK.wpMediaTarget.next().next("input.wp-media-image-id").attr("value",attachment.id);$WK.wpMediaTarget.hide()}else{$WK.wpMediaTarget.attr("src",attachment.url);$WK.wpMediaTarget.next("input.wp-media-image-id").attr("value",attachment.id)}});$WK.wpMediaFrame.open()}).on("click",".action-add-attachment",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this file"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();$WK.wpMediaTarget.next("input.wp-media-attachment-id").val(attachment.id);$WK.wpMediaTarget.next().next("a.wp-media-attachment-preview").attr("href",attachment.url).text(attachment.url)});$WK.wpMediaFrame.open()}).on("focus",'[data-type="colorswatches"] input.fs-title',function(e){e.preventDefault();var _target=$(this);$WK.colorpicker.iris("show");$(".iris-picker").css({top:_target.offset().top+40,left:_target.offset().left});$WK.colorpicker.iris("option","change",function(event,ui){_target.val(ui.color.toString());var color=ui.color.toRgb();var t=(color.r+color.g+color.b)/2;var textColor=t<200?"#FFFFFF":"#000000";_target.css({"background-color":ui.color.toString(),color:textColor})});$WK.colorpicker.iris("color",$(this).val())}).on("click","input.allowed-extensions",function(){var field_id="#"+$(this).closest("li").attr("id");var ext=[];$(field_id+" input.allowed-extensions:checked").each(function(){console.log($(this).data("extension"));ext.push($(this).data("extension"))});$(field_id+" input.fu-allowed-extensions").val(ext.join("|"))});$(".iris-square-value").on("click",function(e){e.preventDefault()});$(document).click(function(e){if(!$(e.target).closest('.iris-picker, [data-type="colorswatches"] input.fs-title').length){if($(".iris-picker").is(":visible")){$WK.colorpicker.iris("hide")}}});$("form#post").submit(function(e){$WK.saveFields();if(!$WK.saved){e.preventDefault();return false}$WK.saveExpression();if(!$WK.expr_saved&&$WK.expression.mode!=="off"){e.preventDefault();alert("Expression is required. Fill in required fields and try again!");return false}return true});$WK.init=function(){$WK.fieldList=$("#f-field-list");$WK.html=wck_fields_html;$WK.fields={};$WK.saved=false;$WK.expr_saved=false;$WK.counter=0;$WK.expression={mode:$("input.expression_type:checked").val()};$WK.loadJSONdata();$WK.showExpressionEditor();$WK.changeAssignType();$("form#post").attr("novalidate","");$WK.buildTooltips("")};$WK.buildTooltips=function(selector){$(selector+"span.wck-field-tip").tipTip({attribute:"title",defaultPosition:"left"})};$WK.changeAssignType=function(){var disabled=$("#assign_type").val()==="1";$("#assign_products, #assign_categories, #assign_tags").prop("disabled",disabled)};$("#assign_type").on("change",$WK.changeAssignType);$WK.preloadMedia=function(id,callback){wp.media.attachment(id).fetch().then(function(){callback(wp.media.attachment(id))});return};$WK.addField=function(type){$WK.counter+=1;var id="wkfield-"+$WK.counter;$("li.welcome",$WK.fieldList).remove();$WK.fieldList.append($("
  • ",{"data-type":type,class:"form-invalid",id:id}).append($WK.html[type].replace("{id}",id)));$WK.buildTooltips("#"+id+" ");return id};$(window).on("beforeunload",function(){if($WK.saved===false){return""}});$WK.saveFields=function(){$WK.fields={};suggest=[];var error=$("li .field",$WK.fieldList).length===0;$("label.error").remove();$WK.saved=false;$("#formula_fields").html(" ‐ ");$WK.appendGlobalParameters();if(error){alert("Please add at least one field before saving.");return false}$("li .field",$WK.fieldList).each(function(){var $row=$(this);var input_fname=$row.find("input.f-name");var input_ftitle=$row.find("input.f-title");var input_fhint=$row.find("input.f-hint");var input_default_value=$row.find("input.f-default-value");var input_css_class=$row.find("input.f-css-class");var field={type:$row.data("type"),use_expression:$row.data("use-expression")===true,name:input_fname.val(),title:input_ftitle.val(),hint:input_fhint.val(),default_value:input_default_value.val(),css_class:input_css_class.val(),required:$row.find("input.f-required").length>0?$row.find("input.f-required").is(":checked"):true};var input_fprice=$row.find("input.f-price");if(input_fprice.length>0){field.price=input_fprice.val();if(field.price!==""){field.use_expression=true}}var input_fimgwidth=$row.find("input.fimg-width");if(input_fimgwidth.length>0){field.image_size=input_fimgwidth.val()}var $fs_options;switch(field.type){case"select":case"radio":case"imageselect":case"imageswatches":case"colorswatches":case"radiogroup":case"checkboxgroup":field.options_name=[];field.options_title=[];if(field.type==="imageselect"||field.type==="imageswatches"){field.options_image=[]}if(field.type==="checkboxgroup"){field.select_limit=$row.find("input.fcbg-limit").val()}$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var fs_name=$(this).find("input.fs-name");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_name.val()+":"+fs_title.val()}field.options_name.push(fs_name.val()+":"+fs_title.val());field.options_title.push(fs_title.val());if(field.type==="imageselect"||field.type==="imageswatches"){var fs_image=$(this).find("input.fs-image");field.options_image.push(fs_image.val())}});break;case"dropdown":field.options_title=[];$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_title.val()}field.options_title.push(fs_title.val())});break;case"number":var input_fnmin=$row.find("input.fn-min-value");field.min=input_fnmin.val();var input_fnmax=$row.find("input.fn-max-value");field.max=input_fnmax.val();break;case"checkbox":var input_fcb_default_state=$row.find("input.fcb-default-state");field.default_state=input_fcb_default_state.is(":checked");break;case"text":case"textarea":case"email":var input_ftminlen=$row.find("input.ft-min-length");var input_ftmaxlen=$row.find("input.ft-max-length");var input_ftpattern=$row.find("input.ft-pattern");field.min=input_ftminlen.val();field.max=input_ftmaxlen.val();if(input_ftpattern.length>0){field.pattern=input_ftpattern.val()}break;case"colorpicker":case"datepicker":case"rangedatepicker":var input_fdpdisallow_past_date=$row.find("input.fdp-disallow-past-date");field.disallow_past_date=input_fdpdisallow_past_date.is(":checked");break;case"imageupload":field.max_file_size=$row.find("input.fu-max-file-size").val();field.allowed_extensions=$row.find("input.fu-allowed-extensions").val();break;case"html":case"paragraph":case"hidden":case"attachment":field.content=$row.find(".fst-content").val();break;case"link":field.content=$row.find(".fst-content").val();field.target=$row.find(".fst-target").val();break;case"heading":field.content=$row.find(".fst-content").val();field.level=$row.find(".fst-level").val();break}if(field.name!==""&&field.name in $WK.fields){error=true;alert("Field names must be unique! The '"+field.name+"' name is used more than once.")}if(!error){$WK.appendFormulaVars(field)}});var wkform=$("form#post");if(!wkform[0].checkValidity()){error=true;$("input:invalid").parent().show();$("input:invalid").each(function(){$('").insertBefore($(this))})}if(error&&$("label.error").length){$("html, body").animate({scrollTop:$("label.error").first().offset().top-160},1e3)}$WK.saveJSONdata();$WK.saved=!error};$WK.appendGlobalParameters=function(){if(typeof wck_global_parameters!==undefined){$.each(wck_global_parameters,function(name,value){var name="global:"+name;suggest.push(name);$("#formula_fields").append('{'+name+"} ")})}};$WK.appendFormulaVars=function(field){$WK.fields[field.name]=field;if(field.use_expression){if(field.type!=="checkboxgroup"){suggest.push(field.name);$("#formula_fields").append('{'+field.name+"} ")}else{suggest.push(field.name+":sum");$("#formula_fields").append('{'+field.name+":sum} ");suggest.push(field.name+":min");$("#formula_fields").append('{'+field.name+":min} ");suggest.push(field.name+":max");$("#formula_fields").append('{'+field.name+":max} ")}if(field.type==="text"||field.type==="textarea"){suggest.push(field.name+":text");$("#formula_fields").append('{'+field.name+":text} ")}if(field.type==="rangedatepicker"){suggest.push(field.name+":date_from");$("#formula_fields").append('{'+field.name+":date_from} ");suggest.push(field.name+":date_to");$("#formula_fields").append('{'+field.name+":date_to} ");suggest.push(field.name+":days");$("#formula_fields").append('{'+field.name+":days} ")}else if(field.type==="datepicker"){suggest.push(field.name+":date");$("#formula_fields").append('{'+field.name+":date} ")}else if(field.type==="imageupload"){suggest.push(field.name+":size");$("#formula_fields").append('{'+field.name+":size} ")}}};$WK.saveJSONdata=function(){if(Object.keys($WK.fields).length>0){$("input[name=_wck_fieldset]").val(JSON.stringify($WK.fields))}};$WK.loadJSONdata=function(){if(typeof wck_load_fieldset==="object"){$.each(wck_load_fieldset,function(){var field_id=$WK.addField(this.type);var $field=$("#"+field_id+" .field");$("#"+field_id+" .f-name").val(this.name);$("#"+field_id+" .f-title").val(this.title);$("#"+field_id+" .f-hint").val(this.hint);$("#"+field_id+" .f-css-class").val(this.css_class);if($("#"+field_id+" .f-required").length>0){$("#"+field_id+" .f-required").prop("checked",this.required)}var fprice=$("#"+field_id+" .f-price");if(fprice.length>0){fprice.val(this.price)}var fimgwidth=$("#"+field_id+" .fimg-width");if(fimgwidth.length>0){fimgwidth.val(this.image_size)}var options_title,options_name,options_image,default_value,first,$checked;if(this.type==="dropdown"){options_title=this.options_title;default_value=this.default_value;first=true;$checked=null;$.each(options_title,function(i,option_title){if(first){var $first=$field.find(".fs-option");$first.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(["select","radio","imageselect","radiogroup","checkboxgroup","imageswatches","colorswatches"].indexOf(this.type)>=0){options_name=this.options_name;options_title=this.options_title;default_value=this.default_value;if(this.type==="imageselect"||this.type==="imageswatches"){options_image=this.options_image;wp.media.attachment(options_image).fetch()}if(this.type==="checkboxgroup"){$("#"+field_id+" .fcbg-limit").val(this.select_limit)}first=true;$checked=null;$.each(options_name,function(i,option_name){if(option_name.indexOf(":")>=0){option_name=option_name.slice(0,option_name.indexOf(":"))}if(first){var $first=$field.find(".fs-option");$first.find("input.fs-name").val(option_name);$first.find("input.fs-title").val(options_title[i]);var fs_image=$first.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$first.find("a.action-add-image").hide();$first.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$first.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-name").val(option_name);$clone.find("input.fs-title").val(options_title[i]);fs_image=$clone.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$clone.find("a.action-add-image").hide();$clone.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$clone.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(this.type==="number"){$("#"+field_id+" .fn-min-value").val(this.min);$("#"+field_id+" .fn-max-value").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value)}else if(this.type==="checkbox"){$("#"+field_id+" .fcb-default-state").prop("checked",this.default_state)}else if(this.type==="text"||this.type==="textarea"||this.type==="email"){$("#"+field_id+" .ft-min-length").val(this.min);$("#"+field_id+" .ft-max-length").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value);if(this.type==="text"){$("#"+field_id+" .ft-pattern").val(this.pattern)}}else if(this.type==="colorpicker"||this.type==="datepicker"||this.type==="rangedatepicker"){$("#"+field_id+" .fdp-disallow-past-date").prop("checked",this.disallow_past_date)}else if(this.type==="imageupload"){$("#"+field_id+" .fu-max-file-size").val(this.max_file_size);$("#"+field_id+" .fu-allowed-extensions").val(this.allowed_extensions);var ext=this.allowed_extensions.split("|");ext.forEach(function(e){$("#"+field_id+" .allowed-extensions.ext-"+e).prop("checked",true)})}else if(["html","paragraph","heading","hidden","link","attachment"].indexOf(this.type)>=0){$("#"+field_id+" .fst-content").val(this.content);if(this.type==="heading"){$("#"+field_id+" .fst-level").val(this.level)}else if(this.type==="link"){$("#"+field_id+" .fst-target").val(this.target)}else if(this.type==="attachment"){$WK.preloadMedia(this.content,function(attachment){console.log(field_id,attachment.get("url"));$("#"+field_id+" .wp-media-attachment-preview").attr("href",attachment.get("url")).text(attachment.get("url"))})}}});$WK.saveFields()}};$WK.showExpressionEditor=function(){$("div.expression_oneline, div.expression_conditional, div.expression_off, div.expression_addon").hide();$("div.expression_"+$WK.expression.mode).show();if($WK.expression.mode==="off"){$(".off-hide").hide()}else{$(".off-hide").show()}};$("input.expression_type").on("change",function(){$WK.expression.mode=$(this).val();$WK.showExpressionEditor()});$WK.addCondition=function(if_value,then_value,addon=false){var $html=$('
    '+''+''+'
    '+'
    '+''+"
    "+'
    '+''+"
    ");$(".input-if input",$html).val(if_value);$(".input-equation input",$html).val(then_value);if(addon===true){$("div#addon-inputs").append($html)}else{$("div#extra-inputs").append($html)}$WK.autocomplete()};$("button.add-condition").on("click",function(){$WK.addCondition()});$("button.add-addon").on("click",function(){$WK.addCondition("","",true)});$WK.autocomplete=function(){$(".input-icon input").bind("keydown",function(e){if(e.keyCode===16||e.keyCode===219){input_key_pressed[e.keyCode]=true}}).autocomplete({minLength:0,source:function(request,response){if(input_key_pressed[16]===true&&input_key_pressed[219]===true){response(suggest)}},focus:function(){return false},select:function(event,ui){delete input_key_pressed[16];delete input_key_pressed[219];this.value+=ui.item.value+"}";return false}})};$WK.saveExpression=function(){var mode=$WK.expression.mode;$WK.expr_saved=false;if(mode==="oneline"){$WK.expression.expr=$(".expression_oneline input").val();if($WK.expression.expr!==""){$WK.expr_saved=true}}if(mode==="conditional"){var data=[];$(".expression_conditional .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});var input_else=$(".expression_conditional .input-else input").val();data.push({type:"else",if:"true",then:input_else});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="addon"){var data=[];$(".expression_addon .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="off"){$("input[name=_wck_expression]").val("off")}else{$("input[name=_wck_expression]").val(JSON.stringify($WK.expression))}};$WK.loadExpression=function(){if(typeof wck_load_expression==="object"){$WK.expression=wck_load_expression;if($WK.expression.mode==="oneline"){$(".expression_oneline input").val($WK.expression.expr);$("input[name=_wck_choose_expression_type].expression_oneline").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}else if($WK.expression.mode==="conditional"){$.each($WK.expression.expr,function(){if(this.type==="condition"){$WK.addCondition(this.if,this.then)}else if(this.type==="else"){$(".input-else input").val(this.then)}});$("input[name=_wck_choose_expression_type].expression_conditional").prop("checked",true);$WK.showExpressionEditor()}else if($WK.expression.mode==="addon"){$.each($WK.expression.expr,function(){$WK.addCondition(this.if,this.then,true)});$("input[name=_wck_choose_expression_type].expression_addon").prop("checked",true);$WK.showExpressionEditor()}}else{$WK.expression.mode="off";$("input[name=_wck_choose_expression_type].expression_off").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}};$("button.test-expression").on("click",function(){$WK.saveExpression()});$WK.init();$WK.loadExpression();$WK.autocomplete()})})(jQuery); \ No newline at end of file +(function($){"use strict";var $WK={};$(document).ready(function($){var suggest=[];var input_key_pressed={};$("#f-field-list").sortable({handle:".action-drag"});$("#extra-inputs, #addon-inputs").sortable({handle:".action-drag"});$("#wck-parameters").on("focus",function(e){$WK.saveFields()});$('').insertBefore("#wpwrap");$WK.colorpicker=$("input.wck-global-color-picker");$WK.colorpicker.iris();$WK.expressionLastFocusedInput=null;$WK.wpMediaFrame=null;$WK.wpMediaTarget=null;$WK.iconPreloader="data:image/gif;base64,R0lGODlhEAAQAPUVAHt7e729vf///4R7e+/v762trZSUlKWlpZycnPf39+bm5t7e3tbW1s7OzoSEhMXFxc7FzpSMjJyUlP/397WtraWlnM7FxbW1tb21tebe3tbOzqWcnIyEhHNzc3tzc4yMjK2lpbWttcW9vffv76Wtpa2lra2tpb21vcXFzt7e1qWlrdbe1pScnO/v5gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBwAVACwAAAAAEAAQAEAGt8CKsGLZfDyez8YyrAAekAdA09R0GoLGE8BgLDQIhwORSSQIDqYxELhcCoXDARHeCBmRSGOh6BMICxIRDBUOAQ0NBiBNIBsTAgscGwgPDxcABYgFHnQSSkMFAAYHcAgRHQVNQgUDmX0NFA6pQxsGC7d9Cn8ECRt2GwddDwMgiCAOC2YYGwCIWlRDGgACAgkADhiVEYtDIAMGAQYcUmxtHwDXc3QdDxV4DhRucHIIAIOqRRxIkkxDQQAh+QQFBwAQACwAAAAAEAAQAAAGr0CIEGLZfDyez8YybBYAh8diYSkMCk1G5PNgrKYKBcMQYQg3hgZjDQ4TEBvIA/BoNCySgQMBIRAUDkVRDQEDIHYgDgx+FxsOFw8PBiBNIAgJCQscAAGRABpNGgCYBACcAQGfoaMJpQ4hqB+UQyAbAgKaGwgXF08FdgUdF7cBG3O8vQ6meypiAw8QRr0FBwcI1wgHDnEQWg4H1NbXBgBlTh4G2dYfHVhNQkUcSBxLTUEAIfkECQcAEAAsAQABAA4ADgAABnBAiFAYYDAeoKEy0GgYF4uG8vN4NJ9QxTBQfQgHQoViMUAEAhiAMqygFM6ftZBAYFzu8jlBcb/kISN0IAUFHHIICQkMBoQHHkoOGYkXHgUkBwdKCgIJBA4QDpgHCAgGFwICE5lfpKQGRQsIch+tBmtBACH5BAUHABQALAEAAQAOAA4AAAaaQAqlAEBcHo3AAVAQMiKO4wPSaDAsnwhj8wkEHuAqg7EwbAAXbyAyGBgaiwVjILlcQgBQFTSALwoHdh8gQkIgEgoKDQWMABqFFBoAiQsHjB6PhZKJChUHBw6EhSAIBAQMBp8IHgVVBQ4UphceBwi2AwAOBwoJBAoOGw62CG8CEwnIGxtPRRIBAtAJCghaQgUdHwYMAgsXDk0UQQAh+QQFBwAQACwBAAEADgAOAAAGcECIECIpBB4XxHBZuASOD5RoyblYn49HYyv0FL4XCECoZTTGhwJoSWYwQIjDwcEWMhYP+cFThywWDAiCfX5/gkp9CgoNH4IGiQoFEHEFDxt0GwsECgtCAxAECQIJpASmiBAeDQKjpQsSbAMYC6QMbEEAIfkEBQcAEAAsAQABAA4ADgAABnZAiNAjOVwCBaFSCDgUCpdjAMNZHpzQU0D0eESEVycHAIgEuo8yAgHxLAGBRkO4Xi7lIoSBbRcyGA0SCB99fn8GD3N9EgsLDxwEAhkOdg2NBQAjAgIKSggMCo0DEAcTCacjBAQKrEsICqeqqwx9DhgMqgwUo0JBACH5BAkHAAAALAEAAQAOAA4AAAVjICACEVIUhzGuyHGc10WtANK+RRwEo92ulx0PIKnRAJfHY2MIGAbHiBLTEDSOogfkkRAIoMdG47EQTDZYcQCTSBwHDwbj4AC0MwgAVLOQi9AEgQqDC4UqIwuChFdHFBqDjCMhACH5BAUHABMALAEAAQAOAA4AAAaTwMmk0PlIDgeEwVMQMiIAA2KKLBwGEcbGkZwiqoULZzNgEC4IBwDAKYQvgIBA8OiAGg0Q4I1YzA8gQkIgHwEBIQmJAxqCExoehgEEioyCGgAPDwELiQiBgiAGmRgXBAQMDgV4BQMiDRAHDgqmEwgDAwYQeBYAGwgECsELCwzFDQYbTxIMwsMMDxFZQqyqww8He0JBACH5BAUHAAMALAEAAQAOAA4AAAZzwIEQYBggEIaPcGlUKBqG4xGw3CQEgkAUcTiYhA7CVcHskgqeSyKRcTA9h0LBwFhvmEJO6FIi+PFLF4IKflR4HgGCDH+AHwEBBQNOGngAGA8BCAMLTgMSSw+hIksKC6YMDA0NoRFMDaepDQGAAyAPqLNMQQAh+QQFBwAYACwBAAEADgAOAAAFZSAmOtciMGKaSlgivAGrIm0yCY2B7KlCJJiDQ7RDHEQEgiplPGKStGXwUFFYAVJMoXBYWLPabcMqW14uh8JigRksKWfJgLHOYQCRgP4ikiwYDA0ND4R6SxaBDRCEfEtYAYIXUSIhACH5BAkHABAALAEAAQAOAA4AAAZyQIhQyEgkFhjHcLggGBMCAcOzbBEII6PAeBhABgsFYbGBOA6iwgEBKSgUjKXQwEJ8Gm/5EMFf+PVCfAgMf4AHhw8LcXpnayAMDA96IAUFQg0MDZIAQheVBVQQDaMPDwEBF6kcQx8ipaaoBUpyGxemlktBACH5BAUHABAALAEAAQAOAA4AAAaRQAikMCg0CATGxVEQMiIGhgJJSCQUiAhjI1F4p1Vr4rAZLBYKBsLh2CgEggSgcG44QI0GyAFJED4PKQsSIEJCewEBUQwMABqGEBodHwgSDYyOkJIInAF5BoWGe5wIB3kBc3kFHgcHWQAPsQEfAAAcBa0HHhsGsokXBcEHbU8fF78XwMNaQgUACAUBFwcGHk0QQQA7";$("body").on("focus","#wck_expression input",function(){$WK.expressionLastFocusedInput=$(this)}).on("click","button.add-field-to-formula, button.add-operator",function(e){e.preventDefault();var $focused=$WK.expressionLastFocusedInput;if(!$focused){$focused=$(".input-icon").find("input:visible").first();$focused.focus()}if($focused&&$focused.length){var value=$(this).hasClass("add-operator")?$(this).val():$("#wck-parameters").val();var cursorPos=$focused[0].selectionStart;var x=$focused.val();$focused.val(x.slice(0,cursorPos)+value+x.slice(cursorPos));$focused.focus();cursorPos+=value.length;$focused[0].setSelectionRange(cursorPos,cursorPos)}}).on("click",".field .pairs .action-add",function(){var $clone=$(this).prev(".pair").clone().insertBefore($(this));$clone.children("input").val("")}).on("click",".field .pairs .action-showimport",function(){$(this).parent().find("div.importer").toggle()}).on("click",".field .pairs .action-import",function(){var $this=$(this);var input=$this.parent().find("textarea").val().trim().split("\n");if(Array.isArray(input)){input.forEach(function(el){var columns=el.trim().split(";");var $last_pair=$this.parent().parent().find(".pair").last();var $clone=$last_pair.clone().insertAfter($last_pair);if(columns.length===2){$clone.find("input.fs-name").val(columns[0]);$clone.find("input.fs-title").val(columns[1])}else if(columns.length===1){$clone.find("input.fs-title").val(columns[0])}})}}).on("click",".field .pairs .action-removeall",function(){if(confirm("Are you sure?")){$(this).parent().find(".pair").slice(1).remove()}}).on("click",".field .pair .action-delete",function(){var $pairs=$(this).closest(".pairs");if($pairs.children(".pair").length>1){if(confirm("Are you sure?")){$(this).closest(".pair").remove()}}else{alert("You cannot remove the last item!")}}).on("click",".field .header .action-delete",function(){if(confirm("Are you sure?")){var $target=$(this).closest("li");$target.hide("slow",function(){$target.remove()})}}).on("click",".field .header .action-toggle",function(){$(this).closest(".field").find(".body").slideToggle(300);$(this).toggleClass("dashicons-arrow-up-alt2");$(this).toggleClass("dashicons-arrow-down-alt2")}).on("click","#add-field-button",function(e){e.preventDefault();var fieldType=$("#select-field").val();var id=$WK.addField(fieldType);$("html, body").animate({scrollTop:$("#"+id).offset().top-50},1e3)}).on("click",".expression_conditional .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#extra-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last condition!")}}).on("click",".expression_addon .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#addon-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last addon!")}}).on("click",".action-add-image",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this image"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();if($WK.wpMediaTarget.prop("tagName")==="A"){$WK.wpMediaTarget.next("img.wp-media-image-preview").attr("src",attachment.url);$WK.wpMediaTarget.next().next("input.wp-media-image-id").attr("value",attachment.id);$WK.wpMediaTarget.hide()}else{$WK.wpMediaTarget.attr("src",attachment.url);$WK.wpMediaTarget.next("input.wp-media-image-id").attr("value",attachment.id)}});$WK.wpMediaFrame.open()}).on("click",".action-add-attachment",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this file"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();$WK.wpMediaTarget.next("input.wp-media-attachment-id").val(attachment.id);$WK.wpMediaTarget.next().next("a.wp-media-attachment-preview").attr("href",attachment.url).text(attachment.url)});$WK.wpMediaFrame.open()}).on("focus",'[data-type="colorswatches"] input.fs-title',function(e){e.preventDefault();var _target=$(this);$WK.colorpicker.iris("show");$(".iris-picker").css({top:_target.offset().top+40,left:_target.offset().left});$WK.colorpicker.iris("option","change",function(event,ui){_target.val(ui.color.toString());var color=ui.color.toRgb();var t=(color.r+color.g+color.b)/2;var textColor=t<200?"#FFFFFF":"#000000";_target.css({"background-color":ui.color.toString(),color:textColor})});$WK.colorpicker.iris("color",$(this).val())}).on("click","input.allowed-extensions",function(){var field_id="#"+$(this).closest("li").attr("id");var ext=[];$(field_id+" input.allowed-extensions:checked").each(function(){console.log($(this).data("extension"));ext.push($(this).data("extension"))});$(field_id+" input.fu-allowed-extensions").val(ext.join("|"))});$(".iris-square-value").on("click",function(e){e.preventDefault()});$(document).click(function(e){if(!$(e.target).closest('.iris-picker, [data-type="colorswatches"] input.fs-title').length){if($(".iris-picker").is(":visible")){$WK.colorpicker.iris("hide")}}});$("form#post").submit(function(e){$WK.saveFields();if(!$WK.saved){e.preventDefault();return false}$WK.saveExpression();if(!$WK.expr_saved&&$WK.expression.mode!=="off"){e.preventDefault();alert("Expression is required. Fill in required fields and try again!");return false}return true});$WK.init=function(){$WK.fieldList=$("#f-field-list");$WK.html=wck_fields_html;$WK.fields={};$WK.saved=false;$WK.expr_saved=false;$WK.counter=0;$WK.expression={mode:$("input.expression_type:checked").val()};$WK.loadJSONdata();$WK.showExpressionEditor();$WK.changeAssignType();$("form#post").attr("novalidate","");$WK.buildTooltips("")};$WK.buildTooltips=function(selector){$(selector+"span.wck-field-tip").tipTip({attribute:"title",defaultPosition:"left"})};$WK.changeAssignType=function(){var disabled=$("#assign_type").val()==="1";$("#assign_products, #assign_categories, #assign_tags").prop("disabled",disabled)};$("#assign_type").on("change",$WK.changeAssignType);$WK.preloadMedia=function(id,callback){wp.media.attachment(id).fetch().then(function(){callback(wp.media.attachment(id))});return};$WK.addField=function(type){$WK.counter+=1;var id="wkfield-"+$WK.counter;$("li.welcome",$WK.fieldList).remove();$WK.fieldList.append($("
  • ",{"data-type":type,class:"form-invalid",id:id}).append($WK.html[type].replace("{id}",id)));$WK.buildTooltips("#"+id+" ");return id};$(window).on("beforeunload",function(){if($WK.saved===false){return""}});$WK.saveFields=function(){$WK.fields={};suggest=[];var error=$("li .field",$WK.fieldList).length===0;$("label.error").remove();$WK.saved=false;$("#wck-parameters .defined-fields").html("");$WK.appendGlobalParameters();if(error){alert("Please add at least one field before saving.");return false}$("li .field",$WK.fieldList).each(function(){var $row=$(this);var input_fname=$row.find("input.f-name");var input_ftitle=$row.find("input.f-title");var input_fhint=$row.find("input.f-hint");var input_default_value=$row.find("input.f-default-value");var input_css_class=$row.find("input.f-css-class");var field={type:$row.data("type"),use_expression:$row.data("use-expression")===true,name:input_fname.val(),title:input_ftitle.val(),hint:input_fhint.val(),default_value:input_default_value.val(),css_class:input_css_class.val(),required:$row.find("input.f-required").length>0?$row.find("input.f-required").is(":checked"):true};var input_fprice=$row.find("input.f-price");if(input_fprice.length>0){field.price=input_fprice.val();if(field.price!==""){field.use_expression=true}}var input_fimgwidth=$row.find("input.fimg-width");if(input_fimgwidth.length>0){field.image_size=input_fimgwidth.val()}var $fs_options;switch(field.type){case"select":case"radio":case"imageselect":case"imageswatches":case"colorswatches":case"radiogroup":case"checkboxgroup":field.options_name=[];field.options_title=[];if(field.type==="imageselect"||field.type==="imageswatches"){field.options_image=[]}if(field.type==="checkboxgroup"){field.select_limit=$row.find("input.fcbg-limit").val()}$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var fs_name=$(this).find("input.fs-name");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_name.val()+":"+fs_title.val()}field.options_name.push(fs_name.val()+":"+fs_title.val());field.options_title.push(fs_title.val());if(field.type==="imageselect"||field.type==="imageswatches"){var fs_image=$(this).find("input.fs-image");field.options_image.push(fs_image.val())}});break;case"dropdown":field.options_title=[];$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_title.val()}field.options_title.push(fs_title.val())});break;case"number":var input_fnmin=$row.find("input.fn-min-value");field.min=input_fnmin.val();var input_fnmax=$row.find("input.fn-max-value");field.max=input_fnmax.val();break;case"checkbox":var input_fcb_default_state=$row.find("input.fcb-default-state");field.default_state=input_fcb_default_state.is(":checked");break;case"text":case"textarea":case"email":var input_ftminlen=$row.find("input.ft-min-length");var input_ftmaxlen=$row.find("input.ft-max-length");var input_ftpattern=$row.find("input.ft-pattern");field.min=input_ftminlen.val();field.max=input_ftmaxlen.val();if(input_ftpattern.length>0){field.pattern=input_ftpattern.val()}break;case"colorpicker":case"datepicker":case"rangedatepicker":var input_fdpdisallow_past_date=$row.find("input.fdp-disallow-past-date");field.disallow_past_date=input_fdpdisallow_past_date.is(":checked");break;case"imageupload":field.max_file_size=$row.find("input.fu-max-file-size").val();field.allowed_extensions=$row.find("input.fu-allowed-extensions").val();break;case"html":case"paragraph":case"hidden":case"attachment":field.content=$row.find(".fst-content").val();break;case"link":field.content=$row.find(".fst-content").val();field.target=$row.find(".fst-target").val();break;case"heading":field.content=$row.find(".fst-content").val();field.level=$row.find(".fst-level").val();break}if(field.name!==""&&field.name in $WK.fields){error=true;alert("Field names must be unique! The '"+field.name+"' name is used more than once.")}if(!error){$WK.appendFormulaVars(field)}});var wkform=$("form#post");if(!wkform[0].checkValidity()){error=true;$("input:invalid").parent().show();$("input:invalid").each(function(){$('").insertBefore($(this))})}if(error&&$("label.error").length){$("html, body").animate({scrollTop:$("label.error").first().offset().top-160},1e3)}$WK.saveJSONdata();$WK.saved=!error};$WK.appendGlobalParameters=function(){if(typeof wck_global_parameters!==undefined){$("#wck-parameters .global-parameters").html("");$.each(wck_global_parameters,function(name,value){var name="global:"+name;var appendChildren="";suggest.push(name);if(typeof value==="object"){$.each(value,function(k,v){var suffix="['"+k+"']";console.log(suffix);appendChildren=appendChildren+'"});value=""}else{value=" = "+value}$("#wck-parameters .global-parameters").append('");$("#wck-parameters .global-parameters").append(appendChildren)})}};$WK.appendFormulaVars=function(field){$WK.fields[field.name]=field;if(field.use_expression){if(field.type!=="checkboxgroup"){suggest.push(field.name);$("#wck-parameters .defined-fields").append('")}else{suggest.push(field.name+":sum");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":min");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":max");$("#wck-parameters .defined-fields").append('")}if(field.type==="text"||field.type==="textarea"){suggest.push(field.name+":text");$("#wck-parameters .defined-fields").append('")}if(field.type==="rangedatepicker"){suggest.push(field.name+":date_from");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":date_to");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":days");$("#wck-parameters .defined-fields").append('")}else if(field.type==="datepicker"){suggest.push(field.name+":date");$("#wck-parameters .defined-fields").append('")}else if(field.type==="imageupload"){suggest.push(field.name+":size");$("#wck-parameters .defined-fields").append('")}}};$WK.saveJSONdata=function(){if(Object.keys($WK.fields).length>0){$("input[name=_wck_fieldset]").val(JSON.stringify($WK.fields))}};$WK.loadJSONdata=function(){if(typeof wck_load_fieldset==="object"){$.each(wck_load_fieldset,function(){var field_id=$WK.addField(this.type);var $field=$("#"+field_id+" .field");$("#"+field_id+" .f-name").val(this.name);$("#"+field_id+" .f-title").val(this.title);$("#"+field_id+" .f-hint").val(this.hint);$("#"+field_id+" .f-css-class").val(this.css_class);if($("#"+field_id+" .f-required").length>0){$("#"+field_id+" .f-required").prop("checked",this.required)}var fprice=$("#"+field_id+" .f-price");if(fprice.length>0){fprice.val(this.price)}var fimgwidth=$("#"+field_id+" .fimg-width");if(fimgwidth.length>0){fimgwidth.val(this.image_size)}var options_title,options_name,options_image,default_value,first,$checked;if(this.type==="dropdown"){options_title=this.options_title;default_value=this.default_value;first=true;$checked=null;$.each(options_title,function(i,option_title){if(first){var $first=$field.find(".fs-option");$first.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(["select","radio","imageselect","radiogroup","checkboxgroup","imageswatches","colorswatches"].indexOf(this.type)>=0){options_name=this.options_name;options_title=this.options_title;default_value=this.default_value;if(this.type==="imageselect"||this.type==="imageswatches"){options_image=this.options_image;wp.media.attachment(options_image).fetch()}if(this.type==="checkboxgroup"){$("#"+field_id+" .fcbg-limit").val(this.select_limit)}first=true;$checked=null;$.each(options_name,function(i,option_name){if(option_name.indexOf(":")>=0){option_name=option_name.slice(0,option_name.indexOf(":"))}if(first){var $first=$field.find(".fs-option");$first.find("input.fs-name").val(option_name);$first.find("input.fs-title").val(options_title[i]);var fs_image=$first.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$first.find("a.action-add-image").hide();$first.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$first.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-name").val(option_name);$clone.find("input.fs-title").val(options_title[i]);fs_image=$clone.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$clone.find("a.action-add-image").hide();$clone.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$clone.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(this.type==="number"){$("#"+field_id+" .fn-min-value").val(this.min);$("#"+field_id+" .fn-max-value").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value)}else if(this.type==="checkbox"){$("#"+field_id+" .fcb-default-state").prop("checked",this.default_state)}else if(this.type==="text"||this.type==="textarea"||this.type==="email"){$("#"+field_id+" .ft-min-length").val(this.min);$("#"+field_id+" .ft-max-length").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value);if(this.type==="text"){$("#"+field_id+" .ft-pattern").val(this.pattern)}}else if(this.type==="colorpicker"||this.type==="datepicker"||this.type==="rangedatepicker"){$("#"+field_id+" .fdp-disallow-past-date").prop("checked",this.disallow_past_date)}else if(this.type==="imageupload"){$("#"+field_id+" .fu-max-file-size").val(this.max_file_size);$("#"+field_id+" .fu-allowed-extensions").val(this.allowed_extensions);var ext=this.allowed_extensions.split("|");ext.forEach(function(e){$("#"+field_id+" .allowed-extensions.ext-"+e).prop("checked",true)})}else if(["html","paragraph","heading","hidden","link","attachment"].indexOf(this.type)>=0){$("#"+field_id+" .fst-content").val(this.content);if(this.type==="heading"){$("#"+field_id+" .fst-level").val(this.level)}else if(this.type==="link"){$("#"+field_id+" .fst-target").val(this.target)}else if(this.type==="attachment"){$WK.preloadMedia(this.content,function(attachment){console.log(field_id,attachment.get("url"));$("#"+field_id+" .wp-media-attachment-preview").attr("href",attachment.get("url")).text(attachment.get("url"))})}}});$WK.saveFields()}};$WK.showExpressionEditor=function(){$("div.expression_oneline, div.expression_conditional, div.expression_off, div.expression_addon").hide();$("div.expression_"+$WK.expression.mode).show();if($WK.expression.mode==="off"){$(".off-hide").hide()}else{$(".off-hide").show()}};$("input.expression_type").on("change",function(){$WK.expression.mode=$(this).val();$WK.expressionLastFocusedInput=null;$WK.showExpressionEditor()});$WK.addCondition=function(if_value,then_value,addon=false){var $html=$('
    '+''+''+'
    '+'
    '+''+"
    "+'
    '+''+"
    ");$(".input-if input",$html).val(if_value);$(".input-equation input",$html).val(then_value);if(addon===true){$("div#addon-inputs").append($html)}else{$("div#extra-inputs").append($html)}$WK.autocomplete()};$("button.add-condition").on("click",function(){$WK.addCondition()});$("button.add-addon").on("click",function(){$WK.addCondition("","",true)});$WK.autocomplete=function(){$(".input-icon input").bind("keydown",function(e){if(e.keyCode===16||e.keyCode===219){input_key_pressed[e.keyCode]=true}}).autocomplete({minLength:0,source:function(request,response){if(input_key_pressed[16]===true&&input_key_pressed[219]===true){response(suggest)}},focus:function(){return false},select:function(event,ui){delete input_key_pressed[16];delete input_key_pressed[219];this.value+=ui.item.value+"}";return false}})};$WK.saveExpression=function(){var mode=$WK.expression.mode;$WK.expr_saved=false;if(mode==="oneline"){$WK.expression.expr=$(".expression_oneline input").val();if($WK.expression.expr!==""){$WK.expr_saved=true}}if(mode==="conditional"){var data=[];$(".expression_conditional .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});var input_else=$(".expression_conditional .input-else input").val();data.push({type:"else",if:"true",then:input_else});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="addon"){var data=[];$(".expression_addon .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="off"){$("input[name=_wck_expression]").val("off")}else{$("input[name=_wck_expression]").val(JSON.stringify($WK.expression))}};$WK.loadExpression=function(){if(typeof wck_load_expression==="object"){$WK.expression=wck_load_expression;if($WK.expression.mode==="oneline"){$(".expression_oneline input").val($WK.expression.expr);$("input[name=_wck_choose_expression_type].expression_oneline").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}else if($WK.expression.mode==="conditional"){$.each($WK.expression.expr,function(){if(this.type==="condition"){$WK.addCondition(this.if,this.then)}else if(this.type==="else"){$(".input-else input").val(this.then)}});$("input[name=_wck_choose_expression_type].expression_conditional").prop("checked",true);$WK.showExpressionEditor()}else if($WK.expression.mode==="addon"){$.each($WK.expression.expr,function(){$WK.addCondition(this.if,this.then,true)});$("input[name=_wck_choose_expression_type].expression_addon").prop("checked",true);$WK.showExpressionEditor()}}else{$WK.expression.mode="off";$("input[name=_wck_choose_expression_type].expression_off").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}};$("button.test-expression").on("click",function(){$WK.saveExpression()});$WK.init();$WK.loadExpression();$WK.autocomplete()})})(jQuery); \ No newline at end of file diff --git a/src/FieldsetProduct.php b/src/FieldsetProduct.php index 2ed3194..c4cbfc4 100644 --- a/src/FieldsetProduct.php +++ b/src/FieldsetProduct.php @@ -668,7 +668,6 @@ public function calculate() $this->user_input["day_of_week"] = absint(current_time("w")); $this->user_input["current_hour"] = absint(current_time("G")); $this->user_input["quantity"] = absint($_POST["quantity"]); - var_dump($this->user_input); } else { return Ajax::response('error', __("Select variation options first!", "wc-kalkulator")); } diff --git a/views/admin/expression.php b/views/admin/expression.php index e73322c..a4ec465 100644 --- a/views/admin/expression.php +++ b/views/admin/expression.php @@ -44,28 +44,93 @@ class="expression_type expression_addon"

    -

    - - {product_price} - {product_regular_price} - {product_weight} - {product_width} - {product_height} - {product_length} - {is_user_logged} - {quantity} - {current_month} (1-12) - {day_of_month} (1-31) - {day_of_week} (0-6) - {current_hour} (0-23) - - - Update list -

    + +

    +

    + : + + + +

    +

    + __('Add', 'wc-kalkulator'), + '-' => __('Subtract', 'wc-kalkulator'), + '*' => __('Multiply', 'wc-kalkulator'), + '/' => __('Divide', 'wc-kalkulator'), + '%' => __('Modulus', 'wc-kalkulator'), + '**' => __('Power', 'wc-kalkulator'), + '==' => __('Equal', 'wc-kalkulator'), + '!=' => __('Not equal', 'wc-kalkulator'), + '<' => __('Less than', 'wc-kalkulator'), + '<=' => __('Less or equal', 'wc-kalkulator'), + '>' => __('Grater than', 'wc-kalkulator'), + '>=' => __('Greater or equal', 'wc-kalkulator'), + 'and' => __('Logical and', 'wc-kalkulator'), + 'or' => __('Logical or', 'wc-kalkulator'), + 'not' => __('Logical not', 'wc-kalkulator') + ); + foreach ($operators as $op => $title) { + echo ''; + } + echo ' | Functions: '; + $operators = array( + 'round' => __('round(x, p) - round x with the precision of p', 'wc-kalkulator'), + 'ceil' => __('ceil(x) - round up to the integer number', 'wc-kalkulator'), + 'floor' => __('floor(x) - round down to the integer number', 'wc-kalkulator'), + 'abs' => __('abs(x) - absolute number', 'wc-kalkulator'), + 'max' => __('max(a,b,...) - maximal value', 'wc-kalkulator'), + 'min' => __('min(a,b,...) - minimal value', 'wc-kalkulator'), + 'sqrt' => __('sqrt(x) - square root of x', 'wc-kalkulator'), + 'strlen' => __('strlen(x) - Text length of x', 'wc-kalkulator') + ); + foreach ($operators as $op => $title) { + echo ''; + } + ?>

    From 5e6ef4a5f2f8d0895ec325a50df5f820fcf16419 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Pi=C4=85tkowski?= Date: Wed, 13 Jul 2022 11:57:05 +0200 Subject: [PATCH 04/14] Apply_filters on field's label and content elements --- src/View.php | 14 ++++++++++---- views/fields/front/attachment.php | 2 +- views/fields/front/checkbox.php | 2 +- views/fields/front/checkboxgroup.php | 4 ++-- views/fields/front/colorpicker.php | 4 ++-- views/fields/front/colorswatches.php | 4 ++-- views/fields/front/datepicker.php | 4 ++-- views/fields/front/dropdown.php | 3 ++- views/fields/front/email.php | 4 ++-- views/fields/front/fileupload.php | 4 ++-- views/fields/front/heading.php | 2 +- views/fields/front/html.php | 2 +- views/fields/front/imageselect.php | 4 ++-- views/fields/front/imageupload.php | 4 ++-- views/fields/front/link.php | 2 +- views/fields/front/number.php | 4 ++-- views/fields/front/paragraph.php | 2 +- views/fields/front/radio.php | 4 ++-- views/fields/front/rangedatepicker.php | 4 ++-- views/fields/front/select.php | 4 ++-- views/fields/front/text.php | 4 ++-- views/fields/front/textarea.php | 4 ++-- 22 files changed, 46 insertions(+), 39 deletions(-) diff --git a/src/View.php b/src/View.php index 3bd5df8..0fadd0a 100644 --- a/src/View.php +++ b/src/View.php @@ -30,20 +30,26 @@ public static function render($template, $view = array()) { if (preg_match('/^([a-z0-9_]+\/?)+$/', $template)) { $view = (object)$view; + + // Add field type information to the $view object + if( substr($template, 0, 12) === 'fields/front' ) { + $view->field_type = substr($template, 13); + } + ob_start(); - + $override = self::override_file($template); if (file_exists($override)) { include $override; } else { include Plugin::path() . '/views/' . $template . '.php'; } - + return ob_get_clean(); } return; } - + private static function override_file($template) { /* @@ -51,5 +57,5 @@ private static function override_file($template) */ return get_stylesheet_directory() . '/' . Plugin::NAME . '/' . $template . '.php'; } - + } \ No newline at end of file diff --git a/views/fields/front/attachment.php b/views/fields/front/attachment.php index d9d43ae..70e891e 100644 --- a/views/fields/front/attachment.php +++ b/views/fields/front/attachment.php @@ -4,7 +4,7 @@ } ?> - + ', $view->field_type)); ?> title); ?> \ No newline at end of file diff --git a/views/fields/front/checkbox.php b/views/fields/front/checkbox.php index dad0dba..e718d6e 100644 --- a/views/fields/front/checkbox.php +++ b/views/fields/front/checkbox.php @@ -13,7 +13,7 @@ - + ', $view->field_type)); ?> checked); ?> required); ?>> diff --git a/views/fields/front/checkboxgroup.php b/views/fields/front/checkboxgroup.php index a86c7a5..1a51d32 100644 --- a/views/fields/front/checkboxgroup.php +++ b/views/fields/front/checkboxgroup.php @@ -5,7 +5,7 @@ ?> - + ', $view->field_type)); ?> hint, \WCKalkulator\Sanitizer::allowed_html()); ?> - + ', $view->field_type)); ?> options_name as $i => $opt_name) : ?>
    + +
    +

    {}

    +
    +

    + Close without saving Save & Close +

    + + +
    + diff --git a/views/admin/global_parameters.php b/views/admin/global_parameters.php index f776bc4..edf21ff 100644 --- a/views/admin/global_parameters.php +++ b/views/admin/global_parameters.php @@ -19,7 +19,7 @@

    -

    -

    admin_fields, \WCKalkulator\Sanitizer::allowed_html()); ?> + + +
    + + + + +
    \ No newline at end of file diff --git a/wc-kalkulator.php b/wc-kalkulator.php index 7be42a3..aa6b4f6 100644 --- a/wc-kalkulator.php +++ b/wc-kalkulator.php @@ -3,7 +3,7 @@ /** * Plugin Name: WC Kalkulator * Description: Description: Store Manager can add fieldsets to Products and Orders. WC Kalkulator allows to order and calculate the price of the product based on the values of the fields selected by the Customer. - * Version: 1.3.4 + * Version: 1.4.0 * Author: Krzysztof PiÄ…tkowski * Author URI: https://wckalkulator.com * Text Domain: wc-kalkulator @@ -31,7 +31,7 @@ */ class Plugin { - const VERSION = "1.3.4"; + const VERSION = "1.4.0"; const NAME = "wc-kalkulator"; From 344d818f8f4bc51988921830f9430766e57b9319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Pi=C4=85tkowski?= Date: Fri, 22 Jul 2022 00:58:37 +0200 Subject: [PATCH 13/14] V 1.4.2 --- assets/css/admin.css | 3 +- assets/css/admin.css.map | 2 +- assets/css/admin.min.css | 2 +- assets/css/admin.sass | 3 +- assets/js/admin.js | 56 +- assets/js/admin.min.js | 2 +- assets/js/wckalkulator.js | 12 - assets/js/wckalkulator.min.js | 2 +- docs/.retype/404.html | 10 +- docs/.retype/changelog/index.html | 23 +- docs/.retype/index.html | 10 +- docs/.retype/news/index.html | 23 +- docs/.retype/resources/js/config.js | 2 +- docs/.retype/resources/js/config.min.js | 2 +- docs/.retype/resources/js/search.json | 2 +- docs/.retype/sitemap.xml.gz | Bin 460 -> 482 bytes docs/.retype/usermanual/about/index.html | 10 +- .../usermanual/advanced_usage/index.html | 12 +- .../usermanual/calculation-types/index.html | 10 +- .../usermanual/example-expressions/index.html | 10 +- .../usermanual/expression-syntax/index.html | 10 +- docs/.retype/usermanual/fields/index.html | 12 +- .../usermanual/import_export/index.html | 14 +- .../usermanual/installation/index.html | 10 +- docs/.retype/usermanual/templates/index.html | 33 +- docs/.retype/usermanual/uninstall/index.html | 10 +- docs/.retype/usermanual/usage/index.html | 10 +- docs/.retype/usermanual/videos/index.html | 10 +- docs/changelog.md | 1 + docs/retype.yml | 2 +- languages/wc-kalkulator.pot | 637 ++++++++++++------ readme.md | 5 +- src/FieldsetProduct.php | 5 +- views/admin/expression.php | 8 +- views/admin/fields_editor.php | 2 +- views/admin/global_parameters.php | 4 +- views/admin/pricefilter.php | 4 +- wc-kalkulator.php | 4 +- 38 files changed, 648 insertions(+), 329 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index 567a1af..a2b2ed3 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -399,9 +399,8 @@ } #wck-toolbar { - display: none; position: fixed; - top: 0; + bottom: 0; left: 0; right: 0; z-index: 9999999; diff --git a/assets/css/admin.css.map b/assets/css/admin.css.map index 14f3e71..c661718 100644 --- a/assets/css/admin.css.map +++ b/assets/css/admin.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["admin.sass"],"names":[],"mappings":"AACE;EACE;;AAGA;EACE;;AAIA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAEN;EACE;;AAEA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEA;EACE;EACA;;AAEA;EACE;EACA;EACA;;AACA;EACE;EACA;EACA;;AAEF;EACE;;AAEJ;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEJ;EACE;EACA;;AAGE;EACE;EACA;EACA;;AAEN;EACE;EACA;;AAGE;EACE;;AAEJ;EACE;EACA;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEN;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEF;EACE;EACA;;AAEN;EACE;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;EACE;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;AAAA;AAAA;AAAA;AAAA;EAKE;EACA;EACA;EACA;;AAEF;AAAA;EAEE;EACA;;AAEF;EACE;EACA;EACA;;AAGA;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEN;EACE;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAIA;EACE;;AAIF;EACE;;AAGJ;EACE;;AAEJ;EACE;;AAIE;EACE;;AAEN;EACE;EACA;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGA;EACE;EACA;EACA;;AAEA;EACE;;AAEN;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEA;EACE;;AAEN;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;;AACA;EACE;EACA;EACA;;AACF;EACE;;;AAGN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;AAEA;EACE;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;;AAER;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAbA;EACE;;AAcF;EACE;;AAEF;EACE;;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;EACA;;AACA;EACE;;AACF;EACE;EACA;;AACA;EACE;;AACF;EACE;;AACF;EACE;;AACJ;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;;AACJ;EACE;;AACF;EACE;EACA;EACA;;AACA;EACE;EACA;;AAEF;EACE;;AACJ;EACE;EACA;;AACF;EACE;EACA;EACA;;AACJ;EACE;;AACF;EACE;EACA;EACA","file":"admin.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["admin.sass"],"names":[],"mappings":"AACE;EACE;;AAGA;EACE;;AAIA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAEN;EACE;;AAEA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEA;EACE;EACA;;AAEA;EACE;EACA;EACA;;AACA;EACE;EACA;EACA;;AAEF;EACE;;AAEJ;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEJ;EACE;EACA;;AAGE;EACE;EACA;EACA;;AAEN;EACE;EACA;;AAGE;EACE;;AAEJ;EACE;EACA;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEN;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEF;EACE;EACA;;AAEN;EACE;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;EACE;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;AAAA;AAAA;AAAA;AAAA;EAKE;EACA;EACA;EACA;;AAEF;AAAA;EAEE;EACA;;AAEF;EACE;EACA;EACA;;AAGA;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEN;EACE;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAIA;EACE;;AAIF;EACE;;AAGJ;EACE;;AAEJ;EACE;;AAIE;EACE;;AAEN;EACE;EACA;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGA;EACE;EACA;EACA;;AAEA;EACE;;AAEN;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEA;EACE;;AAEN;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;;AACA;EACE;EACA;EACA;;AACF;EACE;;;AAGN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;AAEA;EACE;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;;AAER;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAbA;EACE;;AAcF;EACE;;AAEF;EACE;;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;EACA;;AACA;EACE;;AACF;EACE;EACA;;AACA;EACE;;AACF;EACE;;AACF;EACE;;AACJ;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;;AACJ;EACE;;AACF;EACE;EACA;EACA;;AACA;EACE;EACA;;AAEF;EACE;;AACJ;EACE;EACA;;AACF;EACE;EACA;EACA;;AACJ;EACE;;AACF;EACE;EACA;EACA","file":"admin.css"} \ No newline at end of file diff --git a/assets/css/admin.min.css b/assets/css/admin.min.css index 91a9c1f..fcc0a45 100644 --- a/assets/css/admin.min.css +++ b/assets/css/admin.min.css @@ -1 +1 @@ -.wc-kalkulator-wrapper html{scroll-padding-top:100px}.wc-kalkulator-wrapper p.add-buttons{line-height:36px}.wc-kalkulator-wrapper a.button.action-add-image{margin-bottom:20px;margin-top:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper a.button.action-add-attachment{margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list{width:100%}.wc-kalkulator-wrapper ul#f-field-list *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list .wck-sortable-placeholder{border:1px dashed #888;background-color:#eee;box-shadow:none;text-align:center;color:#888;padding:22px}.wc-kalkulator-wrapper ul#f-field-list li{box-shadow:0 5px 10px #ccc;margin-bottom:5px}.wc-kalkulator-wrapper ul#f-field-list li .field{border:1px solid #aaa;background-color:#fff}.wc-kalkulator-wrapper ul#f-field-list li .field .header{background-color:#f5f5f5;padding:8px;cursor:move}.wc-kalkulator-wrapper ul#f-field-list li .field .header .text{font-size:14px;color:#000;padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .header .name{padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .body{padding:20px;border-top:1px solid #aaa}.wc-kalkulator-wrapper ul#f-field-list li .field .body .half{float:left;width:50%;padding-left:10px;padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .third{float:left;padding-left:10px;padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .last,.wc-kalkulator-wrapper ul#f-field-list li .field .body .second{padding-left:10px;padding-right:0}.wc-kalkulator-wrapper ul#f-field-list li .field .body .first{padding-right:10px;padding-left:0}.wc-kalkulator-wrapper ul#f-field-list li .field .body .third{width:33%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .fu-allowed-extensions{margin-top:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body label{font-size:12px;margin-bottom:3px;font-weight:700}.wc-kalkulator-wrapper ul#f-field-list li .field .body label.error{background-color:#e30000;color:#fff;padding:6px;margin:6px 0;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair{display:flex;align-items:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair span.dashicons-no-alt{cursor:pointer;font-size:28px;color:red}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs{margin-top:20px;margin-bottom:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .pair:not(:first-child) label{display:none}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs button{margin-right:6px;margin-bottom:6px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer{display:none;margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer textarea{display:block;width:100%;min-height:200px;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column{float:left}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1{width:40%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-half{width:20%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2{width:40%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2-half{text-align:center;width:20%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-2{width:80%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-3{width:10%;padding-left:20px;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-4{width:10%;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .clear{clear:both}.wc-kalkulator-wrapper .input-group .dashicons,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons{padding:3px;margin-left:2px;margin-right:2px;cursor:pointer;color:#555;font-size:16px;line-height:1.5}.wc-kalkulator-wrapper .input-group .dashicons.action-drag,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons.action-drag{cursor:move;font-size:16px;line-height:1.5}.wc-kalkulator-wrapper .input-group .left,.wc-kalkulator-wrapper ul#f-field-list li .field .header .left{float:left}.wc-kalkulator-wrapper .input-group .right,.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{float:right}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]),.wc-kalkulator-wrapper ul#f-field-list li .field .body label{display:block;width:100%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]).inline,.wc-kalkulator-wrapper ul#f-field-list li .field .body label.inline{display:inline;margin-right:10px;width:auto}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.fdp-disallow-past-date,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param[type=checkbox]{margin:10px 15px 14px 3px}.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=number].param,.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=text].param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text]{border:1px solid #aaa;border-radius:0;padding:5px 10px;width:100%;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body select.param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper .clearfix,.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair:after{content:"";display:block;clear:both}.wc-kalkulator-wrapper ul#f-field-list li .header .wck-toggle-colspan,.wc-kalkulator-wrapper ul#f-field-list li .header .wck-toggle-colspan-label{display:none}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col li{width:49.4%;display:inline-block;margin:.25%;vertical-align:top}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col li.wck-layout-colspan{width:99.25%}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col .header .wck-toggle-colspan{display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;margin-top:4px;cursor:pointer}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col .header .wck-toggle-colspan-label{display:block;line-height:2.2em;font-size:12px;padding-right:6px}.wc-kalkulator-wrapper .pr-20{padding-right:20px}.wc-kalkulator-wrapper .input-icon{position:relative;font-family:monospace;width:100%;margin:10px 0 15px}.wc-kalkulator-wrapper .input-icon i{font-family:monospace;font-size:13px;position:absolute;display:block;top:11px;pointer-events:none;width:50px;text-align:right;font-style:normal;color:#00f}.wc-kalkulator-wrapper .input-icon input{border:1px solid #aaa;border-radius:0;padding:5px 10px 5px 55px;width:100%}.wc-kalkulator-wrapper .input-if i::after{content:"if"}.wc-kalkulator-wrapper .input-equation i::after{content:"price"}.wc-kalkulator-wrapper .input-stock i::after{content:"qty * "}.wc-kalkulator-wrapper #addon-inputs .input-equation i::after{content:"add"}.wc-kalkulator-wrapper .input-else i::after{content:"else"}.wc-kalkulator-wrapper .input-group{padding:8px;background-color:#eee;margin-bottom:5px}.wc-kalkulator-wrapper .ui-autocomplete-loading{background-image:none!important}.wc-kalkulator-wrapper .wc-category-search,.wc-kalkulator-wrapper .wc-enhanced-select,.wc-kalkulator-wrapper .wc-page-search,.wc-kalkulator-wrapper .wc-product-search{width:100%}.wc-kalkulator-wrapper button.add-operator{margin-right:3px}.wc-kalkulator-wrapper span.formula-field{padding-left:6px;cursor:pointer;font-weight:700}.wc-kalkulator-wrapper span.formula-field:hover{text-decoration:underline}.wc-kalkulator-wrapper .wp-media-image-preview{max-width:80px;max-height:80px;cursor:pointer}.wc-kalkulator-wrapper .wp-media-image-preview:hover{transform:scale(1.2);-moz-transform:scale(1.2);-webkit-transform:scale(1.2)}.wc-kalkulator-wrapper select.param{margin-bottom:20px}.wc-kalkulator-wrapper .iris-picker{position:absolute;z-index:9999}.wc-kalkulator-wrapper .fields-section{text-align:center;padding:50px;margin:0 auto;max-width:500px}.wc-kalkulator-wrapper .fields-section button,.wc-kalkulator-wrapper .fields-section select{font-size:16px}.wc-kalkulator-wrapper .fields-section select{width:300px;padding:5px 10px}.wc-kalkulator-wrapper .fields-section button{width:50px;padding:3px 8px}.wc-kalkulator-wrapper .fields-section button span{line-height:2}.wc-kalkulator-wrapper hr{margin:35px 0}#wck-toolbar,.wc-kalkulator-wrapper .align-right{text-align:right}.wc-kalkulator-wrapper .wck-toggle-expand,.wc-kalkulator-wrapper .wck-toggle-layout{cursor:pointer}.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{opacity:0}#wck-cv-builder .builder .and-condition:hover .cv-remove,.wc-kalkulator-wrapper ul#f-field-list li .field:hover .header .right{opacity:1}.wc-kalkulator-wrapper #wck_expression .wck-sortable-placeholder{border:1px dashed #888;background-color:#eee;box-shadow:none;text-align:center;color:#888;height:60px;margin-bottom:3px}.wc-kalkulator-wrapper #wck_expression .input-group .input-equation,.wc-kalkulator-wrapper #wck_expression .input-group .input-if{float:left;width:46%;margin:0 .5%}.wc-kalkulator-wrapper #wck_expression .input-group .input-buttons{float:left;width:2.5%;padding-top:5px}.wc-kalkulator-wrapper .inventory label{font-size:15px;margin:55px 0 10px;border-top:1px solid #c3c4c7;display:block;border-bottom:1px solid #c3c4c7;padding:10px 0 10px 5px}.wc-kalkulator-wrapper .cv-container{position:relative}.wc-kalkulator-wrapper .cv-container .action-field-visibility{position:absolute;right:5px;top:5px}.wc-kalkulator-wrapper .cv-container .visibility-readable{background-color:#fff}#postbox-container-2.fullscreen{position:fixed;z-index:999999;left:0;top:0;right:0;bottom:0;margin:0;background-color:#fff;overflow-y:scroll}#postbox-container-2.fullscreen #advanced-sortables,#postbox-container-2.fullscreen #normal-sortables{padding:20px}#wck-toolbar{display:none;position:fixed;top:0;left:0;right:0;z-index:9999999;background:#f5f5f5;border-top:1px solid #aaa;padding:10px 20px;box-shadow:0 0 45px #000}#wck-toolbar .wck-toggle-fullscreen{cursor:pointer}#wck-toolbar ul{margin:0}#wck-toolbar ul li{margin-bottom:0;display:inline-block}#wck-toolbar ul li,#wck-toolbar ul li li>*{vertical-align:middle}#wck-toolbar ul li.space{width:10px}#wck-expression-toolbar{display:none;position:absolute;top:0;border:1px solid #888;border-radius:5px;box-shadow:0 0 50px rgba(0,0,0,.5);padding:10px 20px;background-color:#fff;margin:0;width:360px;vertical-align:middle;text-align:justify;tab-index:0}#wck-expression-toolbar *{tab-index:0}#wck-expression-toolbar .button{margin-bottom:6px}#wck-expression-toolbar select{width:270px}#wck-cv-builder{overflow:none;display:none;border-radius:3px;position:fixed;z-index:99999999;top:150px;left:50%;margin-left:-500px;bottom:150px;width:1000px;background-color:#fff;box-shadow:0 0 200px 100px rgba(0,0,0,.4);flex-direction:column}#wck-cv-builder .template{display:none;visibility:hidden}#wck-cv-builder .builder{flex-basis:100%;margin:20px 40px 0 5px;overflow-y:auto}#wck-cv-builder .builder .or-group{width:100%}#wck-cv-builder .builder .and-condition{display:flex;gap:3px;margin-bottom:3px}#wck-cv-builder .builder .and-condition .validation-error{border-color:red}#wck-cv-builder .builder .and-condition button{margin-bottom:3px}#wck-cv-builder .builder .and-condition .p-value{flex-grow:2}#wck-cv-builder .builder .or-condition{display:flex;flex-direction:row;align-content:stretch;gap:3px;flex-wrap:wrap}#wck-cv-builder .builder .or-condition:not(:first-child)::before{content:"OR";flex-basis:100%;display:block;font-weight:700;padding:10px;margin-left:25px}#wck-cv-builder .builder .and-group{flex-grow:4}#wck-cv-builder .builder .cv-remove{text-decoration:none;opacity:0;padding:5px}#wck-cv-builder .builder .cv-remove span{font-size:14px;line-height:1}#wck-cv-builder .builder .cv-action-and{align-self:end;margin-bottom:3px}#wck-cv-builder .builder .cv-action-or{display:block;margin-top:10px;margin-left:33px}#wck-cv-builder h1{padding:40px 40px 0}#wck-cv-builder p.save{padding:10px 20px 0;text-align:right;border-top:1px solid #ccc} \ No newline at end of file +.wc-kalkulator-wrapper html{scroll-padding-top:100px}.wc-kalkulator-wrapper p.add-buttons{line-height:36px}.wc-kalkulator-wrapper a.button.action-add-image{margin-bottom:20px;margin-top:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper a.button.action-add-attachment{margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list{width:100%}.wc-kalkulator-wrapper ul#f-field-list *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list .wck-sortable-placeholder{border:1px dashed #888;background-color:#eee;box-shadow:none;text-align:center;color:#888;padding:22px}.wc-kalkulator-wrapper ul#f-field-list li{box-shadow:0 5px 10px #ccc;margin-bottom:5px}.wc-kalkulator-wrapper ul#f-field-list li .field{border:1px solid #aaa;background-color:#fff}.wc-kalkulator-wrapper ul#f-field-list li .field .header{background-color:#f5f5f5;padding:8px;cursor:move}.wc-kalkulator-wrapper ul#f-field-list li .field .header .text{font-size:14px;color:#000;padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .header .name{padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .body{padding:20px;border-top:1px solid #aaa}.wc-kalkulator-wrapper ul#f-field-list li .field .body .half{float:left;width:50%;padding-left:10px;padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .third{float:left;padding-left:10px;padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .last,.wc-kalkulator-wrapper ul#f-field-list li .field .body .second{padding-left:10px;padding-right:0}.wc-kalkulator-wrapper ul#f-field-list li .field .body .first{padding-right:10px;padding-left:0}.wc-kalkulator-wrapper ul#f-field-list li .field .body .third{width:33%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .fu-allowed-extensions{margin-top:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body label{font-size:12px;margin-bottom:3px;font-weight:700}.wc-kalkulator-wrapper ul#f-field-list li .field .body label.error{background-color:#e30000;color:#fff;padding:6px;margin:6px 0;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair{display:flex;align-items:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair span.dashicons-no-alt{cursor:pointer;font-size:28px;color:red}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs{margin-top:20px;margin-bottom:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .pair:not(:first-child) label{display:none}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs button{margin-right:6px;margin-bottom:6px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer{display:none;margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer textarea{display:block;width:100%;min-height:200px;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column{float:left}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1{width:40%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-half{width:20%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2{width:40%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2-half{text-align:center;width:20%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-2{width:80%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-3{width:10%;padding-left:20px;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-4{width:10%;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .clear{clear:both}.wc-kalkulator-wrapper .input-group .dashicons,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons{padding:3px;margin-left:2px;margin-right:2px;cursor:pointer;color:#555;font-size:16px;line-height:1.5}.wc-kalkulator-wrapper .input-group .dashicons.action-drag,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons.action-drag{cursor:move;font-size:16px;line-height:1.5}.wc-kalkulator-wrapper .input-group .left,.wc-kalkulator-wrapper ul#f-field-list li .field .header .left{float:left}.wc-kalkulator-wrapper .input-group .right,.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{float:right}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]),.wc-kalkulator-wrapper ul#f-field-list li .field .body label{display:block;width:100%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]).inline,.wc-kalkulator-wrapper ul#f-field-list li .field .body label.inline{display:inline;margin-right:10px;width:auto}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.fdp-disallow-past-date,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param[type=checkbox]{margin:10px 15px 14px 3px}.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=number].param,.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=text].param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text]{border:1px solid #aaa;border-radius:0;padding:5px 10px;width:100%;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body select.param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper .clearfix,.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair:after{content:"";display:block;clear:both}.wc-kalkulator-wrapper ul#f-field-list li .header .wck-toggle-colspan,.wc-kalkulator-wrapper ul#f-field-list li .header .wck-toggle-colspan-label{display:none}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col li{width:49.4%;display:inline-block;margin:.25%;vertical-align:top}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col li.wck-layout-colspan{width:99.25%}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col .header .wck-toggle-colspan{display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;margin-top:4px;cursor:pointer}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col .header .wck-toggle-colspan-label{display:block;line-height:2.2em;font-size:12px;padding-right:6px}.wc-kalkulator-wrapper .pr-20{padding-right:20px}.wc-kalkulator-wrapper .input-icon{position:relative;font-family:monospace;width:100%;margin:10px 0 15px}.wc-kalkulator-wrapper .input-icon i{font-family:monospace;font-size:13px;position:absolute;display:block;top:11px;pointer-events:none;width:50px;text-align:right;font-style:normal;color:#00f}.wc-kalkulator-wrapper .input-icon input{border:1px solid #aaa;border-radius:0;padding:5px 10px 5px 55px;width:100%}.wc-kalkulator-wrapper .input-if i::after{content:"if"}.wc-kalkulator-wrapper .input-equation i::after{content:"price"}.wc-kalkulator-wrapper .input-stock i::after{content:"qty * "}.wc-kalkulator-wrapper #addon-inputs .input-equation i::after{content:"add"}.wc-kalkulator-wrapper .input-else i::after{content:"else"}.wc-kalkulator-wrapper .input-group{padding:8px;background-color:#eee;margin-bottom:5px}.wc-kalkulator-wrapper .ui-autocomplete-loading{background-image:none!important}.wc-kalkulator-wrapper .wc-category-search,.wc-kalkulator-wrapper .wc-enhanced-select,.wc-kalkulator-wrapper .wc-page-search,.wc-kalkulator-wrapper .wc-product-search{width:100%}.wc-kalkulator-wrapper button.add-operator{margin-right:3px}.wc-kalkulator-wrapper span.formula-field{padding-left:6px;cursor:pointer;font-weight:700}.wc-kalkulator-wrapper span.formula-field:hover{text-decoration:underline}.wc-kalkulator-wrapper .wp-media-image-preview{max-width:80px;max-height:80px;cursor:pointer}.wc-kalkulator-wrapper .wp-media-image-preview:hover{transform:scale(1.2);-moz-transform:scale(1.2);-webkit-transform:scale(1.2)}.wc-kalkulator-wrapper select.param{margin-bottom:20px}.wc-kalkulator-wrapper .iris-picker{position:absolute;z-index:9999}.wc-kalkulator-wrapper .fields-section{text-align:center;padding:50px;margin:0 auto;max-width:500px}.wc-kalkulator-wrapper .fields-section button,.wc-kalkulator-wrapper .fields-section select{font-size:16px}.wc-kalkulator-wrapper .fields-section select{width:300px;padding:5px 10px}.wc-kalkulator-wrapper .fields-section button{width:50px;padding:3px 8px}.wc-kalkulator-wrapper .fields-section button span{line-height:2}.wc-kalkulator-wrapper hr{margin:35px 0}#wck-toolbar,.wc-kalkulator-wrapper .align-right{text-align:right}.wc-kalkulator-wrapper .wck-toggle-expand,.wc-kalkulator-wrapper .wck-toggle-layout{cursor:pointer}.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{opacity:0}#wck-cv-builder .builder .and-condition:hover .cv-remove,.wc-kalkulator-wrapper ul#f-field-list li .field:hover .header .right{opacity:1}.wc-kalkulator-wrapper #wck_expression .wck-sortable-placeholder{border:1px dashed #888;background-color:#eee;box-shadow:none;text-align:center;color:#888;height:60px;margin-bottom:3px}.wc-kalkulator-wrapper #wck_expression .input-group .input-equation,.wc-kalkulator-wrapper #wck_expression .input-group .input-if{float:left;width:46%;margin:0 .5%}.wc-kalkulator-wrapper #wck_expression .input-group .input-buttons{float:left;width:2.5%;padding-top:5px}.wc-kalkulator-wrapper .inventory label{font-size:15px;margin:55px 0 10px;border-top:1px solid #c3c4c7;display:block;border-bottom:1px solid #c3c4c7;padding:10px 0 10px 5px}.wc-kalkulator-wrapper .cv-container{position:relative}.wc-kalkulator-wrapper .cv-container .action-field-visibility{position:absolute;right:5px;top:5px}.wc-kalkulator-wrapper .cv-container .visibility-readable{background-color:#fff}#postbox-container-2.fullscreen{position:fixed;z-index:999999;left:0;top:0;right:0;bottom:0;margin:0;background-color:#fff;overflow-y:scroll}#postbox-container-2.fullscreen #advanced-sortables,#postbox-container-2.fullscreen #normal-sortables{padding:20px}#wck-toolbar{position:fixed;bottom:0;left:0;right:0;z-index:9999999;background:#f5f5f5;border-top:1px solid #aaa;padding:10px 20px;box-shadow:0 0 45px #000}#wck-toolbar .wck-toggle-fullscreen{cursor:pointer}#wck-toolbar ul{margin:0}#wck-toolbar ul li{margin-bottom:0;display:inline-block}#wck-toolbar ul li,#wck-toolbar ul li li>*{vertical-align:middle}#wck-toolbar ul li.space{width:10px}#wck-expression-toolbar{display:none;position:absolute;top:0;border:1px solid #888;border-radius:5px;box-shadow:0 0 50px rgba(0,0,0,.5);padding:10px 20px;background-color:#fff;margin:0;width:360px;vertical-align:middle;text-align:justify;tab-index:0}#wck-expression-toolbar *{tab-index:0}#wck-expression-toolbar .button{margin-bottom:6px}#wck-expression-toolbar select{width:270px}#wck-cv-builder{overflow:none;display:none;border-radius:3px;position:fixed;z-index:99999999;top:150px;left:50%;margin-left:-500px;bottom:150px;width:1000px;background-color:#fff;box-shadow:0 0 200px 100px rgba(0,0,0,.4);flex-direction:column}#wck-cv-builder .template{display:none;visibility:hidden}#wck-cv-builder .builder{flex-basis:100%;margin:20px 40px 0 5px;overflow-y:auto}#wck-cv-builder .builder .or-group{width:100%}#wck-cv-builder .builder .and-condition{display:flex;gap:3px;margin-bottom:3px}#wck-cv-builder .builder .and-condition .validation-error{border-color:red}#wck-cv-builder .builder .and-condition button{margin-bottom:3px}#wck-cv-builder .builder .and-condition .p-value{flex-grow:2}#wck-cv-builder .builder .or-condition{display:flex;flex-direction:row;align-content:stretch;gap:3px;flex-wrap:wrap}#wck-cv-builder .builder .or-condition:not(:first-child)::before{content:"OR";flex-basis:100%;display:block;font-weight:700;padding:10px;margin-left:25px}#wck-cv-builder .builder .and-group{flex-grow:4}#wck-cv-builder .builder .cv-remove{text-decoration:none;opacity:0;padding:5px}#wck-cv-builder .builder .cv-remove span{font-size:14px;line-height:1}#wck-cv-builder .builder .cv-action-and{align-self:end;margin-bottom:3px}#wck-cv-builder .builder .cv-action-or{display:block;margin-top:10px;margin-left:33px}#wck-cv-builder h1{padding:40px 40px 0}#wck-cv-builder p.save{padding:10px 20px 0;text-align:right;border-top:1px solid #ccc} \ No newline at end of file diff --git a/assets/css/admin.sass b/assets/css/admin.sass index 7f6dac6..32532f9 100644 --- a/assets/css/admin.sass +++ b/assets/css/admin.sass @@ -414,9 +414,8 @@ padding: 20px #wck-toolbar - display: none position: fixed - top: 0 + bottom: 0 left: 0 right: 0 z-index: 9999999 diff --git a/assets/js/admin.js b/assets/js/admin.js index 6e74c08..4e057d8 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -317,6 +317,42 @@ ext.push($(this).data('extension')); }); $(field_id + " input.fu-allowed-extensions").val(ext.join('|')); + }).on('change', 'input.f-name', function () { + var target = $(this); + var newName = $(this).val().trim(); + if (newName !== "") { + $("#wck_fields_editor input.f-name").each(function () { + if ($(this).val() === newName && !$(this).is(target)) { + alert("The name {" + newName + "} is already in use! Choose another name."); + target.val(""); + return false; + } + }); + } + + if ($(this)[0].checkValidity() && typeof $(this).data('lastValid') !== "undefined") { + var oldName = $(this).data('lastValid'); + if (oldName !== newName) { + var oldNameInUse = false; + $("#wck_expression input[type=text], #wck_fields_editor input.f-visibility, #wck_fields_editor input.f-visibility-readable, #wck_fields_editor input.visibility-readable").each(function () { + if ($(this).val().includes(oldName)) { + oldNameInUse = true; + return false; //break + } + }); + if (oldNameInUse && confirm("Wait! Seems like {" + oldName + "} is used in formulas! Do you want to replace {" + oldName + "} in all formulas? {" + oldName + "} will be changed to {" + newName + "}")) { + $("#wck_expression input[type=text], #wck_fields_editor input.f-visibility, #wck_fields_editor input.f-visibility-readable, #wck_fields_editor input.visibility-readable").each(function () { + $(this).val($(this).val().replaceAll("{" + oldName + "}", "{" + newName + "}").replaceAll("{" + oldName + ":", "{" + newName + ":").replaceAll('"field":"' + oldName + '"', '"field":"' + newName + '"')); + }); + $(this).data('lastValid', newName); + } + } + } + + }).on('focusin', 'input.f-name', function () { + if ($(this)[0].checkValidity()) { + $(this).data('lastValid', $(this).val()); + } }); $(".iris-square-value").on("click", function (e) { @@ -405,7 +441,7 @@ "id": id }).append($WK.html[type].replace("{id}", id))); $WK.buildTooltips("#" + id + " "); - if( $("#" + id).find(".pairs").length > 0) { + if ($("#" + id).find(".pairs").length > 0) { $("#" + id + " .pairs").sortable({ placeholder: "wck-sortable-placeholder", tolerance: "pointer" @@ -603,7 +639,7 @@ var wkform = $("form#post"); if (!wkform[0].checkValidity()) { error = true; - $("input:invalid").parent().show(); + $("input:invalid").closest('.field').find('.action-toggle.dashicons-arrow-down-alt2').trigger('click'); $("input:invalid").each(function () { $('").insertBefore($(this)); }); @@ -1037,11 +1073,23 @@ $WK.saveExpression(); }); + $WK.toolbarOnTop = false; + $(window).scroll(function () { if ($(this).scrollTop() > 100) { - $("#wck-toolbar").fadeIn(); + if (!$WK.toolbarOnTop) { + $("#wck-toolbar").fadeOut(function () { + $WK.toolbarOnTop = true; + $("#wck-toolbar").css({"top": "0px", "bottom": "auto"}).fadeIn(); + }); + } } else if (!$("#postbox-container-2").hasClass("fullscreen")) { - $("#wck-toolbar").fadeOut(); + if ($WK.toolbarOnTop) { + $("#wck-toolbar").fadeOut(function () { + $WK.toolbarOnTop = false; + $("#wck-toolbar").css({"top": "auto", "bottom": "0px"}).fadeIn(); + }); + } } }); diff --git a/assets/js/admin.min.js b/assets/js/admin.min.js index 71f9015..afad6b6 100644 --- a/assets/js/admin.min.js +++ b/assets/js/admin.min.js @@ -1 +1 @@ -(function($){"use strict";var $WK={};var $CV={};$(document).ready(function($){var suggest=[];var input_key_pressed={};$("#f-field-list").sortable({handle:".header",placeholder:"wck-sortable-placeholder",tolerance:"pointer"});$("#extra-inputs, #addon-inputs").sortable({handle:".action-drag",placeholder:"wck-sortable-placeholder",tolerance:"pointer"});$('').insertBefore("#wpwrap");$WK.colorpicker=$("input.wck-global-color-picker");$WK.colorpicker.iris();$WK.expressionLastFocusedInput=null;$WK.wpMediaFrame=null;$WK.wpMediaTarget=null;$WK.iconPreloader="data:image/gif;base64,R0lGODlhEAAQAPUVAHt7e729vf///4R7e+/v762trZSUlKWlpZycnPf39+bm5t7e3tbW1s7OzoSEhMXFxc7FzpSMjJyUlP/397WtraWlnM7FxbW1tb21tebe3tbOzqWcnIyEhHNzc3tzc4yMjK2lpbWttcW9vffv76Wtpa2lra2tpb21vcXFzt7e1qWlrdbe1pScnO/v5gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBwAVACwAAAAAEAAQAEAGt8CKsGLZfDyez8YyrAAekAdA09R0GoLGE8BgLDQIhwORSSQIDqYxELhcCoXDARHeCBmRSGOh6BMICxIRDBUOAQ0NBiBNIBsTAgscGwgPDxcABYgFHnQSSkMFAAYHcAgRHQVNQgUDmX0NFA6pQxsGC7d9Cn8ECRt2GwddDwMgiCAOC2YYGwCIWlRDGgACAgkADhiVEYtDIAMGAQYcUmxtHwDXc3QdDxV4DhRucHIIAIOqRRxIkkxDQQAh+QQFBwAQACwAAAAAEAAQAAAGr0CIEGLZfDyez8YybBYAh8diYSkMCk1G5PNgrKYKBcMQYQg3hgZjDQ4TEBvIA/BoNCySgQMBIRAUDkVRDQEDIHYgDgx+FxsOFw8PBiBNIAgJCQscAAGRABpNGgCYBACcAQGfoaMJpQ4hqB+UQyAbAgKaGwgXF08FdgUdF7cBG3O8vQ6meypiAw8QRr0FBwcI1wgHDnEQWg4H1NbXBgBlTh4G2dYfHVhNQkUcSBxLTUEAIfkECQcAEAAsAQABAA4ADgAABnBAiFAYYDAeoKEy0GgYF4uG8vN4NJ9QxTBQfQgHQoViMUAEAhiAMqygFM6ftZBAYFzu8jlBcb/kISN0IAUFHHIICQkMBoQHHkoOGYkXHgUkBwdKCgIJBA4QDpgHCAgGFwICE5lfpKQGRQsIch+tBmtBACH5BAUHABQALAEAAQAOAA4AAAaaQAqlAEBcHo3AAVAQMiKO4wPSaDAsnwhj8wkEHuAqg7EwbAAXbyAyGBgaiwVjILlcQgBQFTSALwoHdh8gQkIgEgoKDQWMABqFFBoAiQsHjB6PhZKJChUHBw6EhSAIBAQMBp8IHgVVBQ4UphceBwi2AwAOBwoJBAoOGw62CG8CEwnIGxtPRRIBAtAJCghaQgUdHwYMAgsXDk0UQQAh+QQFBwAQACwBAAEADgAOAAAGcECIECIpBB4XxHBZuASOD5RoyblYn49HYyv0FL4XCECoZTTGhwJoSWYwQIjDwcEWMhYP+cFThywWDAiCfX5/gkp9CgoNH4IGiQoFEHEFDxt0GwsECgtCAxAECQIJpASmiBAeDQKjpQsSbAMYC6QMbEEAIfkEBQcAEAAsAQABAA4ADgAABnZAiNAjOVwCBaFSCDgUCpdjAMNZHpzQU0D0eESEVycHAIgEuo8yAgHxLAGBRkO4Xi7lIoSBbRcyGA0SCB99fn8GD3N9EgsLDxwEAhkOdg2NBQAjAgIKSggMCo0DEAcTCacjBAQKrEsICqeqqwx9DhgMqgwUo0JBACH5BAkHAAAALAEAAQAOAA4AAAVjICACEVIUhzGuyHGc10WtANK+RRwEo92ulx0PIKnRAJfHY2MIGAbHiBLTEDSOogfkkRAIoMdG47EQTDZYcQCTSBwHDwbj4AC0MwgAVLOQi9AEgQqDC4UqIwuChFdHFBqDjCMhACH5BAUHABMALAEAAQAOAA4AAAaTwMmk0PlIDgeEwVMQMiIAA2KKLBwGEcbGkZwiqoULZzNgEC4IBwDAKYQvgIBA8OiAGg0Q4I1YzA8gQkIgHwEBIQmJAxqCExoehgEEioyCGgAPDwELiQiBgiAGmRgXBAQMDgV4BQMiDRAHDgqmEwgDAwYQeBYAGwgECsELCwzFDQYbTxIMwsMMDxFZQqyqww8He0JBACH5BAUHAAMALAEAAQAOAA4AAAZzwIEQYBggEIaPcGlUKBqG4xGw3CQEgkAUcTiYhA7CVcHskgqeSyKRcTA9h0LBwFhvmEJO6FIi+PFLF4IKflR4HgGCDH+AHwEBBQNOGngAGA8BCAMLTgMSSw+hIksKC6YMDA0NoRFMDaepDQGAAyAPqLNMQQAh+QQFBwAYACwBAAEADgAOAAAFZSAmOtciMGKaSlgivAGrIm0yCY2B7KlCJJiDQ7RDHEQEgiplPGKStGXwUFFYAVJMoXBYWLPabcMqW14uh8JigRksKWfJgLHOYQCRgP4ikiwYDA0ND4R6SxaBDRCEfEtYAYIXUSIhACH5BAkHABAALAEAAQAOAA4AAAZyQIhQyEgkFhjHcLggGBMCAcOzbBEII6PAeBhABgsFYbGBOA6iwgEBKSgUjKXQwEJ8Gm/5EMFf+PVCfAgMf4AHhw8LcXpnayAMDA96IAUFQg0MDZIAQheVBVQQDaMPDwEBF6kcQx8ipaaoBUpyGxemlktBACH5BAUHABAALAEAAQAOAA4AAAaRQAikMCg0CATGxVEQMiIGhgJJSCQUiAhjI1F4p1Vr4rAZLBYKBsLh2CgEggSgcG44QI0GyAFJED4PKQsSIEJCewEBUQwMABqGEBodHwgSDYyOkJIInAF5BoWGe5wIB3kBc3kFHgcHWQAPsQEfAAAcBa0HHhsGsokXBcEHbU8fF78XwMNaQgUACAUBFwcGHk0QQQA7";$WK.fieldsLayout="one-col";$WK.toggleButton=function(btn,e){e.preventDefault();if(btn.hasClass("woocommerce-input-toggle--disabled")){btn.removeClass("woocommerce-input-toggle--disabled").addClass("woocommerce-input-toggle--enabled");return true}else{btn.removeClass("woocommerce-input-toggle--enabled").addClass("woocommerce-input-toggle--disabled");return false}return false};$WK.fullscreenMode=function(state){if(state){$("body").css("overflow","hidden");$("#postbox-container-2").addClass("fullscreen")}else{$("body").css("overflow","auto");$("#postbox-container-2").removeClass("fullscreen")}};$(".wck-toggle-layout").on("click",function(e){var state=$WK.toggleButton($(this),e);$WK.fieldsLayout=state?"two-col":"one-col";$WK.updateLayout()});$(".wck-toggle-fullscreen").on("click",function(e){var state=$WK.toggleButton($(this),e);$WK.fullscreenMode(state)});$(".wck-toggle-expand").on("click",function(e){var state=$WK.toggleButton($(this),e);$(".action-toggle.dashicons-arrow-"+(state?"down":"up")+"-alt2").trigger("click")});$("body").on("click",".wck-toggle-colspan",function(e){e.preventDefault();var item=$(this).parent().parent().parent();if($(this).hasClass("woocommerce-input-toggle--disabled")){$(this).removeClass("woocommerce-input-toggle--disabled").addClass("woocommerce-input-toggle--enabled");item.addClass("wck-layout-colspan");item.find(".f-colspan").val(2)}else{$(this).removeClass("woocommerce-input-toggle--enabled").addClass("woocommerce-input-toggle--disabled");item.removeClass("wck-layout-colspan");item.find(".f-colspan").val(1)}});$(".action-save-post").on("click",function(e){e.preventDefault();$("#publish").trigger("click");if($("#publish").hasClass("disabled")){$(this).prop("disabled",true).addClass("disabled")}});$("body").on("click",".action-duplicate",function(e){e.preventDefault();var element=$(this).parent().parent().parent();var clonedElement=element.clone();clonedElement.hide();clonedElement.find(".f-title").val("");clonedElement.find(".f-name").val("");clonedElement.insertAfter(element);clonedElement.fadeIn(1500,function(){clonedElement.find(".dashicons-arrow-down-alt2").trigger("click");$(this).find(".f-title").fadeOut(150).fadeIn(150).fadeOut(150).fadeIn(150).fadeOut(150).fadeIn(150);$(this).find(".f-name").fadeOut(150).fadeIn(150).fadeOut(150).fadeIn(150).fadeOut(150).fadeIn(150)})});$WK.shouldHideExprToolbar=false;$WK.stateExprToolbar=false;$("body").on("focusin","#wck_expression .input-icon input",function(e){$WK.expressionLastFocusedInput=$(this);$WK.shouldHideExprToolbar=false;var posA=$(this).offset();var h=$(this).outerHeight();var posB=$("#wck_expression").offset();$("#wck-expression-toolbar").css({top:posA.top-posB.top-h-$("#wck-expression-toolbar").outerHeight()-20,left:posA.left-posB.left});if(!$WK.stateExprToolbar){$WK.stateExprToolbar=true;$WK.saveFields();$("#wck-parameters .first-selected").prop("selected",true);$("#wck-expression-toolbar").stop(true,false).fadeIn("fast")}}).on("focusout","#wck_expression input",function(e){$WK.shouldHideExprToolbar=!(e.relatedTarget&&$("#wck-expression-toolbar").has(e.relatedTarget).length);setTimeout(function(){if($WK.stateExprToolbar&&$WK.shouldHideExprToolbar){$("#wck-expression-toolbar").stop(true,false).fadeOut("fast");$WK.stateExprToolbar=false}},200)}).on("click","#wck-expression-toolbar",function(e){if(e.target!==e.currentTarget&&e.target.tagName!=="OPTION")return;$WK.expressionLastFocusedInput.focus()}).on("click","button.add-field-to-formula, button.add-operator",function(e){e.preventDefault();var $focused=$WK.expressionLastFocusedInput;if(!$focused){$focused=$(".input-icon").find("input:visible").first();$focused.focus()}if($focused&&$focused.length){var value=$(this).hasClass("add-operator")?$(this).val():$("#wck-parameters").val();if(value===null){return}var cursorPos=$focused[0].selectionStart;var x=$focused.val();$focused.val(x.slice(0,cursorPos)+value+x.slice(cursorPos));$focused.focus();cursorPos+=value.length;$focused[0].setSelectionRange(cursorPos,cursorPos)}}).on("click",".field .pairs .action-add",function(){var $clone=$(this).prev(".pair").clone().insertBefore($(this));$clone.find("input").val("")}).on("click",".field .pairs .action-showimport",function(){$(this).parent().find("div.importer").toggle()}).on("click",".field .pairs .action-import",function(){var $this=$(this);var input=$this.parent().find("textarea").val().trim().split("\n");if(Array.isArray(input)){input.forEach(function(el){var columns=el.trim().split(";");var $last_pair=$this.parent().parent().find(".pair").last();var $clone=$last_pair.clone().insertAfter($last_pair);if(columns.length===2){$clone.find("input.fs-name").val(columns[0]);$clone.find("input.fs-title").val(columns[1])}else if(columns.length===1){$clone.find("input.fs-title").val(columns[0])}})}}).on("click",".field .pairs .action-removeall",function(){if(confirm("Are you sure?")){$(this).parent().find(".pair").slice(1).remove()}}).on("click",".field .pair .action-delete",function(){var $pairs=$(this).closest(".pairs");if($pairs.children(".pair").length>1){if(confirm("Are you sure?")){$(this).closest(".pair").remove()}}else{alert("You cannot remove the last item!")}}).on("click",".field .header .action-delete",function(){if(confirm("Are you sure?")){var $target=$(this).closest("li");$target.fadeOut("slow",function(){$target.remove()})}}).on("click",".field .header .action-toggle",function(){var fieldBody=$(this).closest(".field").find(".body");fieldBody.slideToggle(300);$(this).toggleClass("dashicons-arrow-up-alt2");$(this).toggleClass("dashicons-arrow-down-alt2");if($(this).hasClass("dashicons-arrow-down-alt2")){$(this).parent().find(".name").text((fieldBody.find(".f-title").length?"- "+fieldBody.find(".f-title").val():"")+" {"+fieldBody.find(".f-name").val()+"}")}else{$(this).parent().find(".name").text("")}}).on("click","#add-field-button",function(e){e.preventDefault();var fieldType=$("#select-field").val();var id=$WK.addField(fieldType);$("html, body").animate({scrollTop:$("#"+id).offset().top-50},1e3)}).on("click",".expression_conditional .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#extra-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last condition!")}}).on("click",".expression_addon .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#addon-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last addon!")}}).on("click",".action-add-image",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this image"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();if($WK.wpMediaTarget.prop("tagName")==="A"){$WK.wpMediaTarget.next("img.wp-media-image-preview").attr("src",attachment.url);$WK.wpMediaTarget.next().next("input.wp-media-image-id").attr("value",attachment.id);$WK.wpMediaTarget.hide()}else{$WK.wpMediaTarget.attr("src",attachment.url);$WK.wpMediaTarget.next("input.wp-media-image-id").attr("value",attachment.id)}});$WK.wpMediaFrame.open()}).on("click",".action-add-attachment",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this file"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();$WK.wpMediaTarget.next("input.wp-media-attachment-id").val(attachment.id);$WK.wpMediaTarget.next().next("a.wp-media-attachment-preview").attr("href",attachment.url).text(attachment.url)});$WK.wpMediaFrame.open()}).on("focus",'[data-type="colorswatches"] input.fs-title',function(e){e.preventDefault();var _target=$(this);$WK.colorpicker.iris("show");$(".iris-picker").css({top:_target.offset().top+40,left:_target.offset().left});$WK.colorpicker.iris("option","change",function(event,ui){_target.val(ui.color.toString());var color=ui.color.toRgb();var t=(color.r+color.g+color.b)/2;var textColor=t<200?"#FFFFFF":"#000000";_target.css({"background-color":ui.color.toString(),color:textColor})});$WK.colorpicker.iris("color",$(this).val())}).on("click","input.allowed-extensions",function(){var field_id="#"+$(this).closest("li").attr("id");var ext=[];$(field_id+" input.allowed-extensions:checked").each(function(){ext.push($(this).data("extension"))});$(field_id+" input.fu-allowed-extensions").val(ext.join("|"))});$(".iris-square-value").on("click",function(e){e.preventDefault()});$(document).click(function(e){if(!$(e.target).closest('.iris-picker, [data-type="colorswatches"] input.fs-title').length){if($(".iris-picker").is(":visible")){$WK.colorpicker.iris("hide")}}});$("form#post").submit(function(e){$WK.saveFields();if(!$WK.saved){e.preventDefault();return false}$WK.saveExpression();if(!$WK.expr_saved&&$WK.expression.mode!=="off"){e.preventDefault();alert("Expression is required. Fill in required fields and try again!");return false}return true});$WK.init=function(){$WK.fieldList=$("#f-field-list");$WK.html=wck_fields_html;$WK.fields={};$WK.saved=false;$WK.expr_saved=false;$WK.counter=0;$WK.expression={mode:$("input.expression_type:checked").val()};$WK.loadJSONdata();$WK.showExpressionEditor();$WK.changeAssignType();$("form#post").attr("novalidate","");$WK.buildTooltips("");$WK.updateLayout();$("#wck-parameters .first-selected").prop("selected",true)};$WK.updateLayout=function(){if($WK.fieldsLayout==="two-col"){$WK.fieldList.addClass("layout-two-col")}else{$WK.fieldList.removeClass("layout-two-col")}};$WK.buildTooltips=function(selector){$(selector+"span.wck-field-tip").tipTip({attribute:"title",defaultPosition:"left"})};$WK.changeAssignType=function(){var disabled=$("#assign_type").val()==="1";$("#assign_products, #assign_categories, #assign_tags, #assign_attributes").prop("disabled",disabled)};$("#assign_type").on("change",$WK.changeAssignType);$WK.preloadMedia=function(id,callback){wp.media.attachment(id).fetch().then(function(){callback(wp.media.attachment(id))});return};$WK.addField=function(type){$WK.counter+=1;var id="wkfield-"+$WK.counter;$("li.welcome",$WK.fieldList).remove();$WK.fieldList.append($("
  • ",{"data-type":type,class:"form-invalid",id:id}).append($WK.html[type].replace("{id}",id)));$WK.buildTooltips("#"+id+" ");if($("#"+id).find(".pairs").length>0){$("#"+id+" .pairs").sortable({placeholder:"wck-sortable-placeholder",tolerance:"pointer"})}return id};$(window).on("beforeunload",function(){if($WK.saved===false){return""}});$WK.saveFields=function(){$WK.fields={};suggest=[];var error=$("li .field",$WK.fieldList).length===0;$("label.error").remove();$WK.saved=false;$("#wck-parameters .defined-fields").html("");$WK.appendGlobalParameters();if(error){alert("Please add at least one field before saving.");return false}$("li .field",$WK.fieldList).each(function(){var $row=$(this);var input_fname=$row.find("input.f-name");var input_ftitle=$row.find("input.f-title");var input_fhint=$row.find("input.f-hint");var input_default_value=$row.find("input.f-default-value");var input_css_class=$row.find("input.f-css-class");var field={type:$row.data("type"),use_expression:$row.data("use-expression")===true,name:input_fname.val(),title:input_ftitle.val(),hint:input_fhint.val(),default_value:input_default_value.val(),css_class:input_css_class.val(),required:$row.find("select.f-required").length>0?$row.find("select.f-required").val()==="on":true,layout:$WK.fieldsLayout,colspan:$row.find("input.f-colspan").val(),visibility:$row.find("input.f-visibility").val(),visibility_readable:$row.find("input.f-visibility-readable").val()};var input_fprice=$row.find("input.f-price");if(input_fprice.length>0){field.price=input_fprice.val();if(field.price!==""){field.use_expression=true}}var input_fimgwidth=$row.find("input.fimg-width");if(input_fimgwidth.length>0){field.image_size=input_fimgwidth.val()}var $fs_options;switch(field.type){case"select":case"radio":case"imageselect":case"imageswatches":case"colorswatches":case"radiogroup":case"checkboxgroup":field.options_name=[];field.options_title=[];if(field.type==="imageselect"||field.type==="imageswatches"){field.options_image=[]}if(field.type==="checkboxgroup"){field.select_limit=$row.find("input.fcbg-limit").val()}$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var fs_name=$(this).find("input.fs-name");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_name.val()+":"+fs_title.val()}field.options_name.push(fs_name.val()+":"+fs_title.val());field.options_title.push(fs_title.val());if(field.type==="imageselect"||field.type==="imageswatches"){var fs_image=$(this).find("input.fs-image");field.options_image.push(fs_image.val())}});break;case"dropdown":field.options_title=[];$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_title.val()}field.options_title.push(fs_title.val())});break;case"number":var input_fnmin=$row.find("input.fn-min-value");field.min=input_fnmin.val();var input_fnmax=$row.find("input.fn-max-value");field.max=input_fnmax.val();break;case"checkbox":var input_fcb_default_state=$row.find("select.fcb-default-state");field.default_state=input_fcb_default_state.val()==="on";break;case"text":case"textarea":case"email":var input_ftminlen=$row.find("input.ft-min-length");var input_ftmaxlen=$row.find("input.ft-max-length");var input_ftpattern=$row.find("input.ft-pattern");field.min=input_ftminlen.val();field.max=input_ftmaxlen.val();if(input_ftpattern.length>0){field.pattern=input_ftpattern.val()}break;case"colorpicker":case"datepicker":case"rangedatepicker":var input_fdpdisallow_past_date=$row.find("input.fdp-disallow-past-date");field.disallow_past_date=input_fdpdisallow_past_date.is(":checked");break;case"imageupload":field.max_file_size=$row.find("input.fu-max-file-size").val();field.allowed_extensions=$row.find("input.fu-allowed-extensions").val();break;case"html":case"paragraph":case"hidden":case"attachment":field.content=$row.find(".fst-content").val();break;case"link":field.content=$row.find(".fst-content").val();field.target=$row.find(".fst-target").val();break;case"heading":field.content=$row.find(".fst-content").val();field.level=$row.find(".fst-level").val();break}if(field.name!==""&&field.name in $WK.fields){error=true;alert("Field names must be unique! The '"+field.name+"' name is used more than once.")}if(!error){$WK.appendFormulaVars(field)}});var wkform=$("form#post");if(!wkform[0].checkValidity()){error=true;$("input:invalid").parent().show();$("input:invalid").each(function(){$('").insertBefore($(this))})}if(error&&$("label.error").length){$("html, body").animate({scrollTop:$("label.error").first().offset().top-160},1e3)}$WK.saveJSONdata();$WK.saved=!error};$WK.appendGlobalParameters=function(){if(typeof wck_global_parameters!==undefined){$("#wck-parameters .global-parameters").html("");$.each(wck_global_parameters,function(name,value){var name="global:"+name;var appendChildren="";suggest.push(name);if(typeof value==="object"){$.each(value,function(k,v){var suffix="['"+k+"']";appendChildren=appendChildren+'"});value=""}else{value=" = "+value}$("#wck-parameters .global-parameters").append('");$("#wck-parameters .global-parameters").append(appendChildren)})}};$WK.appendFormulaVars=function(field){$WK.fields[field.name]=field;if(field.use_expression){if(field.type!=="checkboxgroup"){suggest.push(field.name);$("#wck-parameters .defined-fields").append('")}else{suggest.push(field.name+":sum");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":min");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":max");$("#wck-parameters .defined-fields").append('")}if(field.type==="text"||field.type==="textarea"){suggest.push(field.name+":text");$("#wck-parameters .defined-fields").append('")}if(field.type==="rangedatepicker"){suggest.push(field.name+":date_from");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":date_to");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":days");$("#wck-parameters .defined-fields").append('")}else if(field.type==="datepicker"){suggest.push(field.name+":date");$("#wck-parameters .defined-fields").append('")}else if(field.type==="imageupload"){suggest.push(field.name+":size");$("#wck-parameters .defined-fields").append('")}}};$WK.saveJSONdata=function(){if(Object.keys($WK.fields).length>0){$("input[name=_wck_fieldset]").val(JSON.stringify($WK.fields))}};$WK.loadJSONdata=function(){if(typeof wck_load_fieldset==="object"){var layoutLoaded=false;$.each(wck_load_fieldset,function(){if(!layoutLoaded){if(this.hasOwnProperty("layout")&&this.layout==="two-col"){$(".wck-toggle-layout").trigger("click")}layoutLoaded=true}var field_id=$WK.addField(this.type);var $field=$("#"+field_id+" .field");$("#"+field_id+" .f-name").val(this.name);if(this.hasOwnProperty("colspan")){$("#"+field_id+" .f-colspan").val(this.colspan);if(this.colspan==="2"){$("#"+field_id+" .wck-toggle-colspan").trigger("click")}}$("#"+field_id+" .f-title").val(this.title);$("#"+field_id+" .f-hint").val(this.hint);$("#"+field_id+" .f-css-class").val(this.css_class);if($("#"+field_id+" .f-required").length>0){$("#"+field_id+" .f-required").val(this.required==="1"?"on":"off")}if(this.hasOwnProperty("visibility")){$("#"+field_id+" .f-visibility").val(this.visibility);$("#"+field_id+" .f-visibility-readable").val(this.visibility_readable);if(this.visibility_readable!==""){$("#"+field_id+" .visibility-readable").val("Rule preview: "+this.visibility_readable)}}var fprice=$("#"+field_id+" .f-price");if(fprice.length>0){fprice.val(this.price)}var fimgwidth=$("#"+field_id+" .fimg-width");if(fimgwidth.length>0){fimgwidth.val(this.image_size)}var options_title,options_name,options_image,default_value,first,$checked;if(this.type==="dropdown"){options_title=this.options_title;default_value=this.default_value;first=true;$checked=null;$.each(options_title,function(i,option_title){if(first){var $first=$field.find(".fs-option");$first.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(["select","radio","imageselect","radiogroup","checkboxgroup","imageswatches","colorswatches"].indexOf(this.type)>=0){options_name=this.options_name;options_title=this.options_title;default_value=this.default_value;if(this.type==="imageselect"||this.type==="imageswatches"){options_image=this.options_image;wp.media.attachment(options_image).fetch()}if(this.type==="checkboxgroup"){$("#"+field_id+" .fcbg-limit").val(this.select_limit)}first=true;$checked=null;$.each(options_name,function(i,option_name){if(option_name.indexOf(":")>=0){option_name=option_name.slice(0,option_name.indexOf(":"))}if(first){var $first=$field.find(".fs-option");$first.find("input.fs-name").val(option_name);$first.find("input.fs-title").val(options_title[i]);var fs_image=$first.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$first.find("a.action-add-image").hide();$first.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$first.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-name").val(option_name);$clone.find("input.fs-title").val(options_title[i]);fs_image=$clone.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$clone.find("a.action-add-image").hide();$clone.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$clone.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(this.type==="number"){$("#"+field_id+" .fn-min-value").val(this.min);$("#"+field_id+" .fn-max-value").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value)}else if(this.type==="checkbox"){$("#"+field_id+" .fcb-default-state").val(this.default_state==="1"?"on":"off")}else if(this.type==="text"||this.type==="textarea"||this.type==="email"){$("#"+field_id+" .ft-min-length").val(this.min);$("#"+field_id+" .ft-max-length").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value);if(this.type==="text"){$("#"+field_id+" .ft-pattern").val(this.pattern)}}else if(this.type==="colorpicker"||this.type==="datepicker"||this.type==="rangedatepicker"){$("#"+field_id+" .fdp-disallow-past-date").prop("checked",this.disallow_past_date)}else if(this.type==="imageupload"){$("#"+field_id+" .fu-max-file-size").val(this.max_file_size);$("#"+field_id+" .fu-allowed-extensions").val(this.allowed_extensions);var ext=this.allowed_extensions.split("|");ext.forEach(function(e){$("#"+field_id+" .allowed-extensions.ext-"+e).prop("checked",true)})}else if(["html","paragraph","heading","hidden","link","attachment"].indexOf(this.type)>=0){$("#"+field_id+" .fst-content").val(this.content);if(this.type==="heading"){$("#"+field_id+" .fst-level").val(this.level)}else if(this.type==="link"){$("#"+field_id+" .fst-target").val(this.target)}else if(this.type==="attachment"){$WK.preloadMedia(this.content,function(attachment){$("#"+field_id+" .wp-media-attachment-preview").attr("href",attachment.get("url")).text(attachment.get("url"))})}}});$WK.saveFields()}};$WK.showExpressionEditor=function(){$("div.expression_oneline, div.expression_conditional, div.expression_off, div.expression_addon").hide();$("div.expression_"+$WK.expression.mode).show();if($WK.expression.mode==="off"){$(".off-hide").hide()}else{$(".off-hide").show()}};$("input.expression_type").on("change",function(){$WK.expression.mode=$(this).val();$WK.expressionLastFocusedInput=null;$WK.showExpressionEditor()});$WK.addCondition=function(if_value,then_value,addon=false){var $html=$('
    '+'
    '+''+"
    "+'
    '+''+"
    "+'
    '+''+"
    "+'
    '+''+"
    "+'
    ');$(".input-if input",$html).val(if_value);$(".input-equation input",$html).val(then_value);if(addon===true){$("div#addon-inputs").append($html)}else{$("div#extra-inputs").append($html)}$WK.autocomplete()};$("button.add-condition").on("click",function(){$WK.addCondition()});$("button.add-addon").on("click",function(){$WK.addCondition("","",true)});$WK.autocomplete=function(){$(".input-icon input").bind("keydown",function(e){if(e.keyCode===16||e.keyCode===219){input_key_pressed[e.keyCode]=true}}).autocomplete({minLength:0,source:function(request,response){if(input_key_pressed[16]===true&&input_key_pressed[219]===true){response(suggest)}},focus:function(){return false},select:function(event,ui){delete input_key_pressed[16];delete input_key_pressed[219];this.value+=ui.item.value+"}";return false}})};$WK.saveExpression=function(){var mode=$WK.expression.mode;$WK.expr_saved=false;if(mode==="oneline"){$WK.expression.expr=$(".expression_oneline input").val();if($WK.expression.expr!==""){$WK.expr_saved=true}}if(mode==="conditional"){var data=[];$(".expression_conditional .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});var input_else=$(".expression_conditional .input-else input").val();data.push({type:"else",if:"true",then:input_else});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="addon"){var data=[];$(".expression_addon .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="off"){$("input[name=_wck_expression]").val("off")}else{$("input[name=_wck_expression]").val(JSON.stringify($WK.expression))}};$WK.loadExpression=function(){if(typeof wck_load_expression==="object"){$WK.expression.mode=wck_load_expression.mode;$WK.expression.expr=wck_load_expression.expr;if($WK.expression.mode==="oneline"){$(".expression_oneline input").val($WK.expression.expr);$("input[name=_wck_choose_expression_type].expression_oneline").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}else if($WK.expression.mode==="conditional"){$.each($WK.expression.expr,function(){if(this.type==="condition"){$WK.addCondition(this.if,this.then)}else if(this.type==="else"){$(".input-else input").val(this.then)}});$("input[name=_wck_choose_expression_type].expression_conditional").prop("checked",true);$WK.showExpressionEditor()}else if($WK.expression.mode==="addon"){$.each($WK.expression.expr,function(){$WK.addCondition(this.if,this.then,true)});$("input[name=_wck_choose_expression_type].expression_addon").prop("checked",true);$WK.showExpressionEditor()}}else{$WK.expression.mode="off";$("input[name=_wck_choose_expression_type].expression_off").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}};$("button.test-expression").on("click",function(){$WK.saveExpression()});$(window).scroll(function(){if($(this).scrollTop()>100){$("#wck-toolbar").fadeIn()}else if(!$("#postbox-container-2").hasClass("fullscreen")){$("#wck-toolbar").fadeOut()}});$CV.window=$("#wck-cv-builder");$CV.builder=$CV.window.find(".builder");$CV.template=$CV.window.find(".template").children();$CV.context=null;$CV.open=function(context){$CV.context=context;var fieldSelect=$CV.template.find("select.p-field");fieldSelect.empty();$WK.saveFields();fieldSelect.append('');$.each($WK.fieldList.find(".field"),function(){if($(this).data("group")!=="static"&&!$(this).is(context)){var name=$(this).find(".f-name").val();fieldSelect.append('")}});$CV.builder.append($CV.template.clone());$CV.builder.find(".or-condition").remove();var loadData=$CV.context.find(".f-visibility").val();try{loadData=JSON.parse(loadData)}catch(e){loadData=false}if(typeof loadData==="object"){$.each(loadData,function(i,or_condition){var first=true;$.each(or_condition,function(j,and_condition){$CV.add(first?"or":"and",null,and_condition);first=false})})}else{$CV.add("or",null,null)}$CV.window.find("span.self-name").text(context.find(".f-name").val());$CV.window.show().css({display:"flex"})};$CV.close=function(){$CV.window.hide();$CV.builder.empty()};$CV.add=function(type,destination,values){if(destination===null){destination=$CV.builder.find("."+type+"-group").last()}destination.append($CV.window.find(".template ."+type+"-condition").clone());var newCondition=destination.find(".and-condition").last();if(values!==null&&typeof values==="object"){newCondition.find(".p-field").val(values.field);newCondition.find(".p-comparison").val(values.comp).trigger("change");newCondition.find(".p-value").val(values.value)}else{newCondition.find(".p-value").val("")}};$CV.validate=function(){var isValid=true;var conditions=$CV.builder.find(".and-condition");conditions.find(".validation-error").removeClass("validation-error");conditions.each(function(){var field=$(this).find(".p-field");var comp=$(this).find(".p-comparison").val();var value=$(this).find(".p-value");if([null,""].includes(field.val())){field.addClass("validation-error");isValid=false}if(!value.prop("disabled")&&value.val()===""){value.addClass("validation-error");isValid=false}if(["5","6","7","8"].includes(comp)&&!value.val().match(/^-?\d*[\.,]?\d+$/)){value.addClass("validation-error");isValid=false}if(comp==="9"&&value.val()===""){value.addClass("validation-error");isValid=false}});return isValid};$CV.window.on("click",".cv-action-and",function(e){e.preventDefault();$CV.add("and",$(this).prev(),null)});$CV.window.on("click",".cv-action-or",function(e){e.preventDefault();$CV.add("or",$(this).prev(),null)});$CV.window.on("click",".cv-remove",function(e){e.preventDefault();var count=$(this).closest(".and-group").children().length;if(count===1){$(this).closest(".or-condition").remove()}else{$(this).parent().remove()}});$CV.window.on("change","select.p-comparison",function(e){var disabled=["1","2"].includes($(this).val());var pVal=$(this).next(".p-value");pVal.prop("disabled",disabled);if(disabled){pVal.val("")}});$CV.window.on("click",".cv-close",function(e){e.preventDefault();$CV.close()});$CV.window.on("click",".cv-save",function(e){e.preventDefault();if(!$CV.validate()){alert("Please correct the form!");return false}var or_conditions=[];var or_readable=[];$.each($CV.builder.find(".or-condition"),function(){var and_conditions=[];var and_readable=[];$.each($(this).find(".and-condition"),function(){var item={field:$(this).find(".p-field").val(),comp:$(this).find(".p-comparison").val(),comp_text:$(this).find(".p-comparison option:selected").text(),value:$(this).find(".p-value").val()};and_conditions.push(item);and_readable.push("{"+item.field+"} "+item.comp_text+" "+item.value)});or_conditions.push(and_conditions);or_readable.push(" ( "+and_readable.join(" and ")+" ) ")});var readable=or_readable.join(" or ").replaceAll(" "," ");$CV.context.find(".f-visibility").val(or_conditions.length===0?"":JSON.stringify(or_conditions));$CV.context.find(".f-visibility-readable").val(readable);if(readable!==""){$CV.context.find(".visibility-readable").val("Rule preview: "+readable)}else{$CV.context.find(".visibility-readable").val("")}$CV.close()});$("body").on("click",".action-field-visibility",function(){var context=$(this).closest(".field");$CV.open(context)});$WK.init();$WK.loadExpression();$WK.autocomplete()})})(jQuery); \ No newline at end of file +(function($){"use strict";var $WK={};var $CV={};$(document).ready(function($){var suggest=[];var input_key_pressed={};$("#f-field-list").sortable({handle:".header",placeholder:"wck-sortable-placeholder",tolerance:"pointer"});$("#extra-inputs, #addon-inputs").sortable({handle:".action-drag",placeholder:"wck-sortable-placeholder",tolerance:"pointer"});$('').insertBefore("#wpwrap");$WK.colorpicker=$("input.wck-global-color-picker");$WK.colorpicker.iris();$WK.expressionLastFocusedInput=null;$WK.wpMediaFrame=null;$WK.wpMediaTarget=null;$WK.iconPreloader="data:image/gif;base64,R0lGODlhEAAQAPUVAHt7e729vf///4R7e+/v762trZSUlKWlpZycnPf39+bm5t7e3tbW1s7OzoSEhMXFxc7FzpSMjJyUlP/397WtraWlnM7FxbW1tb21tebe3tbOzqWcnIyEhHNzc3tzc4yMjK2lpbWttcW9vffv76Wtpa2lra2tpb21vcXFzt7e1qWlrdbe1pScnO/v5gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJBwAVACwAAAAAEAAQAEAGt8CKsGLZfDyez8YyrAAekAdA09R0GoLGE8BgLDQIhwORSSQIDqYxELhcCoXDARHeCBmRSGOh6BMICxIRDBUOAQ0NBiBNIBsTAgscGwgPDxcABYgFHnQSSkMFAAYHcAgRHQVNQgUDmX0NFA6pQxsGC7d9Cn8ECRt2GwddDwMgiCAOC2YYGwCIWlRDGgACAgkADhiVEYtDIAMGAQYcUmxtHwDXc3QdDxV4DhRucHIIAIOqRRxIkkxDQQAh+QQFBwAQACwAAAAAEAAQAAAGr0CIEGLZfDyez8YybBYAh8diYSkMCk1G5PNgrKYKBcMQYQg3hgZjDQ4TEBvIA/BoNCySgQMBIRAUDkVRDQEDIHYgDgx+FxsOFw8PBiBNIAgJCQscAAGRABpNGgCYBACcAQGfoaMJpQ4hqB+UQyAbAgKaGwgXF08FdgUdF7cBG3O8vQ6meypiAw8QRr0FBwcI1wgHDnEQWg4H1NbXBgBlTh4G2dYfHVhNQkUcSBxLTUEAIfkECQcAEAAsAQABAA4ADgAABnBAiFAYYDAeoKEy0GgYF4uG8vN4NJ9QxTBQfQgHQoViMUAEAhiAMqygFM6ftZBAYFzu8jlBcb/kISN0IAUFHHIICQkMBoQHHkoOGYkXHgUkBwdKCgIJBA4QDpgHCAgGFwICE5lfpKQGRQsIch+tBmtBACH5BAUHABQALAEAAQAOAA4AAAaaQAqlAEBcHo3AAVAQMiKO4wPSaDAsnwhj8wkEHuAqg7EwbAAXbyAyGBgaiwVjILlcQgBQFTSALwoHdh8gQkIgEgoKDQWMABqFFBoAiQsHjB6PhZKJChUHBw6EhSAIBAQMBp8IHgVVBQ4UphceBwi2AwAOBwoJBAoOGw62CG8CEwnIGxtPRRIBAtAJCghaQgUdHwYMAgsXDk0UQQAh+QQFBwAQACwBAAEADgAOAAAGcECIECIpBB4XxHBZuASOD5RoyblYn49HYyv0FL4XCECoZTTGhwJoSWYwQIjDwcEWMhYP+cFThywWDAiCfX5/gkp9CgoNH4IGiQoFEHEFDxt0GwsECgtCAxAECQIJpASmiBAeDQKjpQsSbAMYC6QMbEEAIfkEBQcAEAAsAQABAA4ADgAABnZAiNAjOVwCBaFSCDgUCpdjAMNZHpzQU0D0eESEVycHAIgEuo8yAgHxLAGBRkO4Xi7lIoSBbRcyGA0SCB99fn8GD3N9EgsLDxwEAhkOdg2NBQAjAgIKSggMCo0DEAcTCacjBAQKrEsICqeqqwx9DhgMqgwUo0JBACH5BAkHAAAALAEAAQAOAA4AAAVjICACEVIUhzGuyHGc10WtANK+RRwEo92ulx0PIKnRAJfHY2MIGAbHiBLTEDSOogfkkRAIoMdG47EQTDZYcQCTSBwHDwbj4AC0MwgAVLOQi9AEgQqDC4UqIwuChFdHFBqDjCMhACH5BAUHABMALAEAAQAOAA4AAAaTwMmk0PlIDgeEwVMQMiIAA2KKLBwGEcbGkZwiqoULZzNgEC4IBwDAKYQvgIBA8OiAGg0Q4I1YzA8gQkIgHwEBIQmJAxqCExoehgEEioyCGgAPDwELiQiBgiAGmRgXBAQMDgV4BQMiDRAHDgqmEwgDAwYQeBYAGwgECsELCwzFDQYbTxIMwsMMDxFZQqyqww8He0JBACH5BAUHAAMALAEAAQAOAA4AAAZzwIEQYBggEIaPcGlUKBqG4xGw3CQEgkAUcTiYhA7CVcHskgqeSyKRcTA9h0LBwFhvmEJO6FIi+PFLF4IKflR4HgGCDH+AHwEBBQNOGngAGA8BCAMLTgMSSw+hIksKC6YMDA0NoRFMDaepDQGAAyAPqLNMQQAh+QQFBwAYACwBAAEADgAOAAAFZSAmOtciMGKaSlgivAGrIm0yCY2B7KlCJJiDQ7RDHEQEgiplPGKStGXwUFFYAVJMoXBYWLPabcMqW14uh8JigRksKWfJgLHOYQCRgP4ikiwYDA0ND4R6SxaBDRCEfEtYAYIXUSIhACH5BAkHABAALAEAAQAOAA4AAAZyQIhQyEgkFhjHcLggGBMCAcOzbBEII6PAeBhABgsFYbGBOA6iwgEBKSgUjKXQwEJ8Gm/5EMFf+PVCfAgMf4AHhw8LcXpnayAMDA96IAUFQg0MDZIAQheVBVQQDaMPDwEBF6kcQx8ipaaoBUpyGxemlktBACH5BAUHABAALAEAAQAOAA4AAAaRQAikMCg0CATGxVEQMiIGhgJJSCQUiAhjI1F4p1Vr4rAZLBYKBsLh2CgEggSgcG44QI0GyAFJED4PKQsSIEJCewEBUQwMABqGEBodHwgSDYyOkJIInAF5BoWGe5wIB3kBc3kFHgcHWQAPsQEfAAAcBa0HHhsGsokXBcEHbU8fF78XwMNaQgUACAUBFwcGHk0QQQA7";$WK.fieldsLayout="one-col";$WK.toggleButton=function(btn,e){e.preventDefault();if(btn.hasClass("woocommerce-input-toggle--disabled")){btn.removeClass("woocommerce-input-toggle--disabled").addClass("woocommerce-input-toggle--enabled");return true}else{btn.removeClass("woocommerce-input-toggle--enabled").addClass("woocommerce-input-toggle--disabled");return false}return false};$WK.fullscreenMode=function(state){if(state){$("body").css("overflow","hidden");$("#postbox-container-2").addClass("fullscreen")}else{$("body").css("overflow","auto");$("#postbox-container-2").removeClass("fullscreen")}};$(".wck-toggle-layout").on("click",function(e){var state=$WK.toggleButton($(this),e);$WK.fieldsLayout=state?"two-col":"one-col";$WK.updateLayout()});$(".wck-toggle-fullscreen").on("click",function(e){var state=$WK.toggleButton($(this),e);$WK.fullscreenMode(state)});$(".wck-toggle-expand").on("click",function(e){var state=$WK.toggleButton($(this),e);$(".action-toggle.dashicons-arrow-"+(state?"down":"up")+"-alt2").trigger("click")});$("body").on("click",".wck-toggle-colspan",function(e){e.preventDefault();var item=$(this).parent().parent().parent();if($(this).hasClass("woocommerce-input-toggle--disabled")){$(this).removeClass("woocommerce-input-toggle--disabled").addClass("woocommerce-input-toggle--enabled");item.addClass("wck-layout-colspan");item.find(".f-colspan").val(2)}else{$(this).removeClass("woocommerce-input-toggle--enabled").addClass("woocommerce-input-toggle--disabled");item.removeClass("wck-layout-colspan");item.find(".f-colspan").val(1)}});$(".action-save-post").on("click",function(e){e.preventDefault();$("#publish").trigger("click");if($("#publish").hasClass("disabled")){$(this).prop("disabled",true).addClass("disabled")}});$("body").on("click",".action-duplicate",function(e){e.preventDefault();var element=$(this).parent().parent().parent();var clonedElement=element.clone();clonedElement.hide();clonedElement.find(".f-title").val("");clonedElement.find(".f-name").val("");clonedElement.insertAfter(element);clonedElement.fadeIn(1500,function(){clonedElement.find(".dashicons-arrow-down-alt2").trigger("click");$(this).find(".f-title").fadeOut(150).fadeIn(150).fadeOut(150).fadeIn(150).fadeOut(150).fadeIn(150);$(this).find(".f-name").fadeOut(150).fadeIn(150).fadeOut(150).fadeIn(150).fadeOut(150).fadeIn(150)})});$WK.shouldHideExprToolbar=false;$WK.stateExprToolbar=false;$("body").on("focusin","#wck_expression .input-icon input",function(e){$WK.expressionLastFocusedInput=$(this);$WK.shouldHideExprToolbar=false;var posA=$(this).offset();var h=$(this).outerHeight();var posB=$("#wck_expression").offset();$("#wck-expression-toolbar").css({top:posA.top-posB.top-h-$("#wck-expression-toolbar").outerHeight()-20,left:posA.left-posB.left});if(!$WK.stateExprToolbar){$WK.stateExprToolbar=true;$WK.saveFields();$("#wck-parameters .first-selected").prop("selected",true);$("#wck-expression-toolbar").stop(true,false).fadeIn("fast")}}).on("focusout","#wck_expression input",function(e){$WK.shouldHideExprToolbar=!(e.relatedTarget&&$("#wck-expression-toolbar").has(e.relatedTarget).length);setTimeout(function(){if($WK.stateExprToolbar&&$WK.shouldHideExprToolbar){$("#wck-expression-toolbar").stop(true,false).fadeOut("fast");$WK.stateExprToolbar=false}},200)}).on("click","#wck-expression-toolbar",function(e){if(e.target!==e.currentTarget&&e.target.tagName!=="OPTION")return;$WK.expressionLastFocusedInput.focus()}).on("click","button.add-field-to-formula, button.add-operator",function(e){e.preventDefault();var $focused=$WK.expressionLastFocusedInput;if(!$focused){$focused=$(".input-icon").find("input:visible").first();$focused.focus()}if($focused&&$focused.length){var value=$(this).hasClass("add-operator")?$(this).val():$("#wck-parameters").val();if(value===null){return}var cursorPos=$focused[0].selectionStart;var x=$focused.val();$focused.val(x.slice(0,cursorPos)+value+x.slice(cursorPos));$focused.focus();cursorPos+=value.length;$focused[0].setSelectionRange(cursorPos,cursorPos)}}).on("click",".field .pairs .action-add",function(){var $clone=$(this).prev(".pair").clone().insertBefore($(this));$clone.find("input").val("")}).on("click",".field .pairs .action-showimport",function(){$(this).parent().find("div.importer").toggle()}).on("click",".field .pairs .action-import",function(){var $this=$(this);var input=$this.parent().find("textarea").val().trim().split("\n");if(Array.isArray(input)){input.forEach(function(el){var columns=el.trim().split(";");var $last_pair=$this.parent().parent().find(".pair").last();var $clone=$last_pair.clone().insertAfter($last_pair);if(columns.length===2){$clone.find("input.fs-name").val(columns[0]);$clone.find("input.fs-title").val(columns[1])}else if(columns.length===1){$clone.find("input.fs-title").val(columns[0])}})}}).on("click",".field .pairs .action-removeall",function(){if(confirm("Are you sure?")){$(this).parent().find(".pair").slice(1).remove()}}).on("click",".field .pair .action-delete",function(){var $pairs=$(this).closest(".pairs");if($pairs.children(".pair").length>1){if(confirm("Are you sure?")){$(this).closest(".pair").remove()}}else{alert("You cannot remove the last item!")}}).on("click",".field .header .action-delete",function(){if(confirm("Are you sure?")){var $target=$(this).closest("li");$target.fadeOut("slow",function(){$target.remove()})}}).on("click",".field .header .action-toggle",function(){var fieldBody=$(this).closest(".field").find(".body");fieldBody.slideToggle(300);$(this).toggleClass("dashicons-arrow-up-alt2");$(this).toggleClass("dashicons-arrow-down-alt2");if($(this).hasClass("dashicons-arrow-down-alt2")){$(this).parent().find(".name").text((fieldBody.find(".f-title").length?"- "+fieldBody.find(".f-title").val():"")+" {"+fieldBody.find(".f-name").val()+"}")}else{$(this).parent().find(".name").text("")}}).on("click","#add-field-button",function(e){e.preventDefault();var fieldType=$("#select-field").val();var id=$WK.addField(fieldType);$("html, body").animate({scrollTop:$("#"+id).offset().top-50},1e3)}).on("click",".expression_conditional .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#extra-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last condition!")}}).on("click",".expression_addon .input-group .action-delete",function(){var $target=$(this).closest(".input-group");if($("#addon-inputs .input-group").length>1){if(confirm("Are you sure?")){$target.hide("slow",function(){$target.remove()})}}else{alert("You cannot remove the last addon!")}}).on("click",".action-add-image",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this image"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();if($WK.wpMediaTarget.prop("tagName")==="A"){$WK.wpMediaTarget.next("img.wp-media-image-preview").attr("src",attachment.url);$WK.wpMediaTarget.next().next("input.wp-media-image-id").attr("value",attachment.id);$WK.wpMediaTarget.hide()}else{$WK.wpMediaTarget.attr("src",attachment.url);$WK.wpMediaTarget.next("input.wp-media-image-id").attr("value",attachment.id)}});$WK.wpMediaFrame.open()}).on("click",".action-add-attachment",function(e){e.preventDefault();$WK.wpMediaTarget=$(this);if($WK.wpMediaFrame){$WK.wpMediaFrame.open();return}$WK.wpMediaFrame=wp.media({multiple:false,button:{text:"Select this file"}});$WK.wpMediaFrame.on("select",function(){var attachment=$WK.wpMediaFrame.state().get("selection").first().toJSON();$WK.wpMediaTarget.next("input.wp-media-attachment-id").val(attachment.id);$WK.wpMediaTarget.next().next("a.wp-media-attachment-preview").attr("href",attachment.url).text(attachment.url)});$WK.wpMediaFrame.open()}).on("focus",'[data-type="colorswatches"] input.fs-title',function(e){e.preventDefault();var _target=$(this);$WK.colorpicker.iris("show");$(".iris-picker").css({top:_target.offset().top+40,left:_target.offset().left});$WK.colorpicker.iris("option","change",function(event,ui){_target.val(ui.color.toString());var color=ui.color.toRgb();var t=(color.r+color.g+color.b)/2;var textColor=t<200?"#FFFFFF":"#000000";_target.css({"background-color":ui.color.toString(),color:textColor})});$WK.colorpicker.iris("color",$(this).val())}).on("click","input.allowed-extensions",function(){var field_id="#"+$(this).closest("li").attr("id");var ext=[];$(field_id+" input.allowed-extensions:checked").each(function(){ext.push($(this).data("extension"))});$(field_id+" input.fu-allowed-extensions").val(ext.join("|"))}).on("change","input.f-name",function(){var target=$(this);var newName=$(this).val().trim();if(newName!==""){$("#wck_fields_editor input.f-name").each(function(){if($(this).val()===newName&&!$(this).is(target)){alert("The name {"+newName+"} is already in use! Choose another name.");target.val("");return false}})}if($(this)[0].checkValidity()&&typeof $(this).data("lastValid")!=="undefined"){var oldName=$(this).data("lastValid");if(oldName!==newName){var oldNameInUse=false;$("#wck_expression input[type=text], #wck_fields_editor input.f-visibility, #wck_fields_editor input.f-visibility-readable, #wck_fields_editor input.visibility-readable").each(function(){if($(this).val().includes(oldName)){oldNameInUse=true;return false}});if(oldNameInUse&&confirm("Wait! Seems like {"+oldName+"} is used in formulas! Do you want to replace {"+oldName+"} in all formulas? {"+oldName+"} will be changed to {"+newName+"}")){$("#wck_expression input[type=text], #wck_fields_editor input.f-visibility, #wck_fields_editor input.f-visibility-readable, #wck_fields_editor input.visibility-readable").each(function(){$(this).val($(this).val().replaceAll("{"+oldName+"}","{"+newName+"}").replaceAll("{"+oldName+":","{"+newName+":").replaceAll('"field":"'+oldName+'"','"field":"'+newName+'"'))});$(this).data("lastValid",newName)}}}}).on("focusin","input.f-name",function(){if($(this)[0].checkValidity()){$(this).data("lastValid",$(this).val())}});$(".iris-square-value").on("click",function(e){e.preventDefault()});$(document).click(function(e){if(!$(e.target).closest('.iris-picker, [data-type="colorswatches"] input.fs-title').length){if($(".iris-picker").is(":visible")){$WK.colorpicker.iris("hide")}}});$("form#post").submit(function(e){$WK.saveFields();if(!$WK.saved){e.preventDefault();return false}$WK.saveExpression();if(!$WK.expr_saved&&$WK.expression.mode!=="off"){e.preventDefault();alert("Expression is required. Fill in required fields and try again!");return false}return true});$WK.init=function(){$WK.fieldList=$("#f-field-list");$WK.html=wck_fields_html;$WK.fields={};$WK.saved=false;$WK.expr_saved=false;$WK.counter=0;$WK.expression={mode:$("input.expression_type:checked").val()};$WK.loadJSONdata();$WK.showExpressionEditor();$WK.changeAssignType();$("form#post").attr("novalidate","");$WK.buildTooltips("");$WK.updateLayout();$("#wck-parameters .first-selected").prop("selected",true)};$WK.updateLayout=function(){if($WK.fieldsLayout==="two-col"){$WK.fieldList.addClass("layout-two-col")}else{$WK.fieldList.removeClass("layout-two-col")}};$WK.buildTooltips=function(selector){$(selector+"span.wck-field-tip").tipTip({attribute:"title",defaultPosition:"left"})};$WK.changeAssignType=function(){var disabled=$("#assign_type").val()==="1";$("#assign_products, #assign_categories, #assign_tags, #assign_attributes").prop("disabled",disabled)};$("#assign_type").on("change",$WK.changeAssignType);$WK.preloadMedia=function(id,callback){wp.media.attachment(id).fetch().then(function(){callback(wp.media.attachment(id))});return};$WK.addField=function(type){$WK.counter+=1;var id="wkfield-"+$WK.counter;$("li.welcome",$WK.fieldList).remove();$WK.fieldList.append($("
  • ",{"data-type":type,class:"form-invalid",id:id}).append($WK.html[type].replace("{id}",id)));$WK.buildTooltips("#"+id+" ");if($("#"+id).find(".pairs").length>0){$("#"+id+" .pairs").sortable({placeholder:"wck-sortable-placeholder",tolerance:"pointer"})}return id};$(window).on("beforeunload",function(){if($WK.saved===false){return""}});$WK.saveFields=function(){$WK.fields={};suggest=[];var error=$("li .field",$WK.fieldList).length===0;$("label.error").remove();$WK.saved=false;$("#wck-parameters .defined-fields").html("");$WK.appendGlobalParameters();if(error){alert("Please add at least one field before saving.");return false}$("li .field",$WK.fieldList).each(function(){var $row=$(this);var input_fname=$row.find("input.f-name");var input_ftitle=$row.find("input.f-title");var input_fhint=$row.find("input.f-hint");var input_default_value=$row.find("input.f-default-value");var input_css_class=$row.find("input.f-css-class");var field={type:$row.data("type"),use_expression:$row.data("use-expression")===true,name:input_fname.val(),title:input_ftitle.val(),hint:input_fhint.val(),default_value:input_default_value.val(),css_class:input_css_class.val(),required:$row.find("select.f-required").length>0?$row.find("select.f-required").val()==="on":true,layout:$WK.fieldsLayout,colspan:$row.find("input.f-colspan").val(),visibility:$row.find("input.f-visibility").val(),visibility_readable:$row.find("input.f-visibility-readable").val()};var input_fprice=$row.find("input.f-price");if(input_fprice.length>0){field.price=input_fprice.val();if(field.price!==""){field.use_expression=true}}var input_fimgwidth=$row.find("input.fimg-width");if(input_fimgwidth.length>0){field.image_size=input_fimgwidth.val()}var $fs_options;switch(field.type){case"select":case"radio":case"imageselect":case"imageswatches":case"colorswatches":case"radiogroup":case"checkboxgroup":field.options_name=[];field.options_title=[];if(field.type==="imageselect"||field.type==="imageswatches"){field.options_image=[]}if(field.type==="checkboxgroup"){field.select_limit=$row.find("input.fcbg-limit").val()}$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var fs_name=$(this).find("input.fs-name");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_name.val()+":"+fs_title.val()}field.options_name.push(fs_name.val()+":"+fs_title.val());field.options_title.push(fs_title.val());if(field.type==="imageselect"||field.type==="imageswatches"){var fs_image=$(this).find("input.fs-image");field.options_image.push(fs_image.val())}});break;case"dropdown":field.options_title=[];$fs_options=$row.find(".fs-option");$fs_options.each(function(){var fs_title=$(this).find("input.fs-title");var f_default_value=$(this).find("input.f-default-value").is(":checked");if(typeof f_default_value!=="undefined"&&f_default_value===true){field.default_value=fs_title.val()}field.options_title.push(fs_title.val())});break;case"number":var input_fnmin=$row.find("input.fn-min-value");field.min=input_fnmin.val();var input_fnmax=$row.find("input.fn-max-value");field.max=input_fnmax.val();break;case"checkbox":var input_fcb_default_state=$row.find("select.fcb-default-state");field.default_state=input_fcb_default_state.val()==="on";break;case"text":case"textarea":case"email":var input_ftminlen=$row.find("input.ft-min-length");var input_ftmaxlen=$row.find("input.ft-max-length");var input_ftpattern=$row.find("input.ft-pattern");field.min=input_ftminlen.val();field.max=input_ftmaxlen.val();if(input_ftpattern.length>0){field.pattern=input_ftpattern.val()}break;case"colorpicker":case"datepicker":case"rangedatepicker":var input_fdpdisallow_past_date=$row.find("input.fdp-disallow-past-date");field.disallow_past_date=input_fdpdisallow_past_date.is(":checked");break;case"imageupload":field.max_file_size=$row.find("input.fu-max-file-size").val();field.allowed_extensions=$row.find("input.fu-allowed-extensions").val();break;case"html":case"paragraph":case"hidden":case"attachment":field.content=$row.find(".fst-content").val();break;case"link":field.content=$row.find(".fst-content").val();field.target=$row.find(".fst-target").val();break;case"heading":field.content=$row.find(".fst-content").val();field.level=$row.find(".fst-level").val();break}if(field.name!==""&&field.name in $WK.fields){error=true;alert("Field names must be unique! The '"+field.name+"' name is used more than once.")}if(!error){$WK.appendFormulaVars(field)}});var wkform=$("form#post");if(!wkform[0].checkValidity()){error=true;$("input:invalid").closest(".field").find(".action-toggle.dashicons-arrow-down-alt2").trigger("click");$("input:invalid").each(function(){$('").insertBefore($(this))})}if(error&&$("label.error").length){$("html, body").animate({scrollTop:$("label.error").first().offset().top-160},1e3)}$WK.saveJSONdata();$WK.saved=!error};$WK.appendGlobalParameters=function(){if(typeof wck_global_parameters!==undefined){$("#wck-parameters .global-parameters").html("");$.each(wck_global_parameters,function(name,value){var name="global:"+name;var appendChildren="";suggest.push(name);if(typeof value==="object"){$.each(value,function(k,v){var suffix="['"+k+"']";appendChildren=appendChildren+'"});value=""}else{value=" = "+value}$("#wck-parameters .global-parameters").append('");$("#wck-parameters .global-parameters").append(appendChildren)})}};$WK.appendFormulaVars=function(field){$WK.fields[field.name]=field;if(field.use_expression){if(field.type!=="checkboxgroup"){suggest.push(field.name);$("#wck-parameters .defined-fields").append('")}else{suggest.push(field.name+":sum");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":min");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":max");$("#wck-parameters .defined-fields").append('")}if(field.type==="text"||field.type==="textarea"){suggest.push(field.name+":text");$("#wck-parameters .defined-fields").append('")}if(field.type==="rangedatepicker"){suggest.push(field.name+":date_from");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":date_to");$("#wck-parameters .defined-fields").append('");suggest.push(field.name+":days");$("#wck-parameters .defined-fields").append('")}else if(field.type==="datepicker"){suggest.push(field.name+":date");$("#wck-parameters .defined-fields").append('")}else if(field.type==="imageupload"){suggest.push(field.name+":size");$("#wck-parameters .defined-fields").append('")}}};$WK.saveJSONdata=function(){if(Object.keys($WK.fields).length>0){$("input[name=_wck_fieldset]").val(JSON.stringify($WK.fields))}};$WK.loadJSONdata=function(){if(typeof wck_load_fieldset==="object"){var layoutLoaded=false;$.each(wck_load_fieldset,function(){if(!layoutLoaded){if(this.hasOwnProperty("layout")&&this.layout==="two-col"){$(".wck-toggle-layout").trigger("click")}layoutLoaded=true}var field_id=$WK.addField(this.type);var $field=$("#"+field_id+" .field");$("#"+field_id+" .f-name").val(this.name);if(this.hasOwnProperty("colspan")){$("#"+field_id+" .f-colspan").val(this.colspan);if(this.colspan==="2"){$("#"+field_id+" .wck-toggle-colspan").trigger("click")}}$("#"+field_id+" .f-title").val(this.title);$("#"+field_id+" .f-hint").val(this.hint);$("#"+field_id+" .f-css-class").val(this.css_class);if($("#"+field_id+" .f-required").length>0){$("#"+field_id+" .f-required").val(this.required==="1"?"on":"off")}if(this.hasOwnProperty("visibility")){$("#"+field_id+" .f-visibility").val(this.visibility);$("#"+field_id+" .f-visibility-readable").val(this.visibility_readable);if(this.visibility_readable!==""){$("#"+field_id+" .visibility-readable").val("Rule preview: "+this.visibility_readable)}}var fprice=$("#"+field_id+" .f-price");if(fprice.length>0){fprice.val(this.price)}var fimgwidth=$("#"+field_id+" .fimg-width");if(fimgwidth.length>0){fimgwidth.val(this.image_size)}var options_title,options_name,options_image,default_value,first,$checked;if(this.type==="dropdown"){options_title=this.options_title;default_value=this.default_value;first=true;$checked=null;$.each(options_title,function(i,option_title){if(first){var $first=$field.find(".fs-option");$first.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-title").val(option_title);if(default_value===option_title){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(["select","radio","imageselect","radiogroup","checkboxgroup","imageswatches","colorswatches"].indexOf(this.type)>=0){options_name=this.options_name;options_title=this.options_title;default_value=this.default_value;if(this.type==="imageselect"||this.type==="imageswatches"){options_image=this.options_image;wp.media.attachment(options_image).fetch()}if(this.type==="checkboxgroup"){$("#"+field_id+" .fcbg-limit").val(this.select_limit)}first=true;$checked=null;$.each(options_name,function(i,option_name){if(option_name.indexOf(":")>=0){option_name=option_name.slice(0,option_name.indexOf(":"))}if(first){var $first=$field.find(".fs-option");$first.find("input.fs-name").val(option_name);$first.find("input.fs-title").val(options_title[i]);var fs_image=$first.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$first.find("a.action-add-image").hide();$first.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$first.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$first.find("input.f-default-value")}first=false}else{var $clone=$field.find(".fs-option").last().clone().insertBefore($("#"+field_id+" .fs-options .action-add"));$clone.find("input.fs-name").val(option_name);$clone.find("input.fs-title").val(options_title[i]);fs_image=$clone.find("input.fs-image");if(fs_image.length>0){fs_image.val(options_image[i]);$clone.find("a.action-add-image").hide();$clone.find(".wp-media-image-preview").attr("src",$WK.iconPreloader);$WK.preloadMedia(options_image[i],function(attachment){$clone.find(".wp-media-image-preview").attr("src",attachment.get("url"))})}if(default_value===option_name){$checked=$clone.find("input.f-default-value")}}if($checked){$checked.prop("checked",true)}})}else if(this.type==="number"){$("#"+field_id+" .fn-min-value").val(this.min);$("#"+field_id+" .fn-max-value").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value)}else if(this.type==="checkbox"){$("#"+field_id+" .fcb-default-state").val(this.default_state==="1"?"on":"off")}else if(this.type==="text"||this.type==="textarea"||this.type==="email"){$("#"+field_id+" .ft-min-length").val(this.min);$("#"+field_id+" .ft-max-length").val(this.max);$("#"+field_id+" .f-default-value").val(this.default_value);if(this.type==="text"){$("#"+field_id+" .ft-pattern").val(this.pattern)}}else if(this.type==="colorpicker"||this.type==="datepicker"||this.type==="rangedatepicker"){$("#"+field_id+" .fdp-disallow-past-date").prop("checked",this.disallow_past_date)}else if(this.type==="imageupload"){$("#"+field_id+" .fu-max-file-size").val(this.max_file_size);$("#"+field_id+" .fu-allowed-extensions").val(this.allowed_extensions);var ext=this.allowed_extensions.split("|");ext.forEach(function(e){$("#"+field_id+" .allowed-extensions.ext-"+e).prop("checked",true)})}else if(["html","paragraph","heading","hidden","link","attachment"].indexOf(this.type)>=0){$("#"+field_id+" .fst-content").val(this.content);if(this.type==="heading"){$("#"+field_id+" .fst-level").val(this.level)}else if(this.type==="link"){$("#"+field_id+" .fst-target").val(this.target)}else if(this.type==="attachment"){$WK.preloadMedia(this.content,function(attachment){$("#"+field_id+" .wp-media-attachment-preview").attr("href",attachment.get("url")).text(attachment.get("url"))})}}});$WK.saveFields()}};$WK.showExpressionEditor=function(){$("div.expression_oneline, div.expression_conditional, div.expression_off, div.expression_addon").hide();$("div.expression_"+$WK.expression.mode).show();if($WK.expression.mode==="off"){$(".off-hide").hide()}else{$(".off-hide").show()}};$("input.expression_type").on("change",function(){$WK.expression.mode=$(this).val();$WK.expressionLastFocusedInput=null;$WK.showExpressionEditor()});$WK.addCondition=function(if_value,then_value,addon=false){var $html=$('
    '+'
    '+''+"
    "+'
    '+''+"
    "+'
    '+''+"
    "+'
    '+''+"
    "+'
    ');$(".input-if input",$html).val(if_value);$(".input-equation input",$html).val(then_value);if(addon===true){$("div#addon-inputs").append($html)}else{$("div#extra-inputs").append($html)}$WK.autocomplete()};$("button.add-condition").on("click",function(){$WK.addCondition()});$("button.add-addon").on("click",function(){$WK.addCondition("","",true)});$WK.autocomplete=function(){$(".input-icon input").bind("keydown",function(e){if(e.keyCode===16||e.keyCode===219){input_key_pressed[e.keyCode]=true}}).autocomplete({minLength:0,source:function(request,response){if(input_key_pressed[16]===true&&input_key_pressed[219]===true){response(suggest)}},focus:function(){return false},select:function(event,ui){delete input_key_pressed[16];delete input_key_pressed[219];this.value+=ui.item.value+"}";return false}})};$WK.saveExpression=function(){var mode=$WK.expression.mode;$WK.expr_saved=false;if(mode==="oneline"){$WK.expression.expr=$(".expression_oneline input").val();if($WK.expression.expr!==""){$WK.expr_saved=true}}if(mode==="conditional"){var data=[];$(".expression_conditional .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});var input_else=$(".expression_conditional .input-else input").val();data.push({type:"else",if:"true",then:input_else});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="addon"){var data=[];$(".expression_addon .input-group").each(function(){var input_if=$(this).find(".input-if input").val();var input_eq=$(this).find(".input-equation input").val();data.push({type:"condition",if:input_if,then:input_eq})});$WK.expression.expr=data;if($WK.expression.expr.length>0){$WK.expr_saved=true}}if(mode==="off"){$("input[name=_wck_expression]").val("off")}else{$("input[name=_wck_expression]").val(JSON.stringify($WK.expression))}};$WK.loadExpression=function(){if(typeof wck_load_expression==="object"){$WK.expression.mode=wck_load_expression.mode;$WK.expression.expr=wck_load_expression.expr;if($WK.expression.mode==="oneline"){$(".expression_oneline input").val($WK.expression.expr);$("input[name=_wck_choose_expression_type].expression_oneline").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}else if($WK.expression.mode==="conditional"){$.each($WK.expression.expr,function(){if(this.type==="condition"){$WK.addCondition(this.if,this.then)}else if(this.type==="else"){$(".input-else input").val(this.then)}});$("input[name=_wck_choose_expression_type].expression_conditional").prop("checked",true);$WK.showExpressionEditor()}else if($WK.expression.mode==="addon"){$.each($WK.expression.expr,function(){$WK.addCondition(this.if,this.then,true)});$("input[name=_wck_choose_expression_type].expression_addon").prop("checked",true);$WK.showExpressionEditor()}}else{$WK.expression.mode="off";$("input[name=_wck_choose_expression_type].expression_off").prop("checked",true);$WK.showExpressionEditor();$WK.addCondition()}};$("button.test-expression").on("click",function(){$WK.saveExpression()});$WK.toolbarOnTop=false;$(window).scroll(function(){if($(this).scrollTop()>100){if(!$WK.toolbarOnTop){$("#wck-toolbar").fadeOut(function(){$WK.toolbarOnTop=true;$("#wck-toolbar").css({top:"0px",bottom:"auto"}).fadeIn()})}}else if(!$("#postbox-container-2").hasClass("fullscreen")){if($WK.toolbarOnTop){$("#wck-toolbar").fadeOut(function(){$WK.toolbarOnTop=false;$("#wck-toolbar").css({top:"auto",bottom:"0px"}).fadeIn()})}}});$CV.window=$("#wck-cv-builder");$CV.builder=$CV.window.find(".builder");$CV.template=$CV.window.find(".template").children();$CV.context=null;$CV.open=function(context){$CV.context=context;var fieldSelect=$CV.template.find("select.p-field");fieldSelect.empty();$WK.saveFields();fieldSelect.append('');$.each($WK.fieldList.find(".field"),function(){if($(this).data("group")!=="static"&&!$(this).is(context)){var name=$(this).find(".f-name").val();fieldSelect.append('")}});$CV.builder.append($CV.template.clone());$CV.builder.find(".or-condition").remove();var loadData=$CV.context.find(".f-visibility").val();try{loadData=JSON.parse(loadData)}catch(e){loadData=false}if(typeof loadData==="object"){$.each(loadData,function(i,or_condition){var first=true;$.each(or_condition,function(j,and_condition){$CV.add(first?"or":"and",null,and_condition);first=false})})}else{$CV.add("or",null,null)}$CV.window.find("span.self-name").text(context.find(".f-name").val());$CV.window.show().css({display:"flex"})};$CV.close=function(){$CV.window.hide();$CV.builder.empty()};$CV.add=function(type,destination,values){if(destination===null){destination=$CV.builder.find("."+type+"-group").last()}destination.append($CV.window.find(".template ."+type+"-condition").clone());var newCondition=destination.find(".and-condition").last();if(values!==null&&typeof values==="object"){newCondition.find(".p-field").val(values.field);newCondition.find(".p-comparison").val(values.comp).trigger("change");newCondition.find(".p-value").val(values.value)}else{newCondition.find(".p-value").val("")}};$CV.validate=function(){var isValid=true;var conditions=$CV.builder.find(".and-condition");conditions.find(".validation-error").removeClass("validation-error");conditions.each(function(){var field=$(this).find(".p-field");var comp=$(this).find(".p-comparison").val();var value=$(this).find(".p-value");if([null,""].includes(field.val())){field.addClass("validation-error");isValid=false}if(!value.prop("disabled")&&value.val()===""){value.addClass("validation-error");isValid=false}if(["5","6","7","8"].includes(comp)&&!value.val().match(/^-?\d*[\.,]?\d+$/)){value.addClass("validation-error");isValid=false}if(comp==="9"&&value.val()===""){value.addClass("validation-error");isValid=false}});return isValid};$CV.window.on("click",".cv-action-and",function(e){e.preventDefault();$CV.add("and",$(this).prev(),null)});$CV.window.on("click",".cv-action-or",function(e){e.preventDefault();$CV.add("or",$(this).prev(),null)});$CV.window.on("click",".cv-remove",function(e){e.preventDefault();var count=$(this).closest(".and-group").children().length;if(count===1){$(this).closest(".or-condition").remove()}else{$(this).parent().remove()}});$CV.window.on("change","select.p-comparison",function(e){var disabled=["1","2"].includes($(this).val());var pVal=$(this).next(".p-value");pVal.prop("disabled",disabled);if(disabled){pVal.val("")}});$CV.window.on("click",".cv-close",function(e){e.preventDefault();$CV.close()});$CV.window.on("click",".cv-save",function(e){e.preventDefault();if(!$CV.validate()){alert("Please correct the form!");return false}var or_conditions=[];var or_readable=[];$.each($CV.builder.find(".or-condition"),function(){var and_conditions=[];var and_readable=[];$.each($(this).find(".and-condition"),function(){var item={field:$(this).find(".p-field").val(),comp:$(this).find(".p-comparison").val(),comp_text:$(this).find(".p-comparison option:selected").text(),value:$(this).find(".p-value").val()};and_conditions.push(item);and_readable.push("{"+item.field+"} "+item.comp_text+" "+item.value)});or_conditions.push(and_conditions);or_readable.push(" ( "+and_readable.join(" and ")+" ) ")});var readable=or_readable.join(" or ").replaceAll(" "," ");$CV.context.find(".f-visibility").val(or_conditions.length===0?"":JSON.stringify(or_conditions));$CV.context.find(".f-visibility-readable").val(readable);if(readable!==""){$CV.context.find(".visibility-readable").val("Rule preview: "+readable)}else{$CV.context.find(".visibility-readable").val("")}$CV.close()});$("body").on("click",".action-field-visibility",function(){var context=$(this).closest(".field");$CV.open(context)});$WK.init();$WK.loadExpression();$WK.autocomplete()})})(jQuery); \ No newline at end of file diff --git a/assets/js/wckalkulator.js b/assets/js/wckalkulator.js index 2e1cc80..dd49a3e 100644 --- a/assets/js/wckalkulator.js +++ b/assets/js/wckalkulator.js @@ -34,17 +34,6 @@ }); } - /* - - - - - - - - - - */ function toggleField(fieldName, rules) { var state = null; $.each(rules, function (i, or_rule) { @@ -53,7 +42,6 @@ if(field.length) { state = compare(field.val(), and_rule.comp, and_rule.value); } - console.log("state", fieldName, and_rule.field, state); return state !== false; }); if (state === true) { diff --git a/assets/js/wckalkulator.min.js b/assets/js/wckalkulator.min.js index 475e6cd..ba723a6 100644 --- a/assets/js/wckalkulator.min.js +++ b/assets/js/wckalkulator.min.js @@ -1 +1 @@ -(function($){"use strict";$(document).ready(function($){var userTimeout;var _form=wck_ajax_object.form;var shouldCalculatePrice=wck_ajax_object._wck_has_expression==="1";var CV={};if(wck_ajax_object.hasOwnProperty("_wck_visibility_rules")&&wck_ajax_object._wck_visibility_rules!==null){$.each(wck_ajax_object._wck_visibility_rules,function(fieldName,options){$("#wck_"+fieldName).hide().closest("tr").hide();CV[fieldName]=options})}function updateUI(){var formFields={};jQuery(_form+" [name^=wck").each(function(){var fieldName=$(this).attr("name").replace("wck[","").replace("]","");formFields["{"+fieldName+"}"]=$(this).val();if(CV.hasOwnProperty(fieldName)){toggleField(fieldName,CV[fieldName])}});$("span.wck-dynamic").each(function(){var expr=$(this).data("expr");var vars=expr.match(/{[^}]+}/gm);vars.forEach(function(v,i){expr=expr.replaceAll(v,formFields[v])});$(this).text(Math.round(Mexp.eval(expr)*100)/100)})}function toggleField(fieldName,rules){var state=null;$.each(rules,function(i,or_rule){$.each(or_rule,function(j,and_rule){var field=$("#wck_"+and_rule.field);if(field.length){state=compare(field.val(),and_rule.comp,and_rule.value)}console.log("state",fieldName,and_rule.field,state);return state!==false});if(state===true){$("#wck_"+fieldName).show().closest("tr").show();return false}});if(state!==true){$("#wck_"+fieldName).hide().closest("tr").hide();return false}}function compare(valueA,comp,valueB){try{switch(comp){case"1":return valueA==="";case"2":return valueA!=="";case"3":return valueA===valueB;case"4":return valueA!==valueB;case"5":case"6":case"7":case"8":var numA=Math.round(parseFloat(valueA)*1e3)/1e3;var numB=Math.round(parseFloat(valueB)*1e3)/1e3;case"5":return numAnumB;case"8":return numA>=numB;case"9":return valueA.includes(valueB)}}catch(e){return false}return false}function calculatePrice(){if(shouldCalculatePrice){var data=$(_form).serialize().replace("add-to-cart","atc")+"&action=wckalkulator_calculate_price"+"&_wck_ajax_nonce="+wck_ajax_object._wck_ajax_nonce;$.each($(_form+" input[type=file].wck_imageupload"),function(){data+="&"+$(this).attr("name")+"="+($(this)[0].files.length===1?$(this)[0].files[0].size:0)});$.post(wck_ajax_object.ajax_url,data,function(response){if(response){$("#wckalkulator-price").html(response)}})}}$("input.wck_imageupload").on("change",function(e){var size=$(this)[0].files[0].size;if(size>$(this).data("maxfilesize")*1e6){alert(wck_ajax_object._wck_i18n_maxfilesize+" Max. "+$(this).data("maxfilesize")+"MB");$(this).val("")}});$(document).on("change",_form+" input, "+_form+" select",function(){updateUI();clearTimeout(userTimeout);userTimeout=setTimeout(function(){$("#wckalkulator-price").html('...');calculatePrice()},1e3)});updateUI();calculatePrice();$("span.wck-field-tip").tipTip({attribute:"title",defaultPosition:"left"});$("input[type=checkbox][data-type='checkboxgroup']").change(function(e){var group=$(this).data("group");var required=$(this).data("required")===1;var limit=$(this).data("limit");var checked_count=$("input[type=checkbox][data-group='"+group+"']:checked").length;if(limit>0){if(checked_count>limit){$(this).prop("checked",false).blur()}}if(required&&checked_count===0){$(this).prop("checked",true)}checked_count=$("input[type=checkbox][data-group='"+group+"']:checked").length;if(checked_count>0){$("input[type=checkbox][data-group="+group+"]").get(0).setCustomValidity("")}});$(_form).submit(function(e){var lastGroup="";var _form=$(this).get(0);$("input[type=checkbox][data-type='checkboxgroup']").each(function(){var group=$(this).data("group");if(group!==lastGroup){if($(this).data("required")===1&&$("input[type=checkbox][data-group="+group+"]:checked").length===0){$("input[type=checkbox][data-group="+group+"]").get(0).setCustomValidity(wck_ajax_object._wck_i18n_required);_form.reportValidity();e.preventDefault();return false}}lastGroup=group})})})})(jQuery);!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Mexp=e():t.Mexp=e()}(self,function(){return t={28:(t,e,a)=>{var n=a(733);n.prototype.formulaEval=function(){"use strict";for(var t,e,a,n=[],o=this.value,p=0;p"+e.value+""+o[p].show+""+t.value+"",type:10}):n.push({value:(1!=e.type?"(":"")+e.value+(1!=e.type?")":"")+""+t.value+"",type:1})):2===o[p].type||9===o[p].type?(t=n.pop(),e=n.pop(),n.push({value:(1!=e.type?"(":"")+e.value+(1!=e.type?")":"")+o[p].show+(1!=t.type?"(":"")+t.value+(1!=t.type?")":""),type:o[p].type})):12===o[p].type&&(t=n.pop(),e=n.pop(),a=n.pop(),n.push({value:o[p].show+"("+a.value+","+e.value+","+t.value+")",type:12}));return n[0].value},t.exports=n},618:(t,e,a)=>{"use strict";var n=a(178);function o(t,e){for(var a=0;ag.length-2?g.length-1:t.length-v;a>0;a--)if(void 0!==g[a])for(o=0;o0&&a{"use strict";var e=function(t){this.value=t};e.math={isDegree:!0,acos:function(t){return e.math.isDegree?180/Math.PI*Math.acos(t):Math.acos(t)},add:function(t,e){return t+e},asin:function(t){return e.math.isDegree?180/Math.PI*Math.asin(t):Math.asin(t)},atan:function(t){return e.math.isDegree?180/Math.PI*Math.atan(t):Math.atan(t)},acosh:function(t){return Math.log(t+Math.sqrt(t*t-1))},asinh:function(t){return Math.log(t+Math.sqrt(t*t+1))},atanh:function(t){return Math.log((1+t)/(1-t))},C:function(t,a){var n=1,o=t-a,p=a;p{var n=a(618);n.prototype.toPostfix=function(){"use strict";for(var t,e,a,o,p,h=[],u=[{value:"(",type:4,pre:0}],s=this.value,r=1;ra)u.push(t);else{for(;a>=o&&!i||i&&o{var n=a(477);n.prototype.postfixEval=function(t){"use strict";(t=t||{}).PI=Math.PI,t.E=Math.E;for(var e,a,o,p=[],h=this.value,u=void 0!==t.n,s=0;s1)throw new n.Exception("Uncaught Syntax error");return p[0].value>1e15?"Infinity":parseFloat(p[0].value.toFixed(15))},n.eval=function(t,e,a){return void 0===e?this.lex(t).toPostfix().postfixEval():void 0===a?void 0!==e.length?this.lex(t,e).toPostfix().postfixEval():this.lex(t).toPostfix().postfixEval(e):this.lex(t,e).toPostfix().postfixEval(a)},t.exports=n}},e={},a=function a(n){var o=e[n];if(void 0!==o)return o.exports;var p=e[n]={exports:{}};return t[n](p,p.exports,a),p.exports}(28),a;var t,e,a}); \ No newline at end of file +(function($){"use strict";$(document).ready(function($){var userTimeout;var _form=wck_ajax_object.form;var shouldCalculatePrice=wck_ajax_object._wck_has_expression==="1";var CV={};if(wck_ajax_object.hasOwnProperty("_wck_visibility_rules")&&wck_ajax_object._wck_visibility_rules!==null){$.each(wck_ajax_object._wck_visibility_rules,function(fieldName,options){$("#wck_"+fieldName).hide().closest("tr").hide();CV[fieldName]=options})}function updateUI(){var formFields={};jQuery(_form+" [name^=wck").each(function(){var fieldName=$(this).attr("name").replace("wck[","").replace("]","");formFields["{"+fieldName+"}"]=$(this).val();if(CV.hasOwnProperty(fieldName)){toggleField(fieldName,CV[fieldName])}});$("span.wck-dynamic").each(function(){var expr=$(this).data("expr");var vars=expr.match(/{[^}]+}/gm);vars.forEach(function(v,i){expr=expr.replaceAll(v,formFields[v])});$(this).text(Math.round(Mexp.eval(expr)*100)/100)})}function toggleField(fieldName,rules){var state=null;$.each(rules,function(i,or_rule){$.each(or_rule,function(j,and_rule){var field=$("#wck_"+and_rule.field);if(field.length){state=compare(field.val(),and_rule.comp,and_rule.value)}return state!==false});if(state===true){$("#wck_"+fieldName).show().closest("tr").show();return false}});if(state!==true){$("#wck_"+fieldName).hide().closest("tr").hide();return false}}function compare(valueA,comp,valueB){try{switch(comp){case"1":return valueA==="";case"2":return valueA!=="";case"3":return valueA===valueB;case"4":return valueA!==valueB;case"5":case"6":case"7":case"8":var numA=Math.round(parseFloat(valueA)*1e3)/1e3;var numB=Math.round(parseFloat(valueB)*1e3)/1e3;case"5":return numAnumB;case"8":return numA>=numB;case"9":return valueA.includes(valueB)}}catch(e){return false}return false}function calculatePrice(){if(shouldCalculatePrice){var data=$(_form).serialize().replace("add-to-cart","atc")+"&action=wckalkulator_calculate_price"+"&_wck_ajax_nonce="+wck_ajax_object._wck_ajax_nonce;$.each($(_form+" input[type=file].wck_imageupload"),function(){data+="&"+$(this).attr("name")+"="+($(this)[0].files.length===1?$(this)[0].files[0].size:0)});$.post(wck_ajax_object.ajax_url,data,function(response){if(response){$("#wckalkulator-price").html(response)}})}}$("input.wck_imageupload").on("change",function(e){var size=$(this)[0].files[0].size;if(size>$(this).data("maxfilesize")*1e6){alert(wck_ajax_object._wck_i18n_maxfilesize+" Max. "+$(this).data("maxfilesize")+"MB");$(this).val("")}});$(document).on("change",_form+" input, "+_form+" select",function(){updateUI();clearTimeout(userTimeout);userTimeout=setTimeout(function(){$("#wckalkulator-price").html('...');calculatePrice()},1e3)});updateUI();calculatePrice();$("span.wck-field-tip").tipTip({attribute:"title",defaultPosition:"left"});$("input[type=checkbox][data-type='checkboxgroup']").change(function(e){var group=$(this).data("group");var required=$(this).data("required")===1;var limit=$(this).data("limit");var checked_count=$("input[type=checkbox][data-group='"+group+"']:checked").length;if(limit>0){if(checked_count>limit){$(this).prop("checked",false).blur()}}if(required&&checked_count===0){$(this).prop("checked",true)}checked_count=$("input[type=checkbox][data-group='"+group+"']:checked").length;if(checked_count>0){$("input[type=checkbox][data-group="+group+"]").get(0).setCustomValidity("")}});$(_form).submit(function(e){var lastGroup="";var _form=$(this).get(0);$("input[type=checkbox][data-type='checkboxgroup']").each(function(){var group=$(this).data("group");if(group!==lastGroup){if($(this).data("required")===1&&$("input[type=checkbox][data-group="+group+"]:checked").length===0){$("input[type=checkbox][data-group="+group+"]").get(0).setCustomValidity(wck_ajax_object._wck_i18n_required);_form.reportValidity();e.preventDefault();return false}}lastGroup=group})})})})(jQuery);!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Mexp=e():t.Mexp=e()}(self,function(){return t={28:(t,e,a)=>{var n=a(733);n.prototype.formulaEval=function(){"use strict";for(var t,e,a,n=[],o=this.value,p=0;p"+e.value+""+o[p].show+""+t.value+"",type:10}):n.push({value:(1!=e.type?"(":"")+e.value+(1!=e.type?")":"")+""+t.value+"",type:1})):2===o[p].type||9===o[p].type?(t=n.pop(),e=n.pop(),n.push({value:(1!=e.type?"(":"")+e.value+(1!=e.type?")":"")+o[p].show+(1!=t.type?"(":"")+t.value+(1!=t.type?")":""),type:o[p].type})):12===o[p].type&&(t=n.pop(),e=n.pop(),a=n.pop(),n.push({value:o[p].show+"("+a.value+","+e.value+","+t.value+")",type:12}));return n[0].value},t.exports=n},618:(t,e,a)=>{"use strict";var n=a(178);function o(t,e){for(var a=0;ag.length-2?g.length-1:t.length-v;a>0;a--)if(void 0!==g[a])for(o=0;o0&&a{"use strict";var e=function(t){this.value=t};e.math={isDegree:!0,acos:function(t){return e.math.isDegree?180/Math.PI*Math.acos(t):Math.acos(t)},add:function(t,e){return t+e},asin:function(t){return e.math.isDegree?180/Math.PI*Math.asin(t):Math.asin(t)},atan:function(t){return e.math.isDegree?180/Math.PI*Math.atan(t):Math.atan(t)},acosh:function(t){return Math.log(t+Math.sqrt(t*t-1))},asinh:function(t){return Math.log(t+Math.sqrt(t*t+1))},atanh:function(t){return Math.log((1+t)/(1-t))},C:function(t,a){var n=1,o=t-a,p=a;p{var n=a(618);n.prototype.toPostfix=function(){"use strict";for(var t,e,a,o,p,h=[],u=[{value:"(",type:4,pre:0}],s=this.value,r=1;ra)u.push(t);else{for(;a>=o&&!i||i&&o{var n=a(477);n.prototype.postfixEval=function(t){"use strict";(t=t||{}).PI=Math.PI,t.E=Math.E;for(var e,a,o,p=[],h=this.value,u=void 0!==t.n,s=0;s1)throw new n.Exception("Uncaught Syntax error");return p[0].value>1e15?"Infinity":parseFloat(p[0].value.toFixed(15))},n.eval=function(t,e,a){return void 0===e?this.lex(t).toPostfix().postfixEval():void 0===a?void 0!==e.length?this.lex(t,e).toPostfix().postfixEval():this.lex(t).toPostfix().postfixEval(e):this.lex(t,e).toPostfix().postfixEval(a)},t.exports=n}},e={},a=function a(n){var o=e[n];if(void 0!==o)return o.exports;var p=e[n]={exports:{}};return t[n](p,p.exports,a),p.exports}(28),a;var t,e,a}); \ No newline at end of file diff --git a/docs/.retype/404.html b/docs/.retype/404.html index 9d4cafa..2d75201 100644 --- a/docs/.retype/404.html +++ b/docs/.retype/404.html @@ -3,7 +3,7 @@ - + @@ -27,11 +27,11 @@ - + - + - +
    @@ -48,7 +48,7 @@
    +
    diff --git a/docs/.retype/changelog/index.html b/docs/.retype/changelog/index.html index 2d9e8ec..afd1e84 100644 --- a/docs/.retype/changelog/index.html +++ b/docs/.retype/changelog/index.html @@ -3,7 +3,7 @@ - + @@ -11,7 +11,7 @@ CHANGELOG | Custom fields and price calculator - + @@ -20,21 +20,21 @@ - + - + - + - + - +
    @@ -51,7 +51,7 @@
    +
    @@ -266,14 +266,17 @@

    CHANGELOG

    -

    2022-07-13 -v.1.3.4

    +

    2022-07-18 +v.1.4.0

    • new formula builder
    • apply filters on td elements in field's templates
    • new assignment type: product attribute
    • more columns on fieldset table
    • toggle button to publish/unpublish fieldsets quickly
    • +
    • support for stock management and stock reduction multiplier
    • +
    • layouts feature - you can choose one or two column layout
    • +
    • conditional visibility (set rules to show/hide fields)
    • bug fixes

    2022-07-11 diff --git a/docs/.retype/index.html b/docs/.retype/index.html index 3191bb0..527fce4 100644 --- a/docs/.retype/index.html +++ b/docs/.retype/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +

    @@ -51,7 +51,7 @@
    +
    diff --git a/docs/.retype/news/index.html b/docs/.retype/news/index.html index fbd1832..0f4c01a 100644 --- a/docs/.retype/news/index.html +++ b/docs/.retype/news/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    @@ -51,7 +51,7 @@
    +
    @@ -292,6 +292,19 @@
    +

    + # + Version 1.4.0 has been released +

    + +

    Update: 2022-07-18

    +

    [x] new formula builder +[x] apply filters on td elements in field's templates +[x] new assignment type: product attribute +[x] toggle button to publish/unpublish fieldsets quickly +[x] support for stock management and stock reduction multiplier +[x] layouts feature - you can choose one or two column layout

    # diff --git a/docs/.retype/resources/js/config.js b/docs/.retype/resources/js/config.js index 834d7fc..d23f4e5 100644 --- a/docs/.retype/resources/js/config.js +++ b/docs/.retype/resources/js/config.js @@ -1 +1 @@ -var __DOCS_CONFIG__ = {"id":"oQA3Ur2EqOBGMhJDWYU2o+Ea8R243gfosii","key":"qIXMvu2daZ1WVF+tM3OhMAAVgH6urlylQ8j18fyJs/Y.obQrk3+UIjoBm8XhBvz2IkZICX6573aOa28MVj0JZu2yF8QeahPGzfeoOHBex9Mo2xy3/+uVfsg7cEJqShLwXw.35","base":"/","host":"wckalkulator.com","version":"1.0.0","useRelativePaths":true,"documentName":"index.html","appendDocumentName":false,"trailingSlash":true,"preloadSearch":false,"cacheBustingToken":"2.3.0.711062443785","cacheBustingStrategy":"query","sidebarFilterPlaceholder":"Filter","toolbarFilterPlaceholder":"Filter","showSidebarFilter":true,"filterNotFoundMsg":"No member names found containing the query \"{query}\"","maxHistoryItems":15,"homeIcon":"","access":[{"value":"public","label":"Public"},{"value":"protected","label":"Protected"}],"toolbarLinks":[{"id":"fields","label":"Fields"},{"id":"properties","label":"Properties","shortLabel":"Props"},{"id":"methods","label":"Methods"},{"id":"events","label":"Events"}],"sidebar":[{"n":"/","l":"WC Kalkulator","s":""},{"n":"news","l":"News","s":""},{"n":"usermanual","l":"User Manual","c":false,"o":true,"i":[{"n":"about","l":"About the Plugin","s":""},{"n":"installation","l":"Installation","s":""},{"n":"fields","l":"Field Types","s":""},{"n":"calculation-types","l":"Calculation Modes","s":""},{"n":"expression-syntax","l":"Expression Syntax","s":""},{"n":"example-expressions","l":"Formula Examples","s":""},{"n":"usage","l":"Usage","s":""},{"n":"advanced_usage","l":"Advanced Usage","s":""},{"n":"templates","l":"Templates","s":""},{"n":"import_export","l":"Import/Export","s":""},{"n":"uninstall","l":"Uninstallation","s":""},{"n":"videos","l":"Video Tutorials","s":""}],"s":""},{"n":"changelog","l":"CHANGELOG","s":""}],"search":{"mode":0,"minChars":2,"maxResults":20,"placeholder":"Search","hotkeys":["/"],"noResultsFoundMsg":"Sorry, no results found.","recognizeLanguages":true,"languages":[0],"preload":false}}; +var __DOCS_CONFIG__ = {"id":"TbeT3207fp3zCqUCEjy90mnjM3Uvag2nhg7","key":"/cEcl8/TbJ96QpGg4AZ1aDHdcQtPVdkz4pUVXjHQQbc.tLw1wxqGzetSJz/GdcNSPR3iHulst0QSV77Me7efGZ1jle0PeLUO0ceeYcw5Cn65uMUwzCGtRA5crjTiaPeNRw.43","base":"/","host":"wckalkulator.com","version":"1.0.0","useRelativePaths":true,"documentName":"index.html","appendDocumentName":false,"trailingSlash":true,"preloadSearch":false,"cacheBustingToken":"2.3.0.711755910061","cacheBustingStrategy":"query","sidebarFilterPlaceholder":"Filter","toolbarFilterPlaceholder":"Filter","showSidebarFilter":true,"filterNotFoundMsg":"No member names found containing the query \"{query}\"","maxHistoryItems":15,"homeIcon":"","access":[{"value":"public","label":"Public"},{"value":"protected","label":"Protected"}],"toolbarLinks":[{"id":"fields","label":"Fields"},{"id":"properties","label":"Properties","shortLabel":"Props"},{"id":"methods","label":"Methods"},{"id":"events","label":"Events"}],"sidebar":[{"n":"/","l":"WC Kalkulator","s":""},{"n":"news","l":"News","s":""},{"n":"usermanual","l":"User Manual","c":false,"o":true,"i":[{"n":"about","l":"About the Plugin","s":""},{"n":"installation","l":"Installation","s":""},{"n":"fields","l":"Field Types","s":""},{"n":"calculation-types","l":"Calculation Modes","s":""},{"n":"expression-syntax","l":"Expression Syntax","s":""},{"n":"example-expressions","l":"Formula Examples","s":""},{"n":"usage","l":"Usage","s":""},{"n":"advanced_usage","l":"Advanced Usage","s":""},{"n":"templates","l":"Templates & Layouts","s":""},{"n":"inventory","l":"Stock Management","s":""},{"n":"import_export","l":"Import/Export","s":""},{"n":"uninstall","l":"Uninstallation","s":""},{"n":"videos","l":"Video Tutorials","s":""}],"s":""},{"n":"changelog","l":"CHANGELOG","s":""}],"search":{"mode":0,"minChars":2,"maxResults":20,"placeholder":"Search","hotkeys":["/"],"noResultsFoundMsg":"Sorry, no results found.","recognizeLanguages":true,"languages":[0],"preload":false}}; diff --git a/docs/.retype/resources/js/config.min.js b/docs/.retype/resources/js/config.min.js index fb8ba98..0a4959f 100644 --- a/docs/.retype/resources/js/config.min.js +++ b/docs/.retype/resources/js/config.min.js @@ -1 +1 @@ -var __DOCS_CONFIG__={id:"oQA3Ur2EqOBGMhJDWYU2o+Ea8R243gfosii",key:"qIXMvu2daZ1WVF+tM3OhMAAVgH6urlylQ8j18fyJs/Y.obQrk3+UIjoBm8XhBvz2IkZICX6573aOa28MVj0JZu2yF8QeahPGzfeoOHBex9Mo2xy3/+uVfsg7cEJqShLwXw.35",base:"/",host:"wckalkulator.com",version:"1.0.0",useRelativePaths:true,documentName:"index.html",appendDocumentName:false,trailingSlash:true,preloadSearch:false,cacheBustingToken:"2.3.0.711062443785",cacheBustingStrategy:"query",sidebarFilterPlaceholder:"Filter",toolbarFilterPlaceholder:"Filter",showSidebarFilter:true,filterNotFoundMsg:'No member names found containing the query "{query}"',maxHistoryItems:15,homeIcon:'',access:[{value:"public",label:"Public"},{value:"protected",label:"Protected"}],toolbarLinks:[{id:"fields",label:"Fields"},{id:"properties",label:"Properties",shortLabel:"Props"},{id:"methods",label:"Methods"},{id:"events",label:"Events"}],sidebar:[{n:"/",l:"WC Kalkulator",s:''},{n:"news",l:"News",s:''},{n:"usermanual",l:"User Manual",c:false,o:true,i:[{n:"about",l:"About the Plugin",s:''},{n:"installation",l:"Installation",s:''},{n:"fields",l:"Field Types",s:''},{n:"calculation-types",l:"Calculation Modes",s:''},{n:"expression-syntax",l:"Expression Syntax",s:''},{n:"example-expressions",l:"Formula Examples",s:''},{n:"usage",l:"Usage",s:''},{n:"advanced_usage",l:"Advanced Usage",s:''},{n:"templates",l:"Templates",s:''},{n:"import_export",l:"Import/Export",s:''},{n:"uninstall",l:"Uninstallation",s:''},{n:"videos",l:"Video Tutorials",s:''}],s:''},{n:"changelog",l:"CHANGELOG",s:''}],search:{mode:0,minChars:2,maxResults:20,placeholder:"Search",hotkeys:["/"],noResultsFoundMsg:"Sorry, no results found.",recognizeLanguages:true,languages:[0],preload:false}}; \ No newline at end of file +var __DOCS_CONFIG__={id:"TbeT3207fp3zCqUCEjy90mnjM3Uvag2nhg7",key:"/cEcl8/TbJ96QpGg4AZ1aDHdcQtPVdkz4pUVXjHQQbc.tLw1wxqGzetSJz/GdcNSPR3iHulst0QSV77Me7efGZ1jle0PeLUO0ceeYcw5Cn65uMUwzCGtRA5crjTiaPeNRw.43",base:"/",host:"wckalkulator.com",version:"1.0.0",useRelativePaths:true,documentName:"index.html",appendDocumentName:false,trailingSlash:true,preloadSearch:false,cacheBustingToken:"2.3.0.711755910061",cacheBustingStrategy:"query",sidebarFilterPlaceholder:"Filter",toolbarFilterPlaceholder:"Filter",showSidebarFilter:true,filterNotFoundMsg:'No member names found containing the query "{query}"',maxHistoryItems:15,homeIcon:'',access:[{value:"public",label:"Public"},{value:"protected",label:"Protected"}],toolbarLinks:[{id:"fields",label:"Fields"},{id:"properties",label:"Properties",shortLabel:"Props"},{id:"methods",label:"Methods"},{id:"events",label:"Events"}],sidebar:[{n:"/",l:"WC Kalkulator",s:''},{n:"news",l:"News",s:''},{n:"usermanual",l:"User Manual",c:false,o:true,i:[{n:"about",l:"About the Plugin",s:''},{n:"installation",l:"Installation",s:''},{n:"fields",l:"Field Types",s:''},{n:"calculation-types",l:"Calculation Modes",s:''},{n:"expression-syntax",l:"Expression Syntax",s:''},{n:"example-expressions",l:"Formula Examples",s:''},{n:"usage",l:"Usage",s:''},{n:"advanced_usage",l:"Advanced Usage",s:''},{n:"templates",l:"Templates & Layouts",s:''},{n:"inventory",l:"Stock Management",s:''},{n:"import_export",l:"Import/Export",s:''},{n:"uninstall",l:"Uninstallation",s:''},{n:"videos",l:"Video Tutorials",s:''}],s:''},{n:"changelog",l:"CHANGELOG",s:''}],search:{mode:0,minChars:2,maxResults:20,placeholder:"Search",hotkeys:["/"],noResultsFoundMsg:"Sorry, no results found.",recognizeLanguages:true,languages:[0],preload:false}}; \ No newline at end of file diff --git a/docs/.retype/resources/js/search.json b/docs/.retype/resources/js/search.json index baca019..88e0b6c 100644 --- a/docs/.retype/resources/js/search.json +++ b/docs/.retype/resources/js/search.json @@ -1 +1 @@ -[[{"l":"WC Kalkulator"},{"l":"Custom Fields and Price Calculator for WooCommerce","p":["WC Kalkulator (WCK) is a WordPress plugin which extends the WooCommerce to use custom extra fields with products and orders. Extra product fields can be used to calculate product price and save information in order details.","Absolutely FREE plugin with PRO features","22 field types to get customer input","Price calculation based on formula, conditional expression or price add-ons.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!","You can sell products by anything. You are not limited to sell only by length, area, volume, etc. You decide how the prices will be calculated."]},{"i":"what-makes-wc-kalkulator-unique-","l":"What makes WC Kalkulator unique ?","p":["When designing the functionality of the plugin, we wanted to obtain software that would be easy to use and highly configurable and suitable for any type of store.","The plugin allows full freedom to define fields and formulas for calculating the price. Some of fields are not used in formulas, but you can use it to get informations from Customer (for example: text, date, date range, color, dropdown, etc.)","The plugin is designed to work with multisite mode. We encourage you to contact us and request new features.","If you appreciate my work - Buy me a Coffee or Donate via PayPal"]},{"i":"22-field-types-all-free","l":"22 Field Types (ALL FREE)"},{"l":"Definitions","p":["Field- is used to get user's input on the woocommerce product page. Custom Field can be used to calculate the price (is used in formula)","Fieldset- store manager can create the fieldset (set of custom product fields) which consists of different Fields. Fieldset must have at least one Field and the expression (formula) to calculate the product price","Expression/Formula- mathematical and/or logical expression using to calculate the woocommerce custom price. The expression can be single-line (one-line) or conditional. Expression is protected and calculated only server-side.","Validation- each Field has specific requirements to be met. Incorrect values make it impossible to calculate the woocommerce custom price and add the product to the cart.","Global Parameters- are numeric variables which can be used in formulas across all fieldsets."]},{"i":"formulaexpression-builder","l":"Formula/Expression Builder","p":["Use field's values as variables to calculate product price. Drag&drop conditional statements."]},{"l":"Price Add-Ons","p":["Use custom fields to make Product Add-Ons. This feature is experimental and will be continued in the next releases."]},{"l":"Display Fields","p":["Assign fields to products, categories or product tags. Include/exclude options. Mass assignment."]},{"l":"Validation","p":["Each field has built-in validation tests on user input. You can define additional conditions."]},{"l":"Protected Formula","p":["The price is calculated server-side only, so the Client can't see exact expression."]},{"l":"Advanced Customization","p":["Field HTML templates can be overloaded in your theme file. Each field has CSS class to set custom styles."]},{"l":"Functions","p":["You can use basic math functions in the formula. Fields such as Multi-checkbox, Date Picker, Date Range Picker has additional functions to get sum, min, max value or get date, days between dates values as number."]},{"l":"Global Parameters","p":["You can define numeric variable across all fieldsets. You can modify all prices by global parameters."]},{"l":"Cart","p":["The customer can edit product options after adding to cart."]},{"l":"Compatibility","p":["multisite mode is supported","product shortcodes","translation","virtual and variable products are supported","product regular and sale prices are supported","product tags"]},{"l":"More Features","p":["ability to edit product fields after from a cart","additional functions for radio group, checkbox group (sum, max, min), range date picker (days between dated)","attach fieldset to: all products/catgories/tags, selected products/categories/tags","customizable HTML code of every field","define single-line expression to calculate the price","define unlimited conditional expressions to calculate the price","define unlimited fieldsets with unlimited fields","every field has built-in validation tests","expression builder","fields are displayed in product page, cart and order details,","global parameters can be defined and used in formula","HMTL template of every field can be overridden in a theme directory","math functions to use in the expression","product shortcodes are supported","regular and sale price are supported","static fields such as HTML, Heading, Paragraph, Hidden, Link, Attachment","supported multisite","supported price filters","supported variable products","the formula is protected and will not be shown to the user- the price is calculated only server-side","the plugin is translatable","the product will be removed from user's cart when shop manager updates the fieldset settings","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"News","p":["This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]},{"i":"version-130-has-been-released","l":"Version 1.3.0 has been released","p":["Update: 2022-07-04","Price Add-ons","Image upload field","Use dynamic formula in a static field's contents","Settings page","Strlen() function to get a text length"]},{"i":"version-120-has-been-released","l":"Version 1.2.0 has been released","p":["Update: 2022-06-13","many new fields","static fields","field's built-in modifiers","global parameters","functions in expressions","customer can edit product in the cart"]},{"i":"what-we-are-working-on","l":"What we are working on?","p":["a new field: file upload,","add a price parameter to all fields and use the value in the formula,","add global fields, so the product could have a one fieldset with calculations and global fields.","add priority for fieldsets","allow editing fields in the user's cart,","apply fieldsets to categories,","Apply for a new feature by clicking the link at the top.","assign to all products/categories, except ...","customizable field's template","mass assignment of fieldsets to products,","some bug fixes reported by users","stock management for numeric fields,","Update: 2022-01-21","Update: 2022-02-18","We are working on new features:","We released new version 1.1.0 which gives more flexibility and performance. We have also added new features, blow:"]}],[{"l":"About the Plugin","p":["The plugin extends the Woocommerce store with the ability to add your own fields to the product page. Almost all fields are used in formulas to calculate a custom price for a product. The plugin allows full freedom to define fields and formulas for calculating the price. Some of fields can be used to get informations from Customer (for example: text, date, date range, color, dropdown, etc.)","The plugin is designed to work with multisite mode. We encourage you to contact us and request new features.","If you appreciate my work - Buy me a Coffee or Donate via PayPal"]},{"l":"Definitions","p":["Field- is used to get user's input on the product page. Field can be used to calculate the price (is used in formula)","Fieldset- store manager can create the fieldset which consists of different Fields. Fieldset must have at least one Field and the expression (formula) to calculate the product price","Expression/Formula- mathematical and/or logical expression using to calculate the product price. The expression can be single-line (one-line) or conditional. Expression is protected and calculated only server-side.","Validation- each Field has specific requirements to be met. Incorrect values make it impossible to calculate the price and add the product to the cart.","Global Parameters- are numeric variables which can be used in formulas across all fieldsets."]},{"l":"Requirements","p":["Minimum tested version, but not recommended","Wordpress v.5.0","Woocommerce v.3.5.0","Maximum tested version","Wordpress v.6.0.0","Woocommerce v.6.6.1","Recommended version","We strongly recommend to use most recent versions of Wordpress and Woocommerce. There is no restriction to PHP version, but please note that PHP below 7.4 is marked as end-of-life. We recommend using PHP7.4 and above. PHP7.4 is supported in Wordpress v5.3 and above.","Supported PHP versions PHP compatibility and Wordpress versions"]},{"l":"Dependencies","p":["Symfony ExpressionLanguage Component","jQuery, jQuery UI (built in Wordpress Core)","Math Expression Evaluator by bugwheels94"]},{"l":"Features","p":["ability to edit product fields after from a cart","additional functions for radio group, checkbox group (sum, max, min), range date picker (days between dated)","attach fieldset to: all products/catgories/tags, selected products/categories/tags","customizable HTML code of every field","define single-line expression to calculate the price","define unlimited conditional expressions to calculate the price","define unlimited fieldsets with unlimited fields","dynamic formula in a static field's contents","every field has built-in validation tests","expression builder","fields are displayed in product page, cart and order details,","global parameters can be defined and used in formula","HTML template of every field can be overridden in a theme directory","image upload field (use file size in formula/expression)","math functions to use in the expression","product shortcodes are supported","regular and sale price are supported","static fields such as HTML, Heading, Paragraph, Hidden, Link, Attachment","supported multisite","supported price filters","supported variable products","the formula is protected and will not be shown to the user- the price is calculated only server-side","the plugin is translatable","the product will be removed from user's cart when shop manager updates the fieldset settings","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]},{"l":"Conflict with other plugins","p":["This plugin has been tested only with Wordpress and Woocommerce without additional plugins. Note that there may be a conflict with plugins that modifies the product price and user's cart, or has similar functionality. This section will be updated and conflicts will be resolved.","We know about issue with displaying prices in a cart page. In some themes there's an issue with cart page. Theme should display cart item price instead of product price. The plugin modifies cart items, but not products itself."]}],[{"l":"Installation","p":["Installation process is the same as for other plugins. The plugin does not require configuration, it is ready to use. The plugin creates new post type - Fieldset.","The plugin adds new menu in Products> WCK Fieldsets.","Plugin supports Wordpress Multisite feature. Fieldsets are separate for each site.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Field Types","p":["The plugin comes with several built-in fields to be used on the product page. Please contact us if you need to add new field types. We are working on the ability to build custom fields as extensions for the plugin. We would like to meet your expectations as much as possible.","Each field has its own parameters, but some parameters are the same for every field. See the list below:","Parameter","Description","Name","Unique field name used in plugin code. It must consist of A-Z, a-z or underscore. For example: product_width, table_height, etc.","Title","Field name showed to the User. For example: Product width, Table height","Hint for Customer","Help message showed in tooltip. For example: Please choose product color from the list.","CSS Class","CSS class applied to the HTML code of the field. You can define additional styles in custom .css files in theme.","Price","If the field is filled in by the customer, the price will be used in the formula. Otherwise the price is 0. This parameter is not present for the: number field and select field.","See Templates section to know how to modify HTML code of any field."]},{"l":"Number","p":["Number Field is the basic field to use in the plugin. It is standard single-line input field, which takes a numeric value and can be used in a formula/expression.","This field is required by default.","Parameter","Description","Min. value","The minimum value of the field","Max. value","The maximum value of the field","Default value","Initial value of the field. This value is loaded into field when user opens the product page."]},{"l":"Select","p":["Select Field is a standard dropdown field. You must define numeric value of options, because this field is used in the formula/expression.","This field is required by default."]},{"l":"Checkbox","p":["Parameter","Description","Default state","Default state of checkbox. Select this option if you want the field to be checked by default"]},{"l":"Color Picker","p":["Color Picker is a standard input text field with jQuery wpColorPicker and IRIS. JS files are bundled in the Wordpress Core.","Parameter","Description","Required","Select this option to make the field required"]},{"l":"Date Picker","p":["Date Picker is a standard input text field with jQuery UI Datepicker. JS files are bundled in the Wordpress Core.","Parameter","Description","Required","Select this option to make the field required.","Disallow past date","Select this option to prohibit the user from selecting a date earlier than today."]},{"l":"Range Date Picker","p":["Range Date Picker includes two Date Picker fields connected with each other.","Parameter","Description","Required","Select this option to make the field required.","Disallow past date","Select this option to prohibit the user from selecting a date earlier than today."]},{"l":"Dropdown","p":["Dropdown field is almost the same as Select field. This field accepts text values.","Parameter","Description","Required","Select this option to make the field required."]},{"l":"Text","p":["Note that defining Min. length greater than zero makes the field required. Even if you have not checked Required option.","Parameter","Description","Required","Select this option to make the field required.","Min. length","The minimum number of characters that the user can enter.","Max. length","The maximum number of characters that the user can enter.","Placeholder","Support text displayed inside the field. This is not the default value for the field. May be used as a guideline for the user."]},{"l":"Textarea","p":["Note that defining Min. length greater than zero makes the field required. Even if you have not checked Required option.","Parameter","Description","Required","Select this option to make the field required.","Min. length","The minimum number of characters that the user can enter.","Max. length","The maximum number of characters that the user can enter.","Placeholder","Support text displayed inside the field. This is not the default value for the field. May be used as a guideline for the user."]},{"l":"E-mail","p":["E-mail field is used to get e-mail address from the Customer input. This field has an e-mail validation test.","Parameter","Description","Required","Select this option to make the field required.","Min. length","The minimum number of characters that the user can enter.","Max. length","The maximum number of characters that the user can enter.","Placeholder","Support text displayed inside the field. This is not the default value for the field. May be used as a guideline for the user."]},{"l":"Radio","p":["Radio field is used to display a group of radio buttons. It has similar funcationality to the Select field, so u can use option's values in the formula/expression.","This field is required by default."]},{"i":"checkbox-group-multi-checkbox","l":"Checkbox Group (Multi Checkbox)","p":["Checkbox Group is used to display a group of checkboxes. It is possible to define selection limit (i.e. customer can choose max 2 options)."]},{"l":"Color Swatches","p":["Color Swatches are shown as square thumbnails, which may be selected by a customer. Each options has a numeric value to use in a formula."]},{"l":"Image Swatches","p":["Image Swatches works like Color Swatches, but you can define images instead of colors."]},{"l":"Image Select","p":["Image Select works similar to Image Swatches, but you can define Caption/Title for each image option."]},{"i":"static-html","l":"Static: HTML","p":["Displays content from a HTML code. It is filtered by wp_kses_post. You can use dynamic expression in the contents, for example: {={field_1}*{field_2}/1000}"]},{"i":"static-attachment","l":"Static: Attachment","p":["You can add file/media attachment, to be downloaded by the Customer on product page."]},{"i":"static-heading","l":"Static: Heading","p":["You can add heading h1-h6 in product page"]},{"i":"static-paragraph","l":"Static: Paragraph","p":["You can add text in paragraph tag in product page. You can use dynamic expression in the contents, for example: {={field_1}*{field_2}/1000}"]},{"i":"static-hidden","l":"Static: Hidden","p":["You can add hidden input fields to store predefined values. This field does not accept user input."]},{"i":"static-link","l":"Static: Link","p":["You can add link to any website, file attachment, URL."]},{"l":"Image upload","p":["You can get image file from the customer. Files are saved in customer directory on checkout. Go to Settings Page to set cron jobs invervals. Files are uploaded to the temp directory and will be deleted after time. Files will be kept longer if the customer places an order. Customer files will be deleted after 360 days (default option), but you can set your own interval.","You can use file size [MB] parameter in formulas.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Calculation Modes","p":["The Plugin comes with several calculation modes. You can choose one of mentioned below:","OFF- price calculation is turned off. This mode can be use to get user input without changing the product price","Single-line Formula- it is a simple single-line math expression without any logical conditions","Conditional Expression- if the condition if is met, calculate the price according to the assigned formula in = field. You can use multiple conditions. The else formula is used when none of the conditions are met.","Price Add-ons- if the condition if is met, the product price is increased by add value. You can use multiple conditions with all available functions and operators. Both if and add field accepts math and logical expression with variables.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Expression Syntax"},{"l":"Field names"},{"l":"Arithmetic operators"},{"l":"Comparision Operators"},{"l":"Logical Operators"},{"l":"Math Functions","p":["This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Formula Examples","p":["In this section, we cover examples of how to use mathematical formulas and expressions. Some of the examples are based on questions asked by users."]},{"i":"1-how-to-add-value-to-a-price-so-that-it-is-not-multiplied-by-quantity","l":"1. How to add value to a price so that it is not multiplied by quantity?","p":["By default, the unit price of the product is calculated. If the customer wants to buy, for example, 2 pieces of a product, the calculated price is multiplied by 2. What to do if we want to add a certain value once, regardless of the quantity purchased. The solution is to divide value by {quantity}. Let's see the example. {field_1} will by multiplied by quantity, but {field_2} is added once."]},{"i":"2-how-to-add-price-for-every-character-in-text-field-","l":"2. How to add price for every character in text field ?","p":["Let's say we have a text field that has to be between 1 and 10 characters long. The price of the product is to change depending on the number of characters entered.","Solution #1 - price per character is constans","Solution #2 - price is different for each character","Next we have to build the formula. We have {global:price_per_char} array and we need to get single value by index. The index is strlen({my_field:text}) - 1, so complete formula looks like this:","Solution #3 - use Price Add-on mode and write multiple if and add expressions. For example:"]},{"i":"3-each-product-has-width-and-height-user-gives-only-one-dimension-and-the-price-is-proportional-to-the-calculated-area","l":"3. Each product has width and height. User gives only one dimension and the price is proportional to the calculated area.","p":["User has to input width, but the height will be calculated with proportions from product dimensions.","First of all, set the product width and height in the product options, so we will be using {product_width} and {product_height} variables. Video: How to use product dimensions. Create number field and name it width. The height will be calculated as proportional to the product dimensions. Look at this equations:","If the price per unit equals 99,00 USD, the result formula will be:","The same formula with \"height\" field instead of \"width\""]},{"i":"4-how-to-decrease-product-price-for-logged-user-by--1000-usd-or-by--5-","l":"4. How to decrease product price for logged user by -10,00 USD or by -5 %","p":["We have built-in variable {is_user_logged} which takes values 1 or 0. So the result formula will be:","or","You must be careful when decreasing prices, because it may be 0 or negative. To protect this, use max() function."]}],[{"l":"Usage","p":["Here we explain how to work with the plugin. Please read carefully whole page. Feel free to contact us if something is not clear.","WCK YouTube tutorials","Plugin supports Wordpress Multisite feature. Fieldsets are separate for each site."]},{"l":"Adding new Fieldset","p":["Navigate to Products > WCK Fieldsets in Wordpress dashboard.","Click Add Fieldset to create new one. The empty form looks like below:","Fieldset Title is used only in Wordpress dashboard","Assign to- you can assign this fieldset to products, categories or tags. If product has more than one fieldset, you can set priority.","Higher value have higher priority","Product Fields Settings- here you set options for each field.","Add Field- click on the button to add the field of selected type.","Price Calculation- here you define the formula/expression to calculate the product price. You can choose single-line or conditional mode.","Price Filtering- this option changes product prices in catalog. For example you can set the product price to: from 99,99 USD/m2"]},{"l":"Defining fields","p":["Fields can be added, deleted and reordered (drag&drop). Parameters of each field are described in the Field Types section.","If you appreciate my work - Buy me a Coffee or Donate via PayPal","All settings are validated when saving. Fieldset cannot be saved in case of errors.","Select and Dropdown field has ability to add, delete, import options. You can choose the default option for the field.","The example below shows the Select field with two options with a default option. In this case the first option is default."]},{"l":"Defining expressions","p":["You are responsible for preparing the correct formula, mathematically and logically correct. Be careful and always test expressions. The result (the price) has to be a positive number greater than zero. It is validated during the calculation process.","The Expression can be defined as single-line or conditional. You can use Number and Select fields as variables in the formula. You can also use other fields in the expression and predefined variables {product_price}, {product_regular_price}, {quantity}","Some other fields has a price option. For example the text field {my_text} has price 50,00 USD and is not required. If the customer fill in this field the price of the field will be 50,00. But if the customer leaves this field empty the price will be 0,00. It is important if you take {my_text} in your expression.","The \"=\" (equals sign) is the calculated product price. The plugin checks the conditions one by one. If the condition is true, it returns the value of the assigned formula.","First option - single-line expression:","Second option - conditional expression:","Expression builder has simple autocompletion feature. Please click Update list to add fields to autocompletion. When you type the formula, enter \"{\" sign and you see the list of available fields."]},{"l":"Example of conditional expression","p":["First, we have to define two Number or Select fields named width and height. The price of the product can be 100 USD, 200 USD or (300+area* 0.05) USD.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Advanced Usage"},{"i":"how-to-get-input-text-length-character-count-","l":"How to get input text length (character count) ?","p":["Add text field with name field_name.","You can get input text using {field_name:text}. There's strlen() function which returns text length, so strlen({field_name:text}) returns input characters count."]},{"i":"how-to-use-multi-checkbox-field-","l":"How to use Multi Checkbox field ?","p":["Let's add multi checkbox field named field_mcb. You can use in expression:","{field_mcb:sum}- sum of selected values","{field_mcb:min}- minimal selected value","{field_mcb:max}- maximal selected value"]},{"i":"how-to-use-range-date-picker-field-","l":"How to use Range Date Picker field ?","p":["Range date picker has two input fields - \"from\" and \"to\" dates. Let's add a new field named rdp","{rdp:date_from}- date \"from\" as unix timestamp","{rdp:date_to}- date \"to\" as unix timestamp","{rdp:days}- number of days between two dates (absolute integer)"]},{"i":"how-deal-with-upload-field-","l":"How deal with Upload field ?","p":["Add Upload/Image Upload field named file","{file}- returns field price defined in the \"Price\" option","{file:size}- returns input file size in MB"]},{"i":"products-variables","l":"Product's variables","p":["Expression builder comes with several built-in variables to use in expressions. The value of that parameters is according to the current product and may be different for each product.","{product_price}- current product price (sale or regular)","{product_regular_price}- current product regular price","{product_weight}- current product weight from Product Data > Shipping","{product_width}- current product width from Product Data > Shipping","{product_height}- current product height from Product Data > Shipping","{product_length}- current product length from Product Data > Shipping","{is_user_logged}- 1 if current visitor is logged in, 0 otherwise","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Templates","p":["WC Kalkulator v1.1.0 brings a new approach to modifying the appearance of fields. Every file in view directory can be overriden. Just copy file from the view directory to the themes/your-theme/wc-kalkulator directory and make your modifications.","For example: view/fields/front/text.php should be copied to the /themes/your-theme/wc-kalkulator/fields/front/text.php"]},{"l":"Structure of the view directory","p":["Files","Description","views/fields/front/*.php","Template files for every field rendered on the produt page","views/woocommerce/catalog_price.php","Template for the price filter - prefix, price, suffix.","views/woocommerce/price_block.php","Template for the \"Total\" in the product page","views/woocommerce/product.php","Container for the fields on the product page"]},{"l":"Filters and Hooks","p":["Example filter to change td class=label tag in field template","Example filter to change td class=value tag in field template","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"i":"importexport-fieldsets","l":"Import/Export fieldsets","p":["WC Kalkulator is built on the new Post Type, which is full compatible with core import/export functionality in Wordpress. Navigate to Tools Export to export Fieldset post type to XML file. Use Tools Import to import that file.","You can also use any importer/exporter plugin in Wordpress.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Uninstallation","p":["The plugin may be deactivated without losing any of its data.","When the plugin is deactivated, it is possible to uninstall it. During the uninstallation process, all data will be deleted from the Wordpress database.","If you want to save all data for later, please export to the XML file.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Video Tutorials","p":["This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]},{"l":"1. Basic Usage"},{"i":"2-how-to-work-with-fieldsets-priority-","l":"2. How to work with fieldset's priority ?"},{"i":"3-how-to-use-date-pickers-","l":"3. How to use Date Pickers ?"},{"i":"4-what-is-global-parameter-and-how-to-use-it-","l":"4. What is Global Parameter and how to use it ?"},{"i":"5-how-to-use-text-input-and-count-text-length-","l":"5. How to use text input and count text length ?"},{"i":"6-how-to-set-custom-field-template-template-overriding-","l":"6. How to set custom field template (template overriding) ?"},{"i":"7-how-to-use-product-dimensions-and-weight-in-formula-","l":"7. How to use product dimensions and weight in formula ?"},{"i":"8-how-to-set-different-price-for-loggedunlogged-users-","l":"8. How to set different price for logged/unlogged users ?"},{"i":"9-how-to-use-arrays-and-json-objects-in-global-parameters-","l":"9. How to use arrays and json objects in Global Parameters ?"}],[{"l":"CHANGELOG","p":["2022-01-20 v.1.0.0","2022-02-18 v.1.1.0","2022-04-20 v.1.1.1","2022-05-08 v.1.1.2","2022-06-13 v.1.2.0","2022-06-13 v.1.2.1","2022-06-14 v.1.2.2","2022-06-15 v.1.2.3","2022-07-04 v.1.3.0","2022-07-06 v.1.3.1","2022-07-07 v.1.3.2","2022-07-11 v 1.3.3","2022-07-13 v.1.3.4","add notices","added a price option to all fields","Added new fields: email, radio","added support for array and json objects in global parameters","added the priority option to fieldsets","Additional functions for radio group, checkbox group (sum, max, min), range date picker (days between dated)","apply filters on td elements in field's templates","Assign fieldset to product's tags","assign the fieldset to products/categories on the fieldset's edit page","Bug fix","Bug fixed: missing numberposts argument on get_posts()","Bug fixed: str_replace on array","bug fixes","cron jobs to keep uploaded files clean","Customer can edit cart item","field's template can be overrided in your theme folder","fieldset post type","fixed field builder (js script issue)","fixed issue with price calculation","fixed typo in HTML code for dropdown and select fields","Global parameters can be defined and used in formula","Image upload field added – you can use file size parameter in expressions","Initial release","Math functions to use in the expression","more columns on fieldset table","new assignment type: product attribute","new calculation mode - Price Add-ons","new edit page","New fields: image select, image swatches, color swatches, checkbox group (multicheckbox), HTML, Heading, Paragraph, Hidden, Link, Attachment","new formula builder","new variable to determine if current visitor is logged in","new variables to get product's weight, width, height, length","performance fixes","Settings page added – you can define custom product form selector, you can toggle error messages for admin/manager","strlen() function added to expressions – it returns text length","text field has new option: pattern (regexp)","toggle button to publish/unpublish fieldsets quickly","upload path settings","you can use formulas in HTML/Paragraph field, for example: {=*/100}"]}]] \ No newline at end of file +[[{"l":"WC Kalkulator"},{"l":"Custom Fields and Price Calculator for WooCommerce","p":["WC Kalkulator (WCK) is a WordPress plugin which extends the WooCommerce to use custom extra fields with products and orders. Extra product fields can be used to calculate product price and save information in order details.","Absolutely FREE plugin with PRO features","22 field types to get customer input","Price calculation based on formula, conditional expression or price add-ons.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!","You can sell products by anything. You are not limited to sell only by length, area, volume, etc. You decide how the prices will be calculated."]},{"i":"what-makes-wc-kalkulator-unique-","l":"What makes WC Kalkulator unique ?","p":["When designing the functionality of the plugin, we wanted to obtain software that would be easy to use and highly configurable and suitable for any type of store.","The plugin allows full freedom to define fields and formulas for calculating the price. Some of fields are not used in formulas, but you can use it to get informations from Customer (for example: text, date, date range, color, dropdown, etc.)","The plugin is designed to work with multisite mode. We encourage you to contact us and request new features.","If you appreciate my work - Buy me a Coffee or Donate via PayPal"]},{"i":"22-field-types-all-free","l":"22 Field Types (ALL FREE)"},{"l":"Definitions","p":["Field- is used to get user's input on the woocommerce product page. Custom Field can be used to calculate the price (is used in formula)","Fieldset- store manager can create the fieldset (set of custom product fields) which consists of different Fields. Fieldset must have at least one Field and the expression (formula) to calculate the product price","Expression/Formula- mathematical and/or logical expression using to calculate the woocommerce custom price. The expression can be single-line (one-line) or conditional. Expression is protected and calculated only server-side.","Validation- each Field has specific requirements to be met. Incorrect values make it impossible to calculate the woocommerce custom price and add the product to the cart.","Global Parameters- are numeric variables which can be used in formulas across all fieldsets."]},{"i":"formulaexpression-builder","l":"Formula/Expression Builder","p":["Use field's values as variables to calculate product price. Drag&drop conditional statements."]},{"l":"Price Add-Ons","p":["Use custom fields to make Product Add-Ons. This feature is experimental and will be continued in the next releases."]},{"l":"Display Fields","p":["Assign fields to products, categories or product tags. Include/exclude options. Mass assignment."]},{"l":"Validation","p":["Each field has built-in validation tests on user input. You can define additional conditions."]},{"l":"Protected Formula","p":["The price is calculated server-side only, so the Client can't see exact expression."]},{"l":"Advanced Customization","p":["Field HTML templates can be overloaded in your theme file. Each field has CSS class to set custom styles."]},{"l":"Functions","p":["You can use basic math functions in the formula. Fields such as Multi-checkbox, Date Picker, Date Range Picker has additional functions to get sum, min, max value or get date, days between dates values as number."]},{"l":"Global Parameters","p":["You can define numeric variable across all fieldsets. You can modify all prices by global parameters."]},{"l":"Cart","p":["The customer can edit product options after adding to cart."]},{"l":"Compatibility","p":["multisite mode is supported","product shortcodes","translation","virtual and variable products are supported","product regular and sale prices are supported","product tags"]},{"l":"More Features","p":["ability to edit product fields after from a cart","additional functions for radio group, checkbox group (sum, max, min), range date picker (days between dated)","attach fieldset to: all products/catgories/tags, selected products/categories/tags","customizable HTML code of every field","define single-line expression to calculate the price","define unlimited conditional expressions to calculate the price","define unlimited fieldsets with unlimited fields","every field has built-in validation tests","expression builder","fields are displayed in product page, cart and order details,","global parameters can be defined and used in formula","HMTL template of every field can be overridden in a theme directory","math functions to use in the expression","product shortcodes are supported","regular and sale price are supported","static fields such as HTML, Heading, Paragraph, Hidden, Link, Attachment","supported multisite","supported price filters","supported variable products","the formula is protected and will not be shown to the user- the price is calculated only server-side","the plugin is translatable","the product will be removed from user's cart when shop manager updates the fieldset settings","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"News","p":["This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]},{"i":"version-140-has-been-released","l":"Version 1.4.0 has been released","p":["Update: 2022-07-18","[x] new formula builder[x] apply filters on td elements in field's templates[x] new assignment type: product attribute[x] toggle button to publish/unpublish fieldsets quickly[x] support for stock management and stock reduction multiplier[x] layouts feature - you can choose one or two column layout"]},{"i":"version-130-has-been-released","l":"Version 1.3.0 has been released","p":["Update: 2022-07-04","Price Add-ons","Image upload field","Use dynamic formula in a static field's contents","Settings page","Strlen() function to get a text length"]},{"i":"version-120-has-been-released","l":"Version 1.2.0 has been released","p":["Update: 2022-06-13","many new fields","static fields","field's built-in modifiers","global parameters","functions in expressions","customer can edit product in the cart"]},{"i":"what-we-are-working-on","l":"What we are working on?","p":["a new field: file upload,","add a price parameter to all fields and use the value in the formula,","add global fields, so the product could have a one fieldset with calculations and global fields.","add priority for fieldsets","allow editing fields in the user's cart,","apply fieldsets to categories,","Apply for a new feature by clicking the link at the top.","assign to all products/categories, except ...","customizable field's template","mass assignment of fieldsets to products,","some bug fixes reported by users","stock management for numeric fields,","Update: 2022-01-21","Update: 2022-02-18","We are working on new features:","We released new version 1.1.0 which gives more flexibility and performance. We have also added new features, blow:"]}],[{"l":"About the Plugin","p":["The plugin extends the Woocommerce store with the ability to add your own fields to the product page. Almost all fields are used in formulas to calculate a custom price for a product. The plugin allows full freedom to define fields and formulas for calculating the price. Some of fields can be used to get informations from Customer (for example: text, date, date range, color, dropdown, etc.)","The plugin is designed to work with multisite mode. We encourage you to contact us and request new features.","If you appreciate my work - Buy me a Coffee or Donate via PayPal"]},{"l":"Definitions","p":["Field- is used to get user's input on the product page. Field can be used to calculate the price (is used in formula)","Fieldset- store manager can create the fieldset which consists of different Fields. Fieldset must have at least one Field and the expression (formula) to calculate the product price","Expression/Formula- mathematical and/or logical expression using to calculate the product price. The expression can be single-line (one-line) or conditional. Expression is protected and calculated only server-side.","Validation- each Field has specific requirements to be met. Incorrect values make it impossible to calculate the price and add the product to the cart.","Global Parameters- are numeric variables which can be used in formulas across all fieldsets."]},{"l":"Requirements","p":["Minimum tested version, but not recommended","Wordpress v.5.0","Woocommerce v.3.5.0","Maximum tested version","Wordpress v.6.0.0","Woocommerce v.6.6.1","Recommended version","We strongly recommend to use most recent versions of Wordpress and Woocommerce. There is no restriction to PHP version, but please note that PHP below 7.4 is marked as end-of-life. We recommend using PHP7.4 and above. PHP7.4 is supported in Wordpress v5.3 and above.","Supported PHP versions PHP compatibility and Wordpress versions"]},{"l":"Dependencies","p":["Symfony ExpressionLanguage Component","jQuery, jQuery UI (built in Wordpress Core)","Math Expression Evaluator by bugwheels94"]},{"l":"Features","p":["ability to edit product fields after from a cart","additional functions for radio group, checkbox group (sum, max, min), range date picker (days between dated)","attach fieldset to: all products/catgories/tags, selected products/categories/tags","customizable HTML code of every field","define single-line expression to calculate the price","define unlimited conditional expressions to calculate the price","define unlimited fieldsets with unlimited fields","dynamic formula in a static field's contents","every field has built-in validation tests","expression builder","fields are displayed in product page, cart and order details,","global parameters can be defined and used in formula","HTML template of every field can be overridden in a theme directory","image upload field (use file size in formula/expression)","math functions to use in the expression","product shortcodes are supported","regular and sale price are supported","static fields such as HTML, Heading, Paragraph, Hidden, Link, Attachment","supported multisite","supported price filters","supported variable products","the formula is protected and will not be shown to the user- the price is calculated only server-side","the plugin is translatable","the product will be removed from user's cart when shop manager updates the fieldset settings","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]},{"l":"Conflict with other plugins","p":["This plugin has been tested only with Wordpress and Woocommerce without additional plugins. Note that there may be a conflict with plugins that modifies the product price and user's cart, or has similar functionality. This section will be updated and conflicts will be resolved.","We know about issue with displaying prices in a cart page. In some themes there's an issue with cart page. Theme should display cart item price instead of product price. The plugin modifies cart items, but not products itself."]}],[{"l":"Installation","p":["Installation process is the same as for other plugins. The plugin does not require configuration, it is ready to use. The plugin creates new post type - Fieldset.","The plugin adds new menu in Products> WCK Fieldsets.","Plugin supports Wordpress Multisite feature. Fieldsets are separate for each site.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Field Types","p":["The plugin comes with several built-in fields to be used on the product page. Please contact us if you need to add new field types. We are working on the ability to build custom fields as extensions for the plugin. We would like to meet your expectations as much as possible.","Each field has its own parameters, but some parameters are the same for every field. See the list below:","Parameter","Description","Name","Unique field name used in plugin code. It must consist of A-Z, a-z or underscore. For example: product_width, table_height, etc.","Title","Field name showed to the User. For example: Product width, Table height","Hint for Customer","Help message showed in tooltip. For example: Please choose product color from the list.","CSS Class","CSS class applied to the HTML code of the field. You can define additional styles in custom .css files in theme.","Price","If the field is filled in by the customer, the price will be used in the formula. Otherwise the price is 0. This parameter is not present for the: number field and select field.","See Templates section to know how to modify HTML code of any field."]},{"l":"Number","p":["Number Field is the basic field to use in the plugin. It is standard single-line input field, which takes a numeric value and can be used in a formula/expression.","This field is required by default.","Parameter","Description","Min. value","The minimum value of the field","Max. value","The maximum value of the field","Default value","Initial value of the field. This value is loaded into field when user opens the product page."]},{"l":"Select","p":["Select Field is a standard dropdown field. You must define numeric value of options, because this field is used in the formula/expression.","This field is required by default."]},{"l":"Checkbox","p":["Parameter","Description","Default state","Default state of checkbox. Select this option if you want the field to be checked by default"]},{"l":"Color Picker","p":["Color Picker is a standard input text field with jQuery wpColorPicker and IRIS. JS files are bundled in the Wordpress Core.","Parameter","Description","Required","Select this option to make the field required"]},{"l":"Date Picker","p":["Date Picker is a standard input text field with jQuery UI Datepicker. JS files are bundled in the Wordpress Core.","Parameter","Description","Required","Select this option to make the field required.","Disallow past date","Select this option to prohibit the user from selecting a date earlier than today."]},{"l":"Range Date Picker","p":["Range Date Picker includes two Date Picker fields connected with each other.","Parameter","Description","Required","Select this option to make the field required.","Disallow past date","Select this option to prohibit the user from selecting a date earlier than today."]},{"l":"Dropdown","p":["Dropdown field is almost the same as Select field. This field accepts text values.","Parameter","Description","Required","Select this option to make the field required."]},{"l":"Text","p":["Note that defining Min. length greater than zero makes the field required. Even if you have not checked Required option.","Parameter","Description","Required","Select this option to make the field required.","Min. length","The minimum number of characters that the user can enter.","Max. length","The maximum number of characters that the user can enter.","Placeholder","Support text displayed inside the field. This is not the default value for the field. May be used as a guideline for the user."]},{"l":"Textarea","p":["Note that defining Min. length greater than zero makes the field required. Even if you have not checked Required option.","Parameter","Description","Required","Select this option to make the field required.","Min. length","The minimum number of characters that the user can enter.","Max. length","The maximum number of characters that the user can enter.","Placeholder","Support text displayed inside the field. This is not the default value for the field. May be used as a guideline for the user."]},{"l":"E-mail","p":["E-mail field is used to get e-mail address from the Customer input. This field has an e-mail validation test.","Parameter","Description","Required","Select this option to make the field required.","Min. length","The minimum number of characters that the user can enter.","Max. length","The maximum number of characters that the user can enter.","Placeholder","Support text displayed inside the field. This is not the default value for the field. May be used as a guideline for the user."]},{"l":"Radio","p":["Radio field is used to display a group of radio buttons. It has similar funcationality to the Select field, so u can use option's values in the formula/expression.","This field is required by default."]},{"i":"checkbox-group-multi-checkbox","l":"Checkbox Group (Multi Checkbox)","p":["Checkbox Group is used to display a group of checkboxes. It is possible to define selection limit (i.e. customer can choose max 2 options)."]},{"l":"Color Swatches","p":["Color Swatches are shown as square thumbnails, which may be selected by a customer. Each options has a numeric value to use in a formula."]},{"l":"Image Swatches","p":["Image Swatches works like Color Swatches, but you can define images instead of colors."]},{"l":"Image Select","p":["Image Select works similar to Image Swatches, but you can define Caption/Title for each image option."]},{"i":"static-html","l":"Static: HTML","p":["Displays content from a HTML code. It is filtered by wp_kses_post. You can use dynamic expression in the contents, for example: {={field_1}*{field_2}/1000}"]},{"i":"static-attachment","l":"Static: Attachment","p":["You can add file/media attachment, to be downloaded by the Customer on product page."]},{"i":"static-heading","l":"Static: Heading","p":["You can add heading h1-h6 in product page"]},{"i":"static-paragraph","l":"Static: Paragraph","p":["You can add text in paragraph tag in product page. You can use dynamic expression in the contents, for example: {={field_1}*{field_2}/1000}"]},{"i":"static-hidden","l":"Static: Hidden","p":["You can add hidden input fields to store predefined values. This field does not accept user input."]},{"i":"static-link","l":"Static: Link","p":["You can add link to any website, file attachment, URL."]},{"l":"Image upload","p":["You can get image file from the customer. Files are saved in customer directory on checkout. Go to Settings Page to set cron jobs invervals. Files are uploaded to the temp directory and will be deleted after time. Files will be kept longer if the customer places an order. Customer files will be deleted after 360 days (default option), but you can set your own interval.","You can use file size [MB] parameter in formulas.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Calculation Modes","p":["The Plugin comes with several calculation modes. You can choose one of mentioned below:","OFF- price calculation is turned off. This mode can be use to get user input without changing the product price","Single-line Formula- it is a simple single-line math expression without any logical conditions","Conditional Expression- if the condition if is met, calculate the price according to the assigned formula in = field. You can use multiple conditions. The else formula is used when none of the conditions are met.","Price Add-ons- if the condition if is met, the product price is increased by add value. You can use multiple conditions with all available functions and operators. Both if and add field accepts math and logical expression with variables.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Expression Syntax"},{"l":"Field names"},{"l":"Arithmetic operators"},{"l":"Comparision Operators"},{"l":"Logical Operators"},{"l":"Math Functions","p":["This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Formula Examples","p":["In this section, we cover examples of how to use mathematical formulas and expressions. Some of the examples are based on questions asked by users."]},{"i":"1-how-to-add-value-to-a-price-so-that-it-is-not-multiplied-by-quantity","l":"1. How to add value to a price so that it is not multiplied by quantity?","p":["By default, the unit price of the product is calculated. If the customer wants to buy, for example, 2 pieces of a product, the calculated price is multiplied by 2. What to do if we want to add a certain value once, regardless of the quantity purchased. The solution is to divide value by {quantity}. Let's see the example. {field_1} will by multiplied by quantity, but {field_2} is added once."]},{"i":"2-how-to-add-price-for-every-character-in-text-field-","l":"2. How to add price for every character in text field ?","p":["Let's say we have a text field that has to be between 1 and 10 characters long. The price of the product is to change depending on the number of characters entered.","Solution #1 - price per character is constans","Solution #2 - price is different for each character","Next we have to build the formula. We have {global:price_per_char} array and we need to get single value by index. The index is strlen({my_field:text}) - 1, so complete formula looks like this:","Solution #3 - use Price Add-on mode and write multiple if and add expressions. For example:"]},{"i":"3-each-product-has-width-and-height-user-gives-only-one-dimension-and-the-price-is-proportional-to-the-calculated-area","l":"3. Each product has width and height. User gives only one dimension and the price is proportional to the calculated area.","p":["User has to input width, but the height will be calculated with proportions from product dimensions.","First of all, set the product width and height in the product options, so we will be using {product_width} and {product_height} variables. Video: How to use product dimensions. Create number field and name it width. The height will be calculated as proportional to the product dimensions. Look at this equations:","If the price per unit equals 99,00 USD, the result formula will be:","The same formula with \"height\" field instead of \"width\""]},{"i":"4-how-to-decrease-product-price-for-logged-user-by--1000-usd-or-by--5-","l":"4. How to decrease product price for logged user by -10,00 USD or by -5 %","p":["We have built-in variable {is_user_logged} which takes values 1 or 0. So the result formula will be:","or","You must be careful when decreasing prices, because it may be 0 or negative. To protect this, use max() function."]}],[{"l":"Usage","p":["Here we explain how to work with the plugin. Please read carefully whole page. Feel free to contact us if something is not clear.","WCK YouTube tutorials","Plugin supports Wordpress Multisite feature. Fieldsets are separate for each site."]},{"l":"Adding new Fieldset","p":["Navigate to Products > WCK Fieldsets in Wordpress dashboard.","Click Add Fieldset to create new one. The empty form looks like below:","Fieldset Title is used only in Wordpress dashboard","Assign to- you can assign this fieldset to products, categories or tags. If product has more than one fieldset, you can set priority.","Higher value have higher priority","Product Fields Settings- here you set options for each field.","Add Field- click on the button to add the field of selected type.","Price Calculation- here you define the formula/expression to calculate the product price. You can choose single-line or conditional mode.","Price Filtering- this option changes product prices in catalog. For example you can set the product price to: from 99,99 USD/m2"]},{"l":"Defining fields","p":["Fields can be added, deleted and reordered (drag&drop). Parameters of each field are described in the Field Types section.","If you appreciate my work - Buy me a Coffee or Donate via PayPal","All settings are validated when saving. Fieldset cannot be saved in case of errors.","Select and Dropdown field has ability to add, delete, import options. You can choose the default option for the field.","The example below shows the Select field with two options with a default option. In this case the first option is default."]},{"l":"Defining expressions","p":["You are responsible for preparing the correct formula, mathematically and logically correct. Be careful and always test expressions. The result (the price) has to be a positive number greater than zero. It is validated during the calculation process.","The Expression can be defined as single-line or conditional. You can use Number and Select fields as variables in the formula. You can also use other fields in the expression and predefined variables {product_price}, {product_regular_price}, {quantity}","Some other fields has a price option. For example the text field {my_text} has price 50,00 USD and is not required. If the customer fill in this field the price of the field will be 50,00. But if the customer leaves this field empty the price will be 0,00. It is important if you take {my_text} in your expression.","The \"=\" (equals sign) is the calculated product price. The plugin checks the conditions one by one. If the condition is true, it returns the value of the assigned formula.","First option - single-line expression:","Second option - conditional expression:","Expression builder has simple autocompletion feature. Please click Update list to add fields to autocompletion. When you type the formula, enter \"{\" sign and you see the list of available fields."]},{"l":"Example of conditional expression","p":["First, we have to define two Number or Select fields named width and height. The price of the product can be 100 USD, 200 USD or (300+area* 0.05) USD.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Advanced Usage"},{"i":"how-to-get-input-text-length-character-count-","l":"How to get input text length (character count) ?","p":["Add text field with name field_name.","You can get input text using {field_name:text}. There's strlen() function which returns text length, so strlen({field_name:text}) returns input characters count."]},{"i":"how-to-use-multi-checkbox-field-","l":"How to use Multi Checkbox field ?","p":["Let's add multi checkbox field named field_mcb. You can use in expression:","{field_mcb:sum}- sum of selected values","{field_mcb:min}- minimal selected value","{field_mcb:max}- maximal selected value"]},{"i":"how-to-use-range-date-picker-field-","l":"How to use Range Date Picker field ?","p":["Range date picker has two input fields - \"from\" and \"to\" dates. Let's add a new field named rdp","{rdp:date_from}- date \"from\" as unix timestamp","{rdp:date_to}- date \"to\" as unix timestamp","{rdp:days}- number of days between two dates (absolute integer)"]},{"i":"how-deal-with-upload-field-","l":"How deal with Upload field ?","p":["Add Upload/Image Upload field named file","{file}- returns field price defined in the \"Price\" option","{file:size}- returns input file size in MB"]},{"i":"products-variables","l":"Product's variables","p":["Expression builder comes with several built-in variables to use in expressions. The value of that parameters is according to the current product and may be different for each product.","{product_price}- current product price (sale or regular)","{product_regular_price}- current product regular price","{product_weight}- current product weight from Product Data > Shipping","{product_width}- current product width from Product Data > Shipping","{product_height}- current product height from Product Data > Shipping","{product_length}- current product length from Product Data > Shipping","{is_user_logged}- 1 if current visitor is logged in, 0 otherwise","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Templates","p":["WC Kalkulator v1.1.0 brings a new approach to modifying the appearance of fields. Every file in view directory can be overriden. Just copy file from the view directory to the themes/your-theme/wc-kalkulator directory and make your modifications.","For example: view/fields/front/text.php should be copied to the /themes/your-theme/wc-kalkulator/fields/front/text.php"]},{"l":"Structure of the view directory","p":["Files","Description","views/fields/front/*.php","Template files for every field rendered on the produt page","views/woocommerce/catalog_price.php","Template for the price filter - prefix, price, suffix.","views/woocommerce/price_block.php","Template for the \"Total\" in the product page","views/woocommerce/product.php","Container for the fields on the product page"]},{"l":"Filters and Hooks","p":["Example filter to change td class=label tag in field template","Example filter to change td class=value tag in field template"]},{"l":"Layouts","p":["Layouts has beed added in v 1.4.0. You can choose default one column layout or switch to two column layout. In this video I show how to use layouts feature.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"i":"stock-management--inventory","l":"Stock Management / Inventory","p":["WC Kalkulator v 1.4.0 brings support for stock management and stock quantity reduction. This feature is available for single and variable products. The idea is to reduce a stock quantity by custom value, which is Quantity x Multiplier.","Multiplier is what you can set in Fieldset's Settings. This value can be a numer or math formula. You can use all available fields, operators and functions.","Product must have stock management enabled in product option"]},{"l":"Video Tutorial","p":["In this video I show how to reduce stock quantity by field's value. Stock quantity is reduced by 90 pieces, because field value is 45 and quantity is 2."]}],[{"i":"importexport-fieldsets","l":"Import/Export fieldsets","p":["WC Kalkulator is built on the new Post Type, which is full compatible with core import/export functionality in Wordpress. Navigate to Tools Export to export Fieldset post type to XML file. Use Tools Import to import that file.","You can also use any importer/exporter plugin in Wordpress.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Uninstallation","p":["The plugin may be deactivated without losing any of its data.","When the plugin is deactivated, it is possible to uninstall it. During the uninstallation process, all data will be deleted from the Wordpress database.","If you want to save all data for later, please export to the XML file.","This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]}],[{"l":"Video Tutorials","p":["This plugin is absolutely FREE with PRO features. It will always be free, so please donate if you like it!"]},{"l":"1. Basic Usage"},{"i":"2-how-to-work-with-fieldsets-priority-","l":"2. How to work with fieldset's priority ?"},{"i":"3-how-to-use-date-pickers-","l":"3. How to use Date Pickers ?"},{"i":"4-what-is-global-parameter-and-how-to-use-it-","l":"4. What is Global Parameter and how to use it ?"},{"i":"5-how-to-use-text-input-and-count-text-length-","l":"5. How to use text input and count text length ?"},{"i":"6-how-to-set-custom-field-template-template-overriding-","l":"6. How to set custom field template (template overriding) ?"},{"i":"7-how-to-use-product-dimensions-and-weight-in-formula-","l":"7. How to use product dimensions and weight in formula ?"},{"i":"8-how-to-set-different-price-for-loggedunlogged-users-","l":"8. How to set different price for logged/unlogged users ?"},{"i":"9-how-to-use-arrays-and-json-objects-in-global-parameters-","l":"9. How to use arrays and json objects in Global Parameters ?"}],[{"l":"CHANGELOG","p":["2022-01-20 v.1.0.0","2022-02-18 v.1.1.0","2022-04-20 v.1.1.1","2022-05-08 v.1.1.2","2022-06-13 v.1.2.0","2022-06-13 v.1.2.1","2022-06-14 v.1.2.2","2022-06-15 v.1.2.3","2022-07-04 v.1.3.0","2022-07-06 v.1.3.1","2022-07-07 v.1.3.2","2022-07-11 v 1.3.3","2022-07-18 v.1.4.0","add notices","added a price option to all fields","Added new fields: email, radio","added support for array and json objects in global parameters","added the priority option to fieldsets","Additional functions for radio group, checkbox group (sum, max, min), range date picker (days between dated)","apply filters on td elements in field's templates","Assign fieldset to product's tags","assign the fieldset to products/categories on the fieldset's edit page","Bug fix","Bug fixed: missing numberposts argument on get_posts()","Bug fixed: str_replace on array","bug fixes","conditional visibility (set rules to show/hide fields)","cron jobs to keep uploaded files clean","Customer can edit cart item","field's template can be overrided in your theme folder","fieldset post type","fixed field builder (js script issue)","fixed issue with price calculation","fixed typo in HTML code for dropdown and select fields","Global parameters can be defined and used in formula","Image upload field added – you can use file size parameter in expressions","Initial release","layouts feature - you can choose one or two column layout","Math functions to use in the expression","more columns on fieldset table","new assignment type: product attribute","new calculation mode - Price Add-ons","new edit page","New fields: image select, image swatches, color swatches, checkbox group (multicheckbox), HTML, Heading, Paragraph, Hidden, Link, Attachment","new formula builder","new variable to determine if current visitor is logged in","new variables to get product's weight, width, height, length","performance fixes","Settings page added – you can define custom product form selector, you can toggle error messages for admin/manager","strlen() function added to expressions – it returns text length","support for stock management and stock reduction multiplier","text field has new option: pattern (regexp)","toggle button to publish/unpublish fieldsets quickly","upload path settings","you can use formulas in HTML/Paragraph field, for example: {=*/100}"]}]] \ No newline at end of file diff --git a/docs/.retype/sitemap.xml.gz b/docs/.retype/sitemap.xml.gz index 02adfb4d6128b3a142865afaec71efae09b49595..999e90964760409af07b627f41f607d85e79b3c4 100644 GIT binary patch literal 482 zcmV<80UiDyiwFP!000006SS7iZlf>|$M1Ox#2x$r1h5i%>l37xy;Lr^#Hz6oHX(WY z+6mgK(ykM!?#b9Qqxmtm|Kr`$c@WWwO`0pYk5LNah{;xUT=x6;=eSsIF^pwZ_dR zid-f)+ApEn#`$X((0)+yF$-$cl(uRBJK)T#Bh_Y5U4tRU2`m#>955yb5>)=NeyjE7 zJ5F3p+*}&_t2^*_<}!md^`i)qE!xY0ssn~3&k5T8p97{<`9qLdvuU7mrUKA6HJb;D z18b5)AJn!82gRi}R9KTeV?o&RaBT0KiO#=`k5b`qR4o zL?h7`Y3SJxSRN22c}eoj3mB4*4x?bn7w4T4R<4A3MvB}=Sk&PVXH9z+Vqc3Ypnh~G zDqGgQK0vp1n`-GYueuch)y;O5(HibthgEhlDZHnx_^HCRM=E|$M1Ox#2x&>SFjR#+b2jby;QF85>#U&+l1up zYbU7Pm3B#__+-q?XnxELe|z_G9z=BF+Vo29W0b-;;*zPhm)$;oJ^V_x@k_JWOMZ!zS2w1fC7a?Y+XsIF^pwZ_dR zihL%&x+kGnF&61KzwiQey|zHW*@@z$$^o0b_z7LDie{TdX(V zQTIys_R_dd-GT3&&kUB-k0MAun+G^xO>+2u4w!DMCqX8|^+4rB1)v{lvLT?#A{8Zb%fhk!?zw1#w6VnDs2CM&x)m(3myw47MBxDWdDPr^(MZfiT6$gwtPTj1 zydrtF3K)`)4x`}759gf{ZhZ;!j1>7AVX+N|I2qdU5PdB|>PLH`lJWNa0lLyR)zM|; zDqX;?x>IFzhC9Cl$_`%p9UEE&dsgAtk;;w>)!n1Ph+s&v)!BcV=1;vHMy2h$n|-$g znXrI@JIUoZ2m%&Rb5DKC)g6_%=~zj!b(Q$H&|VjJi)uDs00030{{sNpAn;3e2><}5 CX5iES diff --git a/docs/.retype/usermanual/about/index.html b/docs/.retype/usermanual/about/index.html index 387bf7b..7668e8f 100644 --- a/docs/.retype/usermanual/about/index.html +++ b/docs/.retype/usermanual/about/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    @@ -51,7 +51,7 @@
    +
    diff --git a/docs/.retype/usermanual/advanced_usage/index.html b/docs/.retype/usermanual/advanced_usage/index.html index c4ffee9..6593b6e 100644 --- a/docs/.retype/usermanual/advanced_usage/index.html +++ b/docs/.retype/usermanual/advanced_usage/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    @@ -51,7 +51,7 @@
    +
    @@ -374,7 +374,7 @@
    Next - Templates + Templates & Layouts diff --git a/docs/.retype/usermanual/calculation-types/index.html b/docs/.retype/usermanual/calculation-types/index.html index cf111c2..97dbc8e 100644 --- a/docs/.retype/usermanual/calculation-types/index.html +++ b/docs/.retype/usermanual/calculation-types/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    @@ -51,7 +51,7 @@
    +
    diff --git a/docs/.retype/usermanual/example-expressions/index.html b/docs/.retype/usermanual/example-expressions/index.html index fa437e9..718cd69 100644 --- a/docs/.retype/usermanual/example-expressions/index.html +++ b/docs/.retype/usermanual/example-expressions/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    @@ -51,7 +51,7 @@
    +
    diff --git a/docs/.retype/usermanual/expression-syntax/index.html b/docs/.retype/usermanual/expression-syntax/index.html index 6f6c87a..f049099 100644 --- a/docs/.retype/usermanual/expression-syntax/index.html +++ b/docs/.retype/usermanual/expression-syntax/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    @@ -51,7 +51,7 @@
    +
    diff --git a/docs/.retype/usermanual/fields/index.html b/docs/.retype/usermanual/fields/index.html index 7cc39df..e12b582 100644 --- a/docs/.retype/usermanual/fields/index.html +++ b/docs/.retype/usermanual/fields/index.html @@ -3,7 +3,7 @@ - + @@ -30,12 +30,12 @@ - + - + - - + +
    @@ -52,7 +52,7 @@
    +
    diff --git a/docs/.retype/usermanual/import_export/index.html b/docs/.retype/usermanual/import_export/index.html index c87c876..b42cd3f 100644 --- a/docs/.retype/usermanual/import_export/index.html +++ b/docs/.retype/usermanual/import_export/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    @@ -51,7 +51,7 @@
    +
    @@ -304,11 +304,11 @@
    diff --git a/docs/.retype/usermanual/installation/index.html b/docs/.retype/usermanual/installation/index.html index 2ab6ad8..80c62d0 100644 --- a/docs/.retype/usermanual/installation/index.html +++ b/docs/.retype/usermanual/installation/index.html @@ -3,7 +3,7 @@ - + @@ -32,11 +32,11 @@ - + - + - +
    @@ -53,7 +53,7 @@
    +
    diff --git a/docs/.retype/usermanual/templates/index.html b/docs/.retype/usermanual/templates/index.html index 8d3f508..6d5fb43 100644 --- a/docs/.retype/usermanual/templates/index.html +++ b/docs/.retype/usermanual/templates/index.html @@ -3,7 +3,7 @@ - + @@ -30,12 +30,12 @@ - + - + - - + +
    @@ -52,7 +52,7 @@
    +
    @@ -329,6 +329,21 @@

    return $html; }, 10, 2);

    + +

    + # + Layouts +

    +
    +

    Layouts has beed added in v 1.4.0. You can choose default one column layout or switch to two column layout. +In this video I show how to use layouts feature.

    +

    +

    +
    + +
    +
    +

    - + diff --git a/docs/.retype/usermanual/uninstall/index.html b/docs/.retype/usermanual/uninstall/index.html index 726449a..143f572 100644 --- a/docs/.retype/usermanual/uninstall/index.html +++ b/docs/.retype/usermanual/uninstall/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    @@ -51,7 +51,7 @@
    +
    diff --git a/docs/.retype/usermanual/usage/index.html b/docs/.retype/usermanual/usage/index.html index 0c48e10..8b9c661 100644 --- a/docs/.retype/usermanual/usage/index.html +++ b/docs/.retype/usermanual/usage/index.html @@ -3,7 +3,7 @@ - + @@ -32,11 +32,11 @@ - + - + - +
    @@ -53,7 +53,7 @@
    +
    diff --git a/docs/.retype/usermanual/videos/index.html b/docs/.retype/usermanual/videos/index.html index 7887a2f..2415055 100644 --- a/docs/.retype/usermanual/videos/index.html +++ b/docs/.retype/usermanual/videos/index.html @@ -3,7 +3,7 @@ - + @@ -30,11 +30,11 @@ - + - + - +
    @@ -51,7 +51,7 @@
    +
    diff --git a/docs/changelog.md b/docs/changelog.md index 9bccc8e..4369f8c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -13,6 +13,7 @@ v.1.4.0 - toggle button to publish/unpublish fieldsets quickly - support for stock management and stock reduction multiplier - layouts feature - you can choose one or two column layout +- conditional visibility (set rules to show/hide fields) - bug fixes 2022-07-11 diff --git a/docs/retype.yml b/docs/retype.yml index d4d0c8e..3addc0d 100644 --- a/docs/retype.yml +++ b/docs/retype.yml @@ -5,7 +5,7 @@ meta: title: " | Custom fields and price calculator" branding: title: WC Kalkulator - label: PRO 1.4.0 + label: PRO 1.4 links: - text: Buy me a Coffee link: https://www.buymeacoffee.com/piatkowski diff --git a/languages/wc-kalkulator.pot b/languages/wc-kalkulator.pot index 0de00b1..d868633 100644 --- a/languages/wc-kalkulator.pot +++ b/languages/wc-kalkulator.pot @@ -2,14 +2,14 @@ # This file is distributed under the GPLv2. msgid "" msgstr "" -"Project-Id-Version: WC Kalkulator 1.3.0\n" +"Project-Id-Version: WC Kalkulator 1.4.0\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/WC Kalkulator\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2022-07-05T19:22:17+00:00\n" +"POT-Creation-Date: 2022-07-21T20:03:44+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.6.0\n" "X-Domain: wc-kalkulator\n" @@ -30,58 +30,58 @@ msgstr "" msgid "https://wckalkulator.com" msgstr "" -#: src/AdminNotice.php:143 +#: src/AdminNotice.php:144 msgid "Thank you for using WC Kalkulator! Please rate us ★★★★★ and remember that WCK will always be for free!" msgstr "" -#: src/AdminNotice.php:158 +#: src/AdminNotice.php:159 msgid "Hello ! Remember that WC Kalkulator will always be for free, so it would be nice if you could donate a small amount of money via PayPal :) - Yes, I'd like to support!" msgstr "" -#: src/Ajax.php:75 +#: src/Ajax.php:76 msgid "You should check at least one option." msgstr "" -#: src/Ajax.php:76 +#: src/Ajax.php:77 msgid "This file is too big!" msgstr "" -#: src/ExpressionParser.php:107 +#: src/ExpressionParser.php:121 msgid "-" msgstr "" -#: src/ExpressionParser.php:112 +#: src/ExpressionParser.php:126 msgid "ExpressionParser: Invalid calculation mode." msgstr "" -#: src/ExpressionParser.php:116 +#: src/ExpressionParser.php:130 msgid "ExpressionParser: Prepared expression has incorrect type." msgstr "" -#: src/ExpressionParser.php:355 -#: src/ExpressionParser.php:375 +#: src/ExpressionParser.php:369 +#: src/ExpressionParser.php:389 msgid "ExpressionParser: Division by zero" msgstr "" -#: src/ExpressionParser.php:357 +#: src/ExpressionParser.php:371 msgid "ExpressionParser: Undefined result!" msgstr "" -#: src/ExpressionParser.php:382 -#: src/ExpressionParser.php:420 +#: src/ExpressionParser.php:396 +#: src/ExpressionParser.php:434 msgid "The price is less than zero." msgstr "" -#: src/ExpressionParser.php:384 -#: src/ExpressionParser.php:422 +#: src/ExpressionParser.php:398 +#: src/ExpressionParser.php:436 msgid "The price is equal zero." msgstr "" -#: src/ExpressionParser.php:393 +#: src/ExpressionParser.php:407 msgid "ExpressionParser: Undefined calculation mode!" msgstr "" -#: src/ExpressionParser.php:428 +#: src/ExpressionParser.php:442 msgid "Division by zero." msgstr "" @@ -152,6 +152,10 @@ msgstr "" msgid "E-mail Field" msgstr "" +#: src/Fields/EmptyField.php:29 +msgid "Empty" +msgstr "" + #: src/Fields/FileuploadField.php:37 msgid "File Upload" msgstr "" @@ -180,10 +184,6 @@ msgstr "" msgid "Image Upload" msgstr "" -#: src/Fields/ImageuploadField.php:62 -msgid "File size:" -msgstr "" - #: src/Fields/LinkField.php:29 msgid "Link / URL" msgstr "" @@ -228,133 +228,162 @@ msgstr "" msgid "Only selected below:" msgstr "" -#: src/FieldsetPostType.php:82 -msgid "Fieldsets" +#: src/FieldsetPostType.php:97 +#: src/FieldsetPostType.php:100 +msgid "WCK Fieldsets" msgstr "" -#: src/FieldsetPostType.php:83 -#: src/FieldsetPostType.php:84 +#: src/FieldsetPostType.php:98 +#: src/FieldsetPostType.php:99 msgid "Fieldset" msgstr "" -#: src/FieldsetPostType.php:85 -msgid "WCK Fieldsets" -msgstr "" - -#: src/FieldsetPostType.php:86 +#: src/FieldsetPostType.php:101 msgid "View Fieldset" msgstr "" -#: src/FieldsetPostType.php:87 +#: src/FieldsetPostType.php:102 msgid "Add new Fieldset" msgstr "" -#: src/FieldsetPostType.php:88 +#: src/FieldsetPostType.php:103 #: src/GlobalParametersPostType.php:64 msgid "Add new" msgstr "" -#: src/FieldsetPostType.php:89 +#: src/FieldsetPostType.php:104 msgid "Edit Fieldset" msgstr "" -#: src/FieldsetPostType.php:90 +#: src/FieldsetPostType.php:105 msgid "Save Fieldset" msgstr "" -#: src/FieldsetPostType.php:91 +#: src/FieldsetPostType.php:106 msgid "Search Fieldset" msgstr "" -#: src/FieldsetPostType.php:92 +#: src/FieldsetPostType.php:107 msgid "Fieldset not found" msgstr "" -#: src/FieldsetPostType.php:93 +#: src/FieldsetPostType.php:108 msgid "There is no Fieldset in the trash" msgstr "" -#: src/FieldsetPostType.php:95 +#: src/FieldsetPostType.php:110 msgid "Fieldsets for Product Fields" msgstr "" -#: src/FieldsetPostType.php:125 +#: src/FieldsetPostType.php:140 msgid "Assigned to" msgstr "" -#: src/FieldsetPostType.php:126 +#: src/FieldsetPostType.php:141 msgid "Priority" msgstr "" -#: src/FieldsetPostType.php:148 +#: src/FieldsetPostType.php:142 +msgid "Calculation Mode" +msgstr "" + +#: src/FieldsetPostType.php:143 +msgid "Field names" +msgstr "" + +#: src/FieldsetPostType.php:144 +#: src/FieldsetPostType.php:214 +msgid "Published" +msgstr "" + +#: src/FieldsetPostType.php:162 +msgid "Single-Line" +msgstr "" + +#: src/FieldsetPostType.php:163 +msgid "Conditional" +msgstr "" + +#: src/FieldsetPostType.php:164 +msgid "- off -" +msgstr "" + +#: src/FieldsetPostType.php:165 +msgid "Price Add-Ons" +msgstr "" + +#: src/FieldsetPostType.php:189 msgid "Products: " msgstr "" -#: src/FieldsetPostType.php:152 +#: src/FieldsetPostType.php:193 msgid "Categories: " msgstr "" -#: src/FieldsetPostType.php:156 +#: src/FieldsetPostType.php:197 msgid "Tags: " msgstr "" -#: src/FieldsetPostType.php:177 +#: src/FieldsetPostType.php:201 +msgid "Attributes: " +msgstr "" + +#: src/FieldsetPostType.php:231 #: src/GlobalParametersPostType.php:131 msgid "Documentation" msgstr "" -#: src/FieldsetPostType.php:181 -#: views/admin/assignment.php:29 +#: src/FieldsetPostType.php:235 +#: views/admin/assignment.php:30 msgid "Assign to" msgstr "" -#: src/FieldsetPostType.php:185 +#: src/FieldsetPostType.php:239 msgid "Product Fields Settings" msgstr "" -#: src/FieldsetPostType.php:193 -msgid "Price Calculation" +#: src/FieldsetPostType.php:247 +msgid "Price Calculation & Inventory" msgstr "" -#: src/FieldsetPostType.php:197 +#: src/FieldsetPostType.php:251 msgid "Price Filtering" msgstr "" -#: src/FieldsetPostType.php:467 +#: src/FieldsetPostType.php:544 msgid "This action is restriced!" msgstr "" -#: src/FieldsetPostType.php:474 +#: src/FieldsetPostType.php:551 msgid "Go back to the Fieldset list" msgstr "" -#: src/FieldsetPostType.php:475 +#: src/FieldsetPostType.php:552 msgid "You cannot duplicate this Fieldset!" msgstr "" -#: src/FieldsetPostType.php:516 +#: src/FieldsetPostType.php:593 msgid "Duplicate Fieldset" msgstr "" -#: src/FieldsetProduct.php:494 +#: src/FieldsetProduct.php:522 msgid "Field %s is required." msgstr "" -#: src/FieldsetProduct.php:529 +#: src/FieldsetProduct.php:557 msgid "Field %s has incorrect value." msgstr "" -#: src/FieldsetProduct.php:657 +#: src/FieldsetProduct.php:694 msgid "Select variation options first!" msgstr "" -#: src/FieldsetProduct.php:667 +#: src/FieldsetProduct.php:704 msgid "Fields are not valid!" msgstr "" #: src/GlobalParametersPostType.php:58 -#: src/GlobalParametersPostType.php:100 -msgid "Parameters" +msgid "WCK Global Parameters" msgstr "" #: src/GlobalParametersPostType.php:59 @@ -398,6 +427,10 @@ msgstr "" msgid "Global Parameters for WCK Fieldset" msgstr "" +#: src/GlobalParametersPostType.php:100 +msgid "Parameters" +msgstr "" + #: src/GlobalParametersPostType.php:135 msgid "Global parameters" msgstr "" @@ -438,59 +471,83 @@ msgstr "" msgid "Keep temp files [days]" msgstr "" -#: src/Settings.php:126 +#: src/Settings.php:54 +msgid "Upload path for Customer data" +msgstr "" + +#: src/Settings.php:132 msgid "Settings Saved" msgstr "" -#: src/Settings.php:136 +#: src/Settings.php:142 msgid "Save settings" msgstr "" -#: src/Woocommerce/Product.php:177 +#: src/Woocommerce/Product.php:186 msgid "Cannot calculate the correct price!" msgstr "" -#: src/Woocommerce/Product.php:393 +#: src/Woocommerce/Product.php:395 +msgid " (original name)" +msgstr "" + +#: src/Woocommerce/Product.php:396 +msgid " (size)" +msgstr "" + +#: src/Woocommerce/Product.php:397 +msgid " (url)" +msgstr "" + +#: src/Woocommerce/Product.php:406 msgid "Product has incorrect parameters! Missing field " msgstr "" -#: src/Woocommerce/Product.php:402 +#: src/Woocommerce/Product.php:414 msgid "Corrupted data! You cannot checkout." msgstr "" -#: views/admin/assignment.php:30 +#: views/admin/assignment.php:31 msgid "You can choose several types of assignment" msgstr "" -#: views/admin/assignment.php:41 +#: views/admin/assignment.php:42 msgid "Choose Products" msgstr "" -#: views/admin/assignment.php:42 +#: views/admin/assignment.php:43 msgid "Search a product by title. You can choose multiple products." msgstr "" -#: views/admin/assignment.php:54 +#: views/admin/assignment.php:55 msgid "Choose Categories" msgstr "" -#: views/admin/assignment.php:55 +#: views/admin/assignment.php:56 msgid "Search a category by title. You can choose multiple categories." msgstr "" -#: views/admin/assignment.php:66 +#: views/admin/assignment.php:67 msgid "Choose Tags" msgstr "" -#: views/admin/assignment.php:67 +#: views/admin/assignment.php:68 msgid "Search a tag by name. You can choose multiple tags." msgstr "" -#: views/admin/assignment.php:80 +#: views/admin/assignment.php:81 +msgid "Choose Product Attributes" +msgstr "" + +#: views/admin/assignment.php:82 +msgid "Search an attribute by name. You can choose multiple attributes." +msgstr "" + +#: views/admin/assignment.php:95 msgid "Priority (number)" msgstr "" -#: views/admin/assignment.php:81 +#: views/admin/assignment.php:96 msgid "If the product has many groups assigned to it, the one with the highest priority (the highest number) will be used. " msgstr "" @@ -510,65 +567,230 @@ msgstr "" msgid "Request Feature" msgstr "" -#: views/admin/expression.php:12 +#: views/admin/expression.php:13 msgid "Choose the type of calculation" msgstr "" -#: views/admin/expression.php:20 +#: views/admin/expression.php:21 msgid "Turn off" msgstr "" -#: views/admin/expression.php:27 +#: views/admin/expression.php:28 msgid "Single-line Formula" msgstr "" -#: views/admin/expression.php:28 +#: views/admin/expression.php:29 msgid "The result of the calculation is a number." msgstr "" -#: views/admin/expression.php:35 +#: views/admin/expression.php:36 msgid "Conditional Expression" msgstr "" -#: views/admin/expression.php:36 +#: views/admin/expression.php:37 msgid "If the condition [if] is met, calculate the price according to the assigned formula [=]. You can use multiple conditions. The [else] formula is used when none of the conditions are met." msgstr "" -#: views/admin/expression.php:43 +#: views/admin/expression.php:44 msgid "Price Add-ons" msgstr "" -#: views/admin/expression.php:44 +#: views/admin/expression.php:45 msgid "The basic price of the product is increased by the price of the add-ons" msgstr "" -#: views/admin/expression.php:57 -msgid "Build the formula" +#: views/admin/expression.php:51 +msgid "equation..." msgstr "" -#: views/admin/expression.php:62 -#: views/admin/expression.php:69 -msgid "equation..." +#: views/admin/expression.php:58 +msgid "Price formula..." msgstr "" -#: views/admin/expression.php:71 +#: views/admin/expression.php:60 msgid "Add condition" msgstr "" -#: views/admin/expression.php:75 +#: views/admin/expression.php:64 msgid "" "If the \"if\" condition is met, the price from the \"add\" field will be added to the price of the product.\n" " Unlike the conditional expression, Price Add-ons allows you to add multiple amounts to the price of a product." msgstr "" -#: views/admin/expression.php:78 +#: views/admin/expression.php:67 msgid "New addon" msgstr "" -#: views/admin/expression.php:83 +#: views/admin/expression.php:72 msgid "Price calculation has been disabled." msgstr "" +#: views/admin/expression.php:79 +msgid "Inventory - Stock quantity reduction multiplier" +msgstr "" + +#: views/admin/expression.php:83 +msgid "In this section you can define inventory reduction multiplier (formula or number). Reduction will be rouded up to the integer number. For example: stock quantity = 1000. Customer buys 3 pieces and the reduction is set to 10, the stock quantity will be reduced by 30 (3*10)" +msgstr "" + +#: views/admin/expression.php:90 +msgid "Number or formula (value will be multiplied by quantity)..." +msgstr "" + +#: views/admin/expression.php:93 +msgid "" +"You can use fields, operators and functions as above. You can modify stock quantity (i.e. add\n" +" unit) using filter `woocommerce_format_stock_quantity`." +msgstr "" + +#: views/admin/expression.php:114 +msgid "Add field" +msgstr "" + +#: views/admin/expression.php:120 +msgid "Fullscreen Editor" +msgstr "" + +#: views/admin/expression.php:125 +msgid "Layout: 2-cols" +msgstr "" + +#: views/admin/expression.php:130 +msgid "Toggle Fields" +msgstr "" + +#: views/admin/expression.php:144 +msgid "Choose parameter..." +msgstr "" + +#: views/admin/expression.php:167 +msgid "Insert" +msgstr "" + +#: views/admin/expression.php:170 +#: views/fields/admin/colorswatches.php:57 +#: views/fields/admin/dropdown.php:49 +#: views/fields/admin/imageselect.php:56 +#: views/fields/admin/select.php:40 +msgid "Add" +msgstr "" + +#: views/admin/expression.php:171 +msgid "Subtract" +msgstr "" + +#: views/admin/expression.php:172 +msgid "Multiply" +msgstr "" + +#: views/admin/expression.php:173 +msgid "Divide" +msgstr "" + +#: views/admin/expression.php:174 +msgid "Modulus" +msgstr "" + +#: views/admin/expression.php:175 +msgid "Power" +msgstr "" + +#: views/admin/expression.php:176 +msgid "Equal" +msgstr "" + +#: views/admin/expression.php:177 +msgid "Not equal" +msgstr "" + +#: views/admin/expression.php:178 +msgid "Less than" +msgstr "" + +#: views/admin/expression.php:179 +msgid "Less or equal" +msgstr "" + +#: views/admin/expression.php:180 +msgid "Grater than" +msgstr "" + +#: views/admin/expression.php:181 +msgid "Greater or equal" +msgstr "" + +#: views/admin/expression.php:182 +msgid "Logical and" +msgstr "" + +#: views/admin/expression.php:183 +msgid "Logical or" +msgstr "" + +#: views/admin/expression.php:184 +msgid "Logical not" +msgstr "" + +#: views/admin/expression.php:190 +msgid "round(x, p) - round x with the precision of p" +msgstr "" + +#: views/admin/expression.php:191 +msgid "ceil(x) - round up to the integer number" +msgstr "" + +#: views/admin/expression.php:192 +msgid "floor(x) - round down to the integer number" +msgstr "" + +#: views/admin/expression.php:193 +msgid "abs(x) - absolute number" +msgstr "" + +#: views/admin/expression.php:194 +msgid "max(a,b,...) - maximal value" +msgstr "" + +#: views/admin/expression.php:195 +msgid "min(a,b,...) - minimal value" +msgstr "" + +#: views/admin/expression.php:196 +msgid "sqrt(x) - square root of x" +msgstr "" + +#: views/admin/expression.php:197 +msgid "strlen(x) - Text length of x" +msgstr "" + +#: views/admin/fields_editor.php:15 +msgid "Choose field..." +msgstr "" + +#: views/admin/fields_editor.php:18 +msgid "is empty" +msgstr "" + +#: views/admin/fields_editor.php:19 +msgid "has any value" +msgstr "" + +#: views/admin/fields_editor.php:26 +msgid "contains" +msgstr "" + +#: views/admin/fields_editor.php:31 +msgid "AND" +msgstr "" + +#: views/admin/fields_editor.php:34 +msgid "OR" +msgstr "" + +#: views/admin/fields_editor.php:36 +msgid " is visible if" +msgstr "" + #: views/admin/global_parameters.php:19 msgid "Name" msgstr "" @@ -577,6 +799,10 @@ msgstr "" msgid "Value (numeric)" msgstr "" +#: views/admin/global_parameters.php:33 +msgid "Example values:" +msgstr "" + #: views/admin/pricefilter.php:27 msgid "Enable price filtering" msgstr "" @@ -609,38 +835,54 @@ msgstr "" msgid "For example: \"per m2\"" msgstr "" -#: views/fields/admin.php:22 +#: views/fields/admin.php:20 +msgid "Full row" +msgstr "" + +#: views/fields/admin.php:28 msgid "Title" msgstr "" -#: views/fields/admin.php:23 +#: views/fields/admin.php:29 msgid "Title will be displayed on the product page." msgstr "" -#: views/fields/admin.php:29 +#: views/fields/admin.php:35 msgid "Unique Field Name" msgstr "" -#: views/fields/admin.php:30 +#: views/fields/admin.php:36 msgid "Field name must be unique and consist of letters, numbers and underscores. Correct names are: field_name, product_width." msgstr "" -#: views/fields/admin.php:39 +#: views/fields/admin.php:47 msgid "Hint for Customer (tooltip)" msgstr "" -#: views/fields/admin.php:40 +#: views/fields/admin.php:48 msgid "Text to be displayed as a tooltip just like this one." msgstr "" -#: views/fields/admin.php:46 +#: views/fields/admin.php:54 msgid "CSS Class" msgstr "" -#: views/fields/admin.php:47 +#: views/fields/admin.php:55 msgid "CSS class or multiple classes separated by a space." msgstr "" +#: views/fields/admin.php:65 +msgid "Conditional Visibility" +msgstr "" + +#: views/fields/admin.php:66 +msgid "Set the rules for which this field will be visible." +msgstr "" + +#: views/fields/admin.php:70 +msgid "Set the rules for which this field will be visible. Click on the button --->" +msgstr "" + #: views/fields/admin/attachment.php:9 msgid "Select a file to attach" msgstr "" @@ -649,148 +891,156 @@ msgstr "" msgid "Select File" msgstr "" -#: views/fields/admin/checkbox.php:9 -msgid "Default state checked/unchecked" +#: views/fields/admin/checkbox.php:10 +msgid "Default state" msgstr "" #: views/fields/admin/checkbox.php:12 -#: views/fields/admin/colorpicker.php:13 -#: views/fields/admin/datepicker.php:18 -#: views/fields/admin/dropdown.php:12 -msgid "Price" +msgid "Unchecked" msgstr "" #: views/fields/admin/checkbox.php:13 -#: views/fields/admin/colorpicker.php:14 -#: views/fields/admin/datepicker.php:19 -#: views/fields/admin/dropdown.php:13 -msgid "The price value to use in a expression/formula." +msgid "Checked" msgstr "" +#: views/fields/admin/checkbox.php:18 #: views/fields/admin/checkboxgroup.php:11 -#: views/fields/admin/colorpicker.php:9 -#: views/fields/admin/colorswatches.php:12 -#: views/fields/admin/datepicker.php:9 -#: views/fields/admin/dropdown.php:9 -#: views/fields/admin/fileupload.php:9 -#: views/fields/admin/imageselect.php:12 -#: views/fields/admin/imageupload.php:11 -#: views/fields/admin/text.php:9 -msgid "Select an option to make the field required " -msgstr "" - -#: views/fields/admin/checkboxgroup.php:14 +#: views/fields/admin/colorpicker.php:8 +#: views/fields/admin/colorswatches.php:11 +#: views/fields/admin/datepicker.php:8 +#: views/fields/admin/dropdown.php:8 +#: views/fields/admin/fileupload.php:8 +#: views/fields/admin/imageselect.php:11 +#: views/fields/admin/imageupload.php:10 +#: views/fields/admin/text.php:11 +msgid "Is this field required?" +msgstr "" + +#: views/fields/admin/checkbox.php:26 +#: views/fields/admin/colorpicker.php:15 +#: views/fields/admin/datepicker.php:22 +#: views/fields/admin/dropdown.php:16 +#: views/fields/admin/imageupload.php:16 +#: views/fields/admin/text.php:19 +msgid "Price" +msgstr "" + +#: views/fields/admin/checkbox.php:27 +#: views/fields/admin/colorpicker.php:16 +#: views/fields/admin/datepicker.php:23 +#: views/fields/admin/dropdown.php:17 +msgid "The price value to use in a expression/formula." +msgstr "" + +#: views/fields/admin/checkboxgroup.php:19 msgid "Limit selected checkboxes" msgstr "" -#: views/fields/admin/checkboxgroup.php:15 +#: views/fields/admin/checkboxgroup.php:20 msgid "Set maximum number of checkboxes the user may select. Empty or \"0\" means no limit." msgstr "" -#: views/fields/admin/colorswatches.php:7 +#: views/fields/admin/colorswatches.php:19 msgid "Thumbnail size [px]" msgstr "" -#: views/fields/admin/colorswatches.php:15 -#: views/fields/admin/dropdown.php:16 -#: views/fields/admin/imageselect.php:14 +#: views/fields/admin/colorswatches.php:24 +#: views/fields/admin/dropdown.php:20 +#: views/fields/admin/imageselect.php:18 #: views/fields/admin/select.php:7 msgid "Option Items" msgstr "" -#: views/fields/admin/colorswatches.php:19 -#: views/fields/admin/imageselect.php:18 +#: views/fields/admin/colorswatches.php:28 +#: views/fields/admin/imageselect.php:22 #: views/fields/admin/select.php:11 msgid "Option value" msgstr "" -#: views/fields/admin/colorswatches.php:23 +#: views/fields/admin/colorswatches.php:32 msgid "Color" msgstr "" -#: views/fields/admin/colorswatches.php:27 -#: views/fields/admin/dropdown.php:24 -#: views/fields/admin/imageselect.php:31 +#: views/fields/admin/colorswatches.php:36 +#: views/fields/admin/dropdown.php:28 +#: views/fields/admin/imageselect.php:35 #: views/fields/admin/select.php:19 msgid "Default" msgstr "" -#: views/fields/admin/colorswatches.php:36 -#: views/fields/admin/dropdown.php:33 -#: views/fields/admin/imageselect.php:40 +#: views/fields/admin/colorswatches.php:45 +#: views/fields/admin/dropdown.php:37 +#: views/fields/admin/imageselect.php:44 #: views/fields/admin/select.php:28 msgid "Add new option" msgstr "" -#: views/fields/admin/colorswatches.php:39 -#: views/fields/admin/dropdown.php:36 -#: views/fields/admin/imageselect.php:43 +#: views/fields/admin/colorswatches.php:48 +#: views/fields/admin/dropdown.php:40 +#: views/fields/admin/imageselect.php:47 #: views/fields/admin/select.php:31 msgid "Remove all" msgstr "" -#: views/fields/admin/colorswatches.php:42 -#: views/fields/admin/dropdown.php:39 -#: views/fields/admin/imageselect.php:46 +#: views/fields/admin/colorswatches.php:51 +#: views/fields/admin/dropdown.php:43 +#: views/fields/admin/imageselect.php:50 #: views/fields/admin/select.php:34 msgid "Import options" msgstr "" -#: views/fields/admin/colorswatches.php:45 -#: views/fields/admin/imageselect.php:49 +#: views/fields/admin/colorswatches.php:54 +#: views/fields/admin/imageselect.php:53 #: views/fields/admin/select.php:37 msgid "Import: each option in new line, format: value;title" msgstr "" -#: views/fields/admin/colorswatches.php:48 -#: views/fields/admin/dropdown.php:45 -#: views/fields/admin/imageselect.php:52 -#: views/fields/admin/select.php:40 -msgid "Add" -msgstr "" - -#: views/fields/admin/datepicker.php:14 +#: views/fields/admin/datepicker.php:18 msgid "Disallow past date" msgstr "" -#: views/fields/admin/datepicker.php:15 +#: views/fields/admin/datepicker.php:19 msgid "Select this option to disallow the user from selecting a past date " msgstr "" -#: views/fields/admin/dropdown.php:20 -#: views/fields/admin/imageselect.php:22 +#: views/fields/admin/dropdown.php:24 +#: views/fields/admin/imageselect.php:26 #: views/fields/admin/select.php:15 msgid "Option Text" msgstr "" -#: views/fields/admin/dropdown.php:42 +#: views/fields/admin/dropdown.php:46 msgid "Import: each option in new line" msgstr "" -#: views/fields/admin/fileupload.php:11 +#: views/fields/admin/empty.php:8 +msgid "I am an empty field to take some space in two column layout :)" +msgstr "" + +#: views/fields/admin/fileupload.php:15 msgid "Max. number of files" msgstr "" -#: views/fields/admin/fileupload.php:12 +#: views/fields/admin/fileupload.php:16 msgid "Maximum numer of files that Customer can upload." msgstr "" -#: views/fields/admin/fileupload.php:15 -#: views/fields/admin/imageupload.php:19 +#: views/fields/admin/fileupload.php:19 +#: views/fields/admin/imageupload.php:20 msgid "Max. file size [MB]" msgstr "" -#: views/fields/admin/fileupload.php:16 +#: views/fields/admin/fileupload.php:20 msgid "Maximum size of one file in [MB] MegaBytes" msgstr "" -#: views/fields/admin/fileupload.php:19 -#: views/fields/admin/imageupload.php:23 +#: views/fields/admin/fileupload.php:23 +#: views/fields/admin/imageupload.php:24 msgid "Allowed extensions" msgstr "" -#: views/fields/admin/fileupload.php:20 -#: views/fields/admin/imageupload.php:24 +#: views/fields/admin/fileupload.php:24 +#: views/fields/admin/imageupload.php:25 msgid "Select allowed file extensions." msgstr "" @@ -823,21 +1073,16 @@ msgstr "" msgid "Image size [px]" msgstr "" -#: views/fields/admin/imageselect.php:26 +#: views/fields/admin/imageselect.php:30 msgid "Add Image" msgstr "" -#: views/fields/admin/imageupload.php:14 -#: views/fields/admin/text.php:30 -msgid "Price for the field filled in by the user " -msgstr "" - -#: views/fields/admin/imageupload.php:15 -#: views/fields/admin/text.php:31 +#: views/fields/admin/imageupload.php:17 +#: views/fields/admin/text.php:20 msgid "The price value to use in a expression/formula. If the user does not fill in the field, the price is 0." msgstr "" -#: views/fields/admin/imageupload.php:20 +#: views/fields/admin/imageupload.php:21 msgid "Maximum size of one file in [MB] megabytes" msgstr "" @@ -861,27 +1106,27 @@ msgstr "" msgid "Open in the same window" msgstr "" -#: views/fields/admin/number.php:9 +#: views/fields/admin/number.php:10 msgid "Min. value" msgstr "" -#: views/fields/admin/number.php:10 +#: views/fields/admin/number.php:11 msgid "The minimum value of the field." msgstr "" -#: views/fields/admin/number.php:14 +#: views/fields/admin/number.php:16 msgid "Max. value" msgstr "" -#: views/fields/admin/number.php:15 +#: views/fields/admin/number.php:17 msgid "The maximum value of the field." msgstr "" -#: views/fields/admin/number.php:19 +#: views/fields/admin/number.php:22 msgid "Default value" msgstr "" -#: views/fields/admin/number.php:20 +#: views/fields/admin/number.php:23 msgid "The default value of the field." msgstr "" @@ -889,35 +1134,35 @@ msgstr "" msgid "Paragraph content" msgstr "" -#: views/fields/admin/text.php:12 -msgid "Pattern (RegExp)" -msgstr "" - -#: views/fields/admin/text.php:13 -msgid "Regular expression that the field's value is checked against." -msgstr "" - -#: views/fields/admin/text.php:18 +#: views/fields/admin/text.php:26 msgid "Min. length" msgstr "" -#: views/fields/admin/text.php:19 +#: views/fields/admin/text.php:27 msgid "Minimum character length. Consider that minimum length > 0 makes this field always required." msgstr "" -#: views/fields/admin/text.php:22 +#: views/fields/admin/text.php:31 msgid "Max. length" msgstr "" -#: views/fields/admin/text.php:23 +#: views/fields/admin/text.php:32 msgid "Maximum charaster length." msgstr "" -#: views/fields/admin/text.php:26 +#: views/fields/admin/text.php:37 +msgid "Pattern (RegExp)" +msgstr "" + +#: views/fields/admin/text.php:38 +msgid "Regular expression that the field's value is checked against." +msgstr "" + +#: views/fields/admin/text.php:43 msgid "Placeholder" msgstr "" -#: views/fields/admin/text.php:27 +#: views/fields/admin/text.php:44 msgid "The placeholder specifies a short hint to user. It is displayed in the field before the user enters a text." msgstr "" @@ -936,3 +1181,7 @@ msgstr "" #: views/woocommerce/price_block.php:7 msgid "Total" msgstr "" + +#: views/woocommerce/product.php:41 +msgid "Unsupported layout!" +msgstr "" diff --git a/readme.md b/readme.md index 9b6e05c..f8663d0 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ Tags: woocommerce custom fields, woocommerce product price, woocommerce product fields, woocommerce custom price field, woocommerce personalized product, woocommerce custom product fields, product fields, custom product price, price calculation, price formula Requires at least: 5.0 Tested up to: 6.0.1 -Stable tag: 1.4.0 +Stable tag: 1.4.2 Requires PHP: 5.6 License: GNU GPLv2 Donate link: https://www.paypal.com/donate/?hosted_button_id=5DNZK72H5YCBY @@ -141,7 +141,7 @@ The customer can edit product options after adding to cart. Full documentation at: [www.wckalkulator.com](https://wckalkulator.com) == Changelog == -2022-07-13 v.1.4.0 +2022-07-21 v.1.4.0 - new formula builder - apply filters on td elements in field's templates - new assignment type: product attribute @@ -149,6 +149,7 @@ Full documentation at: [www.wckalkulator.com](https://wckalkulator.com) - toggle button to publish/unpublish fieldsets quickly - support for stock management and stock reduction multiplier - layouts feature - you can choose one or two column layout +- conditional visibility (set rules to show/hide fields) - bug fixes 2022-07-11 v.1.3.3 diff --git a/src/FieldsetProduct.php b/src/FieldsetProduct.php index 640ba39..c11aef1 100644 --- a/src/FieldsetProduct.php +++ b/src/FieldsetProduct.php @@ -93,7 +93,7 @@ public static function getInstance(): FieldsetProduct public function init($product_id = null, $variation_id = null) { $this->product_id = ($product_id === null) ? Product::get_id() : $product_id; - $this->variation_id = ($product_id === null) ? null : $variation_id; + $this->variation_id = ($variation_id === null) ? null : $variation_id; //if ($this->has_fieldset()) { $this->data = $this->get_data(); @@ -741,6 +741,8 @@ public function stock_reduction_multiplier() */ public function visibility_rules() { + $rules = array(); + if (empty($this->fields())) { $this->init(); } @@ -748,7 +750,6 @@ public function visibility_rules() if (!empty($field->data('visibility'))) $rules[$field->data('name')] = json_decode(stripslashes($field->data('visibility')), true); } - return $rules; } diff --git a/views/admin/expression.php b/views/admin/expression.php index 4c83aab..1821650 100644 --- a/views/admin/expression.php +++ b/views/admin/expression.php @@ -48,14 +48,14 @@ class="expression_type expression_addon"
    - +
    - +
    @@ -88,7 +88,9 @@ class="expression_type expression_addon"
    + value="" + autocomplete="off" + role="presentation">

    diff --git a/views/admin/fields_editor.php b/views/admin/fields_editor.php index 751d395..bdee456 100644 --- a/views/admin/fields_editor.php +++ b/views/admin/fields_editor.php @@ -25,7 +25,7 @@ - +
    diff --git a/views/admin/global_parameters.php b/views/admin/global_parameters.php index edf21ff..b999e74 100644 --- a/views/admin/global_parameters.php +++ b/views/admin/global_parameters.php @@ -20,14 +20,14 @@

    + value="" autocomplete="off" required>

    + value="" autocomplete="off" required>


    diff --git a/views/admin/pricefilter.php b/views/admin/pricefilter.php index 9c2d72b..b10cd22 100644 --- a/views/admin/pricefilter.php +++ b/views/admin/pricefilter.php @@ -43,7 +43,7 @@

    - +

    - \ No newline at end of file + \ No newline at end of file diff --git a/wc-kalkulator.php b/wc-kalkulator.php index aa6b4f6..f1df6e8 100644 --- a/wc-kalkulator.php +++ b/wc-kalkulator.php @@ -3,7 +3,7 @@ /** * Plugin Name: WC Kalkulator * Description: Description: Store Manager can add fieldsets to Products and Orders. WC Kalkulator allows to order and calculate the price of the product based on the values of the fields selected by the Customer. - * Version: 1.4.0 + * Version: 1.4.2 * Author: Krzysztof PiÄ…tkowski * Author URI: https://wckalkulator.com * Text Domain: wc-kalkulator @@ -31,7 +31,7 @@ */ class Plugin { - const VERSION = "1.4.0"; + const VERSION = "1.4.2"; const NAME = "wc-kalkulator"; From 2ef430e7a721c60401ac94377990e993ac451d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Pi=C4=85tkowski?= Date: Fri, 22 Jul 2022 01:23:25 +0200 Subject: [PATCH 14/14] V 1.4.2 --- assets/css/admin.css | 3 --- assets/css/admin.css.map | 2 +- assets/css/admin.min.css | 2 +- assets/css/admin.sass | 3 --- assets/js/wckalkulator.js | 2 +- assets/js/wckalkulator.min.js | 2 +- 6 files changed, 4 insertions(+), 10 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index a2b2ed3..b32a67e 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -329,9 +329,6 @@ .wc-kalkulator-wrapper .fields-section button span { line-height: 2; } -.wc-kalkulator-wrapper hr { - margin: 35px 0 35px 0; -} .wc-kalkulator-wrapper .align-right { text-align: right; } diff --git a/assets/css/admin.css.map b/assets/css/admin.css.map index c661718..38143d6 100644 --- a/assets/css/admin.css.map +++ b/assets/css/admin.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["admin.sass"],"names":[],"mappings":"AACE;EACE;;AAGA;EACE;;AAIA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAEN;EACE;;AAEA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEA;EACE;EACA;;AAEA;EACE;EACA;EACA;;AACA;EACE;EACA;EACA;;AAEF;EACE;;AAEJ;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEJ;EACE;EACA;;AAGE;EACE;EACA;EACA;;AAEN;EACE;EACA;;AAGE;EACE;;AAEJ;EACE;EACA;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEN;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEF;EACE;EACA;;AAEN;EACE;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;EACE;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;AAAA;AAAA;AAAA;AAAA;EAKE;EACA;EACA;EACA;;AAEF;AAAA;EAEE;EACA;;AAEF;EACE;EACA;EACA;;AAGA;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEN;EACE;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAIA;EACE;;AAIF;EACE;;AAGJ;EACE;;AAEJ;EACE;;AAIE;EACE;;AAEN;EACE;EACA;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGA;EACE;EACA;EACA;;AAEA;EACE;;AAEN;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEA;EACE;;AAEN;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;;AACA;EACE;EACA;EACA;;AACF;EACE;;;AAGN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;AAEA;EACE;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;;AAER;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAbA;EACE;;AAcF;EACE;;AAEF;EACE;;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;EACA;;AACA;EACE;;AACF;EACE;EACA;;AACA;EACE;;AACF;EACE;;AACF;EACE;;AACJ;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;;AACJ;EACE;;AACF;EACE;EACA;EACA;;AACA;EACE;EACA;;AAEF;EACE;;AACJ;EACE;EACA;;AACF;EACE;EACA;EACA;;AACJ;EACE;;AACF;EACE;EACA;EACA","file":"admin.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["admin.sass"],"names":[],"mappings":"AACE;EACE;;AAGA;EACE;;AAIA;EACE;EACA;EACA;EACA;EACA;;AAEF;EACE;;AAEN;EACE;;AAEA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEA;EACE;EACA;;AAEA;EACE;EACA;EACA;;AACA;EACE;EACA;EACA;;AAEF;EACE;;AAEJ;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEJ;EACE;EACA;;AAGE;EACE;EACA;EACA;;AAEN;EACE;EACA;;AAGE;EACE;;AAEJ;EACE;EACA;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEN;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;;AAEF;EACE;;AAEF;EACE;EACA;EACA;;AAEF;EACE;EACA;;AAEN;EACE;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;EACE;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;AAAA;AAAA;AAAA;AAAA;EAKE;EACA;EACA;EACA;;AAEF;AAAA;EAEE;EACA;;AAEF;EACE;EACA;EACA;;AAGA;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEN;EACE;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAIA;EACE;;AAIF;EACE;;AAGJ;EACE;;AAEJ;EACE;;AAIE;EACE;;AAEN;EACE;EACA;EACA;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGA;EACE;EACA;EACA;;AAEA;EACE;;AAEN;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;;AAEF;EACE;EACA;;AAEA;EACE;;AAEN;EACE;;AAEF;EACE;;AAEF;EACE;;AAEF;EACE;;AAGA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;;AAEN;EACE;EACA;EACA;EACA;EACA;EACA;;AAEF;EACE;;AACA;EACE;EACA;EACA;;AACF;EACE;;;AAGN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;AAEA;EACE;EACA;EACA;;AAEA;EACE;;AAEF;EACE;;;AAER;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAbA;EACE;;AAcF;EACE;;AAEF;EACE;;;AAEJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;;AACF;EACE;EACA;EACA;;AACA;EACE;;AACF;EACE;EACA;;AACA;EACE;;AACF;EACE;;AACF;EACE;;AACJ;EACE;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;;AACJ;EACE;;AACF;EACE;EACA;EACA;;AACA;EACE;EACA;;AAEF;EACE;;AACJ;EACE;EACA;;AACF;EACE;EACA;EACA;;AACJ;EACE;;AACF;EACE;EACA;EACA","file":"admin.css"} \ No newline at end of file diff --git a/assets/css/admin.min.css b/assets/css/admin.min.css index fcc0a45..0490939 100644 --- a/assets/css/admin.min.css +++ b/assets/css/admin.min.css @@ -1 +1 @@ -.wc-kalkulator-wrapper html{scroll-padding-top:100px}.wc-kalkulator-wrapper p.add-buttons{line-height:36px}.wc-kalkulator-wrapper a.button.action-add-image{margin-bottom:20px;margin-top:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper a.button.action-add-attachment{margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list{width:100%}.wc-kalkulator-wrapper ul#f-field-list *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list .wck-sortable-placeholder{border:1px dashed #888;background-color:#eee;box-shadow:none;text-align:center;color:#888;padding:22px}.wc-kalkulator-wrapper ul#f-field-list li{box-shadow:0 5px 10px #ccc;margin-bottom:5px}.wc-kalkulator-wrapper ul#f-field-list li .field{border:1px solid #aaa;background-color:#fff}.wc-kalkulator-wrapper ul#f-field-list li .field .header{background-color:#f5f5f5;padding:8px;cursor:move}.wc-kalkulator-wrapper ul#f-field-list li .field .header .text{font-size:14px;color:#000;padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .header .name{padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .body{padding:20px;border-top:1px solid #aaa}.wc-kalkulator-wrapper ul#f-field-list li .field .body .half{float:left;width:50%;padding-left:10px;padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .third{float:left;padding-left:10px;padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .last,.wc-kalkulator-wrapper ul#f-field-list li .field .body .second{padding-left:10px;padding-right:0}.wc-kalkulator-wrapper ul#f-field-list li .field .body .first{padding-right:10px;padding-left:0}.wc-kalkulator-wrapper ul#f-field-list li .field .body .third{width:33%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .fu-allowed-extensions{margin-top:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body label{font-size:12px;margin-bottom:3px;font-weight:700}.wc-kalkulator-wrapper ul#f-field-list li .field .body label.error{background-color:#e30000;color:#fff;padding:6px;margin:6px 0;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair{display:flex;align-items:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair span.dashicons-no-alt{cursor:pointer;font-size:28px;color:red}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs{margin-top:20px;margin-bottom:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .pair:not(:first-child) label{display:none}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs button{margin-right:6px;margin-bottom:6px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer{display:none;margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer textarea{display:block;width:100%;min-height:200px;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column{float:left}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1{width:40%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-half{width:20%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2{width:40%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2-half{text-align:center;width:20%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-2{width:80%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-3{width:10%;padding-left:20px;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-4{width:10%;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .clear{clear:both}.wc-kalkulator-wrapper .input-group .dashicons,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons{padding:3px;margin-left:2px;margin-right:2px;cursor:pointer;color:#555;font-size:16px;line-height:1.5}.wc-kalkulator-wrapper .input-group .dashicons.action-drag,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons.action-drag{cursor:move;font-size:16px;line-height:1.5}.wc-kalkulator-wrapper .input-group .left,.wc-kalkulator-wrapper ul#f-field-list li .field .header .left{float:left}.wc-kalkulator-wrapper .input-group .right,.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{float:right}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]),.wc-kalkulator-wrapper ul#f-field-list li .field .body label{display:block;width:100%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]).inline,.wc-kalkulator-wrapper ul#f-field-list li .field .body label.inline{display:inline;margin-right:10px;width:auto}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.fdp-disallow-past-date,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param[type=checkbox]{margin:10px 15px 14px 3px}.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=number].param,.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=text].param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text]{border:1px solid #aaa;border-radius:0;padding:5px 10px;width:100%;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body select.param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper .clearfix,.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair:after{content:"";display:block;clear:both}.wc-kalkulator-wrapper ul#f-field-list li .header .wck-toggle-colspan,.wc-kalkulator-wrapper ul#f-field-list li .header .wck-toggle-colspan-label{display:none}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col li{width:49.4%;display:inline-block;margin:.25%;vertical-align:top}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col li.wck-layout-colspan{width:99.25%}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col .header .wck-toggle-colspan{display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;margin-top:4px;cursor:pointer}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col .header .wck-toggle-colspan-label{display:block;line-height:2.2em;font-size:12px;padding-right:6px}.wc-kalkulator-wrapper .pr-20{padding-right:20px}.wc-kalkulator-wrapper .input-icon{position:relative;font-family:monospace;width:100%;margin:10px 0 15px}.wc-kalkulator-wrapper .input-icon i{font-family:monospace;font-size:13px;position:absolute;display:block;top:11px;pointer-events:none;width:50px;text-align:right;font-style:normal;color:#00f}.wc-kalkulator-wrapper .input-icon input{border:1px solid #aaa;border-radius:0;padding:5px 10px 5px 55px;width:100%}.wc-kalkulator-wrapper .input-if i::after{content:"if"}.wc-kalkulator-wrapper .input-equation i::after{content:"price"}.wc-kalkulator-wrapper .input-stock i::after{content:"qty * "}.wc-kalkulator-wrapper #addon-inputs .input-equation i::after{content:"add"}.wc-kalkulator-wrapper .input-else i::after{content:"else"}.wc-kalkulator-wrapper .input-group{padding:8px;background-color:#eee;margin-bottom:5px}.wc-kalkulator-wrapper .ui-autocomplete-loading{background-image:none!important}.wc-kalkulator-wrapper .wc-category-search,.wc-kalkulator-wrapper .wc-enhanced-select,.wc-kalkulator-wrapper .wc-page-search,.wc-kalkulator-wrapper .wc-product-search{width:100%}.wc-kalkulator-wrapper button.add-operator{margin-right:3px}.wc-kalkulator-wrapper span.formula-field{padding-left:6px;cursor:pointer;font-weight:700}.wc-kalkulator-wrapper span.formula-field:hover{text-decoration:underline}.wc-kalkulator-wrapper .wp-media-image-preview{max-width:80px;max-height:80px;cursor:pointer}.wc-kalkulator-wrapper .wp-media-image-preview:hover{transform:scale(1.2);-moz-transform:scale(1.2);-webkit-transform:scale(1.2)}.wc-kalkulator-wrapper select.param{margin-bottom:20px}.wc-kalkulator-wrapper .iris-picker{position:absolute;z-index:9999}.wc-kalkulator-wrapper .fields-section{text-align:center;padding:50px;margin:0 auto;max-width:500px}.wc-kalkulator-wrapper .fields-section button,.wc-kalkulator-wrapper .fields-section select{font-size:16px}.wc-kalkulator-wrapper .fields-section select{width:300px;padding:5px 10px}.wc-kalkulator-wrapper .fields-section button{width:50px;padding:3px 8px}.wc-kalkulator-wrapper .fields-section button span{line-height:2}.wc-kalkulator-wrapper hr{margin:35px 0}#wck-toolbar,.wc-kalkulator-wrapper .align-right{text-align:right}.wc-kalkulator-wrapper .wck-toggle-expand,.wc-kalkulator-wrapper .wck-toggle-layout{cursor:pointer}.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{opacity:0}#wck-cv-builder .builder .and-condition:hover .cv-remove,.wc-kalkulator-wrapper ul#f-field-list li .field:hover .header .right{opacity:1}.wc-kalkulator-wrapper #wck_expression .wck-sortable-placeholder{border:1px dashed #888;background-color:#eee;box-shadow:none;text-align:center;color:#888;height:60px;margin-bottom:3px}.wc-kalkulator-wrapper #wck_expression .input-group .input-equation,.wc-kalkulator-wrapper #wck_expression .input-group .input-if{float:left;width:46%;margin:0 .5%}.wc-kalkulator-wrapper #wck_expression .input-group .input-buttons{float:left;width:2.5%;padding-top:5px}.wc-kalkulator-wrapper .inventory label{font-size:15px;margin:55px 0 10px;border-top:1px solid #c3c4c7;display:block;border-bottom:1px solid #c3c4c7;padding:10px 0 10px 5px}.wc-kalkulator-wrapper .cv-container{position:relative}.wc-kalkulator-wrapper .cv-container .action-field-visibility{position:absolute;right:5px;top:5px}.wc-kalkulator-wrapper .cv-container .visibility-readable{background-color:#fff}#postbox-container-2.fullscreen{position:fixed;z-index:999999;left:0;top:0;right:0;bottom:0;margin:0;background-color:#fff;overflow-y:scroll}#postbox-container-2.fullscreen #advanced-sortables,#postbox-container-2.fullscreen #normal-sortables{padding:20px}#wck-toolbar{position:fixed;bottom:0;left:0;right:0;z-index:9999999;background:#f5f5f5;border-top:1px solid #aaa;padding:10px 20px;box-shadow:0 0 45px #000}#wck-toolbar .wck-toggle-fullscreen{cursor:pointer}#wck-toolbar ul{margin:0}#wck-toolbar ul li{margin-bottom:0;display:inline-block}#wck-toolbar ul li,#wck-toolbar ul li li>*{vertical-align:middle}#wck-toolbar ul li.space{width:10px}#wck-expression-toolbar{display:none;position:absolute;top:0;border:1px solid #888;border-radius:5px;box-shadow:0 0 50px rgba(0,0,0,.5);padding:10px 20px;background-color:#fff;margin:0;width:360px;vertical-align:middle;text-align:justify;tab-index:0}#wck-expression-toolbar *{tab-index:0}#wck-expression-toolbar .button{margin-bottom:6px}#wck-expression-toolbar select{width:270px}#wck-cv-builder{overflow:none;display:none;border-radius:3px;position:fixed;z-index:99999999;top:150px;left:50%;margin-left:-500px;bottom:150px;width:1000px;background-color:#fff;box-shadow:0 0 200px 100px rgba(0,0,0,.4);flex-direction:column}#wck-cv-builder .template{display:none;visibility:hidden}#wck-cv-builder .builder{flex-basis:100%;margin:20px 40px 0 5px;overflow-y:auto}#wck-cv-builder .builder .or-group{width:100%}#wck-cv-builder .builder .and-condition{display:flex;gap:3px;margin-bottom:3px}#wck-cv-builder .builder .and-condition .validation-error{border-color:red}#wck-cv-builder .builder .and-condition button{margin-bottom:3px}#wck-cv-builder .builder .and-condition .p-value{flex-grow:2}#wck-cv-builder .builder .or-condition{display:flex;flex-direction:row;align-content:stretch;gap:3px;flex-wrap:wrap}#wck-cv-builder .builder .or-condition:not(:first-child)::before{content:"OR";flex-basis:100%;display:block;font-weight:700;padding:10px;margin-left:25px}#wck-cv-builder .builder .and-group{flex-grow:4}#wck-cv-builder .builder .cv-remove{text-decoration:none;opacity:0;padding:5px}#wck-cv-builder .builder .cv-remove span{font-size:14px;line-height:1}#wck-cv-builder .builder .cv-action-and{align-self:end;margin-bottom:3px}#wck-cv-builder .builder .cv-action-or{display:block;margin-top:10px;margin-left:33px}#wck-cv-builder h1{padding:40px 40px 0}#wck-cv-builder p.save{padding:10px 20px 0;text-align:right;border-top:1px solid #ccc} \ No newline at end of file +.wc-kalkulator-wrapper html{scroll-padding-top:100px}.wc-kalkulator-wrapper p.add-buttons{line-height:36px}.wc-kalkulator-wrapper a.button.action-add-image{margin-bottom:20px;margin-top:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper a.button.action-add-attachment{margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list{width:100%}.wc-kalkulator-wrapper ul#f-field-list *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list .wck-sortable-placeholder{border:1px dashed #888;background-color:#eee;box-shadow:none;text-align:center;color:#888;padding:22px}.wc-kalkulator-wrapper ul#f-field-list li{box-shadow:0 5px 10px #ccc;margin-bottom:5px}.wc-kalkulator-wrapper ul#f-field-list li .field{border:1px solid #aaa;background-color:#fff}.wc-kalkulator-wrapper ul#f-field-list li .field .header{background-color:#f5f5f5;padding:8px;cursor:move}.wc-kalkulator-wrapper ul#f-field-list li .field .header .text{font-size:14px;color:#000;padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .header .name{padding:5px}.wc-kalkulator-wrapper ul#f-field-list li .field .body{padding:20px;border-top:1px solid #aaa}.wc-kalkulator-wrapper ul#f-field-list li .field .body .half{float:left;width:50%;padding-left:10px;padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .third{float:left;padding-left:10px;padding-right:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .last,.wc-kalkulator-wrapper ul#f-field-list li .field .body .second{padding-left:10px;padding-right:0}.wc-kalkulator-wrapper ul#f-field-list li .field .body .first{padding-right:10px;padding-left:0}.wc-kalkulator-wrapper ul#f-field-list li .field .body .third{width:33%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .fu-allowed-extensions{margin-top:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body label{font-size:12px;margin-bottom:3px;font-weight:700}.wc-kalkulator-wrapper ul#f-field-list li .field .body label.error{background-color:#e30000;color:#fff;padding:6px;margin:6px 0;box-sizing:border-box}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair{display:flex;align-items:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair span.dashicons-no-alt{cursor:pointer;font-size:28px;color:red}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs{margin-top:20px;margin-bottom:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .pair:not(:first-child) label{display:none}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs button{margin-right:6px;margin-bottom:6px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer{display:none;margin-top:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pairs .importer textarea{display:block;width:100%;min-height:200px;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column{float:left}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1{width:40%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-half{width:20%;padding-right:20px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2{width:40%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-2-half{text-align:center;width:20%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-1-2{width:80%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-3{width:10%;padding-left:20px;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .field .body .column-4{width:10%;text-align:center}.wc-kalkulator-wrapper ul#f-field-list li .clear{clear:both}.wc-kalkulator-wrapper .input-group .dashicons,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons{padding:3px;margin-left:2px;margin-right:2px;cursor:pointer;color:#555;font-size:16px;line-height:1.5}.wc-kalkulator-wrapper .input-group .dashicons.action-drag,.wc-kalkulator-wrapper ul#f-field-list li .field .header .dashicons.action-drag{cursor:move;font-size:16px;line-height:1.5}.wc-kalkulator-wrapper .input-group .left,.wc-kalkulator-wrapper ul#f-field-list li .field .header .left{float:left}.wc-kalkulator-wrapper .input-group .right,.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{float:right}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]),.wc-kalkulator-wrapper ul#f-field-list li .field .body label{display:block;width:100%}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param:not([type=checkbox]).inline,.wc-kalkulator-wrapper ul#f-field-list li .field .body label.inline{display:inline;margin-right:10px;width:auto}.wc-kalkulator-wrapper ul#f-field-list li .field .body .param.fdp-disallow-past-date,.wc-kalkulator-wrapper ul#f-field-list li .field .body .param[type=checkbox]{margin:10px 15px 14px 3px}.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=number].param,.wc-kalkulator-wrapper ul#f-field-list li .field .body input[type=text].param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=number],.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair input[type=text]{border:1px solid #aaa;border-radius:0;padding:5px 10px;width:100%;margin-bottom:10px}.wc-kalkulator-wrapper ul#f-field-list li .field .body select.param{margin-bottom:20px;border:1px solid #aaa;border-radius:0;padding:5px 10px}.wc-kalkulator-wrapper .clearfix,.wc-kalkulator-wrapper ul#f-field-list li .field .body .pair:after{content:"";display:block;clear:both}.wc-kalkulator-wrapper ul#f-field-list li .header .wck-toggle-colspan,.wc-kalkulator-wrapper ul#f-field-list li .header .wck-toggle-colspan-label{display:none}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col li{width:49.4%;display:inline-block;margin:.25%;vertical-align:top}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col li.wck-layout-colspan{width:99.25%}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col .header .wck-toggle-colspan{display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;margin-top:4px;cursor:pointer}.wc-kalkulator-wrapper ul#f-field-list.layout-two-col .header .wck-toggle-colspan-label{display:block;line-height:2.2em;font-size:12px;padding-right:6px}.wc-kalkulator-wrapper .pr-20{padding-right:20px}.wc-kalkulator-wrapper .input-icon{position:relative;font-family:monospace;width:100%;margin:10px 0 15px}.wc-kalkulator-wrapper .input-icon i{font-family:monospace;font-size:13px;position:absolute;display:block;top:11px;pointer-events:none;width:50px;text-align:right;font-style:normal;color:#00f}.wc-kalkulator-wrapper .input-icon input{border:1px solid #aaa;border-radius:0;padding:5px 10px 5px 55px;width:100%}.wc-kalkulator-wrapper .input-if i::after{content:"if"}.wc-kalkulator-wrapper .input-equation i::after{content:"price"}.wc-kalkulator-wrapper .input-stock i::after{content:"qty * "}.wc-kalkulator-wrapper #addon-inputs .input-equation i::after{content:"add"}.wc-kalkulator-wrapper .input-else i::after{content:"else"}.wc-kalkulator-wrapper .input-group{padding:8px;background-color:#eee;margin-bottom:5px}.wc-kalkulator-wrapper .ui-autocomplete-loading{background-image:none!important}.wc-kalkulator-wrapper .wc-category-search,.wc-kalkulator-wrapper .wc-enhanced-select,.wc-kalkulator-wrapper .wc-page-search,.wc-kalkulator-wrapper .wc-product-search{width:100%}.wc-kalkulator-wrapper button.add-operator{margin-right:3px}.wc-kalkulator-wrapper span.formula-field{padding-left:6px;cursor:pointer;font-weight:700}.wc-kalkulator-wrapper span.formula-field:hover{text-decoration:underline}.wc-kalkulator-wrapper .wp-media-image-preview{max-width:80px;max-height:80px;cursor:pointer}.wc-kalkulator-wrapper .wp-media-image-preview:hover{transform:scale(1.2);-moz-transform:scale(1.2);-webkit-transform:scale(1.2)}.wc-kalkulator-wrapper select.param{margin-bottom:20px}.wc-kalkulator-wrapper .iris-picker{position:absolute;z-index:9999}.wc-kalkulator-wrapper .fields-section{text-align:center;padding:50px;margin:0 auto;max-width:500px}.wc-kalkulator-wrapper .fields-section button,.wc-kalkulator-wrapper .fields-section select{font-size:16px}.wc-kalkulator-wrapper .fields-section select{width:300px;padding:5px 10px}.wc-kalkulator-wrapper .fields-section button{width:50px;padding:3px 8px}.wc-kalkulator-wrapper .fields-section button span{line-height:2}#wck-toolbar,.wc-kalkulator-wrapper .align-right{text-align:right}.wc-kalkulator-wrapper .wck-toggle-expand,.wc-kalkulator-wrapper .wck-toggle-layout{cursor:pointer}.wc-kalkulator-wrapper ul#f-field-list li .field .header .right{opacity:0}#wck-cv-builder .builder .and-condition:hover .cv-remove,.wc-kalkulator-wrapper ul#f-field-list li .field:hover .header .right{opacity:1}.wc-kalkulator-wrapper #wck_expression .wck-sortable-placeholder{border:1px dashed #888;background-color:#eee;box-shadow:none;text-align:center;color:#888;height:60px;margin-bottom:3px}.wc-kalkulator-wrapper #wck_expression .input-group .input-equation,.wc-kalkulator-wrapper #wck_expression .input-group .input-if{float:left;width:46%;margin:0 .5%}.wc-kalkulator-wrapper #wck_expression .input-group .input-buttons{float:left;width:2.5%;padding-top:5px}.wc-kalkulator-wrapper .inventory label{font-size:15px;margin:55px 0 10px;border-top:1px solid #c3c4c7;display:block;border-bottom:1px solid #c3c4c7;padding:10px 0 10px 5px}.wc-kalkulator-wrapper .cv-container{position:relative}.wc-kalkulator-wrapper .cv-container .action-field-visibility{position:absolute;right:5px;top:5px}.wc-kalkulator-wrapper .cv-container .visibility-readable{background-color:#fff}#postbox-container-2.fullscreen{position:fixed;z-index:999999;left:0;top:0;right:0;bottom:0;margin:0;background-color:#fff;overflow-y:scroll}#postbox-container-2.fullscreen #advanced-sortables,#postbox-container-2.fullscreen #normal-sortables{padding:20px}#wck-toolbar{position:fixed;bottom:0;left:0;right:0;z-index:9999999;background:#f5f5f5;border-top:1px solid #aaa;padding:10px 20px;box-shadow:0 0 45px #000}#wck-toolbar .wck-toggle-fullscreen{cursor:pointer}#wck-toolbar ul{margin:0}#wck-toolbar ul li{margin-bottom:0;display:inline-block}#wck-toolbar ul li,#wck-toolbar ul li li>*{vertical-align:middle}#wck-toolbar ul li.space{width:10px}#wck-expression-toolbar{display:none;position:absolute;top:0;border:1px solid #888;border-radius:5px;box-shadow:0 0 50px rgba(0,0,0,.5);padding:10px 20px;background-color:#fff;margin:0;width:360px;vertical-align:middle;text-align:justify;tab-index:0}#wck-expression-toolbar *{tab-index:0}#wck-expression-toolbar .button{margin-bottom:6px}#wck-expression-toolbar select{width:270px}#wck-cv-builder{overflow:none;display:none;border-radius:3px;position:fixed;z-index:99999999;top:150px;left:50%;margin-left:-500px;bottom:150px;width:1000px;background-color:#fff;box-shadow:0 0 200px 100px rgba(0,0,0,.4);flex-direction:column}#wck-cv-builder .template{display:none;visibility:hidden}#wck-cv-builder .builder{flex-basis:100%;margin:20px 40px 0 5px;overflow-y:auto}#wck-cv-builder .builder .or-group{width:100%}#wck-cv-builder .builder .and-condition{display:flex;gap:3px;margin-bottom:3px}#wck-cv-builder .builder .and-condition .validation-error{border-color:red}#wck-cv-builder .builder .and-condition button{margin-bottom:3px}#wck-cv-builder .builder .and-condition .p-value{flex-grow:2}#wck-cv-builder .builder .or-condition{display:flex;flex-direction:row;align-content:stretch;gap:3px;flex-wrap:wrap}#wck-cv-builder .builder .or-condition:not(:first-child)::before{content:"OR";flex-basis:100%;display:block;font-weight:700;padding:10px;margin-left:25px}#wck-cv-builder .builder .and-group{flex-grow:4}#wck-cv-builder .builder .cv-remove{text-decoration:none;opacity:0;padding:5px}#wck-cv-builder .builder .cv-remove span{font-size:14px;line-height:1}#wck-cv-builder .builder .cv-action-and{align-self:end;margin-bottom:3px}#wck-cv-builder .builder .cv-action-or{display:block;margin-top:10px;margin-left:33px}#wck-cv-builder h1{padding:40px 40px 0}#wck-cv-builder p.save{padding:10px 20px 0;text-align:right;border-top:1px solid #ccc} \ No newline at end of file diff --git a/assets/css/admin.sass b/assets/css/admin.sass index 32532f9..6053621 100644 --- a/assets/css/admin.sass +++ b/assets/css/admin.sass @@ -345,9 +345,6 @@ span line-height: 2 - hr - margin: 35px 0 35px 0 - .align-right text-align: right diff --git a/assets/js/wckalkulator.js b/assets/js/wckalkulator.js index dd49a3e..12eed3b 100644 --- a/assets/js/wckalkulator.js +++ b/assets/js/wckalkulator.js @@ -111,7 +111,7 @@ } }); - $(document).on('change', _form + ' input, ' + _form + ' select', function () { + $(document).on('change', _form + ' input, ' + _form + ' select, ' + _form + ' textarea', function () { updateUI(); clearTimeout(userTimeout); userTimeout = setTimeout(function () { diff --git a/assets/js/wckalkulator.min.js b/assets/js/wckalkulator.min.js index ba723a6..37d7222 100644 --- a/assets/js/wckalkulator.min.js +++ b/assets/js/wckalkulator.min.js @@ -1 +1 @@ -(function($){"use strict";$(document).ready(function($){var userTimeout;var _form=wck_ajax_object.form;var shouldCalculatePrice=wck_ajax_object._wck_has_expression==="1";var CV={};if(wck_ajax_object.hasOwnProperty("_wck_visibility_rules")&&wck_ajax_object._wck_visibility_rules!==null){$.each(wck_ajax_object._wck_visibility_rules,function(fieldName,options){$("#wck_"+fieldName).hide().closest("tr").hide();CV[fieldName]=options})}function updateUI(){var formFields={};jQuery(_form+" [name^=wck").each(function(){var fieldName=$(this).attr("name").replace("wck[","").replace("]","");formFields["{"+fieldName+"}"]=$(this).val();if(CV.hasOwnProperty(fieldName)){toggleField(fieldName,CV[fieldName])}});$("span.wck-dynamic").each(function(){var expr=$(this).data("expr");var vars=expr.match(/{[^}]+}/gm);vars.forEach(function(v,i){expr=expr.replaceAll(v,formFields[v])});$(this).text(Math.round(Mexp.eval(expr)*100)/100)})}function toggleField(fieldName,rules){var state=null;$.each(rules,function(i,or_rule){$.each(or_rule,function(j,and_rule){var field=$("#wck_"+and_rule.field);if(field.length){state=compare(field.val(),and_rule.comp,and_rule.value)}return state!==false});if(state===true){$("#wck_"+fieldName).show().closest("tr").show();return false}});if(state!==true){$("#wck_"+fieldName).hide().closest("tr").hide();return false}}function compare(valueA,comp,valueB){try{switch(comp){case"1":return valueA==="";case"2":return valueA!=="";case"3":return valueA===valueB;case"4":return valueA!==valueB;case"5":case"6":case"7":case"8":var numA=Math.round(parseFloat(valueA)*1e3)/1e3;var numB=Math.round(parseFloat(valueB)*1e3)/1e3;case"5":return numAnumB;case"8":return numA>=numB;case"9":return valueA.includes(valueB)}}catch(e){return false}return false}function calculatePrice(){if(shouldCalculatePrice){var data=$(_form).serialize().replace("add-to-cart","atc")+"&action=wckalkulator_calculate_price"+"&_wck_ajax_nonce="+wck_ajax_object._wck_ajax_nonce;$.each($(_form+" input[type=file].wck_imageupload"),function(){data+="&"+$(this).attr("name")+"="+($(this)[0].files.length===1?$(this)[0].files[0].size:0)});$.post(wck_ajax_object.ajax_url,data,function(response){if(response){$("#wckalkulator-price").html(response)}})}}$("input.wck_imageupload").on("change",function(e){var size=$(this)[0].files[0].size;if(size>$(this).data("maxfilesize")*1e6){alert(wck_ajax_object._wck_i18n_maxfilesize+" Max. "+$(this).data("maxfilesize")+"MB");$(this).val("")}});$(document).on("change",_form+" input, "+_form+" select",function(){updateUI();clearTimeout(userTimeout);userTimeout=setTimeout(function(){$("#wckalkulator-price").html('...');calculatePrice()},1e3)});updateUI();calculatePrice();$("span.wck-field-tip").tipTip({attribute:"title",defaultPosition:"left"});$("input[type=checkbox][data-type='checkboxgroup']").change(function(e){var group=$(this).data("group");var required=$(this).data("required")===1;var limit=$(this).data("limit");var checked_count=$("input[type=checkbox][data-group='"+group+"']:checked").length;if(limit>0){if(checked_count>limit){$(this).prop("checked",false).blur()}}if(required&&checked_count===0){$(this).prop("checked",true)}checked_count=$("input[type=checkbox][data-group='"+group+"']:checked").length;if(checked_count>0){$("input[type=checkbox][data-group="+group+"]").get(0).setCustomValidity("")}});$(_form).submit(function(e){var lastGroup="";var _form=$(this).get(0);$("input[type=checkbox][data-type='checkboxgroup']").each(function(){var group=$(this).data("group");if(group!==lastGroup){if($(this).data("required")===1&&$("input[type=checkbox][data-group="+group+"]:checked").length===0){$("input[type=checkbox][data-group="+group+"]").get(0).setCustomValidity(wck_ajax_object._wck_i18n_required);_form.reportValidity();e.preventDefault();return false}}lastGroup=group})})})})(jQuery);!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Mexp=e():t.Mexp=e()}(self,function(){return t={28:(t,e,a)=>{var n=a(733);n.prototype.formulaEval=function(){"use strict";for(var t,e,a,n=[],o=this.value,p=0;p"+e.value+""+o[p].show+""+t.value+"",type:10}):n.push({value:(1!=e.type?"(":"")+e.value+(1!=e.type?")":"")+""+t.value+"",type:1})):2===o[p].type||9===o[p].type?(t=n.pop(),e=n.pop(),n.push({value:(1!=e.type?"(":"")+e.value+(1!=e.type?")":"")+o[p].show+(1!=t.type?"(":"")+t.value+(1!=t.type?")":""),type:o[p].type})):12===o[p].type&&(t=n.pop(),e=n.pop(),a=n.pop(),n.push({value:o[p].show+"("+a.value+","+e.value+","+t.value+")",type:12}));return n[0].value},t.exports=n},618:(t,e,a)=>{"use strict";var n=a(178);function o(t,e){for(var a=0;ag.length-2?g.length-1:t.length-v;a>0;a--)if(void 0!==g[a])for(o=0;o0&&a{"use strict";var e=function(t){this.value=t};e.math={isDegree:!0,acos:function(t){return e.math.isDegree?180/Math.PI*Math.acos(t):Math.acos(t)},add:function(t,e){return t+e},asin:function(t){return e.math.isDegree?180/Math.PI*Math.asin(t):Math.asin(t)},atan:function(t){return e.math.isDegree?180/Math.PI*Math.atan(t):Math.atan(t)},acosh:function(t){return Math.log(t+Math.sqrt(t*t-1))},asinh:function(t){return Math.log(t+Math.sqrt(t*t+1))},atanh:function(t){return Math.log((1+t)/(1-t))},C:function(t,a){var n=1,o=t-a,p=a;p{var n=a(618);n.prototype.toPostfix=function(){"use strict";for(var t,e,a,o,p,h=[],u=[{value:"(",type:4,pre:0}],s=this.value,r=1;ra)u.push(t);else{for(;a>=o&&!i||i&&o{var n=a(477);n.prototype.postfixEval=function(t){"use strict";(t=t||{}).PI=Math.PI,t.E=Math.E;for(var e,a,o,p=[],h=this.value,u=void 0!==t.n,s=0;s1)throw new n.Exception("Uncaught Syntax error");return p[0].value>1e15?"Infinity":parseFloat(p[0].value.toFixed(15))},n.eval=function(t,e,a){return void 0===e?this.lex(t).toPostfix().postfixEval():void 0===a?void 0!==e.length?this.lex(t,e).toPostfix().postfixEval():this.lex(t).toPostfix().postfixEval(e):this.lex(t,e).toPostfix().postfixEval(a)},t.exports=n}},e={},a=function a(n){var o=e[n];if(void 0!==o)return o.exports;var p=e[n]={exports:{}};return t[n](p,p.exports,a),p.exports}(28),a;var t,e,a}); \ No newline at end of file +(function($){"use strict";$(document).ready(function($){var userTimeout;var _form=wck_ajax_object.form;var shouldCalculatePrice=wck_ajax_object._wck_has_expression==="1";var CV={};if(wck_ajax_object.hasOwnProperty("_wck_visibility_rules")&&wck_ajax_object._wck_visibility_rules!==null){$.each(wck_ajax_object._wck_visibility_rules,function(fieldName,options){$("#wck_"+fieldName).hide().closest("tr").hide();CV[fieldName]=options})}function updateUI(){var formFields={};jQuery(_form+" [name^=wck").each(function(){var fieldName=$(this).attr("name").replace("wck[","").replace("]","");formFields["{"+fieldName+"}"]=$(this).val();if(CV.hasOwnProperty(fieldName)){toggleField(fieldName,CV[fieldName])}});$("span.wck-dynamic").each(function(){var expr=$(this).data("expr");var vars=expr.match(/{[^}]+}/gm);vars.forEach(function(v,i){expr=expr.replaceAll(v,formFields[v])});$(this).text(Math.round(Mexp.eval(expr)*100)/100)})}function toggleField(fieldName,rules){var state=null;$.each(rules,function(i,or_rule){$.each(or_rule,function(j,and_rule){var field=$("#wck_"+and_rule.field);if(field.length){state=compare(field.val(),and_rule.comp,and_rule.value)}return state!==false});if(state===true){$("#wck_"+fieldName).show().closest("tr").show();return false}});if(state!==true){$("#wck_"+fieldName).hide().closest("tr").hide();return false}}function compare(valueA,comp,valueB){try{switch(comp){case"1":return valueA==="";case"2":return valueA!=="";case"3":return valueA===valueB;case"4":return valueA!==valueB;case"5":case"6":case"7":case"8":var numA=Math.round(parseFloat(valueA)*1e3)/1e3;var numB=Math.round(parseFloat(valueB)*1e3)/1e3;case"5":return numAnumB;case"8":return numA>=numB;case"9":return valueA.includes(valueB)}}catch(e){return false}return false}function calculatePrice(){if(shouldCalculatePrice){var data=$(_form).serialize().replace("add-to-cart","atc")+"&action=wckalkulator_calculate_price"+"&_wck_ajax_nonce="+wck_ajax_object._wck_ajax_nonce;$.each($(_form+" input[type=file].wck_imageupload"),function(){data+="&"+$(this).attr("name")+"="+($(this)[0].files.length===1?$(this)[0].files[0].size:0)});$.post(wck_ajax_object.ajax_url,data,function(response){if(response){$("#wckalkulator-price").html(response)}})}}$("input.wck_imageupload").on("change",function(e){var size=$(this)[0].files[0].size;if(size>$(this).data("maxfilesize")*1e6){alert(wck_ajax_object._wck_i18n_maxfilesize+" Max. "+$(this).data("maxfilesize")+"MB");$(this).val("")}});$(document).on("change",_form+" input, "+_form+" select, "+_form+" textarea",function(){updateUI();clearTimeout(userTimeout);userTimeout=setTimeout(function(){$("#wckalkulator-price").html('...');calculatePrice()},1e3)});updateUI();calculatePrice();$("span.wck-field-tip").tipTip({attribute:"title",defaultPosition:"left"});$("input[type=checkbox][data-type='checkboxgroup']").change(function(e){var group=$(this).data("group");var required=$(this).data("required")===1;var limit=$(this).data("limit");var checked_count=$("input[type=checkbox][data-group='"+group+"']:checked").length;if(limit>0){if(checked_count>limit){$(this).prop("checked",false).blur()}}if(required&&checked_count===0){$(this).prop("checked",true)}checked_count=$("input[type=checkbox][data-group='"+group+"']:checked").length;if(checked_count>0){$("input[type=checkbox][data-group="+group+"]").get(0).setCustomValidity("")}});$(_form).submit(function(e){var lastGroup="";var _form=$(this).get(0);$("input[type=checkbox][data-type='checkboxgroup']").each(function(){var group=$(this).data("group");if(group!==lastGroup){if($(this).data("required")===1&&$("input[type=checkbox][data-group="+group+"]:checked").length===0){$("input[type=checkbox][data-group="+group+"]").get(0).setCustomValidity(wck_ajax_object._wck_i18n_required);_form.reportValidity();e.preventDefault();return false}}lastGroup=group})})})})(jQuery);!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Mexp=e():t.Mexp=e()}(self,function(){return t={28:(t,e,a)=>{var n=a(733);n.prototype.formulaEval=function(){"use strict";for(var t,e,a,n=[],o=this.value,p=0;p"+e.value+""+o[p].show+""+t.value+"",type:10}):n.push({value:(1!=e.type?"(":"")+e.value+(1!=e.type?")":"")+""+t.value+"",type:1})):2===o[p].type||9===o[p].type?(t=n.pop(),e=n.pop(),n.push({value:(1!=e.type?"(":"")+e.value+(1!=e.type?")":"")+o[p].show+(1!=t.type?"(":"")+t.value+(1!=t.type?")":""),type:o[p].type})):12===o[p].type&&(t=n.pop(),e=n.pop(),a=n.pop(),n.push({value:o[p].show+"("+a.value+","+e.value+","+t.value+")",type:12}));return n[0].value},t.exports=n},618:(t,e,a)=>{"use strict";var n=a(178);function o(t,e){for(var a=0;ag.length-2?g.length-1:t.length-v;a>0;a--)if(void 0!==g[a])for(o=0;o0&&a{"use strict";var e=function(t){this.value=t};e.math={isDegree:!0,acos:function(t){return e.math.isDegree?180/Math.PI*Math.acos(t):Math.acos(t)},add:function(t,e){return t+e},asin:function(t){return e.math.isDegree?180/Math.PI*Math.asin(t):Math.asin(t)},atan:function(t){return e.math.isDegree?180/Math.PI*Math.atan(t):Math.atan(t)},acosh:function(t){return Math.log(t+Math.sqrt(t*t-1))},asinh:function(t){return Math.log(t+Math.sqrt(t*t+1))},atanh:function(t){return Math.log((1+t)/(1-t))},C:function(t,a){var n=1,o=t-a,p=a;p{var n=a(618);n.prototype.toPostfix=function(){"use strict";for(var t,e,a,o,p,h=[],u=[{value:"(",type:4,pre:0}],s=this.value,r=1;ra)u.push(t);else{for(;a>=o&&!i||i&&o{var n=a(477);n.prototype.postfixEval=function(t){"use strict";(t=t||{}).PI=Math.PI,t.E=Math.E;for(var e,a,o,p=[],h=this.value,u=void 0!==t.n,s=0;s1)throw new n.Exception("Uncaught Syntax error");return p[0].value>1e15?"Infinity":parseFloat(p[0].value.toFixed(15))},n.eval=function(t,e,a){return void 0===e?this.lex(t).toPostfix().postfixEval():void 0===a?void 0!==e.length?this.lex(t,e).toPostfix().postfixEval():this.lex(t).toPostfix().postfixEval(e):this.lex(t,e).toPostfix().postfixEval(a)},t.exports=n}},e={},a=function a(n){var o=e[n];if(void 0!==o)return o.exports;var p=e[n]={exports:{}};return t[n](p,p.exports,a),p.exports}(28),a;var t,e,a}); \ No newline at end of file