From dbe25f429808922a628ad438b83f9bf16d3d2657 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Pi=C4=85tkowski?= Date: Mon, 25 Jul 2022 00:26:48 +0200 Subject: [PATCH] Multicheckbox update --- assets/css/admin.css | 12 +++++++ assets/css/admin.css.map | 2 +- assets/css/admin.min.css | 2 +- assets/css/admin.sass | 32 ++++++++++++++++++ assets/js/admin.js | 2 +- 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/resources/js/search.json | 2 +- docs/.retype/sitemap.xml.gz | Bin 481 -> 487 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 | 13 +++---- .../usermanual/import_export/index.html | 8 ++--- .../usermanual/installation/index.html | 8 ++--- docs/.retype/usermanual/templates/index.html | 10 +++--- docs/.retype/usermanual/uninstall/index.html | 8 ++--- docs/.retype/usermanual/usage/index.html | 8 ++--- docs/.retype/usermanual/videos/index.html | 8 ++--- docs/usermanual/fields.md | 1 + src/FieldsetProduct.php | 15 ++++++-- views/admin/expression.php | 22 ++++++++++-- 29 files changed, 151 insertions(+), 80 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index beea45c..e3431d5 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -1,3 +1,8 @@ +::placeholder, ::-moz-placeholder, ::-webkit-input-placeholder { + color: #9b9b9b !important; + font-size: 12px !important; +} + .wc-kalkulator-wrapper html { scroll-padding-top: 100px; } @@ -547,4 +552,11 @@ border-top: 1px solid #ccc; } +.postbox.closed { + border: 1px solid #c3c4c7; +} +.postbox.closed .inside { + display: block; +} + /*# sourceMappingURL=admin.css.map */ diff --git a/assets/css/admin.css.map b/assets/css/admin.css.map index b8d758a..b517a17 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;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;;AACF;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;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 +{"version":3,"sourceRoot":"","sources":["admin.sass"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGA;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;EACA;EACA;EACA;EACA;;AAEF;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAEA;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;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;;AAEA;EACE;EACA;EACA;;AAEF;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;;AAEA;EACE;EACA;;AAEF;EACE;EACA;EACA;;AAEA;EACE;;AAEF;EACE;EACA;;AAEA;EACE;;AAEF;EACE;;AAEF;EACE;;AAEJ;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;AAEJ;EACE;;AAEF;EACE;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;;AAEJ;EACE;EACA;;AAEF;EACE;EACA;EACA;;AAEJ;EACE;;AAEF;EACE;EACA;EACA;;;AAEJ;EACE;;AAEA;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 83ea095..c826173 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.welcome{box-shadow:none;padding:30px;text-align:center;font-size:16px;border:1px dashed #aaa;margin:30px}.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-block;margin-right:10px;width:auto;line-height:2;margin-bottom:20px}.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 +::-moz-placeholder,::-webkit-input-placeholder,::placeholder{color:#9b9b9b!important;font-size:12px!important}.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.welcome{box-shadow:none;padding:30px;text-align:center;font-size:16px;border:1px dashed #aaa;margin:30px}.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-block;margin-right:10px;width:auto;line-height:2;margin-bottom:20px}.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}.postbox.closed{border:1px solid #c3c4c7}.postbox.closed .inside{display:block} \ No newline at end of file diff --git a/assets/css/admin.sass b/assets/css/admin.sass index 82b8090..56a846c 100644 --- a/assets/css/admin.sass +++ b/assets/css/admin.sass @@ -1,3 +1,7 @@ +::placeholder, ::-moz-placeholder, ::-webkit-input-placeholder + color: #9b9b9b !important + font-size: 12px !important + .wc-kalkulator-wrapper html scroll-padding-top: 100px @@ -37,6 +41,7 @@ li box-shadow: 0px 5px 10px #ccc margin-bottom: 5px + &.welcome box-shadow: none padding: 30px @@ -44,6 +49,7 @@ font-size: 16px border: 1px dashed #aaa margin: 30px + .field border: 1px solid #AAA background-color: #FFFFFF @@ -52,6 +58,7 @@ background-color: #F5F5F5 padding: 8px cursor: move + .text font-size: 14px color: #000 @@ -396,10 +403,12 @@ .cv-container position: relative + .action-field-visibility position: absolute right: 5px top: 5px + .visibility-readable background-color: #FFF @@ -483,30 +492,39 @@ background-color: #FFFFFF box-shadow: 0 0 200px 100px rgba(0, 0, 0, 0.4) flex-direction: column + .template display: none visibility: hidden + .builder flex-basis: 100% margin: 20px 40px 0 5px overflow-y: auto + .or-group width: 100% + .and-condition display: flex gap: 3px + .validation-error border-color: red + &, button margin-bottom: 3px + .p-value flex-grow: 2 + .or-condition display: flex flex-direction: row align-content: stretch gap: 3px flex-wrap: wrap + &:not(:first-child)::before content: 'OR' flex-basis: 100% @@ -514,28 +532,42 @@ font-weight: 700 padding: 10px margin-left: 25px + .and-group flex-grow: 4 + .cv-remove text-decoration: none opacity: 0 padding: 5px + span font-size: 14px line-height: 1 + .and-condition:hover .cv-remove opacity: 1 + .cv-action-and align-self: end margin-bottom: 3px + .cv-action-or display: block margin-top: 10px margin-left: 33px + h1 padding: 40px 40px 0 40px + p.save padding: 10px 20px 0px text-align: right border-top: 1px solid #ccc + +.postbox.closed + border: 1px solid #c3c4c7 + + .inside + display: block \ No newline at end of file diff --git a/assets/js/admin.js b/assets/js/admin.js index 744f303..bfc6d5c 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -155,7 +155,7 @@ } var cursorPos = $focused[0].selectionStart; var x = $focused.val(); - $focused.val(x.slice(0, cursorPos) + value + x.slice(cursorPos)); + $focused.val(x.slice(0, cursorPos) + value + ($(this).data("ending") || "") + x.slice(cursorPos)); $focused.focus(); cursorPos += value.length; $focused[0].setSelectionRange(cursorPos, cursorPos); diff --git a/assets/js/admin.min.js b/assets/js/admin.min.js index 170e402..58da3e4 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("|"))}).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);$(".hide-if-disabled").toggle(!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);$("#wck-parameters .defined-fields").append('");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 +(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+($(this).data("ending")||"")+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);$(".hide-if-disabled").toggle(!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);$("#wck-parameters .defined-fields").append('");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/docs/.retype/404.html b/docs/.retype/404.html index 1146046..d1b08e1 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 70d1da3..63aace2 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 4a5cfcc..a7a7577 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 0b4ff0a..c9f0c1e 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 bea2dee..484dbec 100644 --- a/docs/.retype/resources/js/config.js +++ b/docs/.retype/resources/js/config.js @@ -1 +1 @@ -var __DOCS_CONFIG__ = {"id":"fSY24jbEytajUHXxM0tWncf2076XFp6XvfJ","key":"OVb3sNPrtoe7mq8YD7NcyapWFCHasW7JmdzfShZTEZg.fifDKbwa2IzKnbmb3wiQqX3ngQjJ18Mh2i8wGDt0GQQb1BtOXZai0mdc/nY5W6uAgMe+fgi5Qx11OYyZyDT/8A.2","base":"/","host":"wckalkulator.com","version":"1.0.0","useRelativePaths":true,"documentName":"index.html","appendDocumentName":false,"trailingSlash":true,"preloadSearch":false,"cacheBustingToken":"2.3.0.711994378075","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}}; +var __DOCS_CONFIG__ = {"id":"N8+l5hdt+A2gRFRWINH1qWzl7HeWaB207t/","key":"jlx9/oEDZ7b65eREI+YupQMEE3rkvmsHu8es+v7G11Q.NX/gLpZm5kHplMNND1uSFSrZM2aDJJKzSHCUz+VAuUlAzi4F28x1giWWkBJ0XSJYuZvDtpy1AClNB1AlnnTaeA.91","base":"/","host":"wckalkulator.com","version":"1.0.0","useRelativePaths":true,"documentName":"index.html","appendDocumentName":false,"trailingSlash":true,"preloadSearch":false,"cacheBustingToken":"2.3.0.711998754141","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 13637d7..a24d399 100644 --- a/docs/.retype/resources/js/config.min.js +++ b/docs/.retype/resources/js/config.min.js @@ -1 +1 @@ -var __DOCS_CONFIG__={id:"fSY24jbEytajUHXxM0tWncf2076XFp6XvfJ",key:"OVb3sNPrtoe7mq8YD7NcyapWFCHasW7JmdzfShZTEZg.fifDKbwa2IzKnbmb3wiQqX3ngQjJ18Mh2i8wGDt0GQQb1BtOXZai0mdc/nY5W6uAgMe+fgi5Qx11OYyZyDT/8A.2",base:"/",host:"wckalkulator.com",version:"1.0.0",useRelativePaths:true,documentName:"index.html",appendDocumentName:false,trailingSlash:true,preloadSearch:false,cacheBustingToken:"2.3.0.711994378075",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 +var __DOCS_CONFIG__={id:"N8+l5hdt+A2gRFRWINH1qWzl7HeWaB207t/",key:"jlx9/oEDZ7b65eREI+YupQMEE3rkvmsHu8es+v7G11Q.NX/gLpZm5kHplMNND1uSFSrZM2aDJJKzSHCUz+VAuUlAzi4F28x1giWWkBJ0XSJYuZvDtpy1AClNB1AlnnTaeA.91",base:"/",host:"wckalkulator.com",version:"1.0.0",useRelativePaths:true,documentName:"index.html",appendDocumentName:false,trailingSlash:true,preloadSearch:false,cacheBustingToken:"2.3.0.711998754141",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 b16028d..c1740b4 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-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-21 v.1.4.0","2022-07-22 v.1.4.1, 1.4.2","2022-07-22 v.1.4.3","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 +[[{"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). Multi Checkbox can be used in the expression, for example: is_selected({multi_cb}; 10) checks if user selected the option with value \"10\". You can also use built-in variables {multi_cb:min}(minimal selected value), {multi_cb:max}(maximal selected value), {multi_cb:sum}(sum of selected values)"]},{"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-21 v.1.4.0","2022-07-22 v.1.4.1, 1.4.2","2022-07-22 v.1.4.3","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 5f0dc6518697d8df3134268327dbc0251352f1dc..96253867e3ef0e2c54a7c9fb217830b5698743ea 100644 GIT binary patch literal 487 zcmV|$M1Ox#2x$rhF~T1wogDWd#SwO5>#U&Y(nz( zH3aRd(yobA@5$hqk$=p1{=@0z){EfEN8KrT4p9ulfXiAnoovtHYxN^KhA-veG>t-Y z6If@d&*8BIjg{K}Au3)f$$E zAXrXXR{JDWT`vB538+7q_?QGUYK&{ugA-WHn0#S z_zq*I#?IVJ`>7}J`)xTHY)3zfAo;AF9OzhKNYj*}?B5(PKIY#9nKU1JCMPBU`=uuH zL~>w3Q|N-qh(D-KYQuyz**oTiE%nFt-f_{m%ZSqo%Lid9Y%y= z^j~Sd=_gKPJhn9#gJ+a0H8ab7aQ$x~VY4IDz{Fk{V-*AVvG1&Tq5c zeTT8rV`p!b`_&`(JzI7L+t$w_C@~u^2RhUk(mbcA_%{bk5BqO|Oh$}7QxlVb{nC?t zA~~?6IrKplBpg(yjAhc9+#L(TmWN||?}Tjp$M`H24oAhAzD6YdO z%pw|zxhc!8UO=4JsGtZx0u0H=`az2152rtc3t>(Pp;_i5BxN|n$*@+0I9GBAs2|OR zDK46~C+LbAt#p}J-AF)nb6sU{h6m-a$u6eEf0o}>IDTfT6;ikUn}yeAL?}l8mFA1y zUW9V%w;*W>D7IZc=+VBpqI5%$tDgm|N452-AYcKT!KG`2e$WB-OD*OF&2lf*-#frM XxaVE9`vd?0|NjF3bxHO14+;PPTKVEJ diff --git a/docs/.retype/usermanual/about/index.html b/docs/.retype/usermanual/about/index.html index a38ba36..4c1a1fc 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 5e6b7d3..407b629 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 71d7095..01a1335 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 10bd629..45f71c0 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 79ee248..afdd442 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 37a325b..78152e2 100644 --- a/docs/.retype/usermanual/fields/index.html +++ b/docs/.retype/usermanual/fields/index.html @@ -3,7 +3,7 @@ - + @@ -30,12 +30,12 @@ - + - + - - + +
    @@ -717,7 +717,8 @@

    Checkbox Group (Multi Checkbox)

    -

    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).

    +

    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). +Multi Checkbox can be used in the expression, for example: is_selected({multi_cb}; 10) checks if user selected the option with value "10". You can also use built-in variables {multi_cb:min} (minimal selected value), {multi_cb:max} (maximal selected value), {multi_cb:sum} (sum of selected values)

    # diff --git a/docs/.retype/usermanual/import_export/index.html b/docs/.retype/usermanual/import_export/index.html index 3426893..6832b15 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 36f097e..f9ec18a 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 6744482..5dd51d8 100644 --- a/docs/.retype/usermanual/templates/index.html +++ b/docs/.retype/usermanual/templates/index.html @@ -3,7 +3,7 @@ - + @@ -30,12 +30,12 @@ - + - + - - + +
    diff --git a/docs/.retype/usermanual/uninstall/index.html b/docs/.retype/usermanual/uninstall/index.html index b41f115..78e4f42 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 4512b7c..fb1374d 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 0276d1b..1abdf38 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/docs/usermanual/fields.md b/docs/usermanual/fields.md index 90e2f2a..c152b47 100644 --- a/docs/usermanual/fields.md +++ b/docs/usermanual/fields.md @@ -180,6 +180,7 @@ This field is required by default. ## Checkbox Group (Multi Checkbox) **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). +Multi Checkbox can be used in the expression, for example: `is_selected({multi_cb}; 10)` checks if user selected the option with value "10". You can also use built-in variables `{multi_cb:min}` (minimal selected value), `{multi_cb:max}` (maximal selected value), `{multi_cb:sum}` (sum of selected values) ## Color Swatches diff --git a/src/FieldsetProduct.php b/src/FieldsetProduct.php index 90bab4c..bcb4ba0 100644 --- a/src/FieldsetProduct.php +++ b/src/FieldsetProduct.php @@ -338,10 +338,8 @@ public function get_user_input() $user_input = array(); $allowed_names = $this->fields_names(); - if (isset($_POST['wck']) && is_array($_POST['wck'])) { - + //if (isset($_POST['wck']) && is_array($_POST['wck'])) { $filtered_post = array(); - foreach ($allowed_names as $name) { if (isset($_POST['wck'][$name])) { $filtered_post[$name] = $_POST['wck'][$name]; @@ -354,6 +352,17 @@ public function get_user_input() } $user_input = Sanitizer::sanitize($filtered_post, 'array'); + //} + + foreach ($allowed_names as $name) { + if (isset($_POST['wck'][$name])) { + $filtered_post[$name] = $_POST['wck'][$name]; + } else { + /* Set Default values if the field is not in POST data */ + if($this->field($name)['type'] === 'checkboxgroup') { + $filtered_post[$name] = array(); + } + } } $user_input['_files'] = array(); diff --git a/views/admin/expression.php b/views/admin/expression.php index 96caaf5..b673dd5 100644 --- a/views/admin/expression.php +++ b/views/admin/expression.php @@ -48,14 +48,16 @@ class="expression_type expression_addon"
    - +
    - +
    @@ -200,8 +202,22 @@ class="first-selected"> __('in_array(value; array) - checks if value is in array', 'wc-kalkulator'), 'is_selected' => __('is_selected(field; value) - checks if value is selected (multi checkbox)', 'wc-kalkulator') ); + + $ending = array( + 'round' => ' ; ... )', + 'ceil' => ' )', + 'floor' => ' )', + 'abs' => ' )', + 'max' => ' ; ... )', + 'min' => ' ; ... )', + 'sqrt' => ' )', + 'strlen' => ' )', + 'in_array' => ' ; array )', + 'is_selected' => ' ; value )' + ); + foreach ($operators as $op => $title) { - echo ''; + echo ''; } ?>